chiark
/
gitweb
/
~mdw
/
mLib
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Another version number bump.
[mLib]
/
sym.c
diff --git
a/sym.c
b/sym.c
index fb3806b11ec86d6b7506d204641fba7528a8d051..6ddc45c303fddaa069eb3f7a5c3d85466a486ea6 100644
(file)
--- a/
sym.c
+++ b/
sym.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: sym.c,v 1.
4 1999/05/06 19:51:35
mdw Exp $
+ * $Id: sym.c,v 1.
6 1999/05/26 21:08:31
mdw Exp $
*
* Symbol table management
*
*
* Symbol table management
*
@@
-30,6
+30,12
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: sym.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: sym.c,v $
+ * Revision 1.6 1999/05/26 21:08:31 mdw
+ * Rename symbols in line with newer conventions.
+ *
+ * Revision 1.5 1999/05/13 22:48:37 mdw
+ * Twiddle the extension threshold. Change `-ise' to `-ize' throughout.
+ *
* Revision 1.4 1999/05/06 19:51:35 mdw
* Reformatted the LGPL notice a little bit.
*
* Revision 1.4 1999/05/06 19:51:35 mdw
* Reformatted the LGPL notice a little bit.
*
@@
-78,26
+84,23
@@
* and the limit %$l$% satisfy the relation %$n < bl$%; if a new item is
* added to the table and this relation is found to be false, the table is
* doubled in size.
* and the limit %$l$% satisfy the relation %$n < bl$%; if a new item is
* added to the table and this relation is found to be false, the table is
* doubled in size.
- *
- * The current function gives %$l = {3n \over 4}$%, which appears to be
- * reasonable on the face of things.
*/
*/
-#define SYM_LIMIT(n) ((
(n) * 3) >> 2)
/* Load factor for growing table */
+#define SYM_LIMIT(n) ((
n) * 4)
/* Load factor for growing table */
/*----- Main code ---------------------------------------------------------*/
/*----- Main code ---------------------------------------------------------*/
-/* --- @sym_create
Table
@ --- *
+/* --- @sym_create@ --- *
*
*
- * Arguments: @sym_table *t@ = symbol table to initiali
s
e
+ * Arguments: @sym_table *t@ = symbol table to initiali
z
e
*
* Returns: ---
*
*
* Returns: ---
*
- * Use: Initiali
s
es the given symbol table. Raises @EXC_NOMEM@ if
+ * Use: Initiali
z
es the given symbol table. Raises @EXC_NOMEM@ if
* there isn't enough memory.
*/
* there isn't enough memory.
*/
-void sym_create
Table
(sym_table *t)
+void sym_create(sym_table *t)
{
size_t i;
{
size_t i;
@@
-114,7
+117,7
@@
void sym_createTable(sym_table *t)
TRACK_POP;
}
TRACK_POP;
}
-/* --- @sym_destroy
Table
@ --- *
+/* --- @sym_destroy@ --- *
*
* Arguments: @sym_table *t@ = pointer to symbol table in question
*
*
* Arguments: @sym_table *t@ = pointer to symbol table in question
*
@@
-124,7
+127,7
@@
void sym_createTable(sym_table *t)
* occupy.
*/
* occupy.
*/
-void sym_destroy
Table
(sym_table *t)
+void sym_destroy(sym_table *t)
{
size_t i;
sym_base *p, *q;
{
size_t i;
sym_base *p, *q;
@@
-222,7
+225,7
@@
void *sym_find(sym_table *t, const char *n, long l, size_t sz, unsigned *f)
if (f) *f = 0; /* Failed to find the block */
if (!sz) return (0); /* Return zero if not creating */
if (f) *f = 0; /* Failed to find the block */
if (!sz) return (0); /* Return zero if not creating */
- /* --- Create a new symbol block and initiali
s
e it --- */
+ /* --- Create a new symbol block and initiali
z
e it --- */
{
TRACK_CTX("new symbol creation");
{
TRACK_CTX("new symbol creation");
@@
-360,7
+363,7
@@
void sym_remove(sym_table *t, void *b)
t->c++;
}
t->c++;
}
-/* --- @sym_
createI
ter@ --- *
+/* --- @sym_
mki
ter@ --- *
*
* Arguments: @sym_iter *i@ = pointer to an iterator object
* @sym_table *t@ = pointer to a symbol table object
*
* Arguments: @sym_iter *i@ = pointer to an iterator object
* @sym_table *t@ = pointer to a symbol table object
@@
-371,7
+374,7
@@
void sym_remove(sym_table *t, void *b)
* iterate through a symbol table.
*/
* iterate through a symbol table.
*/
-void sym_
createI
ter(sym_iter *i, sym_table *t)
+void sym_
mki
ter(sym_iter *i, sym_table *t)
{
i->t = t;
i->i = 0;
{
i->t = t;
i->i = 0;
@@
-442,7
+445,7
@@
int main(void)
sym_table tbl;
int entries;
sym_table tbl;
int entries;
- /* --- Initiali
s
e for reading the file --- */
+ /* --- Initiali
z
e for reading the file --- */
sz = BUFSIZ;
buff = xmalloc(sz + 1);
sz = BUFSIZ;
buff = xmalloc(sz + 1);
@@
-496,7
+499,7
@@
int main(void)
flag[i] = 0;
entries = 0;
flag[i] = 0;
entries = 0;
- sym_create
Table
(&tbl);
+ sym_create(&tbl);
for (;;) {
i = (unsigned)rand() % sz;
for (;;) {
i = (unsigned)rand() % sz;
@@
-569,7
+572,7
@@
int main(void)
ntbl = xmalloc(sz * sizeof(sym_word *));
memcpy(ntbl, flag, sz * sizeof(sym_word *));
ntbl = xmalloc(sz * sizeof(sym_word *));
memcpy(ntbl, flag, sz * sizeof(sym_word *));
- sym_
createI
ter(&it, &tbl);
+ sym_
mki
ter(&it, &tbl);
while ((w = sym_next(&it)) != 0) {
if (ntbl[w->i] == 0)
while ((w = sym_next(&it)) != 0) {
if (ntbl[w->i] == 0)