Changeset 6
Author: Leszek Godlewski
(2009/12/08 18:22) Over 2 years ago
islip: * added Turbo Delphi project wrapper * changed data indexing convention to start at 1, allowing for ARG_NULL to be 0 * fixed a bug with zero-length Turbo Delphi strings
Author: Leszek Godlewski
(2009/12/08 18:22) Over 2 years ago
islip: * added Turbo Delphi project wrapper * changed data indexing convention to start at 1, allowing for ARG_NULL to be 0 * fixed a bug with zero-length Turbo Delphi strings
BI_STOP = $00;OP_STOP = $00;BI_PUSH = $01;OP_PUSH = $01;BI_POP = $02;OP_POP = $02;BI_ADD = $03;OP_ADD = $03;BI_SUB = $04;OP_SUB = $04;BI_MUL = $05;OP_MUL = $05;BI_DIV = $06;OP_DIV = $06;BI_JMP = $07;OP_JMP = $07;BI_CNDJMP = $08;OP_CNDJMP = $08;BI_TRAP = $09;OP_TRAP = $09;BI_CALL = $0A;OP_CALL = $0A;ARG_NULL = $FFFFFFFF;ARG_NULL = $00000000;m_head : pislip_cmp_var;m_tail : pislip_cmp_var;m_index : size_t;m_head : pislip_cmp_inst;m_tail : pislip_cmp_inst;m_count : size_t;constructor create(var input : cfile);function eval_expr(end_token : string) : boolean;constructor islip_compiler.create(var input : cfile);m_code.append(BI_PUSH, index);m_code.append(OP_PUSH, index);m_code.append(BI_TRAP, TRAP_PRINT);m_code.append(OP_TRAP, TRAP_PRINT);m_code.append(BI_POP, ARG_NULL);m_code.append(OP_POP, ARG_NULL);m_code.append(BI_TRAP, TRAP_LINEFEED);m_code.append(OP_TRAP, TRAP_LINEFEED);m_code.append(BI_STOP, 0);m_code.append(OP_STOP, ARG_NULL);writeln('ERROR: Unable to parse script');writeln('ERROR: Unable to parse script');{$IFDEF DEBUG}{$IFDEF DEBUG}write('DEBUG: variable #', i - 1, ' = ');write('DEBUG: variable #', i, ' = ');{$ENDIF}{$ENDIF}inc(m_index);BI_STOP:OP_STOP:BI_PUSH:OP_PUSH:m_stack.push(@m_data^[m_code^[i].arg + 1]);BI_POP:OP_POP:m_stack.pop(@m_data^[m_code^[i].arg + 1]);BI_TRAP:OP_TRAP:g_script : file of byte;g_script : cfile;// helper typesconstructor create(var input : cfile);m_input : file of char;m_input : pcfile;constructor create(var input : cfile);constructor islip_reader.create(var input : cfile);m_input := @input;if eof(m_input^) then beginread(m_input^, c);constructor islip_parser.create(var input : cfile);if m_token[1] in [chr(10), chr(13), ',', '.'] then beginif (length(m_token) = 1) and (m_token[1] in [chr(10), chr(13), ',']) then beginuses typedefs in 'typedefs.pas';