|
|
1.1 ! root 1: /********************************************************************* ! 2: * COPYRIGHT NOTICE * ! 3: ********************************************************************** ! 4: * This software is copyright (C) 1982 by Pavel Curtis * ! 5: * * ! 6: * Permission is granted to reproduce and distribute * ! 7: * this file by any means so long as no fee is charged * ! 8: * above a nominal handling fee and so long as this * ! 9: * notice is always included in the copies. * ! 10: * * ! 11: * Other rights are reserved except as explicitly granted * ! 12: * by written permission of the author. * ! 13: * Pavel Curtis * ! 14: * Computer Science Dept. * ! 15: * 405 Upson Hall * ! 16: * Cornell University * ! 17: * Ithaca, NY 14853 * ! 18: * * ! 19: * Ph- (607) 256-4934 * ! 20: * * ! 21: * Pavel.Cornell@Udel-Relay (ARPAnet) * ! 22: * decvax!cornell!pavel (UUCPnet) * ! 23: *********************************************************************/ ! 24: ! 25: /* ! 26: * compiler.h - Global variables and structures for the terminfo ! 27: * compiler. ! 28: * ! 29: * $Header: /src386/usr/bin/tic/RCS/compiler.h,v 1.1 92/03/13 10:45:54 bin Exp $ ! 30: * ! 31: * $Log: compiler.h,v $ ! 32: * Revision 1.1 92/03/13 10:45:54 bin ! 33: * Initial revision ! 34: * ! 35: Revision 2.1 82/10/25 14:46:04 pavel ! 36: Added Copyright Notice ! 37: ! 38: Revision 2.0 82/10/24 15:17:20 pavel ! 39: Beta-one Test Release ! 40: ! 41: Revision 1.3 82/08/23 22:30:09 pavel ! 42: The REAL Alpha-one Release Version ! 43: ! 44: Revision 1.2 82/08/19 19:10:10 pavel ! 45: Alpha Test Release One ! 46: ! 47: Revision 1.1 82/08/12 18:38:11 pavel ! 48: Initial revision ! 49: ! 50: * ! 51: */ ! 52: ! 53: #include <stdio.h> ! 54: ! 55: #ifndef TRUE ! 56: #define TRUE 1 ! 57: #define FALSE 0 ! 58: #endif ! 59: ! 60: #define SINGLE /* only one terminal (actually none) */ ! 61: ! 62: extern char *destination; /* destination directory for object files */ ! 63: ! 64: long start_time; /* time at start of compilation */ ! 65: long time(); ! 66: ! 67: int curr_line; /* current line # in input */ ! 68: long curr_file_pos; /* file offset of current line */ ! 69: ! 70: int debug_level; /* level of debugging output */ ! 71: ! 72: #define DEBUG(level, fmt, a1) \ ! 73: if (debug_level >= level)\ ! 74: fprintf(stderr, fmt, a1); ! 75: ! 76: /* ! 77: * These are the types of tokens returned by the scanner. ! 78: * The first three are also used in the hash table of capability ! 79: * names. The scanner returns one of these values after loading ! 80: * the specifics into the global structure curr_token. ! 81: * ! 82: */ ! 83: ! 84: #define BOOLEAN 0 /* Boolean capability */ ! 85: #define NUMBER 1 /* Numeric capability */ ! 86: #define STRING 2 /* String-valued capability */ ! 87: #define CANCEL 3 /* Capability to be cancelled in following tc's */ ! 88: #define NAMES 4 /* The names for a terminal type */ ! 89: ! 90: /* ! 91: * The global structure in which the specific parts of a ! 92: * scanned token are returned. ! 93: * ! 94: */ ! 95: ! 96: struct token ! 97: { ! 98: char *tk_name; /* name of capability */ ! 99: int tk_valnumber; /* value of capability (if a number) */ ! 100: char *tk_valstring; /* value of capability (if a string) */ ! 101: }; ! 102: ! 103: struct token curr_token; ! 104: ! 105: /* ! 106: * The file comp_captab.c contains an array of these structures, ! 107: * one per possible capability. These are then made into a hash ! 108: * table array of the same structures for use by the parser. ! 109: * ! 110: */ ! 111: ! 112: struct name_table_entry ! 113: { ! 114: struct name_table_entry *nte_link; ! 115: char *nte_name; /* name to hash on */ ! 116: int nte_type; /* BOOLEAN, NUMBER or STRING */ ! 117: short nte_index; /* index of associated variable in its array */ ! 118: }; ! 119: ! 120: extern struct name_table_entry cap_table[]; ! 121: extern struct name_table_entry *cap_hash_table[]; ! 122: ! 123: extern int Captabsize; ! 124: extern int Hashtabsize; ! 125: ! 126: #define NOTFOUND ((struct name_table_entry *) 0) ! 127: /* ! 128: * Function types ! 129: * ! 130: */ ! 131: ! 132: struct name_table_entry *find_entry(); /* look up entry in hash table */ ! 133: ! 134: char next_char(); ! 135: char trans_string();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.