|
|
1.1 ! root 1: #include "cem.h" ! 2: ! 3: /* ! 4: * Cemantics. Intelligent C loader and binder. ! 5: * ! 6: * Bruce Ellis - Sept 1984. ! 7: */ ! 8: ! 9: int debug; ! 10: int errors; ! 11: int file_errors; ! 12: int in_lib; ! 13: int modtimes = 1; ! 14: int out_fid; ! 15: int pedantic; ! 16: int tell_times; ! 17: int verbose; ! 18: char *load_out; ! 19: ! 20: char *alloc_end; ! 21: char *alloc_ptr; ! 22: char *data_base; ! 23: char *data_end; ! 24: char *data_ptr; ! 25: char *my_name; ! 26: char *str_base; ! 27: inst *global_list; ! 28: long new_type_index; ! 29: long str_num; ! 30: long type_index; ! 31: long var_index; ! 32: symbol **str_trans; ! 33: symbol *src_file; ! 34: type **type_trans; ! 35: var **var_trans; ! 36: ! 37: /* ! 38: * cem ! 39: * -o file output file ! 40: * -d debug ! 41: * -m override modtime quick check ! 42: * -p be pedantic about types ! 43: * -t tell all file times ! 44: * -v verbose format for types ! 45: * -l lib load library ! 46: * file load file ! 47: */ ! 48: static void ! 49: usage() ! 50: { ! 51: fprintf(stderr, "usage: %s [-o file] [-dmptv] [-l lib] file ...\n", my_name); ! 52: exit(1); ! 53: } ! 54: ! 55: int ! 56: main(argc, argv) ! 57: int argc; ! 58: char *argv[]; ! 59: { ! 60: register int i; ! 61: register int j; ! 62: extern char *strrchr(); ! 63: extern void check_externs(); ! 64: extern void load_lib(); ! 65: extern void load_obj(); ! 66: ! 67: if ((my_name = strrchr(argv[0], '/')) == NULL || *++my_name == '\0') ! 68: my_name = argv[0]; ! 69: ! 70: setbuf(stdout, salloc((long)BUFSIZ)); ! 71: ! 72: for (i = 1; i < argc; i++) ! 73: { ! 74: if (argv[i][0] == '-') ! 75: { ! 76: for (j = 1; argv[i][j] != '\0'; j++) ! 77: { ! 78: switch (argv[i][j]) ! 79: { ! 80: case 'd': ! 81: debug = 1; ! 82: continue; ! 83: ! 84: case 'l': ! 85: if (argv[i][++j] == '\0') ! 86: { ! 87: if (++i >= argc) ! 88: usage(); ! 89: ! 90: load_lib(argv[i]); ! 91: } ! 92: else ! 93: load_lib(&argv[i][j]); ! 94: ! 95: break; ! 96: ! 97: case 'm': ! 98: modtimes = 0; ! 99: continue; ! 100: ! 101: case 'o': ! 102: if (argv[i][++j] == '\0') ! 103: { ! 104: if (++i >= argc) ! 105: usage(); ! 106: ! 107: load_out = argv[i]; ! 108: } ! 109: else ! 110: load_out = &argv[i][j]; ! 111: ! 112: break; ! 113: ! 114: case 'p': ! 115: pedantic = 1; ! 116: continue; ! 117: ! 118: case 't': ! 119: tell_times = 1; ! 120: continue; ! 121: ! 122: case 'v': ! 123: verbose = 1; ! 124: continue; ! 125: ! 126: default: ! 127: usage(); ! 128: } ! 129: ! 130: break; ! 131: } ! 132: } ! 133: else ! 134: load_obj(argv[i]); ! 135: } ! 136: ! 137: check_externs(); ! 138: ! 139: return errors; ! 140: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.