]> git.pond.sub.org Git - empserver/commitdiff
Move nstr_promote() to src/lib/common/, external linkage
authorMarkus Armbruster <armbru@pond.sub.org>
Tue, 4 Mar 2008 06:51:56 +0000 (07:51 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Fri, 14 Mar 2008 19:25:40 +0000 (20:25 +0100)
include/nsc.h
src/lib/common/nstreval.c
src/lib/subs/nstr.c

index 4a7f72510af1a49aeebc50679a89cebd015d49d6..91519206d0aaad911ea69e4c9624432bb438d349 100644 (file)
@@ -275,6 +275,7 @@ extern int nstr_coerce_val(struct valstr *, nsc_type, char *);
 extern int nstr_exec(struct nscstr *, int, void *);
 /* src/lib/common/nstreval.c */
 extern void nstr_exec_val(struct valstr *, natid, void *, nsc_type);
+extern int nstr_promote(int);
 extern char *symbol_by_value(int, struct symbol *);
 /* src/lib/global/nsc.c */
 extern void nsc_init(void);
index 9bb35dc858ad7bede9d296b63be9bb915ce6b3b8..c730ff5aaf98bde5cc00e16b4a3b0e80f3e0bc7f 100644 (file)
@@ -160,6 +160,44 @@ nstr_exec_val(struct valstr *val, natid cnum, void *ptr, nsc_type want)
     val->val_type = valtype;
 }
 
+/*
+ * Promote VALTYPE.
+ * If VALTYPE is an integer type, return NSC_LONG.
+ * If VALTYPE is a floating-point type, return NSC_DOUBLE.
+ * If VALTYPE is a string type, return NSC_STRING.
+ */
+int
+nstr_promote(int valtype)
+{
+    switch (valtype) {
+    case NSC_LONG:
+    case NSC_DOUBLE:
+    case NSC_STRING:
+       break;
+    case NSC_CHAR:
+    case NSC_UCHAR:
+    case NSC_SHORT:
+    case NSC_USHORT:
+    case NSC_INT:
+    case NSC_XCOORD:
+    case NSC_YCOORD:
+    case NSC_HIDDEN:
+    case NSC_TIME:
+       valtype = NSC_LONG;
+       break;
+    case NSC_FLOAT:
+       valtype = NSC_DOUBLE;
+       break;
+    case NSC_STRINGY:
+       valtype = NSC_STRING;
+       break;
+    default:
+       CANT_REACH();
+       valtype = NSC_NOTYPE;
+    }
+    return valtype;
+}
+
 char *
 symbol_by_value(int key, struct symbol *table)
 {
index 2ce084032998b58ff31c370a0a5e4d4a72cea085..0142257ca5341e26ecc17414e025338a31493d5c 100644 (file)
@@ -49,8 +49,6 @@ static int nstr_string_ok(struct castr *ca, int idx);
 static struct valstr *nstr_resolve_sel(struct valstr *, struct castr *);
 static struct valstr *nstr_mkselval(struct valstr *, int, struct castr *);
 static struct valstr *nstr_resolve_id(struct valstr *, struct castr *, int, int);
-static int nstr_promote(int);
-
 
 /*
  * Compile conditions into array NP[LEN].
@@ -474,45 +472,6 @@ nstr_comp_val(char *str, struct valstr *val, int type)
     return tail;
 }
 
-
-/*
- * Promote VALTYPE.
- * If VALTYPE is an integer type, return NSC_LONG.
- * If VALTYPE is a floating-point type, return NSC_DOUBLE.
- * If VALTYPE is a string type, return NSC_STRING.
- */
-static int
-nstr_promote(int valtype)
-{
-    switch (valtype) {
-    case NSC_LONG:
-    case NSC_DOUBLE:
-    case NSC_STRING:
-       break;
-    case NSC_CHAR:
-    case NSC_UCHAR:
-    case NSC_SHORT:
-    case NSC_USHORT:
-    case NSC_INT:
-    case NSC_XCOORD:
-    case NSC_YCOORD:
-    case NSC_HIDDEN:
-    case NSC_TIME:
-       valtype = NSC_LONG;
-       break;
-    case NSC_FLOAT:
-       valtype = NSC_DOUBLE;
-       break;
-    case NSC_STRINGY:
-       valtype = NSC_STRING;
-       break;
-    default:
-       CANT_REACH();
-       valtype = NSC_NOTYPE;
-    }
-    return valtype;
-}
-
 static int
 cond_type_mismatch(char *str)
 {