chiark
/
gitweb
/
~mdw
/
mLib
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Describe custom interface.
[mLib]
/
atom.c
diff --git
a/atom.c
b/atom.c
index 661c3429b055dab9f4941dd78ac2f4c4593c1156..dd02f5457b656919995052b037cf6f5de79b5e65 100644
(file)
--- a/
atom.c
+++ b/
atom.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: atom.c,v 1.
2 2001/01/21 19:04:51
mdw Exp $
+ * $Id: atom.c,v 1.
3 2001/01/25 21:13:15
mdw Exp $
*
* Atom management
*
*
* Atom management
*
@@
-30,6
+30,9
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: atom.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: atom.c,v $
+ * Revision 1.3 2001/01/25 21:13:15 mdw
+ * New function allowing an atom's length to be specified at intern time.
+ *
* Revision 1.2 2001/01/21 19:04:51 mdw
* Include `crc32.h' for @CRC32@ macro.
*
* Revision 1.2 2001/01/21 19:04:51 mdw
* Include `crc32.h' for @CRC32@ macro.
*
@@
-105,10
+108,11
@@
void atom_destroytable(atom_table *t)
sym_destroy(&t->t);
}
sym_destroy(&t->t);
}
-/* --- @atom_intern@ --- *
+/* --- @atom_intern@
, @atom_nintern@
--- *
*
* Arguments: @atom_table *t@ = pointer to an atom table
* @const char *p@ = pointer to the string to intern
*
* Arguments: @atom_table *t@ = pointer to an atom table
* @const char *p@ = pointer to the string to intern
+ * @size_t n@ = size of the string (for @atom_nintern)
*
* Returns: A pointer to the atom block for the given symbol string.
*
*
* Returns: A pointer to the atom block for the given symbol string.
*
@@
-128,6
+132,18
@@
atom *atom_intern(atom_table *t, const char *p)
return (a);
}
return (a);
}
+atom *atom_nintern(atom_table *t, const char *p, size_t n)
+{
+ atom *a;
+ unsigned f;
+
+ ATOM_RESOLVE(t);
+ a = sym_find(&t->t, p, n, sizeof(atom), &f);
+ if (!f)
+ a->f = 0;
+ return (a);
+}
+
/* --- @atom_gensym@ --- *
*
* Arguments: @atom_table *t@ = pointer to a symbol table
/* --- @atom_gensym@ --- *
*
* Arguments: @atom_table *t@ = pointer to a symbol table