#include #include #include int nexta = -1; void out(int a, int d) { #ifdef SIMH printf("d %o %06o\n", a, d); #else if(nexta == -1 || nexta != a){ nexta = a; printf("L %o\r", a); } printf("D %o\r", d); nexta += 2; #endif } int main() { char line[512]; char *p; int a, d; while(fgets(line, 512, stdin) == line){ line[strlen(line)-1] = 0; if(strstr(line, "Symbol table")) break; if(strlen(line) < 22) continue; p = line+9; if(p[0] == ' ') continue; if(p[7] == ' ') continue; a = strtol(p, &p, 8); while(*p == ' ') p++; while(*p >= '0' && *p <= '7'){ d = strtol(p, &p, 8); while(*p == ' ') p++; out(a, d); a += 2; } } return 0; }