#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "c.h"
#include "rcc.h"
Include dependency graph for 2html.c:

Go to the source code of this file.
Defines | |
| #define | attributes |
| #define | attributes xx(x,suffix,suffix); xx(x,size,int) |
| #define | attributes xx(x,uid,define_uid) |
| #define | attributes xx(x,size,int); xx(x,align,int) |
| #define | caselabel(kind) |
| #define | xx(ptr, field, type) do { printf("<li>" #field " = "); do_##type(ptr->field); printf("</li>\n"); } while (0) |
| #define | xx(s) if (x == s) { printf(#s); return; } |
| #define | xx(f, n) if ((x>>n)&1) { printf("%s" #f, bar); bar = "|"; } |
| #define | xx(c) if (x == c) { printf(#c); return; } |
| #define | xx(c) if (x == c) { printf(#c); return; } |
| #define | yy(kind, field, type) xx((&x->v.rcc_##kind),field,type) |
Functions | |
| void | do_define_label (int x) |
| void | do_define_uid (int x) |
| void | do_enum (void *x) |
| void | do_enum_list (list_ty x) |
| void | do_field (void *x) |
| void | do_field_list (list_ty x) |
| void | do_flags (int x) |
| void | do_generic_string (void *x) |
| void | do_identifier (const char *x) |
| void | do_int (int x) |
| void | do_interface (void *) |
| void | do_interface_list (list_ty x) |
| void | do_item (rcc_item_ty x) |
| void | do_item_list (list_ty x) |
| void | do_label (int x) |
| void | do_list (list_ty x, void do_one(void *), char *type, char *listhtml, char *separator) |
| void | do_node (void *y) |
| void | do_node_list (list_ty x) |
| void | do_op (int x) |
| void | do_program (rcc_program_ty x) |
| void | do_real (rcc_real_ty x) |
| void | do_sclass (int x) |
| void | do_scope (int x) |
| void | do_seg (int x) |
| void | do_string (string_ty x) |
| void | do_string_list (list_ty x) |
| void | do_suffix (int x) |
| void | do_symbol (rcc_symbol_ty x) |
| void | do_type (rcc_type_ty x) |
| void | do_uid (int x) |
| void | do_uid_list (list_ty x) |
| int | main (int argc, char *argv[]) |
Variables | |
| int | nextid |
|
|
|
|
|
|
|
|
|
|
|
Referenced by Sys_CreatePathToFile(). |
|
|
Value: case rcc_##kind##_enum: \ printf("<strong>" #kind "</strong> : <em>%s</em>", typename); \ printf("<ul>\n"); attributes Definition at line 240 of file 2html.c. Referenced by do_interface(), do_item(), do_node(), do_type(), and statement(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 243 of file 2html.c. Referenced by do_interface(), do_item(), do_node(), do_type(), R_LevelShot(), set1(), set2(), and toMatrix(). |
|
|
Definition at line 126 of file 2html.c. 00126 {
00127 printf("<strong id=ll%d>%d</strong>", x, x);
00128 }
|
Here is the call graph for this function:

|
|
Definition at line 122 of file 2html.c. 00122 {
00123 printf("<strong id=uid%d>%d</strong>", x, x);
00124 }
|
Here is the call graph for this function:

|
|
Definition at line 201 of file 2html.c. References do_identifier(), do_int(), e, and printf(). Referenced by do_enum_list(). 00201 {
00202 rcc_enum__ty e = x;
00203
00204 do_identifier(e->id);
00205 printf("=");
00206 do_int(e->value);
00207 }
|
Here is the call graph for this function:

|
|
Definition at line 209 of file 2html.c. References do_enum(), do_list(), NULL, and x. 00209 {
00210 do_list(x, do_enum, "enum", NULL, " ");
00211 }
|
Here is the call graph for this function:

