diff lwasm/lwasm.h @ 519:724bcc4508bc

Add SETSTR/INCLUDESTR for some basic code building It seemed useful to have the ability to build up a variable containing arbitrary text and then to be able to include that in the assembly process like an include file. So add, undocumented for now, the following: SETTSTR varname="string" INCLUDESTSR "string" "string" must be enclosed in double quotes and may contain most of the usual escape sequences (\t, \r, etc.) as well as %(varname) to interpolate a variable value. To use it to create assembleable source code, you need to make sure it creates lines (ended by either \r or \n) with appropriate whitespace in appropriate places.
author William Astle <lost@l-w.ca>
date Sun, 19 Dec 2021 17:01:42 -0700
parents bab891d85a53
children e10618b48e68
line wrap: on
line diff
--- a/lwasm/lwasm.h	Tue Apr 13 15:41:23 2021 -0600
+++ b/lwasm/lwasm.h	Sun Dec 19 17:01:42 2021 -0700
@@ -29,6 +29,7 @@
 #include <lw_expr.h>
 #include <lw_stringlist.h>
 #include <lw_stack.h>
+#include <lw_dict.h>
 
 #include <version.h>
 
@@ -426,6 +427,8 @@
 	lw_stringlist_t include_list;		// include paths
 	lw_stack_t file_dir;				// stack of the "current file" dir
 	lw_stack_t includelist;
+	lw_dict_t stringvars;               // dictionary of string variables (SETSTR/INCLUDESTR)
+
 
 	structtab_t *structs;				// defined structures
 	structtab_t *cstruct;				// current structure
@@ -496,4 +499,7 @@
 /* skip to the start of the next token if the current parsing mode allows it */
 void lwasm_skip_to_next_token(line_t *cl, char **p);
 
+/* parse a generalized string enclosed in double quotes */
+char *lwasm_parse_general_string(line_t *cl, char **p);
+
 #endif /* ___lwasm_h_seen___ */