]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
-disasm should show builtins as builtins rather than trying to print negative stateme...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 2 Nov 2012 11:32:13 +0000 (12:32 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 2 Nov 2012 11:32:13 +0000 (12:32 +0100)
exec.c

diff --git a/exec.c b/exec.c
index 1658604e2f686bde9228e0dad7e85136b863f943..cbbe54685c550a324090cf2e8cfdef765de6b696 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -922,7 +922,7 @@ int main(int argc, char **argv)
         return 0;
     }
     if (opts_disasm) {
-        for (i = 0; i < prog->functions_count; ++i)
+        for (i = 1; i < prog->functions_count; ++i)
             prog_disasm_function(prog, i);
         return 0;
     }
@@ -962,7 +962,12 @@ void prog_disasm_function(qc_program *prog, size_t id)
     prog_section_function *fdef = prog->functions + id;
     prog_section_statement *st;
 
-    printf("FUNCTION \"%s\"\n", prog_getstring(prog, fdef->name));
+    if (fdef->entry < 0) {
+        printf("FUNCTION \"%s\" = builtin #%i\n", prog_getstring(prog, fdef->name), (int)-fdef->entry);
+        return;
+    }
+    else
+        printf("FUNCTION \"%s\"\n", prog_getstring(prog, fdef->name));
 
     st = prog->code + fdef->entry;
     while (st->opcode != AINSTR_END) {