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);
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)
{
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].
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)
{