]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - exec.c
Just make it -v
[xonotic/gmqcc.git] / exec.c
diff --git a/exec.c b/exec.c
index cd2ef6e46e27f1b74aa96ab6a85b15b19ca13315..3955371d5c5fa5f44a5129c87036bb159f7d0600 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -617,6 +617,8 @@ cleanup:
 #if defined(QCVM_EXECUTOR)
 #include <math.h>
 
+cmd_options opts;
+
 const char *type_name[TYPE_COUNT] = {
     "void",
     "string",
@@ -632,9 +634,6 @@ const char *type_name[TYPE_COUNT] = {
     "variant"
 };
 
-bool        opts_debug    = false;
-bool        opts_memchk   = false;
-
 typedef struct {
     int         vtype;
     const char *value;
@@ -692,6 +691,17 @@ static int qc_ftos(qc_program *prog)
     return 0;
 }
 
+static int qc_stof(qc_program *prog)
+{
+    qcany *str;
+    qcany num;
+    CheckArgs(1);
+    str = GetArg(0);
+    num._float = strtof(prog_getstring(prog, str->string), NULL);
+    Return(num);
+    return 0;
+}
+
 static int qc_vtos(qc_program *prog)
 {
     char buffer[512];
@@ -757,7 +767,8 @@ static prog_builtin qc_builtins[] = {
     &qc_vtos,  /*   5   */
     &qc_error, /*   6   */
     &qc_vlen,  /*   7   */
-    &qc_etos   /*   8   */
+    &qc_etos,  /*   8   */
+    &qc_stof   /*   9   */
 };
 static size_t qc_builtins_count = sizeof(qc_builtins) / sizeof(qc_builtins[0]);
 
@@ -936,13 +947,15 @@ int main(int argc, char **argv)
     else if (opts_printfuns) {
         for (i = 0; i < vec_size(prog->functions); ++i) {
             int32_t a;
-            printf("Function: %-16s taking %i parameters:",
+            printf("Function: %-16s taking %i parameters:(",
                    prog_getstring(prog, prog->functions[i].name),
                    (unsigned int)prog->functions[i].nargs);
             for (a = 0; a < prog->functions[i].nargs; ++a) {
                 printf(" %i", prog->functions[i].argsize[a]);
             }
-            printf("\n");
+            printf(") locals: %i + %i\n",
+                   prog->functions[i].firstlocal,
+                   prog->functions[i].locals);
         }
     }
     else