aboutsummaryrefslogtreecommitdiffstats
path: root/src/aup.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/aup.h')
-rw-r--r--src/aup.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/aup.h b/src/aup.h
new file mode 100644
index 0000000..aa48daf
--- /dev/null
+++ b/src/aup.h
@@ -0,0 +1,19 @@
+#ifndef AUP_H
+#define AUP_H
+#include <stdbool.h>
+#include <stddef.h>
+
+/* aup v0a: source text to a Pure module v1 (Pure docs/design/008). */
+enum { AUP_SOURCE_LIMIT = 32768, AUP_MESSAGE = 160 };
+
+typedef struct {
+ int line, column;
+ char message[AUP_MESSAGE];
+} AupDiagnostic;
+
+/* Compile source into a newly allocated module (free with free()). The same
+ * source always produces the same bytes. On failure *module is NULL and the
+ * diagnostic names the first error. */
+bool aup_compile(const char *source, size_t length, unsigned char **module, size_t *size,
+ AupDiagnostic *error);
+#endif