summaryrefslogtreecommitdiff
path: root/apl9.h
diff options
context:
space:
mode:
authorPeter Mikkelsen <petermikkelsen10@gmail.com>2022-01-26 09:40:50 +0000
committerPeter Mikkelsen <petermikkelsen10@gmail.com>2022-01-26 09:40:50 +0000
commitbcaf7f25f42b21067a26895e097ada73765ba7d5 (patch)
treeccfb887cf08619c17b3afa3b517bfc3dcdfa18ad /apl9.h
parent57a86f761605b6261d1045558c9cb7c83d723b60 (diff)
Implement a new "mixed" type which can be either of the three scalar types: int, float, rune. This allows scalar arrays with mixed scalar types
Diffstat (limited to 'apl9.h')
-rw-r--r--apl9.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/apl9.h b/apl9.h
index b15b7e6..9004636 100644
--- a/apl9.h
+++ b/apl9.h
@@ -22,6 +22,7 @@ typedef enum
AtypeInt,
AtypeFloat,
AtypeRune,
+ AtypeMixed,
AtypeArray,
} arrayDataType;
@@ -57,6 +58,7 @@ typedef enum
} errorCodes;
/* Data types */
+typedef struct Mixed Mixed;
typedef struct Array Array;
typedef struct Statement Statement;
typedef struct Operator Operator;
@@ -69,6 +71,16 @@ typedef struct QuadnameDef QuadnameDef;
typedef struct ErrorHandler ErrorHandler;
typedef struct DfnFrame DfnFrame;
+struct Mixed
+{
+ int type;
+ union {
+ vlong i;
+ double f;
+ Rune r;
+ };
+};
+
struct Array
{
arrayDataType type;
@@ -82,6 +94,7 @@ struct Array
vlong *intdata;
double *floatdata;
Rune *runedata;
+ Mixed *mixeddata;
Array **arraydata;
};
};
@@ -222,6 +235,7 @@ Array *arrayitem(Array *, int);
Array *simplifyarray(Array *);
int comparearray(Array *, Array *, int);
Array *fillelement(Array *);
+uvlong arrayspaceused(Array *);
/* eval.c */
Datum *eval(Statement *, int);