/* =============================================================================== myawk.h =============================================================================== */ # define HELLO(s) \ fprintf(stderr,\ "%s Program %s at line %d in source %s,\n%s which was compiled on %s at %s.\n"\ ,"Hello: ",s,__LINE__,__FILE__,"Hello: ",__DATE__,__TIME__); # define SAY_HI HELLO(argv[0]) ; # define SAY_HI_FIRST \ int _say_hi_first_ = fprintf(stderr,\ "%s program %s at line %d in source %s,\n%s which was compiled on %s at %s.\n"\ ,"Hello: ",argv[0],__LINE__,__FILE__,"Hello: ",__DATE__,__TIME__) # define OLD_CITATION \ int _citation_ = fprintf(stderr,\ "%s citation is %s & %s.\n%s e-mail M Gerstein <%s>.\n",\ "Hello: ","J. Mol. Biol. 249: 955-966",\ "Structure 2: 641-649","Hello: ","mbg@hyper.stanford.edu") # define OLD_CITATION2 \ int _citation_ = fprintf(stderr,\ "%s citation is %s & %s.\n%s e-mail M Gerstein <%s>.\n",\ "Hello: ","J. Mol. Biol. 290: 253-366 (1999)",\ "J Tsai & M Gerstein (submitted)","Hello: ","Mark.Gerstein@yale.edu") # define CITATION \ int _citation_ = fprintf(stderr,\ "Citations are:\n %s\n %s\n %s\n %s\nContact info:\n %s\n %s\n\n",\ "Primary: Neil R Voss and Mark Gerstein. J Mol. Biol. v34(2): 2005, pp 477-492.",\ "Expanded: Neil R Voss, \'Geometry of RNA and Ribosomes, and Ribosome Crystallization,\'",\ " Ph.D. dissertation. Yale University, New Haven, CT, USA, 2006.",\ " http://proton.chem.yale.edu/thesis/voss06-small.pdf",\ "email: Mark Gerstein, mark.gerstein@yale.edu",\ "email: Neil Voss, vossman77@yahoo.com") # define STRG_AFTER_OPT_W_ENV(opt,default)\ Expand1stEnvVar(StringAfterOption(argc,argv,opt,default)) # define OPT(a) ArgvMatch(argc,argv,a) # define MAXTOK 2048 # define TOKMAXFLAG 10 # define SYMBOL_NOT_IN_TABLE -1 # define NO_INDEX -1 # define FIRST_SYMBOL_INDEX 0 typedef struct a { char * strg ; int n ; struct a * ptr ; } StringIndex ; typedef struct { int initialized ; FILE * fp; char * filename ; int debug ; char * whitespace ; int flag[TOKMAXFLAG] ; int NF ; char * RS ; int NR ; double D[MAXTOK]; char *T[MAXTOK]; char TokBuf[BUFSIZ], KeepBuf[BUFSIZ]; void * P1, * P2; } TokenizeData ; # define BeginsWithP(s,Tn) (STRNEQ(s,Tn,strlen(s))) # define Begins2With1P(s,Tn) (STRNEQ(s,Tn,strlen(s))) # define ContainsP(s,Tn) (strstr(Tn,s) != NULL) # define Contains1in2P(s,Tn) (strstr(Tn,s) != NULL) # define MoveBetwToStrg(s,from,to,into) strncpy(into,s + from,to-from) # define AllocateN(thing,n) ((thing *) calloc(n,sizeof(thing))) # define StringAllocate(s) strcpy((char *) malloc(strlen(s)+1),s) # define BlankLineP(T) (T[1] == NULL) # define EOF_TOK(D) ((D)->T == NULL) typedef enum {EnvironVar = 1, ComLineOption = 0, DataBase = 2} DataSourceType ; typedef struct { DataSourceType type ; TokenizeData * db; char ** argv; int argc ; } DataSource ;