void PR_PrintStatement (dstatement_t *s) { int i; if ((unsigned) s->op < sizeof(pr_opnames) / sizeof(pr_opnames[0])) { Com_Printf ("%s ", pr_opnames[s->op]); i = strlen(pr_opnames[s->op]); for ( ; i < 10; i++) Com_Printf (" "); } if (s->op == OP_IF || s->op == OP_IFNOT) { Com_Printf ("%sbranch %i",PR_GlobalString(s->a), s->b); } else if (s->op == OP_GOTO) { Com_Printf ("branch %i", s->a); } else if ((unsigned) (s->op - OP_STORE_F) < 6) { Com_Printf ("%s",PR_GlobalString(s->a)); Com_Printf ("%s", PR_GlobalStringNoContents(s->b)); } else { if (s->a) Com_Printf ("%s",PR_GlobalString(s->a)); if (s->b) Com_Printf ("%s",PR_GlobalString(s->b)); if (s->c) Com_Printf ("%s", PR_GlobalStringNoContents(s->c)); } Com_Printf ("\n"); }
/* ================= PR_PrintStatement ================= */ void PR_PrintStatement (dstatement_t *s) { int i; printf ("%4i : %4i : %s ", (int)(s - statements), statement_linenums[s-statements], pr_opcodes[s->op].opname); i = strlen(pr_opcodes[s->op].opname); for ( ; i<10 ; i++) printf (" "); if (s->op == OP_IF || s->op == OP_IFNOT) printf ("%sbranch %i",PR_GlobalString(s->a),s->b); else if (s->op == OP_GOTO) { printf ("branch %i",s->a); } else if ( (unsigned)(s->op - OP_STORE_F) < 6) { printf ("%s",PR_GlobalString(s->a)); printf ("%s", PR_GlobalStringNoContents(s->b)); } else { if (s->a) printf ("%s",PR_GlobalString(s->a)); if (s->b) printf ("%s",PR_GlobalString(s->b)); if (s->c) printf ("%s", PR_GlobalStringNoContents(s->c)); } printf ("\n"); }
char *PR_GlobalString (gofs_t ofs) { char *s; int i; def_t *def; void *val; static char line[128]; val = (void *)&pr_globals[ofs]; def = pr_global_defs[ofs]; if (!def) return PR_GlobalStringNoContents(ofs); if (def->constant && def->type->type != ev_function) { s = PR_ValueString (def->type->type, &pr_globals[ofs]); sprintf (line,"%i(%s)", ofs, s); } else sprintf (line,"%i(%s)", ofs, def->name); i = strlen(line); for ( ; i<16 ; i++) strcat (line," "); strcat (line," "); return line; }
static const char *PR_GlobalString (gofs_t ofs) { static char line[128]; const char *s; def_t *def; int i; def = pr_global_defs[ofs]; if (!def) return PR_GlobalStringNoContents(ofs); if (def->initialized && def->type->type != ev_function) { s = PR_ValueString (def->type->type, &pr_globals[ofs]); q_snprintf (line, sizeof(line), "%i(%s)", ofs, s); } else q_snprintf (line, sizeof(line), "%i(%s)", ofs, def->name); i = strlen(line); for ( ; i < 16; i++) strcat (line, " "); strcat (line, " "); return line; }