Skip to content

Commit

Permalink
Fixup.
Browse files Browse the repository at this point in the history
  • Loading branch information
z00m128 committed Apr 10, 2019
1 parent b910118 commit 9c1f08b
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 9 deletions.
13 changes: 13 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
2004-07-23 Russell Marks <russell.marks@ntlworld.com>

* Version 1.2.

2004-05-01 Russell Marks <russell.marks@ntlworld.com>

* Fixed ignoring of escape sequences in REM statements. Thanks
again to Matthew Westcott.

* zmakebas.c: added support for embedding literal eight-bit
character codes into the output, for e.g. colour control codes.
Thanks to Matthew Westcott for the patch.

2000-11-03 Russell Marks <russell.marks@ntlworld.com>

* Version 1.1.
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ clean:

# The stuff below makes the distribution tgz.

VERS=1.1
VERS=1.2

dist: tgz
tgz: ../zmakebas-$(VERS).tar.gz
Expand Down
15 changes: 10 additions & 5 deletions zmakebas.1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.\"
.\" zmakebas.1 - man page
.\"
.TH zmakebas 1 "3rd November, 2000" "Version 1.1" "Retrocomputing Tools"
.TH zmakebas 1 "1st May, 2004" "Version 1.2" "Retrocomputing Tools"
.\"
.\"------------------------------------------------------------------
.\"
Expand Down Expand Up @@ -123,10 +123,14 @@ though); both upper and lowercase work. To get the copyright symbol,
follow it with `*'. To get a block graphics character, follow it with
a two-character `drawing' of it using spaces, dots, apostrophes and/or
colons. (For example, you'd get character 135 with `\\':', and
character 142 with `\\:.'.) To get a literal `@', follow it
with `@'. (This is needed only if the `-l' option was given, but works
whether it was or not.) Finally, as usual with such things, you can
get a literal backslash by following the first backslash with another.
character 142 with `\\:.'.) To get a literal `@', follow it with `@'.
(This is needed only if the `-l' option was given, but works whether
it was or not.) To specify a literal eight-bit character code to dump
into the Basic output file directly (to use for embedded colour
control codes and the like), use braces and a C-syntax number e.g.
`\\{42}' for decimal, and `\\{0x42}' for hex. Finally, as usual with
such things, you can get a literal backslash by following the first
backslash with another.
.PP
If the `-l' option was given, line numbers must be omitted. Instead
these are automatically generated in the output, and you can use
Expand Down Expand Up @@ -223,6 +227,7 @@ least I can be bothered to capitalise the thing, right? :-)
.\"------------------------------------------------------------------
.\"
.SH "SEE ALSO"
.IR fuse "(1),"
.IR xz80 "(1),"
.IR xzx "(1)"
.\"
Expand Down
31 changes: 28 additions & 3 deletions zmakebas.c
Original file line number Diff line number Diff line change
Expand Up @@ -528,10 +528,10 @@ static unsigned char buf[2048],lcasebuf[2048],outbuf[4096];
#endif
int f,toknum,toklen,linenum,linelen,in_quotes,in_rem,lastline;
char **tarrptr;
unsigned char *ptr,*ptr2,*linestart,*outptr,*remptr,*fileptr;
unsigned char *ptr,*ptr2,*linestart,*outptr,*remptr,*fileptr,*asciiptr;
double num;
int num_exp;
unsigned long num_mantissa;
unsigned long num_mantissa,num_ascii;
int textlinenum;
int chk=0;
int alttok;
Expand Down Expand Up @@ -849,7 +849,7 @@ do

if(*ptr==REM_TOKEN_NUM) in_rem=1;

if(!in_rem && *ptr=='\\')
if(*ptr=='\\')
{
if(isalpha(ptr[1]) && strchr("VWXYZvwxyz",ptr[1])==NULL)
*outptr++=144+tolower(ptr[1])-'a';
Expand All @@ -863,6 +863,31 @@ do
*outptr++=grok_block(ptr,textlinenum);
ptr++;
break;
case '{': /* directly specify output code */
/* find end of number */
asciiptr=strchr(ptr+2,'}');
if(asciiptr==NULL)
{
fprintf(stderr,
"line %d: unclosed brace in eight-bit character code\n",
textlinenum);
exit(1);
}
/* parse number in decimal, octal or hex */
num_ascii=strtoul(ptr+2, NULL, 0);
if(num_ascii<0 || num_ascii>255)
{
fprintf(stderr,
"line %d: eight-bit character code out of range\n",
textlinenum);
exit(1);
}
*outptr++=(char)num_ascii;
/* set pointer to the second char from the end, so we're in the
* right place when we skip forward two chars below
*/
ptr=asciiptr-1;
break;
default:
fprintf(stderr,
"line %d: warning: unknown escape `%c', inserting literally\n",
Expand Down

0 comments on commit 9c1f08b

Please sign in to comment.