?login_element?

Subversion Repositories NedoOS

Rev

Rev 8 | Blame | Compare with Previous | Last modification | View Log | Download

  1. //// imported
  2. #include "../_sdk/io.h"
  3.  
  4. //CONST PCHAR CH_ADD;
  5. CONST PCHAR fn;
  6.  
  7. CONST PBYTE RUNADDR;
  8. CONST PBYTE PARADDR;
  9.  
  10. ////
  11.  
  12. PROC batch()
  13. {
  14. VAR CHAR c;
  15. VAR PCHAR pfn;
  16. VAR PCHAR ppar;
  17. VAR BOOL waswaseof;
  18.   _fin = nfopen(fn, "rb");
  19.   IF (_fin != (PBYTE)0) {
  20.     _waseof = +FALSE;
  21.  
  22.     WHILE (!_waseof) {
  23. //read command to (fn), (eol = ' ' or '\n' or EOF, skip 0x0d), end with '\0'
  24.       pfn = fn;
  25.       ppar = (PCHAR)PARADDR; //(PCHAR)(*(PUINT)CH_ADD);
  26.       //POKE *(PCHAR)(ppar) = (CHAR)0xea; //REM
  27.       //INC ppar;
  28.       readcmd:
  29.         c = (CHAR)readfin();
  30.         IF (c == ' ') goto readcmdq; //read parameters
  31.         IF ((c == '\n') || _waseof) goto readparq; //skip parameters
  32.         IF ((BYTE)c != 0x0d) {
  33.           POKE *(PCHAR)(pfn) = c;
  34.           INC pfn;
  35.         };
  36.         goto readcmd;
  37.       readcmdq:
  38. //read parameters to (CH_ADD), (eol = '\n' or EOF, skip 0x0d), end with 0x0d
  39.       readpar:
  40.         c = (CHAR)readfin();
  41.         IF ((c == '\n') || _waseof) goto readparq;
  42.         IF ((BYTE)c != 0x0d) {
  43.           POKE *(PCHAR)(ppar) = c;
  44.           INC ppar;
  45.         };
  46.         goto readpar;
  47.       readparq:
  48.       POKE *(PCHAR)(pfn) = '\0';
  49.       POKE *(PCHAR)(ppar) = (CHAR)0x0d;
  50. //run command: load file (fn) to RUNADDR
  51.       waswaseof = _waseof;
  52.       IF ((UINT)loadfile(fn, RUNADDR) != 0/**RUNADDR*/) {
  53.         CALL (RUNADDR);
  54.       };
  55.       _waseof = waswaseof;
  56. //next line
  57.     };
  58.     fclose(_fin); //closefin();
  59.   };
  60. }
  61.