aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorRaymaekers Luca <luca@spacehb.net>2025-03-18 11:26:40 +0100
committerRaymaekers Luca <luca@spacehb.net>2025-03-18 11:26:40 +0100
commitfee81a2dbda7791f462adc70e080e4bb6e96365f (patch)
tree22eeb8e39ecf018bbad00a7e327d47bf8e389c14 /source
parentc1cbf799aef1393fecd707b6121c8a3d94d0a773 (diff)
Bug fixes
Fixed not outputting '@' if no keyword follows Fixed not outputting newline after @expand expression
Diffstat (limited to 'source')
-rw-r--r--source/expected.c7
-rw-r--r--source/meta.c16
-rw-r--r--source/table.c27
-rwxr-xr-xsource/table.metabin21088 -> 0 bytes
-rw-r--r--source/table.meta.c25
5 files changed, 5 insertions, 70 deletions
diff --git a/source/expected.c b/source/expected.c
deleted file mode 100644
index 6db128a..0000000
--- a/source/expected.c
+++ /dev/null
@@ -1,7 +0,0 @@
-typedef enum {
- MyEnum_A,
- MyEnum_B,
- MyEnum_C,
- MyEnum_Count
-} MyEnum;
-
diff --git a/source/meta.c b/source/meta.c
index 1eb643d..9b7faff 100644
--- a/source/meta.c
+++ b/source/meta.c
@@ -180,12 +180,11 @@ main(int ArgC, char *Args[])
{
Filename = Args[1];
}
-#if 1
else
{
- Filename = "table.c";
+ fprintf(stderr, "Usage: %s [filename]\n", Args[0]);
+ return 1;
}
-#endif
// NOTE(luca): The memory is assumed to stay mapped until program exits, because we will use
// pointers into that memory.
@@ -239,7 +238,6 @@ main(int ArgC, char *Args[])
}
Assert(ExpressionTable);
- // TODO: not used yet
while (IsWhitespace(In[At]) && At < InSize) At++;
Assert(At < InSize);
ExpressionTableArgumentAt = At;
@@ -309,17 +307,13 @@ main(int ArgC, char *Args[])
memcpy(Out, Expansion.Memory, Expansion.Size);
Out += Expansion.Size;
}
- else if (In[At] == '`')
- {
- // ERROR: When the last character is '`' does not print.
- *Out++ = '\n';
- }
- else
+ else if (In[At] != '`')
{
*Out++ = In[At++];
}
}
+ *Out++ = '\n';
}
Assert(At < InSize);
@@ -486,7 +480,7 @@ main(int ArgC, char *Args[])
}
else
{
- // ERROR: What if the code contains a non meta-"@_expand" tag ???
+ *Out++ = '@';
*Out++ = In[At];
}
diff --git a/source/table.c b/source/table.c
deleted file mode 100644
index d2ec1ad..0000000
--- a/source/table.c
+++ /dev/null
@@ -1,27 +0,0 @@
-#include <stdio.h>
-
-@table(name, str) MyEnumTable
-{
- { A "A" }
- { B "B" }
- { C "C" }
-}
-
-typedef enum {
-@expand(MyEnumTable a)
- `MyEnum_$(a.name),`
-MyEnum_Count
-} MyEnum;
-
-char *StringTable[MyEnum_Count] = {
-@expand(MyEnumTable a) `$(a.str),`
-};
-
-
-int
-main(int Argc, char *Args[])
-{
- printf("%s\n", StringTable[MyEnum_B]);
-
- return 0;
-}
diff --git a/source/table.meta b/source/table.meta
deleted file mode 100755
index 63edbd2..0000000
--- a/source/table.meta
+++ /dev/null
Binary files differ
diff --git a/source/table.meta.c b/source/table.meta.c
deleted file mode 100644
index 4f38e0e..0000000
--- a/source/table.meta.c
+++ /dev/null
@@ -1,25 +0,0 @@
-#include <stdio.h>
-
-
-
-typedef enum {
-MyEnum_A,
-MyEnum_B,
-MyEnum_C,
-MyEnum_Count
-} MyEnum;
-
-char *StringTable[MyEnum_Count] = {
-"A",
-"B",
-"C",
-};
-
-
-int
-main(int Argc, char *Args[])
-{
- printf("%s\n", StringTable[MyEnum_B]);
-
- return 0;
-}