|
|
Definition at line 213 of file 2html.c. References f, offset, printf(), and xx. Referenced by do_field_list(). 00213 {
00214 rcc_field_ty f = x;
00215
00216 printf("<em>field</em><ul>\n");
00217 xx(f,id,identifier);
00218 xx(f,type,uid);
00219 xx(f,offset,int);
00220 xx(f,bitsize,int);
00221 xx(f,lsb,int);
00222 printf("</ul>\n");
00223 }
|
Here is the call graph for this function:

|
|
Definition at line 225 of file 2html.c. References do_field(), do_list(), and x. 00225 {
00226 do_list(x, do_field, "field", "ol", "");
00227 }
|
Here is the call graph for this function:

|
|
Definition at line 43 of file 2html.c. References do_int(), temporary(), x, and xx. 00043 {
00044 char *bar = "";
00045 #define xx(f,n) if ((x>>n)&1) { printf("%s" #f, bar); bar = "|"; }
00046 xx(structarg,0)
00047 xx(addressed,1)
00048 xx(computed,2)
00049 xx(temporary,3)
00050 xx(generated,4)
00051 #undef xx
00052 if (*bar == '\0')
00053 do_int(x);
00054 }
|
Here is the call graph for this function:

|
|
Definition at line 328 of file 2html.c. References do_string(), and x. Referenced by do_string_list(). 00328 {
00329 do_string(*(string_ty *)x);
00330 }
|
Here is the call graph for this function:

|
|
Definition at line 178 of file 2html.c. Referenced by do_enum(). 00178 {
00179 printf("%s", x);
00180 }
|
Here is the call graph for this function:

|
|
Definition at line 14 of file 2html.c. Referenced by do_enum(), do_flags(), do_sclass(), do_scope(), and do_seg(). 00014 {
00015 printf("%d", x);
00016 }
|
Here is the call graph for this function:

|
|
Definition at line 426 of file 2html.c. References assert, caselabel, codelist, f, n, p, printf(), q, s, suffix(), x, and yy. Referenced by do_interface_list(). 00426 {
00427 rcc_interface_ty x = y;
00428
00429 if (x->kind == rcc_Address_enum)
00430 printf("<a name='%d'></a>", x->v.rcc_Address.uid);
00431 else if (x->kind == rcc_Local_enum)
00432 printf("<a name='%d'></a>", x->v.rcc_Local.uid);
00433 #define attributes
00434 switch (x->kind) {
00435 static char *typename = "interface";
00436 caselabel(Export);
00437 yy(Export,p,uid);
00438 break;
00439 caselabel(Import);
00440 yy(Import,p,uid);
00441 break;
00442 caselabel(Global);
00443 yy(Global,p,uid);
00444 yy(Global,seg,seg);
00445 break;
00446 caselabel(Local);
00447 yy(Local,uid,define_uid);
00448 yy(Local,p,symbol);
00449 break;
00450 caselabel(Address);
00451 yy(Address,uid,define_uid);
00452 yy(Address,q,symbol);
00453 yy(Address,p,uid);
00454 yy(Address,n,int);
00455 break;
00456 caselabel(Segment);
00457 yy(Segment,seg,seg);
00458 break;
00459 caselabel(Defaddress);
00460 yy(Defaddress,p,uid);
00461 break;
00462 caselabel(Deflabel);
00463 yy(Deflabel,label,label);
00464 break;
00465 caselabel(Defconst);
00466 yy(Defconst,suffix,suffix);
00467 yy(Defconst,size,int);
00468 yy(Defconst,value,int);
00469 break;
00470 caselabel(Defconstf);
00471 yy(Defconstf,size,int);
00472 yy(Defconstf,value,real);
00473 break;
00474 caselabel(Defstring);
00475 yy(Defstring,s,string);
00476 break;
00477 caselabel(Space);
00478 yy(Space,n,int);
00479 break;
00480 caselabel(Function);
00481 yy(Function,f,uid);
00482 yy(Function,caller,uid_list);
00483 yy(Function,callee,uid_list);
00484 yy(Function,ncalls,int);
00485 yy(Function,codelist,interface_list);
00486 break;
00487 caselabel(Forest);
00488 yy(Forest,nodes,node_list);
00489 break;
00490 case rcc_Blockbeg_enum: printf("<strong>Blockbeg</strong> : <em>%s</em>", typename); return;
00491 case rcc_Blockend_enum: printf("<strong>Blockend</strong> : <em>%s</em>", typename); return;
00492 default: assert(0);
00493 }
00494 #undef attributes
00495 printf("</ul>\n");
00496 }
|
Here is the call graph for this function:

