|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T s
Length: 1588 (0x634) Types: TextFile Names: »symtab.c«
└─⟦52210d11f⟧ Bits:30007239 EUUGD2: TeX 3 1992-12 └─⟦c319c2751⟧ »unix3.0/TeX3.0.tar.Z« └─⟦036c765ac⟧ └─⟦this⟧ »TeX3.0/TeXcontrib/van/s2latex/symtab.c« └─⟦060c9c824⟧ Bits:30007080 DKUUG TeX 2/12/89 └─⟦this⟧ »./tex82/TeXcontrib/van/s2latex/symtab.c« └─⟦52210d11f⟧ Bits:30007239 EUUGD2: TeX 3 1992-12 └─⟦63303ae94⟧ »unix3.14/TeX3.14.tar.Z« └─⟦c58930e5c⟧ └─⟦this⟧ »TeX3.14/TeXcontrib/van/s2latex/symtab.c«
/* symtab.c 1.2 85/02/04 */ /* symbol table routines for scribe-to-latex * * copyright (c) 1984 by Van Jacobson, Lawrence Berkeley Laboratory * This program may be freely redistributed but not for profit. This * comment must remain in the program or any derivative. */ #include <ctype.h> #include "symtab.h" #define HASHSIZE 127 #define MAXSYM 128 /* max char in a symbol name */ static struct stab *sthash[HASHSIZE]; #define SYMHASH(str) ((str[0]+(str[1]<<8))%HASHSIZE) struct stab *lookup( str ) register char *str; { register struct stab *s; char text[MAXSYM]; register char *cp = text; register char *textend = &text[MAXSYM-1]; /* convert the string to lower case, then try to find it */ while( *str && cp<textend ) *cp++ = (isupper(*str)? tolower(*str++): *str++); *cp = '\0'; s = sthash[SYMHASH(text)]; while( s && strcmp(text,s->s_text) ) s = s->s_next; return(s); } struct stab *enter( text, type, reptext ) char *text, *reptext; int type; { register struct stab *n; /* set up the new entry */ n = (struct stab *) malloc( sizeof(struct stab) ); n->s_text = (char *) malloc( strlen(text)+1 ); lc_strcpy( n->s_text, text ); n->s_reptext = (char *) malloc( strlen(reptext)+1 ); lc_strcpy( n->s_reptext, reptext ); n->s_type = type; /* add it to the table */ n->s_next = sthash[SYMHASH(n->s_text)]; sthash[SYMHASH(n->s_text)] = n; return(n); } /* copy a string converting upper case to lower case. */ lc_strcpy( dst, src ) char *dst; char *src; { while( *src ) *dst++ = isupper(*src)? tolower(*src++): *src++; *dst = '\0'; }