aboutsummaryrefslogtreecommitdiff
path: root/mktpl
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-09-22 02:11:50 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-09-22 02:11:50 +0200
commit1e0433c9df062ead21d0f46b15d088622b7d5c4f (patch)
treecc894172ca7deae5d835aea8f313da3aab1e2915 /mktpl
parent3ea978c60ee03dba2cb883ba18d3b334cfbf6cd0 (diff)
downloadcforum-master.tar.gz
Log in, log outHEADmaster
Diffstat (limited to 'mktpl')
-rw-r--r--mktpl/README2
-rw-r--r--mktpl/mktpl.lex12
2 files changed, 7 insertions, 7 deletions
diff --git a/mktpl/README b/mktpl/README
index 85a2fe3..cb50a6e 100644
--- a/mktpl/README
+++ b/mktpl/README
@@ -20,7 +20,7 @@ is compiled to the following C code:
/* This C code will be executed. */
for(i = 0; i<10; i++) printf("Hello World!\n");
strcpy(s, "This");
-
+
printf("\n");
printf("%s", s );
printf(" will be evaluated and printed as a string.");
diff --git a/mktpl/mktpl.lex b/mktpl/mktpl.lex
index e184c0e..296cc0b 100644
--- a/mktpl/mktpl.lex
+++ b/mktpl/mktpl.lex
@@ -5,12 +5,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-
+
void apnd();
void eval();
void text();
void prnt();
-
+
char *buf;
int len;
int sz;
@@ -38,7 +38,7 @@ main(int argc, char *argv[])
sz = 512;
if(!(buf = malloc(sz)))
err(1, "malloc");
-
+
yylex();
return 0;
}
@@ -51,7 +51,7 @@ apnd()
if(!(buf = realloc(buf, sz)))
err(1, "realloc");
}
-
+
buf[len++] = *yytext;
}
@@ -66,9 +66,9 @@ void
text()
{
int i, ofs;
-
+
if(!len) return;
-
+
printf("printf(\"");
for(i = ofs = 0; i < len; i++){
/*