|
|
Definition at line 422 of file 2html.c. References do_interface(), do_list(), and x. 00422 {
00423 do_list(x, do_interface, "interface", "ol", "");
00424 }
|
Here is the call graph for this function:

|
|
Definition at line 287 of file 2html.c. References assert, caselabel, printf(), Symbol, Type, x, and yy. Referenced by do_item_list(). 00287 {
00288 printf("<a name='%d'>", x->uid);
00289 #define attributes xx(x,uid,define_uid)
00290 printf("</a>");
00291 switch (x->kind) {
00292 static char *typename = "item";
00293 caselabel(Symbol);
00294 yy(Symbol,symbol,symbol);
00295 break;
00296 caselabel(Type);
00297 yy(Type,type,type);
00298 break;
00299 default: assert(0);
00300 }
00301 #undef attributes
00302 printf("</ul>\n");
00303 }
|
Here is the call graph for this function:

|
|
Definition at line 305 of file 2html.c. References count, do_item(), i, printf(), and x. 00305 {
00306 int count = Seq_length(x);
00307
00308 if (count == 0)
00309 printf("<em>empty item list</em>\n");
00310 else {
00311 int i;
00312 printf("<em>item list</em>");
00313 printf("<ol>\n");
00314 for (i = 0; i < count; i++) {
00315 rcc_item_ty item = Seq_get(x, i);
00316 printf("<li value=%d>", item->uid);
00317 do_item(item);
00318 printf("</li>\n");
00319 }
00320 printf("</ol>\n");
00321 }
00322 }
|
Here is the call graph for this function:

|
|
Definition at line 134 of file 2html.c. 00134 {
00135 printf("<a href='#L%d'>%d</a>", x, x, x);
00136 }
|
Here is the call graph for this function:

|
||||||||||||||||||||||||
|
Definition at line 140 of file 2html.c. References count, i, printf(), type, and x. Referenced by do_enum_list(), do_field_list(), do_interface_list(), do_node_list(), and do_string_list(). 00140 {
00141 int count = Seq_length(x);
00142
00143 if (count == 0)
00144 printf("<em>empty %s list</em>\n", type);
00145 else {
00146 int i;
00147 printf("<em>%s list</em>", type);
00148 if (listhtml != NULL)
00149 printf("<%s>\n", listhtml);
00150 for (i = 0; i < count; i++) {
00151 if (listhtml != NULL)
00152 printf("<li>");
00153 printf(separator);
00154 do_one(Seq_get(x, i));
00155 if (listhtml != NULL)
00156 printf("</li>\n");
00157 }
00158 if (listhtml != NULL)
00159 printf("</%s>\n", listhtml);
00160 }
00161 }
|
Here is the call graph for this function:

