Re: Question for ¬a\/b
- From: "¬a\\/b" <al@xxx>
- Date: Sat, 10 Sep 2005 07:46:16 GMT
On Fri, 09 Sep 2005 16:43:28 -0400, Frank Kotler
<fbkotler@xxxxxxxxxxx> wrote:
>Hey ¬a\/b,
>
>This uhhh "thing" you use, that I don't like too much, has it got a
>name? Is it "available to the public"? I think I found a guy who might
>like it!
>
>A guy posted to the nasm-devel list at SourceFrog,
"SourceFrog"?
I use a dos shell file and a c program. If someone want to use it ...
but i have no responsibility for any damages or wrong consequences
@echo off
if "%1"=="" goto usage
if "%1"=="?" goto usage
if "%1"=="-h" goto usage
if "%2"=="com" goto pst
if "%2"=="obj" goto object
if "%2"=="dll" goto vai_dll
if not "%2"=="" goto lkk
rem Se c'e alink usa il linker alink
rem Altrimenti compila con bcc
:pst2
rem nasmw -f obj file.asm
if not exist %1.m goto pst1_n_as2
asa %1.m %1.asm
:pst1_n_as2
nasmw -f obj %1.asm
if errorlevel 1 goto errasm
alink -oPE %1.obj
if errorlevel 1 goto erralink
goto TheEnd
:pst
rem nasmw -f bin -o upcase.com upcase.asm
if not exist %1.m goto pstnas1
asa -l %1.m %1.asm
:pstnas1
nasmw -f bin -o %1.com %1.asm
if errorlevel 1 goto errasm
goto TheEnd
:lkk
rem nasmw -f obj file.asm
if not exist %1.m goto pst1_n_as3
asa %1.m %1.asm
:pst1_n_as3
nasmw -f obj %1.asm
if errorlevel 1 goto errasm
brcc32 %2.rc
if errorlevel 1 goto errc
alink -oPE %1.obj %2.res
if errorlevel 1 goto erralink
rem if exist %1.obj del %1.obj
goto TheEnd
:object
rem nasmw -f obj file.asm
if not exist %1.m goto object_n_as3
asa %1.m %1.asm
:object_n_as3
nasmw -f obj %1.asm
goto TheEnd
:vai_dll
rem compone dll
if not exist %1.m goto pst1_n_as3
asa %1.m %1.asm
:pst1_n_as3
nasmw -f obj %1.asm
if errorlevel 1 goto errasm
alink -oPE -dll %1.obj
if errorlevel 1 goto erralink
goto TheEnd
:usage
echo Uso con la shell:
echo ---------------------------------------------------------
echo %0 nome com
echo output nome.com
echo {asa nome.m nome.asm} {nasmw -f bin -o nome.com nome.asm}
echo ---------------------------------------------------------
echo %0 nome obj
echo output nome.obj
echo {asa nome.m nome.asm} {nasmw -f obj nome.asm}
echo ---------------------------------------------------------
echo %0 nome
echo output nome.exe
echo {asa nome.m nome.asm} {nasmw -f obj nome.asm}
echo {alink -oPE nome }
echo ---------------------------------------------------------
echo %0 nome nome1
echo output nome.exe
echo {asa nome.m nome.asm} {nasmw -f obj nome.asm}
echo {brcc32 nome1.rc} {alink -oPE nome nome1.res}
echo --------------------------------------------------------
echo %0 nome dll
echo output nome.dll
echo {asa nome.m nome.asm} {nasmw -f obj nome.asm}
echo {alink -oPE -dll nome.obj}
goto TheEnd
:erralink
echo __
echo Linker Error
goto TheEnd
:errasm
echo __
echo Assembly Error
goto TheEnd
:errc
echo __
echo Errore di risorsa
goto TheEnd
:non_esiste
echo __
echo Non esiste %1.[m, asm]
goto TheEnd
:TheEnd
rem aggiungere eventualmente pause
/* NOME DEL FILE: asa.c */
/*
uso con nasmw:
> n_asm.exe file_in file_out.asm
oppure [> n_asm.exe -l file_in file_out.asm]
> nasmw file_out.asm
'-l' serve per visualizzare la linea dell'errore
Senza l'opzione -l allora l'output non usa %line.
e dovrebbe essere piu' sicuro.
************************************************
Questo programma ha un diverso tipo di 'getword'
serve come preprocessore di macro per file .asm
il suo proposito e' *non abolire*
le micro-istruzioni dell'allassembly pur trovando
un modo per *evidenziare* i loop e gli if.
/ e' escape per commenti
{, }, sono sostituite *con niente*
e potrebbero essere usate solo nell'intento di
*evidenziare* i *loop* e gli *if*.
Per permettere a piu' istruzioni di condividere la
stessa linea i separatori ';' e '|' vengono usati
e sostituiti da '\n' nella traduzione.
'\n' preceduto da una virgola ',' provoca l'unione
delle linee;
In poche parole per i registri:
a->eax, b->ebx, c->ecx, r->edx, i->esi, j->edi
s->esp, k->ebp,
rx->dx, jx->di, ix->si, sx->sp, kx->bp
rh->dh, rl->dl
(i nomi degli altri registri o sottoregistri
sono quelli che usa nasmw )
per le operazioni:
"a+=b" -> add eax, ebx
"a++=b" -> adc eax, ebx
"++a" -> inc eax
eccetera
"a<(b, c)" -> "push ecx \npush ebx \ncall eax \nadd esp, 8"
"a(b, c)" -> "push ecx \npush ebx \ncall eax"
"< a, b, c" -> "push eax \npush ebx \npush ecx"
"> a, b, c" -> "pop ecx \npop ebx \npop eax"
...
# .hj -> jmp short .hj
## .hj -> jmp .hj
a==19#.fh -> cmp eax, 19 \n je .fh
a==19!#.fh -> cmp eax, 19 \n jne .fh
eccetera
Le macro sostituzioni sono evidenti nella funzione
install_all() comunque l'assembly dovrebbe essere
un sottoinsieme del linguaggio risultante
Mi sono ispirato al linguaggio C.
BUGS
Non sono supportati
1) I calcoli *su numeri* che potrebbe fare
nasm prima della fase di traduzione esempio:
a=89&99; oppure a= 77 * 8 + 99;
La cosa che si potrebbe fare e' usare il
comando normale esempio:
mov eax, 89 & 99
mov eax, (77 ** 8 + 99) || 67
oppure usare il carattere di escape _ esempio
a= _ 89&99 _ ; a= _ 77 ** 8 + 99 _
mov eax, _ (77 ** 8 + 99) || 67 _
Notare come _ e' circodato da spazi
notare come '*' e '|' vengono tradotti da ** e ||
rispettivamente poiche' sono caratteri 'speciali'
Col carattere di escape _ ||==or &==and **=*
^==xor, <<e>>==shift, +, -, %; non si può usare
"/" come carattere di operazione divisione.
2) I commenti su line che iniziano (dopo eventuali
spazi) con %
3) Espressioni come a = b -7 non vengono
correttamente tradotte poiche' il + o il - sono
associati al 7; se si scrive una di queste:
a=b- 7; a= b- 7; a = b - 7; a = b- 7; a=b - 7;
tutto dovrebbe essere ok;
4) Le definizioni di macro con l'opzione -l
(senza tale opzione tutto sembra ok) meglio
definire le macro usando solo l'assembly normale
oppure non usare l'opzione -l nelle macro in
un'altro file, importarlo e usare -l.
5) se i commenti finiscono con una virgola\n
l'opzione -l non funziona
6) Non ho fatto molte prove su testi e programmi
ci saranno un sacco di errori.
Declino ogni responsabilita' per qualsiasi danno
che potrebbe arrecare questo programma e ogni
garanzia che serva a qualche cosa; Il programma si
intende libero (free) per l'uso e per il
cambiamento.
*/
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#define R return
#define P printf
#define F for
#define W while
#define UC unsigned char
char *argomento; /* serve per assert_m */
char *nome_file;
char* estrai(char* nome)
{char *a=nome, *b;
char c;
if(nome==0) return 0;
W(1)
{b=a;
W( (c = *a)!=0 && c!='\\' && c!='/' ) ++a;
if(c==0) break;
++a;
}
R b;
}
#define assert_m(x, y) \
if(!(x)) do{ \
fprintf(stderr, "ERRORE %s: %s\n", argomento, y );\
allUscita( 0, 0, 0, 0); \
assert(x); \
}while(0)
void allUscita(int flag, FILE* f_in, FILE* f_out, char** ch);
int catstr(char* a, char* b, int i)
{char *h=a;
int k;
if(i<=0 || a==NULL || b==NULL)
{
i=0;
goto lab;
}
W(*h!='\0') ++h;
k = h-a;
i = i>k ? i-k: 0;
W(i!=0)
{*h++=*b++;
if(*b=='\0') break;
--i;
}
*h='\0';
lab:
assert_m(i!=0, "catstr: Stringa troppo lunga o argomenti nulli");
R h-a;
}
#define HASHSIZE 4019
/*2837*/
struct nlist{
struct nlist* next;
char* name;
char* defn;
};
static struct nlist* hashtab[HASHSIZE];
/*hash: calcola il valore di hashing della stringa s*/
unsigned hash(char* s)
{unsigned hashval;
if(s==NULL) R 0;
F(hashval=0;*s!='\0';++s)
hashval=*s+31*hashval;
R hashval%HASHSIZE;
}
/*lookup: cerca s in hashtab*/
struct nlist* lookup(char* s)
{struct nlist *np;
if(s==NULL) R NULL;
F(np=hashtab[hash(s)];np!=NULL;np=np->next)
if(strcmp(s,np->name)==0)
R np; /* trovata */
R NULL; /*non trovata*/
}
/* dupstr: fa una copia di s */
char* dupstr(char* s)
{char *p;
if(s==NULL) return NULL;
p=malloc(strlen(s)+1); /* +1 per '\0' */
if(p!=NULL)
strcpy( p, s );
return p;
}
void free_node(struct nlist* a)
{if(a==NULL) R;
if(a->name!=NULL) free(a->name);
if(a->defn!=NULL) free(a->defn);
free(a);
}
void free_tab(void)
{unsigned i;
struct nlist *p, *q;
F(i=0;i<HASHSIZE;++i)
F(p=hashtab[i];p!=NULL; p=q)
{q=p->next;
free_node(p);
}
}
/*undef: rimuove un nodo dalla tabella*/
int undef(char* name)
{struct nlist *pp, *p;
unsigned hsv;
if(name==NULL) R -1;
hsv=hash(name);
F(p=hashtab[hsv], pp=NULL;p!=NULL;pp=p, p=p->next)
if(strcmp(name,p->name)==0)
{if(pp==NULL)
hashtab[hsv]=p->next; /*il primo */
else pp->next=p->next;
free_node(p);
R 0;
}
R 1;
}
/*instal: inserisce il nome (name, defn) in hashtab*/
struct nlist* install(char* name, char* defn)
{struct nlist *np;
unsigned hashval;
if((np=lookup(name))==NULL) /*non trovata*/
{np=malloc(sizeof(*np));
if(np==NULL) R NULL;
if((np->name=dupstr(name))==NULL)
{free(np);
R NULL;
}
if((np->defn=dupstr(defn))==NULL)
{free(np->name);
free(np);
R NULL;
}
hashval=hash(name);
np->next=hashtab[hashval];
hashtab[hashval]=np;/*mette il nuovo nodo davanti a tutti*/
}
else
{free(np->defn); /*annulla il precedente defn P*/
np->defn=NULL;
if((np->defn=dupstr(defn))==NULL)
{undef(name);
R NULL;
}
}
return np;
}
void installl(char* name, char* defn)
{struct nlist *np;
assert_m(name!=NULL && defn!=NULL, "di memoria");
np=install(name, defn);
assert_m(np!=NULL, "di memoria");
}
int is_punct(int c)
{
if( c=='<' || c=='>' || c=='+' || c=='-' || c=='&' ||
c=='^' || c=='!' || c=='=' || c=='?' || c=='*' ||
c=='|' || c=='(' ||c==')' || c==',' || c=='!' || c=='#' ) R
1;
R 0;
}
char* gword(char* buf, char** c, int cont)
{char *b=buf, *a;
int ip;
a="gword: Buffers nulli o argomenti errati";
label:
assert_m(buf!=NULL && c!=NULL && cont>0, a);
a=*c;
W( *a!=0 && isspace(*a))
++a;
ip= is_punct(*a) || *a=='[' ? 1: 0;
if(*a && --cont>0)
F(*b++=*a++; --cont>0 && *a!=0; *b++=*a++)
{
if(isspace(*a)) break;
if(*a==':') {*b++=':';
++a; --cont;
if (isspace(*a) )
{W(isspace(*a)) ++a;
--a;
}
break;
}
if( ip && ( !is_punct(*a) || (*a=='|' && !(a[1]=='=' ||
a[1]=='|' || a[-1]=='|')) ) )
break;
if( !ip && !isalnum(*a) && *a!='_' && *a!='@' )
break;
}
if(cont<=0)
{a="gword: Linea troppo lunga"; goto label;}
*b=0; *c=a;
R buf;
}
/* Nota che non ritorna s ma ritorna NULL o un puntatore
all'ultimo carattere
*/
char* fgets_p(char* s, size_t n, FILE* iop)
{int c;
char *cs=s;
int getch(FILE* pnt);
void ungetch(char c);
/*-------------------------------------------------------*/
assert_m( s!=0 && iop!=0 && n>0, "fgets: argomenti errati" );
W( --n>0 && (c=getch(iop)) != EOF )
if( (*cs++=c) == '\n')
{if(cs>s+1 && cs[-2]==',')
{cs[-1]=' '; continue;}
else break;
}
/* P("c==%d cs-s=%d \n", (int) c, (int) (cs-s) ); */
if(c!='\n' && c!=EOF)
{F( --cs; s!=cs && *cs!=';' && !(*cs=='|' && cs[1]!='=')
&& !(*cs=='|' && cs[1]!='|') ; --cs)
ungetch(*cs);
assert_m(cs!=s, "fgets: linea troppo lunga");
/* linea piu' lunga di un token */
++cs;
}
*cs='\0';
return ( c==EOF && cs==s ) ? NULL : --cs;
}
int macro_s(char* bufr, int cont, char* buf, char** t_buf, int
num)
{char *c, *a=buf, *b=bufr, fqt[(sizeof(int)*CHAR_BIT+2)/3+1];
int i=0, led=0, led1=1, k=7;
c="macro_s: Argomenti errati";
label:
assert_m(bufr!=NULL&& buf!=NULL&& t_buf!=NULL&& cont>0&& num>i &&
k>=0, c);
W( *a!=0 && cont>0 )
{W( *a!=0 && isspace(*a) ) ++a;
if(is_punct(*a)) led=1;
W( *a!=0 && cont>0 && is_punct(*a) &&
!( (*a=='+'||*a=='-') && isdigit(a[1]) )
) /* in +8 -3 il + o il - non sono punti */
{--cont; *bufr++ = *a++;
if(led1) {if(a>buf+2 && isspace(a[-2]) )
a[-2]=0;
else a[-1]=0;
led1=0;
}
}
led1=1;
W( *a!=0 && isspace(*a) ) ++a;
if(led==1 && cont>0 )
{--cont; *bufr++=' '; led=0;}
if( *a!=0 && !isspace(*a) && cont>0 &&
( !is_punct(*a) || ( (*a=='+' || *a=='-') &&
isdigit(a[1]) )
)
)
{--cont;
*bufr++ = 'õ';
if( cont>0 )
k=sprintf( fqt, "%u", ++i);
if(k <= 0 || cont<=0) break;
if( k<cont )
{c=fqt;
W(*c!=0 && cont>0 )
{--cont ;
*bufr++ = *c++;
}
}
else {cont=0; break; }
if(i>num) break;
else t_buf[i]=a;
W( (*a!=0 && !is_punct(*a)) || *a=='+' || *a=='-'
)
{if(*a=='\'')
W(*++a!=0 && *a!='\'' );
else if(*a=='\"')
W(*++a!=0 && *a!='\"');
else if(*a=='[' )
W(*a!=0 && *a!=']' ) ++a;
else if(*a=='_' && (a[1]==' ' ||
a[1]=='\t') && isspace(a[-1]) )
{if(a==t_buf[i]) t_buf[i]=++a;
W(*a!=0 && !( *a=='_' &&
(a[1]==' ' || a[1]=='\t' || a[1]==0) ))
++a;
/* P("*a== %c::%d", *a , (int) *a);
*/
if(*a=='_') *a=' ';
}
if( *a=='+' || *a=='-' )
{if( isdigit( a[1] ) )
++a;
else break;
}
if(*a!='\0') ++a;
}
*bufr++=' ';
}
}
if(!(cont>0 && num>i && k>=0))
{ c="macro_s: Troppe parole o linea troppo lunga"; goto label;}
if( bufr>b+1 && isspace(bufr[-1]) ) bufr[-1]='\0';
else *bufr='\0';
t_buf[++i]=NULL;
R bufr-b;
}
/* õ1 + õ2 = õ3 -> õ3 + õ2 = õ1 */
int macro_sinv(char* wor, int dim, char* bufr, char* buf, char**
ch, int num)
{char *a=bufr, *w=wor, *c;
int i=0;
c="macro_sinv: argomenti errati o nulli";
label:
assert_m( wor!=0 && buf!=0 && bufr!=0 && ch!=0 && dim>0, c );
W( dim>0 )
{W(*a!=0 && *a!='õ' && dim>0)
{ *w++=*a++; --dim;} /* õ4 ## #r #EOL */
if( *a=='õ' && dim>0 )
{if( isdigit(a[1]) )
{i=atoi(++a);
W(isdigit(*a)) ++a;
if(i>=num) break;
c=ch[i];
W(*c!=0 && dim>0 )
{*w++=*c++; --dim;}
}
else {*w++=*a++; --dim;}
}
if(*a==0) break;
}
*w=0;
if(i>=num || dim<=0)
{ dim=0; c="Linea troppo lunga o troppe parole"; goto label; }
R w-wor;
}
int get_token(char** org, char** end)
{char *endd, k, led_2=0, led_1=0;
assert_m( end!=NULL, "inserimento di un null come stringa" );
*org = endd = *end;
F( ; (k=*endd)!='\0' ; endd++ )
{
if(k=='\'' && led_2==0 ) led_1= led_1==0 ? 1: 0;
if(k=='\"' && led_1==0 ) led_2= led_2==0 ? 1: 0;
if( k=='\n' )
break;
else if( k==':' && (isspace(endd[1]) || endd[1]=='\0')
&& led_1==0 && led_2==0
) break;
}
if(k==':')
++endd;
if(*endd!='\0')
{*endd='\0'; *end=++endd;}
else *end=endd;
if(k=='\0' && **org!='\0' ) k='\n';
/* P(" *end - *org=%d ", (int) (*end - *org)); */
R (int) k;
}
/* word, buffer, b devono avere dimensione bsize */
int
micro_s(char* b, int bsize, char* word, char** comm, char*
buffer)
{char c, inq=0, *h, m, *a=b, *e, *eh, led, zen=0, zer=0;
struct nlist *np;
e="micro_s: argomenti nulli o errati";
la:
assert_m( b && word && bsize>0, e );
*comm=0; led=1;
F( ; (c=*word)!='\0' && bsize>0; ++word)
{if(isspace(c)) { *b++=c; --bsize; continue; }
else if(c==';' || (c=='|' && !(word[1]=='=' || word[1]=='|'
)))
{h=word; zen=1;
W((m=*h)!='\0')
{if(!( ( isspace(m) || m=='}' ) && m!='\n') && m!=';' &&
m!='|' )
break; /* m=' ' => isspace(' ') && ' '!='\n' VERA
*/
++h;
}
if(*h!='/' || (*h=='%' && !isdigit(h[1])) )
{*b++='\n'; --bsize;}
if (*h=='\0') break ;
else if(*h=='\n' ) word=h ;
else word=--h;
continue;
}
else if(c=='/') /* %, / commenti */
{ *b++='\n'; --bsize; *comm=word; break; }
else if(c=='%' && !isdigit(word[1]))
{ *b++='\n'; --bsize; *comm=word; break; }
else if( led && (c=='s' || c=='S')
&& ( !strncmp(word, "SECTION", 7) || !strncmp(word, "section",
7) )
) { *b++='\n'; --bsize;
*comm=word; break;
}
else if(c=='\'')
{*b++=c; --bsize; ++word;
F(h=word; (m=*h)!='\0' && m!='\'' && bsize>0 ; ++h)
{*b++=*h; --bsize;}
if(m=='\0' || bsize<=0) break;
else {*b++=m; --bsize; word=h; continue; }
}
else if(c=='\"')
{*b++=c; --bsize; ++word;
F(h=word; (m=*h)!='\0' && m!='\"' && bsize>0 ; ++h)
{*b++=*h; --bsize;}
if(m=='\0' || bsize<=0) break;
else {*b++=m; --bsize; word=h; continue; }
} /* "{" e "}" ->"" */
else if(c=='{' || c=='}') /* elimina il carattere */
{*b++=' '; --bsize; continue;}
else {
led=0;
if(c=='[') inq=1;
else if(c==']') inq=0;
h=word;
gword(buffer, &h, bsize);
if( !( is_punct(c) && inq==1) &&
(np=lookup(buffer))!=NULL )
{e=np->defn; eh=e; /* trova in lookup(buffer) */
F(; *e && bsize>0 ; )
{*b++=*e++; --bsize;}
if( *eh == '[' ) zer=1;
else if(zer==1)
{if(bsize>0)
{*b++=']'; --bsize;}
zer=0;
}
}
else { /* *non* trova in lookup(buffer) */
F(e=buffer ; *e && bsize>0 ; )
{*b++=*e++; --bsize;}
if(zer==1)
{if(bsize>0)
{*b++=']'; --bsize;}
zer=0;
}
}
if(word!=h) word=--h;
}
}
if(bsize<=0) {e="Linea troppo lunga"; goto la; }
*b='\0';
if(zen==0) *buffer=0; /* salvo il fatto che trovo ; e | */
else {*buffer=1; buffer[1]=0;}
return b-a;
}
void install_all(void)
{// sj->di kp->bp si->si
installl( "a" , "eax"); installl( "b" , "ebx"); // 2
installl( "c" , "ecx"); installl( "jx" , "di"); // 4
installl( "i" , "esi"); installl( "j" , "edi"); // 6
installl( "ix" , "si");
installl( "r" , "edx"); installl( "rx" , "dx"); // 8
installl( "rl" , "dl"); installl( "rh" , "dh"); //10
installl( "s" , "esp"); installl( "sx" , "sp");
installl( "k" , "ebp"); installl( "kx" , "bp");
/* col carattere di escape _ ||==or &==end **=per etc */
installl( "||" , "|");
installl( "**" , "*");
installl( "*" , "[");
installl( "## õ1" , "jmp õ1");
installl( "# õ1" , "jmp short õ1");
installl( "õ1 = õ2" , "mov õ1, õ2");
installl( "õ1 += õ2", "add õ1, õ2");
installl( "õ1 -= õ2", "sub õ1, õ2");
installl( "õ1 ++= õ2", "adc õ1, õ2");
installl( "õ1 --= õ2", "sbb õ1, õ2");
installl( "õ1 <-> õ2", "xchg õ1, õ2");
installl( "õ1 =^ õ2", "mov õ1, [ esp + õ2 ]");
installl( "õ1 = ^ õ2", "mov õ1, [ esp + õ2 ]");
installl( "^ õ1 = õ2", "mov [ esp + õ1 ], õ2");
installl( "D" , "dword");
installl( "W" , "word" );
installl( "B" , "byte" );
installl( "Q" , "qword");
installl( "T" , "tword");
installl( "õ1 <<= õ2" , "shl õ1, õ2");
installl( "õ1 >>= õ2" , "shr õ1, õ2");
installl( "õ1 <<<= õ2" , "rcl õ1, õ2");
installl( "õ1 >>>= õ2" , "rcr õ1, õ2");
installl( "õ1 & õ2" , "test õ1, õ2");
installl( "õ1 = & õ2" , "lea õ1, õ2");
installl( "õ1 =& õ2" , "lea õ1, õ2");
installl( "õ1 &= õ2" , "and õ1, õ2");
installl( "õ1 |= õ2" , "or õ1, õ2");
installl( "õ1 ^= õ2" , "xor õ1, õ2");
installl( "õ1 =* õ2" , "mov õ1, [õ2]");
installl( "< õ1" , "push õ1");// 36
installl( "> õ1" , "pop õ1");
installl( "õ1 ()" , "call õ1");
installl( "õ1 ( )" , "call õ1");
installl( "õ1 ( õ2 < )" , "call õ1");
installl( "õ1 ( õ2 <)" , "call õ1");
installl( "õ1 = õ2 ( õ3 < )" , "call õ2 \nmov õ1, õ3");
installl( "õ1 = õ2 ( õ3 <)" , "call õ2 \nmov õ1, õ3");
installl( "õ1 ( õ2 < õ3 )" , "push õ3 \ncall õ1");
installl( "õ1 = õ2 ( õ3 < õ4 )" , "push õ4 \ncall õ2\nmov õ1,
õ3");
installl( "õ1 <( õ2 < õ3 )" , "push õ3 \ncall õ1 \nadd esp,
4");
installl( "õ1 = õ2 <( õ3 < õ4 )" , "push õ4 \ncall õ2 \nadd esp,
4 \nmov õ1, õ3");
installl( "õ1 ( õ2 > õ3 , õ4 )" , "õ1 õ4");
installl( "õ1 ( õ2 > õ3 , õ4 , õ5 )" , "õ1 õ5");
installl( "õ1 = õ2 ( õ3 > õ4 , õ5 )" , "õ2 õ5 \nmov õ1,
õ3");
installl( "õ1 = õ2 ( õ3 > õ4 , õ5 , õ6 )" , "õ2 õ6 \nmov õ1,
õ3");
installl( "< õ1 , õ2" , "push õ1 \npush õ2");
installl( "> õ1 , õ2" , "pop õ2 \npop õ1");
installl( "õ1 ( õ2 < õ3 , õ4 )" , "push õ4 \npush õ3 \ncall
õ1");
installl( "õ1 = õ2 ( õ3 < õ4 , õ5 )" , "push õ5 \npush õ4 \ncall
õ2\nmov õ1, õ3");
installl( "õ1 <( õ2 < õ3 , õ4 )" , "push õ4 \npush õ3 \ncall
õ1 \nadd esp, 8");
installl( "õ1 = õ2 <( õ3 < õ4 , õ5 )" , "push õ5 \npush õ4 \ncall
õ2 \nadd esp, 8 \nmov õ1, õ3");
installl( "< õ1 , õ2 , õ3" , "push õ1 \npush õ2 \npush õ3");
installl( "> õ1 , õ2 , õ3" , "pop õ3 \npop õ2 \npop õ1");
installl( "õ1 ( õ2 < õ3 , õ4 , õ5 )" , "push õ5 \npush õ4 \npush
õ3 \ncall õ1");
installl( "õ1 = õ2 ( õ3 < õ4 , õ5 , õ6 )" ,
"push õ6 \npush õ5 \npush õ4 \ncall õ2\nmov õ1, õ3");
installl( "õ1 <( õ2 < õ3 , õ4 , õ5 )" , "push õ5 \npush õ4 \npush
õ3 \ncall õ1 \nadd esp, 12");
installl( "õ1 = õ2 <( õ3 < õ4 , õ5 , õ6 )" ,
"push õ6 \npush õ5 \npush õ4 \ncall õ2 \nadd esp, 12 \nmov
õ1, õ3");
installl( "< õ1 , õ2 , õ3 , õ4", "push õ1 \npush õ2 \npush õ3
\npush õ4");
installl( "> õ1 , õ2 , õ3 , õ4", "pop õ4 \npop õ3 \npop õ2
\npop õ1");
installl( "õ1 ( õ2 < õ3 , õ4 , õ5 , õ6 )" ,
"push õ6 \npush õ5 \npush õ4 \npush õ3 \ncall õ1");
installl( "õ1 = õ2 ( õ3 < õ4 , õ5 , õ6 , õ7 )" ,
"push õ7 \npush õ6 \npush õ5 \npush õ4 \ncall õ2\nmov õ1,
õ3");
installl( "õ1 <( õ2 < õ3 , õ4 , õ5 , õ6 )" ,
"push õ6 \npush õ5 \npush õ4 \npush õ3 \ncall õ1 \nadd
esp, 16");
installl( "õ1 = õ2 <( õ3 < õ4 , õ5 , õ6 , õ7 )" ,
"push õ7 \npush õ6 \npush õ5 \npush õ4 \ncall õ2 \nadd esp,
16 \nmov õ1, õ3");
installl( "< õ1 , õ2 , õ3 , õ4 , õ5" ,
"push õ1 \npush õ2 \npush õ3 \npush õ4 \npush õ5");
installl( "> õ1 , õ2 , õ3 , õ4 , õ5" ,
"pop õ5 \npop õ4 \npop õ3 \npop õ2 \npop õ1");
installl( "õ1 ( õ2 < õ3 , õ4 , õ5 , õ6 , õ7 )" ,
"push õ7 \npush õ6 \npush õ5 \npush õ4 \npush õ3
\ncall õ1");
installl( "õ1 = õ2 ( õ3 < õ4 , õ5 , õ6 , õ7 , õ8 )" ,
"push õ8 \npush õ7 \npush õ6 \npush õ5 \npush õ4 \ncall
õ2\nmov õ1, õ3");
installl( "õ1 <( õ2 < õ3 , õ4 , õ5 , õ6 , õ7 )" ,
"push õ7 \npush õ6 \npush õ5 \npush õ4 \npush õ3
\ncall õ1 \nadd esp, 20");
installl( "õ1 = õ2 <( õ3 < õ4 , õ5 , õ6 , õ7 , õ8 )" ,
"push õ8 \npush õ7 \npush õ6 \npush õ5 \npush õ4 \ncall õ2
\nadd esp, 20 \nmov õ1, õ3");
installl( "< õ1 , õ2 , õ3 , õ4 , õ5 , õ6" ,
"push õ1 \npush õ2 \npush õ3 \npush õ4 \npush õ5 \npush
õ6");
installl( "> õ1 , õ2 , õ3 , õ4 , õ5 , õ6" ,
"pop õ6 \npop õ5 \npop õ4 \npop õ3 \npop õ2 \npop
õ1");
installl( "õ1 ( õ2 < õ3 , õ4 , õ5 , õ6 , õ7 , õ8 )" ,
"push õ8 \npush õ7 \npush õ6 \npush õ5 \npush õ4 \npush õ3
\ncall õ1");
installl( "õ1 = õ2 ( õ3 < õ4 , õ5 , õ6 , õ7 , õ8 , õ9 )" ,
"push õ9 \npush õ8 \npush õ7 \npush õ6 \npush õ5 \npush õ4
\ncall õ2\nmov õ1, õ3");
installl( "õ1 <( õ2 < õ3 , õ4 , õ5 , õ6 , õ7 , õ8 )" ,
"push õ8 \npush õ7 \npush õ6 \npush õ5 \npush õ4 \npush õ3
\ncall õ1 \nadd esp, 24");
installl( "õ1 = õ2 <( õ3 < õ4 , õ5 , õ6 , õ7 , õ8 , õ9 )" ,
"push õ9 \npush õ8 \npush õ7 \npush õ6 \npush õ5 \npush õ4
\ncall õ2 \nadd esp, 24 \nmov õ1, õ3");
installl( "< õ1 , õ2 , õ3 , õ4 , õ5 , õ6 , õ7" ,
"push õ1 \npush õ2 \npush õ3 \npush õ4 \npush õ5 \npush õ6
\npush õ7");
installl( "> õ1 , õ2 , õ3 , õ4 , õ5 , õ6 , õ7" ,
"pop õ7 \npop õ6 \npop õ5 \npop õ4 \npop õ3 \npop õ2
\npop õ1");
installl( "õ1 ( õ2 < õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 )" ,
"push õ9 \npush õ8 \npush õ7 \npush õ6 \npush õ5 \npush õ4
\npush õ3 \ncall õ1");
installl( "õ1 = õ2 ( õ3 < õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 )" ,
"push õ10 \npush õ9 \npush õ8 \npush õ7 \npush õ6 \npush õ5
\npush õ4 \ncall õ2\nmov õ1, õ3");
installl( "õ1 <( õ2 < õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 )" ,
"push õ9 \npush õ8 \npush õ7 \npush õ6 \npush õ5 \npush õ4
\npush õ3 \ncall õ1 \nadd esp, 28");
installl( "õ1 = õ2 <( õ3 < õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 )" ,
"push õ10 \npush õ9 \npush õ8 \npush õ7 \npush õ6 \npush õ5
\npush õ4 \ncall õ2\nadd esp, 28 \nmov õ1, õ3");
installl( "õ1 ( õ2 < õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 )" ,
"push õ10 \npush õ9 \npush õ8 \npush õ7 \npush õ6 \npush õ5
\npush õ4 \npush õ3 \ncall õ1");
installl( "õ1 = õ2 ( õ3 < õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 )"
,
"push õ11 \npush õ10 \npush õ9 \npush õ8 \npush õ7 \npush õ6
\npush õ5 \npush õ4 \ncall õ2\nmov õ1, õ3");
installl( "õ1 <( õ2 < õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 )" ,
"push õ10 \npush õ9 \npush õ8 \npush õ7 \npush õ6 \npush õ5
\npush õ4 \npush õ3 \ncall õ1 \nadd esp, 32");
installl( "õ1 = õ2 <( õ3 < õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 )"
,
"push õ11 \npush õ10 \npush õ9 \npush õ8 \npush õ7 \npush õ6
\npush õ5 \npush õ4 \ncall õ2\nadd esp, 32 \nmov õ1, õ3");
installl( "õ1 ( õ2 < õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 )"
,
"push õ11 \npush õ10 \npush õ9 \npush õ8 \npush õ7 \npush õ6
\npush õ5 \npush õ4 \npush õ3 \ncall õ1");
installl( "õ1 = õ2 ( õ3 < õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 ,
õ12 )" ,
"push õ12 \npush õ11 \npush õ10 \npush õ9 \npush õ8 \npush õ7
\npush õ6 \npush õ5 \npush õ4 \ncall õ2\nmov õ1, õ3");
installl( "õ1 <( õ2 < õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 )"
,
"push õ11 \npush õ10 \npush õ9 \npush õ8 \npush õ7 \npush õ6
\npush õ5 \npush õ4 \npush õ3 \ncall õ1 \nadd esp, 36");
installl( "õ1 = õ2 <( õ3 < õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 ,
õ12 )" ,
"push õ12 \npush õ11 \npush õ10 \npush õ9 \npush õ8 \npush õ7
\npush õ6 \npush õ5 \npush õ4 \ncall õ2\nadd esp, 36 \nmov
õ1, õ3");
installl( "õ1 ( õ2 < õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 ,
õ12 )" ,
"push õ12 \npush õ11 \npush õ10 \npush õ9 \npush õ8 \npush õ7
\npush õ6 \npush õ5 \npush õ4 \npush õ3 \ncall õ1");
installl( "õ1 = õ2 ( õ3 < õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 ,
õ12 , õ13 )" ,
"push õ13 \npush õ12 \npush õ11 \npush õ10 \npush õ9 \npush
õ8 \npush õ7 \npush õ6 \npush õ5 \npush õ4 \ncall õ2\nmov õ1,
õ3");
installl( "õ1 <( õ2 < õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 ,
õ12 )" ,
"push õ12 \npush õ11 \npush õ10 \npush õ9 \npush õ8 \npush õ7
\npush õ6 \npush õ5 \npush õ4 \npush õ3 \ncall õ1 \nadd esp,
40");
installl( "õ1 = õ2 <( õ3 < õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 ,
õ12 )" ,
"push õ13 \npush õ12 \npush õ11 \npush õ10 \npush õ9 \npush õ8
\npush õ7 \npush õ6 \npush õ5 \npush õ4 \ncall õ2\nadd esp, 40
\nmov õ1, õ3");
/*------------------------------------------*/
installl( "õ1 = õ2 ( )" , "call õ2 \nmov õ1, eax");
installl( "õ1 = õ2 ()" , "call õ2 \nmov õ1, eax");
installl( "õ1 ( õ2 )" , "push õ2 \ncall õ1");
installl( "õ1 = õ2 ( õ3 )" , "push õ3 \ncall õ2 \nmov õ1, eax");
installl( "õ1 <( õ2 )" , "push õ2 \ncall õ1\nadd esp, 4");
installl( "õ1 = õ2 <( õ3 )" , "push õ3 \ncall õ2\nadd esp,
4\nmov õ1, eax");
installl( "õ1 ( õ2 , õ3 )" , "push õ3 \npush õ2 \ncall õ1");
installl( "õ1 = õ2 ( õ3 , õ4 )" , "push õ4 \npush õ3 \ncall
õ2\nmov õ1, eax");
installl( "õ1 <( õ2 , õ3 )" , "push õ3 \npush õ2 \ncall
õ1\nadd esp, 8");
installl( "õ1 = õ2 <( õ3 , õ4 )" , "push õ4 \npush õ3 \ncall
õ2\nadd esp, 8\nmov õ1, eax");
installl( "õ1 ( õ2 , õ3 , õ4 )" , "push õ4 \npush õ3 \npush
õ2 \ncall õ1");
installl( "õ1 = õ2 ( õ3 , õ4 , õ5 )" , "push õ5 \npush õ4 \npush
õ3 \ncall õ2\nmov õ1, eax");
installl( "õ1 <( õ2 , õ3 , õ4 )" , "push õ4 \npush õ3 \npush
õ2 \ncall õ1\nadd esp, 12");
installl( "õ1 = õ2 <( õ3 , õ4 , õ5 )" , "push õ5 \npush õ4 \npush
õ3 \ncall õ2\nadd esp, 12\nmov õ1, eax");
installl( "õ1 ( õ2 , õ3 , õ4 , õ5 )" ,
"push õ5 \npush õ4 \npush õ3 \npush õ2 \ncall õ1");
installl( "õ1 = õ2 ( õ3 , õ4 , õ5 , õ6 )" ,
"push õ6 \npush õ5 \npush õ4 \npush õ3 \ncall õ2\nmov õ1,
eax");
installl( "õ1 <( õ2 , õ3 , õ4 , õ5 )" ,
"push õ5 \npush õ4 \npush õ3 \npush õ2 \ncall õ1 \nadd
esp, 16");
installl( "õ1 = õ2 <( õ3 , õ4 , õ5 , õ6 )" ,
"push õ6 \npush õ5 \npush õ4 \npush õ3 \ncall õ2 \nadd esp,
16 \nmov õ1, eax");
installl( "õ1 ( õ2 , õ3 , õ4 , õ5 , õ6 )" ,
"push õ6 \npush õ5 \npush õ4 \npush õ3 \npush õ2
\ncall õ1");
installl( "õ1 = õ2 ( õ3 , õ4 , õ5 , õ6 , õ7 )" ,
"push õ7 \npush õ6 \npush õ5 \npush õ4 \npush õ3 \ncall
õ2\nmov õ1, eax");
installl( "õ1 <( õ2 , õ3 , õ4 , õ5 , õ6 )" ,
"push õ6 \npush õ5 \npush õ4 \npush õ3 \npush õ2
\ncall õ1 \nadd esp, 20");
installl( "õ1 = õ2 <( õ3 , õ4 , õ5 , õ6 , õ7 )" ,
"push õ7 \npush õ6 \npush õ5 \npush õ4 \npush õ3 \ncall õ2
\nadd esp, 20 \nmov õ1, eax");
installl( "õ1 ( õ2 , õ3 , õ4 , õ5 , õ6 , õ7 )" ,
"push õ7 \npush õ6 \npush õ5 \npush õ4 \npush õ3 \npush õ2
\ncall õ1");
installl( "õ1 = õ2 ( õ3 , õ4 , õ5 , õ6 , õ7 , õ8 )" ,
"push õ8 \npush õ7 \npush õ6 \npush õ5 \npush õ4 \npush õ3
\ncall õ2\nmov õ1, eax");
installl( "õ1 <( õ2 , õ3 , õ4 , õ5 , õ6 , õ7 )" ,
"push õ7 \npush õ6 \npush õ5 \npush õ4 \npush õ3 \npush õ2
\ncall õ1 \nadd esp, 24");
installl( "õ1 = õ2 <( õ3 , õ4 , õ5 , õ6 , õ7 , õ8 )" ,
"push õ8 \npush õ7 \npush õ6 \npush õ5 \npush õ4 \npush õ3
\ncall õ2 \nadd esp, 24 \nmov õ1, eax");
installl( "õ1 ( õ2 , õ3 , õ4 , õ5 , õ6 , õ7 , õ8 )" ,
"push õ8 \npush õ7 \npush õ6 \npush õ5 \npush õ4 \npush õ3
\npush õ2 \ncall õ1");
installl( "õ1 = õ2 ( õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 )" ,
"push õ9 \npush õ8 \npush õ7 \npush õ6 \npush õ5 \npush õ4
\npush õ3 \ncall õ2\nmov õ1, eax");
installl( "õ1 <( õ2 , õ3 , õ4 , õ5 , õ6 , õ7 , õ8 )" ,
"push õ8 \npush õ7 \npush õ6 \npush õ5 \npush õ4 \npush õ3
\npush õ2 \ncall õ1 \nadd esp, 28");
installl( "õ1 = õ2 <( õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 )" ,
"push õ9 \npush õ8 \npush õ7 \npush õ6 \npush õ5 \npush õ4
\npush õ3 \ncall õ2\nadd esp, 28 \nmov õ1, eax");
installl( "õ1 ( õ2 , õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 )" ,
"push õ9 \npush õ8 \npush õ7 \npush õ6 \npush õ5 \npush õ4
\npush õ3 \npush õ2 \ncall õ1");
installl( "õ1 = õ2 ( õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 )" ,
"push õ10 \npush õ9 \npush õ8 \npush õ7 \npush õ6 \npush õ5
\npush õ4 \npush õ3 \ncall õ2\nmov õ1, eax");
installl( "õ1 <( õ2 , õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 )" ,
"push õ9 \npush õ8 \npush õ7 \npush õ6 \npush õ5 \npush õ4
\npush õ3 \npush õ2 \ncall õ1 \nadd esp, 32");
installl( "õ1 = õ2 <( õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 )" ,
"push õ10 \npush õ9 \npush õ8 \npush õ7 \npush õ6 \npush õ5
\npush õ4 \npush õ3 \ncall õ2\nadd esp, 32 \nmov õ1, eax");
installl( "õ1 ( õ2 , õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 )" ,
"push õ10 \npush õ9 \npush õ8 \npush õ7 \npush õ6 \npush õ5
\npush õ4 \npush õ3 \npush õ2 \ncall õ1");
installl( "õ1 = õ2 ( õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 )"
,
"push õ11 \npush õ10 \npush õ9 \npush õ8 \npush õ7 \npush õ6
\npush õ5 \npush õ4 \npush õ3 \ncall õ2\nmov õ1, eax");
installl( "õ1 <( õ2 , õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 )" ,
"push õ10 \npush õ9 \npush õ8 \npush õ7 \npush õ6 \npush õ5
\npush õ4 \npush õ3 \npush õ2 \ncall õ1 \nadd esp, 36");
installl( "õ1 = õ2 <( õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 )"
,
"push õ11 \npush õ10 \npush õ9 \npush õ8 \npush õ7 \npush õ6
\npush õ5 \npush õ4 \npush õ3 \ncall õ2\nadd esp, 36 \nmov
õ1, eax");
installl( "õ1 ( õ2 , õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 )"
,
"push õ11 \npush õ10 \npush õ9 \npush õ8 \npush õ7 \npush õ6
\npush õ5 \npush õ4 \npush õ3 \npush õ2 \ncall õ1");
installl( "õ1 = õ2 ( õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 ,
õ12 )" ,
"push õ12 \npush õ11 \npush õ10 \npush õ9 \npush õ8 \npush õ7
\npush õ6 \npush õ5 \npush õ4 \npush õ3 \ncall õ2\nmov õ1,
eax");
installl( "õ1 <( õ2 , õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 )"
,
"push õ11 \npush õ10 \npush õ9 \npush õ8 \npush õ7 \npush õ6
\npush õ5 \npush õ4 \npush õ3 \npush õ2 \ncall õ1 \nadd esp,
40");
installl( "õ1 = õ2 <( õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 ,
õ12 )" ,
"push õ12 \npush õ11 \npush õ10 \npush õ9 \npush õ8 \npush õ7
\npush õ6 \npush õ5 \npush õ4 \npush õ3 \ncall õ2\nadd esp, 40
\nmov õ1, eax");
installl( "õ1 ( õ2 , õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 ,
õ12 )" ,
"push õ12 \npush õ11 \npush õ10 \npush õ9 \npush õ8 \npush õ7
\npush õ6 \npush õ5 \npush õ4 \npush õ3 \npush õ2 \ncall õ1");
installl( "õ1 = õ2 ( õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 ,
õ12 , õ13 )" ,
"push õ13 \npush õ12 \npush õ11 \npush õ10 \npush õ9 \npush
õ8 \npush õ7 \npush õ6 \npush õ5 \npush õ4 \npush õ3 \ncall
õ2\nmov õ1, eax");
installl( "õ1 <( õ2 , õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 ,
õ12 )" ,
"push õ12 \npush õ11 \npush õ10 \npush õ9 \npush õ8 \npush õ7
\npush õ6 \npush õ5 \npush õ4 \npush õ3 \npush õ2 \ncall õ1
\nadd esp, 44");
installl( "õ1 = õ2 <( õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 ,
õ12 , õ13 )" ,
"push õ13 \npush õ12 \npush õ11 \npush õ10 \npush õ9 \npush õ8
\npush õ7 \npush õ6 \npush õ5 \npush õ4 \npush õ3 \ncall õ2\nadd
esp, 44 \nmov õ1, eax");
installl( "õ1 ( õ2 , õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 ,
õ12 , õ13 )" ,
"push õ13 \npush õ12 \npush õ11 \npush õ10 \npush õ9 \npush õ8
\npush õ7 \npush õ6 \npush õ5 \npush õ4 \npush õ3 \npush õ2
\ncall õ1");
installl( "õ1 = õ2 ( õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 ,
õ12 , õ13 , õ14 )" ,
"push õ14 \npush õ13 \npush õ12 \npush õ11 \npush õ10 \npush
õ9 \npush õ8 \npush õ7 \npush õ6 \npush õ5 \npush õ4 \npush õ3
\ncall õ2\nmov õ1, eax");
installl( "õ1 <( õ2 , õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 ,
õ12 , õ13 )" ,
"push õ13 \npush õ12 \npush õ11 \npush õ10 \npush õ9 \npush õ8
\npush õ7 \npush õ6 \npush õ5 \npush õ4 \npush õ3 \npush õ2
\ncall õ1 \nadd esp, 48");
installl( "õ1 = õ2 <( õ3 , õ4 , õ5 , õ6 , õ7 , õ8 , õ9 , õ10 , õ11 ,
õ12 , õ13 , õ14 )" ,
"push õ14 \npush õ13 \npush õ12 \npush õ11 \npush õ10 \npush õ9
\npush õ8 \npush õ7 \npush õ6 \npush õ5 \npush õ4 \npush õ3
\ncall õ2\nadd esp, 48 \nmov õ1, eax");
/*------------------------------------------*/
installl( "++ õ1" , "inc õ1 ");
installl( "-- õ1" , "dec õ1 "); /* --[a+si]*/
installl( "++ õ1 , õ2" , "inc õ1 \ninc õ2 ");
installl( "-- õ1 , õ2" , "dec õ1 \ndec õ2 ");
installl( "++ õ1 , õ2 , õ3" , "inc õ1 \ninc õ2 \ninc õ3 ");
installl( "-- õ1 , õ2 , õ3" , "dec õ1 \ndec õ2 \ndec õ3 ");
installl( "++ õ1 , õ2 , õ3 , õ4" ,
"inc õ1 \ninc õ2 \ninc õ3 \ninc õ4 ");
installl( "-- õ1 , õ2 , õ3 , õ4" ,
"dec õ1 \ndec õ2 \ndec õ3 \ndec õ4 ");
installl( "-- õ1 # õ2" , "dec õ1 \njnz õ2 ");
installl( "-- õ1 !# õ2" , "dec õ1 \njz õ2 ");
installl( "õ1 <> õ2", "cmp õ1, õ2 ");
installl( "õ1 # õ2" , "cmp õ1, 0 \njne õ2");
installl( "õ1 !# õ2" , "cmp õ1, 0 \nje õ2");
installl( "õ1 < õ2 # õ3" , "cmp õ1, õ2 \njb õ3 "); /* numeri
senza segno */
installl( "õ1 & õ2 # õ3" , "test õ1, õ2 \njnz õ3 ");
installl( "õ1 > õ2 # õ3" , "cmp õ1, õ2 \nja õ3 ");
installl( "õ1 <= õ2 # õ3", "cmp õ1, õ2 \njbe õ3 ");
installl( "õ1 >= õ2 # õ3", "cmp õ1, õ2 \njae õ3 ");
installl( "õ1 == õ2 # õ3", "cmp õ1, õ2 \nje õ3 ");
installl( "õ1 != õ2 # õ3", "cmp õ1, õ2 \njne õ3 ");
installl( "õ1 >= õ2 !# õ3" , "cmp õ1, õ2 \njb õ3 ");
installl( "õ1 <= õ2 !# õ3" , "cmp õ1, õ2 \nja õ3 ");
installl( "õ1 > õ2 !# õ3" , "cmp õ1, õ2 \njbe õ3 ");
installl( "õ1 & õ2 !# õ3" , "test õ1, õ2 \njz õ3 ");
installl( "õ1 < õ2 !# õ3" , "cmp õ1, õ2 \njae õ3 ");
installl( "õ1 != õ2 !# õ3" , "cmp õ1, õ2 \nje õ3 ");
installl( "õ1 == õ2 !# õ3" , "cmp õ1, õ2 \njne õ3 ");
installl( "õ1 < õ2 ?# õ3" , "cmp õ1, õ2 \njl õ3 "); /* numeri
col segno */
installl( "õ1 > õ2 ?# õ3" , "cmp õ1, õ2 \njg õ3 ");
installl( "õ1 <= õ2 ?# õ3", "cmp õ1, õ2 \njle õ3 ");
installl( "õ1 >= õ2 ?# õ3", "cmp õ1, õ2 \njge õ3 ");
installl( "õ1 == õ2 ?# õ3", "cmp õ1, õ2 \nje õ3 ");
installl( "õ1 != õ2 ?# õ3", "cmp õ1, õ2 \njne õ3 ");
installl( "õ1 >= õ2 ?!# õ3" , "cmp õ1, õ2 \njl õ3 ");
installl( "õ1 <= õ2 ?!# õ3" , "cmp õ1, õ2 \njg õ3 ");
installl( "õ1 > õ2 ?!# õ3" , "cmp õ1, õ2 \njle õ3 ");
installl( "õ1 < õ2 ?!# õ3" , "cmp õ1, õ2 \njge õ3 ");
installl( "õ1 != õ2 ?!# õ3" , "cmp õ1, õ2 \nje õ3 ");
installl( "õ1 == õ2 ?!# õ3" , "cmp õ1, õ2 \njne õ3 ");
installl( "õ1 = õ2 + õ3", "mov õ1, õ2 \nadd õ1, õ3 ");
installl( "õ1 = õ2 - õ3", "mov õ1, õ2 \nsub õ1, õ3 "); /* 143
*/
/* label: istruzione = istruzione \0 commento
*/
installl( "=# õ1" , "jz õ1 "); /* numeri senza segno */
installl( "<# õ1" , "jb õ1 ");
installl( "># õ1" , "ja õ1 ");
installl( "<=# õ1", "jbe õ1 ");
installl( ">=# õ1", "jae õ1 ");
installl( "=?# õ1" , "je õ1 ");
installl( "<?# õ1" , "jl õ1 "); /* numeri con segno */
installl( ">?# õ1" , "jg õ1 ");
installl( "<=?# õ1", "jle õ1 ");
installl( ">=?# õ1", "jge õ1 "); /* 155 */
installl( "!# õ1" , "jnz õ1 ");
installl( "!<# õ1" , "jae õ1 "); /* numeri senza segno */
installl( "!># õ1" , "jbe õ1 ");
installl( "!<=# õ1", "ja õ1 ");
installl( "!>=# õ1", "jb õ1 ");
installl( "!?# õ1" , "jne õ1 ");
installl( "!<?# õ1" , "jge õ1 "); /* numeri con segno */
installl( "!>?# õ1" , "jle õ1 ");
installl( "!<=?# õ1", "jg õ1 ");
installl( "!>=?# õ1", "jl õ1 "); /* 165 */
installl( "( õ1 , õ2 ) <<= õ3", "shld õ1, õ2, õ3 ");
installl( "( õ1 , õ2 ) >>= õ3", "shrd õ1, õ2, õ3 ");
installl( "( õ1 , õ2 )<<= õ3", "shld õ1, õ2, õ3 ");
installl( "( õ1 , õ2 )>>= õ3", "shrd õ1, õ2, õ3 ");
installl( "<< õ1 = õ2", "%define õ1 õ2");
installl( ">> õ1" , "%undef õ1" );
installl( "<< õ1 = õ2 , õ3 = õ4", "%define õ1 õ2 \n%define õ3 õ4
");
installl( ">> õ1 , õ2", "%undef õ1 \n%undef õ2 " );
installl( "<< õ1 = õ2 , õ3 = õ4 , õ5 = õ6",
"%define õ1 õ2 \n%define õ3 õ4 \n%define õ5 õ6 ");
installl( ">> õ1 , õ2 , õ3", "%undef õ1 \n%undef õ2 \n%undef õ3 "
);
installl( "<< õ1 = õ2 , õ3 = õ4 , õ5 = õ6 , õ7 = õ8",
"%define õ1 õ2 \n%define õ3 õ4 \n%define õ5 õ6 \n%define õ7
õ8");
installl( ">> õ1 , õ2 , õ3 , õ4",
"%undef õ1 \n%undef õ2 \n%undef õ3 \n%undef õ4 " );
installl( "<< õ1 = õ2 , õ3 = õ4 , õ5 = õ6 , õ7 = õ8 , õ9 = õ10",
"%define õ1 õ2 \n%define õ3 õ4 \n%define õ5 õ6 \n%define õ7 õ8
\n%define õ9 õ10");
installl( ">> õ1 , õ2 , õ3 , õ4 , õ5",
"%undef õ1 \n%undef õ2 \n%undef õ3 \n%undef õ4 \n%undef õ5 ");
installl( "<< õ1 = õ2 , õ3 = õ4 , õ5 = õ6 , õ7 = õ8 , õ9 = õ10 , õ11
= õ12",
"%define õ1 õ2 \n%define õ3 õ4 \n%define õ5 õ6 \n%define õ7 õ8
\n%define õ9 õ10 \n%define õ11 õ12 ");
installl( ">> õ1 , õ2 , õ3 , õ4 , õ5 , õ6",
"%undef õ1 \n%undef õ2 \n%undef õ3 \n%undef õ4 \n%undef õ5
\n%undef õ6 ");
installl( "<< õ1 = õ2 , õ3 = õ4 , õ5 = õ6 , õ7 = õ8 , õ9 = õ10 , õ11
= õ12 , õ13 = õ14",
"%define õ1 õ2 \n%define õ3 õ4 \n%define õ5 õ6 \n%define õ7 õ8
\n%define õ9 õ10 \n%define õ11 õ12 \n%define õ13 õ14 ");
installl( ">> õ1 , õ2 , õ3 , õ4 , õ5 , õ6 , õ7",
"%undef õ1 \n%undef õ2 \n%undef õ3 \n%undef õ4 \n%undef õ5
\n%undef õ6 \n%undef õ7 ");
installl("== õ1 == õ2", "extern õ1 \nimport õ1 õ2 ");
installl("== õ1 , õ2 == õ3",
"extern õ1, õ2 \nimport õ1 õ3 \nimport õ2 õ3 ");
installl("== õ1 , õ2 , õ3 == õ4",
"extern õ1, õ2, õ3 \nimport õ1 õ4 \nimport õ2 õ4 \nimport õ3
õ4 ");
installl("== õ1 , õ2 , õ3 , õ4 == õ5",
"extern õ1, õ2, õ3, õ4 \nimport õ1 õ5 \nimport õ2 õ5 \nimport
õ3 õ5 \nimport õ4 õ5 ");
installl("== õ1 , õ2 , õ3 , õ4 , õ5 == õ6",
"extern õ1, õ2, õ3, õ4, õ5 \nimport õ1 õ6 \nimport õ2 õ6
\nimport õ3 õ6 \nimport õ4 õ6 \nimport õ5 õ6 ");
installl( "õ1 , õ2 = õ3" , "[section .data] \nõ2 õ1 õ3 , 0
\n__SECT__ ");
installl( "õ1 , õ2 = õ3 , õ4 = õ5" , "[section .data] \nõ2 õ1 õ3 ,
0 \nõ4 õ1 õ5 , 0 \n__SECT__ ");
installl( "õ1 , õ2 = õ3 , õ4 = õ5 , õ6 = õ7" ,
"[section .data] \nõ2 õ1 õ3 , 0 \nõ4 õ1 õ5 , 0 \nõ6 õ1 õ7
, 0 \n__SECT__ ");
installl( "õ1 , õ2 = õ3 , õ4 = õ5 , õ6 = õ7 , õ8 = õ9" ,
"[section .data] \nõ2 õ1 õ3 , 0 \nõ4 õ1 õ5 , 0 \nõ6 õ1 õ7 , 0
\nõ8 õ1 õ9 , 0 \n__SECT__ ");
installl( "õ1 , õ2 = õ3 , õ4 = õ5 , õ6 = õ7 , õ8 = õ9 , õ10 = õ11" ,
"[section .data] \nõ2 õ1 õ3 , 0 \nõ4 õ1 õ5 , 0 \nõ6 õ1 õ7 , 0
\nõ8 õ1 õ9 , 0 \nõ10 õ1 õ11 , 0 \n__SECT__ ");
installl( "õ1 , õ2 = õ3 , õ4 = õ5 , õ6 = õ7 , õ8 = õ9 , õ10 = õ11 ,
õ12 = õ13" ,
"[section .data] \nõ2 õ1 õ3 ,0 \nõ4 õ1 õ5 ,0 \nõ6 õ1 õ7 ,0 \nõ8 õ1 õ9
,0 \nõ10 õ1 õ11 ,0 \nõ12 õ1 õ13 ,0 \n__SECT__ ");
}
#define MAXW 2048 /* Massima lunghezza linea trattabile */
#define MAXP 512 /* Massimo numero di parole per linea */
int main(int x, char** a)
{int linea, led;
char word[MAXW], **ch, *in, *out, *nl;
struct nlist *np;
FILE *f_in, *f_out;
if(x!=0 && a!=0 && a[0]!=0) argomento=a[0]; /* per assert_m */
else argomento="prog";
if( !(x==3) && !( x==4 && a[1][0]=='-' && a[1][1]=='l' ) )
{P("USO:\n>nome_prog [-l] nome_file_in nome_file_out\n"); R
0;}
if(x==4) { in=a[2]; out=a[3]; led=1; }
else { in=a[1]; out=a[2]; led=0; }
nome_file=estrai(in);
if( (ch=malloc(MAXP * sizeof *ch) )== NULL)
{ P("Scarsa memoria! Esco\n"); R 1; }
if(strcmp(in, "stdin")!=0)
{if((f_in=fopen(in,"r"))==NULL)
{printf("\n ERRORE, impossibile leggere il file %s\n", a[1]);
free(ch);
return 1;
}
}
else f_in=stdin;
if(strcmp(out, "stdout")!=0)
{if((f_out=fopen(out,"w"))==NULL)
{printf("\n ERRORE, impossibile scrivere il file %s\n", a[2]);
fclose(f_in); free(ch);
return 1;
}
}
else f_out=stdout;
allUscita(1, f_in, f_out, ch); install_all();
linea=1;
while( (nl=fgets_p(word, sizeof word, f_in)) != NULL )
{char buf[MAXW], bufr[MAXW], word1[MAXW],
*b, *bf, *comm, *u, *v, *h, za, *bj;
int i, j, t;
char fmt[7+11+32+10+10], ne[32+10]="", *pointer;
micro_s(buf, MAXW, word, &comm, bufr);
t=0;
if(led && linea<10000000 )
{t = sprintf(fmt, "%%line %u %.30s\n", linea-1, nome_file);
}
else if(led && linea>=10000000)
{ assert_m(linea>=10000000, "File troppo lungo" ); }
/* Per la macro assert_m gli if *non* sono sicuri */
else *fmt='\0';
j=strlen(fmt); bj=fmt+j;
*ne='\0';
b=buf; bf=NULL; j=0;
W( ( i=get_token(&bf, &b) ) != '\0')
{char inizio_linea;
macro_s(bufr, sizeof bufr, bf, ch, MAXP);
if((np=lookup(bufr))!=NULL)
strncpy(bufr, np->defn, MAXW);
if( led ) {pointer = fmt; *bj=0;}
else {*ne=0; pointer = ne;}
inizio_linea=*bufr;
/* j==0 && qui sotto */
if( i!=':' && inizio_linea!='%'
&& ( comm==NULL || inizio_linea!='\0') )
{t += catstr(pointer, " ", MAXW-t); }
label:
if(t>=MAXW) P("Lunghezza linea attuale> t = %d\n", t );
assert_m(MAXW>t, "Linea troppo lunga");
macro_sinv(word1, (sizeof word1)-t, bufr, bf, ch, MAXP);
v=word1; h=bufr;
W(1)
{u = pointer;
W( ++t<MAXW && (*h++=*u++) );
--h; --t;
W( ++t<MAXW && ( za=(*h++=*v++) ) && za!='\n');
if( za!='\n' || t>=MAXW )
{--h; *h++='\n'; *h='\0'; break;}
}
if(t>= MAXW) goto label;
if( !(j==0 && comm!=NULL) )
fputs(bufr, f_out);
else /* commenti /, %, section */
{--h; --t;
u = *comm=='/' && inizio_linea!=0 ? " ;" : /*
commento dopo un comando */
*comm=='/' && inizio_linea==0 ? ";" : /*
commento in inizio linea */
*comm=='%' ? "%" : ""; /* % o
altrimenti */
W( ++t<MAXW && (*h++=*u++) );
--h; /* se t<MAXW --h->'\0' */
u= *comm=='%'||(*comm=='/' && comm[1]!='*') ? comm+1 :
*comm=='/' && comm[1]=='*' ? comm+2 :
comm;
W( ++t<MAXW && (*h++=*u++) );
if(t>= MAXW) goto label;
fputs(bufr, f_out);
}
++j; /* j=0 allora metto il commento altrimenti niente */
}
if( *nl=='\n' ) ++linea;
}
fclose(f_in);
fclose(f_out);
free_tab();
free(ch);
R 0;
}
void allUscita(int flag, FILE* f_in, FILE* f_out, char** ch)
{static FILE *f_inn=0, *f_outt=0;
static char **chh=0;
if(flag==1) /* Aggiorna */
{f_inn=f_in; f_outt=f_out; chh=ch;}
else {free(chh);
if(f_inn!=0 ) fclose(f_inn);
if(f_outt!=0) fclose(f_outt);
free_tab();
}
}
#define BUFSIZE 256
char buf[BUFSIZE];
int bufp= 0;
int getch(FILE* pnt)
{static int led = EOF+1;
R (bufp>0) ? buf[--bufp] :
led!=EOF ? led=fgetc(pnt) : EOF;
}
void ungetch(char c)
{assert_m(bufp<BUFSIZE, "ungetch: troppi caratteri");
buf[bufp++]=c;
}
.
- Follow-Ups:
- Re: Question for ¬a\/b
- From: Frank Kotler
- Re: Question for ¬a\/b
- References:
- Question for ¬a\/b
- From: Frank Kotler
- Question for ¬a\/b
- Prev by Date: Re: No, POLL and WAIT
- Next by Date: Re: No, POLL and WAIT
- Previous by thread: Question for ¬a\/b
- Next by thread: Re: Question for ¬a\/b
- Index(es):
Relevant Pages
|
Loading