diff --git a/source/compiler/sc.h b/source/compiler/sc.h index a2f7936..7b151c4 100644 --- a/source/compiler/sc.h +++ b/source/compiler/sc.h @@ -1009,6 +1009,7 @@ SC_VDECL int pc_retexpr; /* true if the current expression is a part of a " SC_VDECL int pc_retheap; /* heap space (in bytes) to be manually freed when returning an array returned by another function */ SC_VDECL int pc_nestlevel; /* number of active (open) compound statements */ SC_VDECL unsigned int pc_attributes;/* currently set attribute flags (for the "__pragma" operator) */ +SC_VDECL int pc_ispackedstr; /* true if the last tokenized string is packed */ SC_VDECL char *sc_tokens[]; diff --git a/source/compiler/sc1.c b/source/compiler/sc1.c index aa952d0..ca0a1c4 100644 --- a/source/compiler/sc1.c +++ b/source/compiler/sc1.c @@ -8308,8 +8308,11 @@ static void dopragma(void) do { /* read the option string */ tok=lex(&val,&str); - if (tok!=tSTRING) { + if (tok!=tSTRING || !pc_ispackedstr) { + /* either not a string, or the user prepended "!" to the option string */ char tokstr[2]; + if (tok==tSTRING) + tok='!'; if (tokbck_litidx); - /* the user shouldn't prepend "!" to the option string */ - if (litq[val]<=UNPACKEDMAX && litq[val]!=0) { - error(1,sc_tokens[tSTRING-tFIRST],"!"); - goto next; - } /* if */ - /* swap the cell bytes if we're on a Little Endian platform */ #if BYTE_ORDER==LITTLE_ENDIAN { /* local */ diff --git a/source/compiler/sc2.c b/source/compiler/sc2.c index 7888e5c..fdb2df9 100644 --- a/source/compiler/sc2.c +++ b/source/compiler/sc2.c @@ -2415,6 +2415,7 @@ SC_FUNC int lex(cell *lexvalue,char **lexsym) if ((stringflags & RAWMODE)!=0) lptr+=1; /* skip "escape" character too */ lptr=sc_packstr ? packedstring(lptr,&stringflags) : unpackedstring(lptr,&stringflags); + pc_ispackedstr=sc_packstr; if (*lptr=='\"') lptr+=1; /* skip final quote */ else if (!(stringflags & STRINGIZE)) @@ -2441,6 +2442,7 @@ SC_FUNC int lex(cell *lexvalue,char **lexsym) if ((stringflags & RAWMODE)!=0) lptr+=1; /* skip "escape" character too */ lptr=sc_packstr ? unpackedstring(lptr,&stringflags) : packedstring(lptr,&stringflags); + pc_ispackedstr=!sc_packstr; if (*lptr=='\"') lptr+=1; /* skip final quote */ else if (!(stringflags & STRINGIZE)) diff --git a/source/compiler/scvars.c b/source/compiler/scvars.c index 41115ce..53158ad 100644 --- a/source/compiler/scvars.c +++ b/source/compiler/scvars.c @@ -102,6 +102,7 @@ SC_VDEFINE int pc_retexpr=FALSE; /* true if the current expression is SC_VDEFINE int pc_retheap=0; /* heap space (in bytes) to be manually freed when returning an array returned by another function */ SC_VDEFINE int pc_nestlevel=0; /* number of active (open) compound statements */ SC_VDEFINE unsigned int pc_attributes=0; /* currently set attribute flags (for the "__pragma" operator) */ +SC_VDEFINE int pc_ispackedstr=FALSE; /* true if the last tokenized string is packed */ SC_VDEFINE char *sc_tokens[] = { "*=", "/=", "%=", "+=", "-=", "<<=", ">>>=", ">>=", "&=", "^=", "|=",