|
|
Definition at line 336 of file 2html.c. References ADDRF, ADDRG, ADDRL, ARG, ASGN, assert, CALL, caselabel, CNST, LABEL, op, printf(), RET, right, x, and yy. Referenced by do_node_list(). 00336 {
00337 rcc_node_ty x = y;
00338
00339 if (x->kind == rcc_LABEL_enum)
00340 printf("<a name='L%d'></a>", x->v.rcc_LABEL.label);
00341 #define attributes xx(x,suffix,suffix); xx(x,size,int)
00342 switch (x->kind) {
00343 static char *typename = "node";
00344 caselabel(CNST);
00345 yy(CNST,value,int);
00346 break;
00347 caselabel(CNSTF);
00348 yy(CNSTF,value,real);
00349 break;
00350 caselabel(ARG);
00351 yy(ARG,left,node);
00352 yy(ARG,len,int);
00353 yy(ARG,align,int);
00354 break;
00355 caselabel(ASGN);
00356 yy(ASGN,left,node);
00357 yy(ASGN,right,node);
00358 yy(ASGN,len,int);
00359 yy(ASGN,align,int);
00360 break;
00361 caselabel(CVT);
00362 yy(CVT,op,op);
00363 yy(CVT,left,node);
00364 yy(CVT,fromsize,int);
00365 break;
00366 caselabel(CALL);
00367 yy(CALL,left,node);
00368 yy(CALL,type,uid);
00369 break;
00370 caselabel(CALLB);
00371 yy(CALLB,left,node);
00372 yy(CALLB,right,node);
00373 yy(CALLB,type,uid);
00374 break;
00375 caselabel(RET); break;
00376 caselabel(ADDRG);
00377 yy(ADDRG,uid,uid);
00378 break;
00379 caselabel(ADDRL);
00380 yy(ADDRL,uid,uid);
00381 break;
00382 caselabel(ADDRF);
00383 yy(ADDRF,uid,uid);
00384 break;
00385 caselabel(Unary);
00386 yy(Unary,op,op);
00387 yy(Unary,left,node);
00388 break;
00389 caselabel(Binary);
00390 yy(Binary,op,op);
00391 yy(Binary,left,node);
00392 yy(Binary,right,node);
00393 break;
00394 caselabel(Compare);
00395 yy(Compare,op,op);
00396 yy(Compare,left,node);
00397 yy(Compare,right,node);
00398 yy(Compare,label,label);
00399 break;
00400 caselabel(LABEL);
00401 yy(LABEL,label,define_label);
00402 break;
00403 caselabel(BRANCH);
00404 yy(BRANCH,label,label);
00405 break;
00406 caselabel(CSE);
00407 yy(CSE,uid,uid);
00408 yy(CSE,node,node);
00409 break;
00410 default: assert(0);
00411 }
00412 #undef attributes
00413 printf("</ul>");
00414 }
|
Here is the call graph for this function:

|
|
Definition at line 416 of file 2html.c. References do_list(), do_node(), and x. 00416 {
00417 do_list(x, do_node, "node", "ol", "");
00418 }
|
Here is the call graph for this function:

|
|
Definition at line 68 of file 2html.c. References op, opindex, printf(), and x. 00068 {
00069 static char *opnames[] = {
00070 "",
00071 "CNST",
00072 "ARG",
00073 "ASGN",
00074 "INDIR",
00075 "CVC",
00076 "CVD",
00077 "CVF",
00078 "CVI",
00079 "CVP",
00080 "CVS",
00081 "CVU",
00082 "NEG",
00083 "CALL",
00084 "*LOAD*",
00085 "RET",
00086 "ADDRG",
00087 "ADDRF",
00088 "ADDRL",
00089 "ADD",
00090 "SUB",
00091 "LSH",
00092 "MOD",
00093 "RSH",
00094 "BAND",
00095 "BCOM",
00096 "BOR",
00097 "BXOR",
00098 "DIV",
00099 "MUL",
00100 "EQ",
00101 "GE",
00102 "GT",
00103 "LE",
00104 "LT",
00105 "NE",
00106 "JUMP",
00107 "LABEL",
00108 "AND",
00109 "NOT",
00110 "OR",
00111 "COND",
00112 "RIGHT",
00113 "FIELD"
00114 };
00115 int op = opindex(x);
00116 if (op < 1 || op >= sizeof opnames/sizeof opnames[0])
00117 printf("%d", x);
00118 else
00119 printf("%s", opnames[op]);
00120 }
|
Here is the call graph for this function:

|
|
Definition at line 498 of file 2html.c. References argc, argv, printf(), x, and xx. Referenced by main(). 00498 {
00499 printf("<ul>\n");
00500 xx(x,nuids,int);
00501 xx(x,nlabels,int);
00502 xx(x,items,item_list);
00503 xx(x,interfaces,interface_list);
00504 xx(x,argc,int);
00505 xx(x,argv,string_list);
00506 printf("</ul>\n");
00507 }
|
Here is the call graph for this function:

