aboutsummaryrefslogtreecommitdiff
path: root/mktpl
diff options
context:
space:
mode:
Diffstat (limited to 'mktpl')
-rwxr-xr-xmktpl/mktplbin23988 -> 23988 bytes
-rw-r--r--mktpl/mktpl.c71
-rw-r--r--mktpl/mktpl.lex21
3 files changed, 44 insertions, 48 deletions
diff --git a/mktpl/mktpl b/mktpl/mktpl
index b1c459c..092441e 100755
--- a/mktpl/mktpl
+++ b/mktpl/mktpl
Binary files differ
diff --git a/mktpl/mktpl.c b/mktpl/mktpl.c
index 7ed1626..2ebc343 100644
--- a/mktpl/mktpl.c
+++ b/mktpl/mktpl.c
@@ -285,10 +285,10 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
#define YY_NUM_RULES 8
#define YY_END_OF_BUFFER 9
-static yyconst short int yy_accept[21] =
+static yyconst short int yy_accept[20] =
{ 0,
0, 0, 0, 0, 0, 0, 9, 1, 1, 4,
- 8, 4, 6, 6, 0, 5, 7, 3, 2, 0
+ 4, 6, 6, 0, 5, 7, 3, 2, 0
} ;
static yyconst int yy_ec[256] =
@@ -328,34 +328,32 @@ static yyconst int yy_meta[7] =
1, 1, 2, 1, 1, 3
} ;
-static yyconst short int yy_base[28] =
+static yyconst short int yy_base[27] =
{ 0,
- 22, 21, 0, 2, 21, 20, 22, 27, 0, 27,
- 27, 0, 27, 0, 16, 27, 27, 27, 27, 27,
- 5, 8, 11, 18, 16, 15, 14
+ 19, 18, 18, 17, 16, 15, 17, 24, 0, 24,
+ 0, 24, 0, 11, 24, 24, 24, 24, 24, 0,
+ 3, 6, 13, 11, 10, 9
} ;
-static yyconst short int yy_def[28] =
+static yyconst short int yy_def[27] =
{ 0,
- 21, 21, 22, 22, 23, 23, 20, 20, 24, 20,
- 20, 25, 20, 26, 27, 20, 20, 20, 20, 0,
- 20, 20, 20, 20, 20, 20, 20
+ 20, 20, 21, 21, 22, 22, 19, 19, 23, 19,
+ 24, 19, 25, 26, 19, 19, 19, 19, 0, 19,
+ 19, 19, 19, 19, 19, 19
} ;
-static yyconst short int yy_nxt[34] =
+static yyconst short int yy_nxt[31] =
{ 0,
- 20, 11, 12, 11, 12, 8, 8, 8, 10, 10,
- 10, 13, 13, 13, 18, 18, 18, 17, 16, 15,
- 19, 20, 14, 14, 9, 9, 7, 20, 20, 20,
- 20, 20, 20
+ 8, 8, 8, 10, 10, 10, 12, 12, 12, 17,
+ 17, 17, 16, 15, 14, 18, 19, 13, 13, 11,
+ 11, 9, 9, 7, 19, 19, 19, 19, 19, 19
} ;
-static yyconst short int yy_chk[34] =
+static yyconst short int yy_chk[31] =
{ 0,
- 0, 3, 3, 4, 4, 21, 21, 21, 22, 22,
- 22, 23, 23, 23, 27, 27, 27, 26, 25, 24,
- 15, 7, 6, 5, 2, 1, 20, 20, 20, 20,
- 20, 20, 20
+ 20, 20, 20, 21, 21, 21, 22, 22, 22, 26,
+ 26, 26, 25, 24, 23, 14, 7, 6, 5, 4,
+ 3, 2, 1, 19, 19, 19, 19, 19, 19, 19
} ;
static yy_state_type yy_last_accepting_state;
@@ -386,7 +384,7 @@ void prnt();
char *buf;
int len;
int sz;
-#line 390 "mktpl.c"
+#line 388 "mktpl.c"
/* Macros after this point can all be overridden by user definitions in
* section 1.
@@ -539,7 +537,7 @@ YY_DECL
#line 18 "mktpl.lex"
-#line 543 "mktpl.c"
+#line 541 "mktpl.c"
if ( yy_init )
{
@@ -590,13 +588,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 21 )
+ if ( yy_current_state >= 20 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
- while ( yy_base[yy_current_state] != 27 );
+ while ( yy_base[yy_current_state] != 24 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
@@ -674,7 +672,7 @@ YY_RULE_SETUP
#line 32 "mktpl.lex"
ECHO;
YY_BREAK
-#line 678 "mktpl.c"
+#line 676 "mktpl.c"
case YY_END_OF_BUFFER:
{
@@ -964,7 +962,7 @@ static yy_state_type yy_get_previous_state()
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 21 )
+ if ( yy_current_state >= 20 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -999,11 +997,11 @@ yy_state_type yy_current_state;
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 21 )
+ if ( yy_current_state >= 20 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 20);
+ yy_is_jam = (yy_current_state == 19);
return yy_is_jam ? 0 : yy_current_state;
}
@@ -1582,27 +1580,26 @@ apnd()
}
buf[len++] = *yytext;
- buf[len+1] = 0;
}
void
eval()
{
- printf("%s\n", buf);
+ printf("%.*s\n", len, buf);
len = 0;
}
void
text()
{
- char *t;
+ int i;
printf("printf(\"");
- for(t = buf; *t; t++){
- if(*t == '\\') printf("\\\\");
- else if(*t == '"') printf("\\\"");
- else if(*t == '\n') printf("\\n");
- else printf("%c", *t);
+ for(i = 0; i < len; i++){
+ if(buf[i] == '\\') printf("\\\\");
+ else if(buf[i] == '"') printf("\\\"");
+ else if(buf[i] == '\n') printf("\\n");
+ else printf("%c", buf[i]);
}
printf("\");\n");
len = 0;
@@ -1611,6 +1608,6 @@ text()
void
prnt()
{
- printf("printf(\"%%s\", %s);\n", buf);
+ printf("printf(\"%%s\", %.*s);\n", len, buf);
len = 0;
} \ No newline at end of file
diff --git a/mktpl/mktpl.lex b/mktpl/mktpl.lex
index e530e45..56ce93f 100644
--- a/mktpl/mktpl.lex
+++ b/mktpl/mktpl.lex
@@ -20,10 +20,10 @@
\<%= text(); BEGIN(PRNT);
\<%[^=] text(); BEGIN(EVAL);
-<PRNT>. apnd();
+<PRNT>(.|\n) apnd();
<PRNT>%\> prnt(); BEGIN(0);
-<EVAL>(.|\n) apnd();
+<EVAL>(.|\n) apnd();
<EVAL>%\> eval(); BEGIN(0);
<PRNT><<EOF>> prnt(); yyterminate();
@@ -52,27 +52,26 @@ apnd()
}
buf[len++] = *yytext;
- buf[len+1] = 0;
}
void
eval()
{
- printf("%s\n", buf);
+ printf("%.*s\n", len, buf);
len = 0;
}
void
text()
{
- char *t;
+ int i;
printf("printf(\"");
- for(t = buf; *t; t++){
- if(*t == '\\') printf("\\\\");
- else if(*t == '"') printf("\\\"");
- else if(*t == '\n') printf("\\n");
- else printf("%c", *t);
+ for(i = 0; i < len; i++){
+ if(buf[i] == '\\') printf("\\\\");
+ else if(buf[i] == '"') printf("\\\"");
+ else if(buf[i] == '\n') printf("\\n");
+ else printf("%c", buf[i]);
}
printf("\");\n");
len = 0;
@@ -81,6 +80,6 @@ text()
void
prnt()
{
- printf("printf(\"%%s\", %s);\n", buf);
+ printf("printf(\"%%s\", %.*s);\n", len, buf);
len = 0;
} \ No newline at end of file