OpenCores
URL https://opencores.org/ocsvn/usb_fpga_1_2/usb_fpga_1_2/trunk

Subversion Repositories usb_fpga_1_2

[/] [usb_fpga_1_2/] [trunk/] [bmp/] [src/] [bmp.pas] - Diff between revs 3 and 4

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 3 Rev 4
Line 1... Line 1...
{*!
{*!
   bmp -- babel macro processor
   bmp -- babel macro processor
   Copyright (C) 2008-2009 ZTEX e.K.
   Copyright (C) 2009-2010 ZTEX e.K.
   http://www.ztex.de
   http://www.ztex.de
 
 
   This program is free software; you can redistribute it and/or modify
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License version 3 as
   it under the terms of the GNU General Public License version 3 as
   published by the Free Software Foundation.
   published by the Free Software Foundation.
Line 388... Line 388...
initsymb('UNIX');
initsymb('UNIX');
{$endif}
{$endif}
{$ifdef WINDOWS}
{$ifdef WINDOWS}
initsymb('WINDOWS');
initsymb('WINDOWS');
{$endif}
{$endif}
{$ifdef dos}
{$ifdef LINUX}
initsymb('dos');
initsymb('LINUX');
{$endif}
 
{$ifdef linux}
 
initsymb('linux');
 
{$endif}
 
{$ifdef unix}
 
initsymb('unix');
 
{$endif}
 
{$ifdef go32v1}
 
initsymb('go32v1');
 
{$endif}
 
{$ifdef go32v2}
 
initsymb('go32v2');
 
{$endif}
 
{$ifdef os2}
 
initsymb('os2');
 
{$endif}
 
{$ifdef win32}
 
initsymb('win32');
 
{$endif}
 
{$ifdef macos}
 
initsymb('macos');
 
{$endif}
 
{$ifdef amiga}
 
initsymb('amiga');
 
{$endif}
 
{$ifdef atari}
 
initsymb('atari');
 
{$endif}
{$endif}
end;
end;
 
 
{ ****** destroy **************************************************** }
{ ****** destroy **************************************************** }
destructor CMainBmp.destroy;
destructor CMainBmp.destroy;
Line 430... Line 403...
  if macros[i]<>nil then freemacro(macros[i]);
  if macros[i]<>nil then freemacro(macros[i]);
end;
end;
 
 
{ ****** run ******************************************************** }
{ ****** run ******************************************************** }
procedure CMainBmp.run(const mf:ansistring; var fo:text);
procedure CMainBmp.run(const mf:ansistring; var fo:text);
var i,mode,j,k,l,bl,ifc  : longint;
var i,mode,j,k,l,ifc     : longint;
 
    bl,bl_ne             : longint;
    outfile,bm_expand    : longint;
    outfile,bm_expand    : longint;
    prevli,ampos         : dword;
    prevli,ampos         : dword;
    sx,endnoexpand       : bmpstring;
    sx,endnoexpand       : bmpstring;
    s4                   : array[0..3] of char;
    s4                   : array[0..3] of char;
    i4                   : dword absolute s4;
    i4                   : dword absolute s4;
Line 655... Line 629...
              j:=0;
              j:=0;
              repeat
              repeat
                repeat
                repeat
                  i+=1;
                  i+=1;
                  k:=bufm[(rbp-i) and rbufmax];
                  k:=bufm[(rbp-i) and rbufmax];
//                writeln(stderr,'  i=',i,'  k=',k);
//                writeln(stderr,'  i=',i,'  k=',k,' rbuf=',rbuf[(rbp-i) and rbufmax]);
                  until (i>=rbufmax) or (k=bm_if) or (k=bm_ifeq_scb2) or (k=bm_ifeq_scb2_ne) or (k=bm_ifneq_scb2) or (k=bm_ifneq_scb2_ne);
                  until (i>=rbufmax) or (k=bm_if) or (k=bm_ifeq_scb2) or (k=bm_ifeq_scb2_ne) or (k=bm_ifneq_scb2) or (k=bm_ifneq_scb2_ne);
                repeat
                repeat
                  j+=1;
                  j+=1;
                  l:=bufm[(rbp-j) and rbufmax];
                  l:=bufm[(rbp-j) and rbufmax];
//                writeln(stderr,'  j=',j,'  l=',l);
//                writeln(stderr,'  j=',j,'  l=',l,' rbuf=',rbuf[(rbp-j) and rbufmax]);
                  until (j>=rbufmax) or (l=bm_if) or (l=bm_ifeq_scb1) or (l=bm_ifeq_scb1_ne) or (l=bm_ifneq_scb1) or (l=bm_ifneq_scb1_ne);
                  until (j>=rbufmax) or (l=bm_if) or (l=bm_ifeq_scb1) or (l=bm_ifeq_scb1_ne) or (l=bm_ifneq_scb1) or (l=bm_ifneq_scb1_ne);
//              writeln(stderr,rbp,',',i,',',j,'-->',rbuf[(rbp-i) and rbufmax],'<-->',rbuf[(rbp-j) and rbufmax],'<--');
//              writeln(stderr,rbp,',',i,',',j,'-->',rbuf[(rbp-i) and rbufmax],'<-->',rbuf[(rbp-j) and rbufmax],'<--');
                until (j>=rbufmax) or (l=bm_if) or (k=bm_if) or (rbuf[(rbp-i) and rbufmax]<>rbuf[(rbp-j) and rbufmax]);
                until (j>=rbufmax) or (l=bm_if) or (k=bm_if) or (rbuf[(rbp-i) and rbufmax]<>rbuf[(rbp-j) and rbufmax]);
//            writeln(stderr);  
//            writeln(stderr);  
              ifc+=1;
              ifc+=1;
Line 923... Line 897...
                 then warning('empty include file name')
                 then warning('empty include file name')
                 else CFileBuf.create(buf,sx, lineInfoStr(lineInfo)+': ');
                 else CFileBuf.create(buf,sx, lineInfoStr(lineInfo)+': ');
              mode:=bm_plain;
              mode:=bm_plain;
              end;
              end;
{noexpand mode}
{noexpand mode}
           if ((mode=bm_pm) or (mode=bm_ifeq_scb1) or (mode=bm_ifeq_scb2) or (mode=bm_ifneq_scb1) or (mode=bm_ifneq_scb2)) and matchstr(bc_pm+'noexpand'+bc_ob,bm_pm) then
           if ((mode=bm_pm) or (mode=bm_ifeq_scb1) or (mode=bm_ifeq_scb2) or (mode=bm_ifneq_scb1) or (mode=bm_ifneq_scb2)) and matchstr(bc_pm+'noexpand'+bc_ob,mode) then
              begin
              begin
              setmode(length(bc_pm+'noexpand'+bc_ob),bm_pm,bm_noexpand);
              setmode(length(bc_pm+'noexpand'+bc_ob),mode,bm_noexpand);
              mode:=bm_noexpand_scb;
              mode:=bm_noexpand_scb;
              bli[0]:=lineInfo;
              bli[0]:=lineInfo;
 
              bl_ne:=bl;
              bl:=1;
              bl:=1;
              end;
              end;
           if (mode=bm_noexpand_scb) and (bl=0) then
           if (mode=bm_noexpand_scb) and (bl=0) then
              begin
              begin
              endnoexpand:=lastmodestr1(bm_noexpand_scb);
              endnoexpand:=lastmodestr1(bm_noexpand_scb);
Line 941... Line 916...
                bm_ifneq_scb1 : mode:=bm_ifneq_scb1_ne;
                bm_ifneq_scb1 : mode:=bm_ifneq_scb1_ne;
                bm_ifneq_scb2 : mode:=bm_ifneq_scb2_ne;
                bm_ifneq_scb2 : mode:=bm_ifneq_scb2_ne;
                else mode:=bm_neplain;
                else mode:=bm_neplain;
                end;
                end;
              ampos:=lineInfo;
              ampos:=lineInfo;
 
              bl:=bl_ne-1;
              end;
              end;
           if ((mode=bm_neplain) or (mode=bm_ifeq_scb1_ne) or (mode=bm_ifeq_scb2_ne) or (mode=bm_ifneq_scb1_ne) or (mode=bm_ifneq_scb2_ne)) and (endnoexpand<>'') and matchstr(endnoexpand,bm_neplain) then
           if ((mode=bm_neplain) or (mode=bm_ifeq_scb1_ne) or (mode=bm_ifeq_scb2_ne) or (mode=bm_ifneq_scb1_ne) or (mode=bm_ifneq_scb2_ne)) and (endnoexpand<>'') and matchstr(endnoexpand,mode) then
              begin
              begin
              setmode(length(endnoexpand),bm_neplain,bm_noexpand);
              setmode(length(endnoexpand),mode,bm_noexpand);
              case bm_expand of
              case bm_expand of
                bm_ifeq_scb1_ne  : mode:=bm_ifeq_scb1;
                bm_ifeq_scb1, bm_ifeq_scb2, bm_ifneq_scb1, bm_ifneq_scb2 : mode:=bm_expand;
                bm_ifeq_scb2_ne  : mode:=bm_ifeq_scb2;
 
                bm_ifneq_scb1_ne : mode:=bm_ifneq_scb1;
 
                bm_ifneq_scb2_ne : mode:=bm_ifneq_scb2;
 
                else mode:=bm_plain;
                else mode:=bm_plain;
                end;
                end;
              end;
              end;
{error mode}
{error mode}
           if (mode=bm_err_scb) and (bl=0) then
           if (mode=bm_err_scb) and (bl=0) then
Line 1559... Line 1532...
{ ********************************************************************* }
{ ********************************************************************* }
 
 
{ ****** paramerr ***************************************************** }
{ ****** paramerr ***************************************************** }
procedure paramerr(msg:ansistring);
procedure paramerr(msg:ansistring);
begin
begin
writeln(stderr,'Usage: '+paramstr(0)+' [<Options>] [<filename1> [<filename1> ...]]');
writeln(stderr,'Usage: '+paramstr(0)+' [<Options>] [<filename1> [<filename2> ...]]');
writeln(stderr,'Options: ');
writeln(stderr,'Options: ');
writeln(stderr,'        -o <fileneme>    Output file');
writeln(stderr,'        -o <fileneme>    Output file');
writeln(stderr,'        -p               Pascal mode (default), equal to -mm "//" -mo "[" -mc "]" -mp "#"');
writeln(stderr,'        -p               Pascal mode (default), equal to -mm "//" -mo "[" -mc "]" -mp "#"');
writeln(stderr,'        -c               C mode, equal to -mm "#" -mo "[" -mc "]" -mp "$" -l "\"#line %2 "%1\""');
writeln(stderr,'        -c               C mode, equal to -mm "#" -mo "[" -mc "]" -mp "$" -l ''#line %2 "%1"''');
writeln(stderr,'        -i               Ignore case');
writeln(stderr,'        -i               Ignore upper/lower case');
writeln(stderr,'        -l               Line info (default for C mode: "#line %2 \"%1\"")');
writeln(stderr,'        -l               Line info (default for C mode: ''#line %2 "%1"'')');
writeln(stderr,'        -I  <directory>  Include path');
writeln(stderr,'        -I  <directory>  Include path');
writeln(stderr,'        -D  <symbol>     Define symbol <symbol>');
writeln(stderr,'        -D  <symbol>     Define symbol <symbol>');
writeln(stderr,'        -mm <string>     Meta macro start string');
writeln(stderr,'        -mm <string>     Meta macro start string');
writeln(stderr,'        -mo <char>       Open bracket');
writeln(stderr,'        -mo <char>       Open bracket');
writeln(stderr,'        -mc <char>       Close bracket');
writeln(stderr,'        -mc <char>       Close bracket');
writeln(stderr,'        -mp <char>       Parameter sign');
writeln(stderr,'        -mp <char>       Parameter character');
//writeln(stderr,'      -nh              Disable hints');
//writeln(stderr,'      -nh              Disable hints');
{$ifdef ENABLE_DEBUGOUT}
{$ifdef ENABLE_DEBUGOUT}
writeln(stderr,'        -do              Enable debug output');
writeln(stderr,'        -do              Enable debug output');
{$endif}
{$endif}
writeln(stderr,'        -dd              Print definitions');
writeln(stderr,'        -dd              Print definitions');

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.