|
|
Definition at line 182 of file 2html.c. References d, p, printf(), and x. 00182 {
00183 double d;
00184 unsigned *p = (unsigned *)&d;
00185 static union { int x; char endian; } little = { 1 };
00186
00187 p[1-little.endian] = x->msb;
00188 p[little.endian] = x->lsb;
00189 printf("(%#X,%#X) = %g", x->msb, x->lsb, d);
00190 }
|
Here is the call graph for this function:

|
|
Definition at line 32 of file 2html.c. References do_int(), EXTERN, x, and xx. 00032 {
00033 #define xx(c) if (x == c) { printf(#c); return; }
00034 xx(REGISTER)
00035 xx(AUTO)
00036 xx(EXTERN)
00037 xx(STATIC)
00038 xx(TYPEDEF)
00039 #undef xx
00040 do_int(x);
00041 }
|
Here is the call graph for this function:

|
|
Definition at line 18 of file 2html.c. References CONSTANTS, do_int(), GLOBAL, LABELS, LOCAL, PARAM, printf(), x, and xx. 00018 {
00019 #define xx(c) if (x == c) { printf(#c); return; }
00020 xx(CONSTANTS)
00021 xx(LABELS)
00022 xx(GLOBAL)
00023 xx(PARAM)
00024 xx(LOCAL)
00025 #undef xx
00026 if (x > LOCAL)
00027 printf("LOCAL+%d", x-LOCAL);
00028 else
00029 do_int(x);
00030 }
|
Here is the call graph for this function:

|
|
Definition at line 56 of file 2html.c. References BSS, CODE, DATA, do_int(), LIT, x, and xx. 00056 {
00057 #define xx(s) if (x == s) { printf(#s); return; }
00058 xx(CODE)
00059 xx(BSS)
00060 xx(DATA)
00061 xx(LIT)
00062 #undef xx
00063 do_int(x);
00064 }
|
Here is the call graph for this function:

|
|
Definition at line 324 of file 2html.c. Referenced by do_generic_string().
|
Here is the call graph for this function:

|
|
Definition at line 332 of file 2html.c. References do_generic_string(), do_list(), and x. 00332 {
00333 do_list(x, do_generic_string, "string", "ol", "");
00334 }
|
Here is the call graph for this function:

|
|
Definition at line 192 of file 2html.c. References printf(), suffixes, and x. 00192 {
00193 static char suffixes[] = "0F234IUPVB";
00194
00195 if (x < 0 || x >= (sizeof suffixes/sizeof suffixes[0]) - 1)
00196 printf("%d", x);
00197 else
00198 printf("%c", suffixes[x]);
00199 }
|
Here is the call graph for this function:

|
|
Definition at line 229 of file 2html.c. References printf(), ref, x, and xx. 00229 {
00230 printf("<em>symbol</em><ul>\n");
00231 xx(x,id,identifier);
00232 xx(x,type,uid);
00233 xx(x,scope,scope);
00234 xx(x,sclass,sclass);
00235 xx(x,ref,int);
00236 xx(x,flags,flags);
00237 printf("</ul>\n");
00238 }
|
Here is the call graph for this function:

