?login_element?

Subversion Repositories NedoOS

Rev

Rev 50 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. //// imported
  2. #include "../_sdk/io.h"
  3.  
  4. //#include "../_sdk/print.h"
  5.  
  6. EXTERN PCHAR _texttoken[256];
  7.  
  8. PROC asmfilltokens FORWARD();
  9.  
  10. ////
  11.  
  12. //яхЁхф EOF ьюцхЄ с√Є№/эх с√Є№ EOL
  13.  
  14. PROC asmexport_line()
  15. {
  16. VAR BYTE token;
  17. VAR CHAR c;
  18. //VAR PCHAR pin;
  19. //VAR PCHAR pout;
  20. VAR PCHAR pintoken;
  21.  
  22.   WHILE (+TRUE) {
  23.     //token=*pin;
  24.     //pin=pin+1;
  25.     token = readfin();
  26.     IF (_waseof) BREAK;
  27.     IF (token == (BYTE)(+_TOKTEXT)) { //anytext
  28.       WHILE (+TRUE) {
  29.         //c=*pin;
  30.         //pin=pin+1;
  31.         c = (CHAR)readfin();
  32.         IF (c == (CHAR)((BYTE)(+_TOKENDTEXT))) BREAK;
  33.         //*pout=c;
  34.         //pout=pout+1;
  35.         writefout((BYTE)c);
  36.       };
  37.     }ELSE {          //token
  38.       fputs(_texttoken[token], _fout);
  39. /**      pintoken = _texttoken[token];
  40.       WHILE (+TRUE) {
  41.         c = *(PCHAR)(pintoken);
  42.         IF (c == '\0') BREAK;
  43.         INC pintoken;
  44.         //*pout=*pintoken;
  45.         //pout=pout+1;
  46.         writebyte(_fexp, (BYTE)c);
  47.       };*/
  48.     };
  49.     IF (token == (BYTE)(+_TOKEOL)) BREAK;
  50.   };
  51. }
  52.  
  53. PROC asmexport(PCHAR fn)
  54. {
  55. VAR BYTE b;
  56.   //setxy(0x05,0x00);
  57.   //prchar('@');
  58.   //nprintf("Hello %s %d world!",(UINT)"ZX Spectrum",(UINT)48);
  59.  
  60.   b = 0x00;
  61.   REPEAT { //эр тё ъшщ ёыєўрщ ўшёЄшь тёх Єюъхэ√
  62.     _texttoken[b] = "";
  63.     INC b;
  64.   }UNTIL (b == 0x00);
  65.  
  66.   _texttoken[+_TOKEOL]="\n";
  67.   //_texttoken[+_TOKEOF]="";
  68.   //_texttoken[+_TOKSPC0]="";
  69.   _texttoken[+_TOKSPC1]=" ";
  70.   _texttoken[+_TOKSPC2]="  ";
  71.   _texttoken[+_TOKSPC3]="   ";
  72.   _texttoken[+_TOKSPC4]="    ";
  73.   _texttoken[+_TOKSPC5]="     ";
  74.   _texttoken[+_TOKSPC6]="      ";
  75.   _texttoken[+_TOKSPC7]="       ";
  76.   _texttoken[+_TOKSPC8]="        ";
  77.  
  78.   _texttoken[+_TOKCOMMA]=",";
  79.   _texttoken[+_TOKOPEN]="(";
  80.   _texttoken[+_TOKOPENSQ]="[";
  81.   _texttoken[+_TOKCLOSE]=")";
  82.   _texttoken[+_TOKCLOSESQ]="]";
  83.   _texttoken[+_TOKCOLON]=":";
  84.   //_texttoken[+_TOKDIRECT]="#";
  85.   _texttoken[+_TOKPRIME]="\'";
  86.   _texttoken[+_TOKPRIMESYM]="\'"; //шёяюы№чєхЄё  фы  ёшьтюы№э√ї ъюэёЄрэЄ Єшяр 'c'
  87.   _texttoken[+_TOKDBLQUOTESYM]="\"";
  88.   _texttoken[+_TOKDOLLAR]="$";
  89.   //_texttoken[+_TOKREEQU]="=";
  90.  
  91.   _texttoken[+_TOKPLUS]="+";
  92.   _texttoken[+_TOKMINUS]="-";
  93.   _texttoken[+_TOKSTAR]="*";
  94.   _texttoken[+_TOKSLASH]="/";
  95.   _texttoken[+_TOKLESS]="<";
  96.   _texttoken[+_TOKMORE]=">";
  97.   _texttoken[+_TOKEQUAL]="=";
  98.   _texttoken[+_TOKAND]="&";
  99.   _texttoken[+_TOKPIPE/**'|'*/]="|";
  100.   _texttoken[+_TOKCARON/**'^'*/]="^";
  101.   _texttoken[+_TOKTILDE/**'~'*/]="~";
  102.   _texttoken[+_TOKEXCL]="!";
  103.  
  104.   //_texttoken[+_TOKTEXT]="";
  105.   //_texttoken[+_TOKENDTEXT]="";
  106.   _texttoken[+_TOKCOMMENT]=";";
  107.   //_texttoken[+_TOKENDCOMMENT]="";
  108.   //_texttoken[+_TOKNUM]="";
  109.   //_texttoken[+_TOKLABEL]="";
  110.   //_texttoken[+_ERR_]="";
  111.  
  112.   //_texttoken[+_CMDLABEL   ]="";
  113.   //_texttoken[+_CMDREEQU   ]="";
  114.   _texttoken[+_CMDORG     ]="org";
  115.   _texttoken[+_CMDALIGN   ]="align";
  116.   _texttoken[+_CMDPAGE    ]="page";
  117.   _texttoken[+_CMDIF      ]="if";
  118.   _texttoken[+_CMDELSE    ]="else";
  119.   _texttoken[+_CMDENDIF   ]="endif";
  120.   _texttoken[+_CMDDUP     ]="dup";
  121.   _texttoken[+_CMDEDUP    ]="edup";
  122.   _texttoken[+_CMDMACRO   ]="macro";
  123.   _texttoken[+_CMDENDM    ]="endm";
  124.   //_texttoken[+_CMDUSEMACRO]="usemacro";
  125.   _texttoken[+_CMDEXPORT  ]="export";
  126.   _texttoken[+_CMDLOCAL   ]="local";
  127.   _texttoken[+_CMDENDL    ]="endl";
  128.   _texttoken[+_CMDDISP    ]="disp";
  129.   _texttoken[+_CMDENT     ]="ent";
  130.   _texttoken[+_CMDINCLUDE ]="include";
  131.   _texttoken[+_CMDINCBIN  ]="incbin";
  132.   _texttoken[+_CMDDB      ]="db";
  133.   _texttoken[+_CMDDW      ]="dw";
  134.   _texttoken[+_CMDDL      ]="dl";
  135.   _texttoken[+_CMDDS      ]="ds";
  136.   _texttoken[+_CMDDISPLAY ]="display";
  137.   _texttoken[+_CMDREPEAT  ]="repeat";
  138.   _texttoken[+_CMDUNTIL   ]="until";
  139.   _texttoken[+_CMDSTRUCT  ]="struct";
  140.   _texttoken[+_CMDENDSTRUCT]="endstruct";
  141.  
  142.   asmfilltokens();
  143.  
  144.   //setfin( "tok.f" );
  145.   _fin = nfopen(fn, "rb");
  146.   IF (_fin != (PBYTE)0) {
  147.     _waseof = +FALSE;
  148.     _fout = openwrite( "exp.f" );
  149.  
  150.     //_waseof = +FALSE; //єцх хёЄ№ т setfin
  151.  
  152.     WHILE (!_waseof) {
  153.       asmexport_line();
  154.     };
  155.     //todo яюффхЁцрЄ№ TOK_EOF
  156.  
  157.     fclose(_fout);
  158.     fclose(_fin); //closefin();
  159.   };
  160. }
  161.