|
|
Definition at line 245 of file 2html.c. References ARRAY, assert, caselabel, CONST, ENUM, fields, FLOAT, FUNCTION, INT, POINTER, printf(), STRUCT, UNION, UNSIGNED, VOID, VOLATILE, x, and yy. 00245 {
00246 #define attributes xx(x,size,int); xx(x,align,int)
00247 switch (x->kind) {
00248 static char *typename = "type";
00249 caselabel(INT); break;
00250 caselabel(UNSIGNED); break;
00251 caselabel(FLOAT); break;
00252 caselabel(VOID); break;
00253 caselabel(POINTER);
00254 yy(POINTER,type,uid);
00255 break;
00256 caselabel(ENUM);
00257 yy(ENUM,tag,identifier);
00258 yy(ENUM,ids,enum_list);
00259 break;
00260 caselabel(STRUCT);
00261 yy(STRUCT,tag,identifier);
00262 yy(STRUCT,fields,field_list);
00263 break;
00264 caselabel(UNION);
00265 yy(UNION,tag,identifier);
00266 yy(UNION,fields,field_list);
00267 break;
00268 caselabel(ARRAY);
00269 yy(ARRAY,type,uid);
00270 break;
00271 caselabel(FUNCTION);
00272 yy(FUNCTION,type,uid);
00273 yy(FUNCTION,formals,uid_list);
00274 break;
00275 caselabel(CONST);
00276 yy(CONST,type,uid);
00277 break;
00278 caselabel(VOLATILE);
00279 yy(VOLATILE,type,uid);
00280 break;
00281 default: assert(0);
00282 }
00283 #undef attributes
00284 printf("</ul>\n");
00285 }
|
Here is the call graph for this function:

|
|
Definition at line 130 of file 2html.c. Referenced by do_uid_list(). 00130 {
00131 printf("<a href='#%d'>%d</a>", x, x, x);
00132 }
|
Here is the call graph for this function:

|
|
Definition at line 163 of file 2html.c. References count, do_uid(), i, printf(), and x. 00163 {
00164 int i, count = Seq_length(x);
00165
00166 if (count == 0)
00167 printf("<em>empty int list</em>\n");
00168 else {
00169 int i;
00170 printf("<em>int list</em>");
00171 for (i= 0; i < count; i++) {
00172 printf(" ");
00173 do_uid(*(int *)Seq_get(x, i));
00174 }
00175 }
00176 }
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 509 of file 2html.c. References argv, assert, ctime(), do_program(), exit(), EXIT_FAILURE, fprintf(), freopen(), i, NULL, printf(), rcsid, stderr, stdin, stdout, strcmp(), strstr(), strtod(), t, time(), and time_t. 00509 {
00510 int i, version;
00511 float stamp = (assert(strstr(rcsid, ",v")), strtod(strstr(rcsid, ",v")+2, NULL))
00512 ;
00513 char *infile = NULL, *outfile = NULL;
00514 rcc_program_ty pickle;
00515
00516 for (i = 1; i < argc; i++)
00517 if (*argv[i] != '-' || strcmp(argv[i], "-") == 0) {
00518 if (infile == NULL)
00519 infile = argv[i];
00520 else if (outfile == NULL)
00521 outfile = argv[i];
00522 }
00523 if (infile != NULL && strcmp(infile, "-") != 0
00524 && freopen(infile, "rb", stdin) == NULL) {
00525 fprintf(stderr, "%s: can't read `%s'\n", argv[0], infile);
00526 exit(EXIT_FAILURE);
00527 }
00528 if (infile == NULL || strcmp(infile, "-") == 0)
00529 infile = "Standard Input";
00530 #if WIN32
00531 else
00532 _setmode(_fileno(stdin), _O_BINARY);
00533 #endif
00534 if (outfile != NULL && strcmp(outfile, "-") != 0
00535 && freopen(outfile, "w", stdout) == NULL) {
00536 fprintf(stderr, "%s: can't write `%s'\n", argv[0], outfile);
00537 exit(EXIT_FAILURE);
00538 }
00539 version = read_int(stdin);
00540 assert(version/100 == (int)stamp);
00541 pickle = rcc_read_program(stdin);
00542 printf("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\"\n");
00543 printf("<html><head><title>%s</title>\n"
00544 "<link rev=made href=\"mailto:drh@microsoft.com\">\n"
00545 "</head><body>\n<h1>%s</h1>\n", infile, infile);
00546 printf("<p>version = %d.%d</p>", version/100, version%100);
00547 do_program(pickle);
00548 {
00549 time_t t;
00550 time(&t);
00551 printf("<hr><address>%s</address>\n", ctime(&t));
00552 }
00553 printf("</body></html>\n");
00554 return EXIT_SUCCESS;
00555 }
|
Here is the call graph for this function:

|
|
|
1.3.9.1