Line 1... |
Line 1... |
{*!
|
{*!
|
bmp -- babel macro processor
|
bmp -- babel macro processor
|
Copyright (C) 2009-2010 ZTEX e.K.
|
Copyright (C) 2009-2011 ZTEX GmbH.
|
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 54... |
Line 54... |
|
|
ignorecase
|
ignorecase
|
exactcase
|
exactcase
|
|
|
noexpand
|
noexpand
|
|
|
|
disablelineinfo disables line info for next define
|
|
|
}
|
}
|
|
|
{$mode objfpc}
|
{$mode objfpc}
|
|
|
{$define USE_SHORTSTRINGS} // shortstrings are two times faster
|
{$define USE_SHORTSTRINGS} // shortstrings are two times faster
|
Line 423... |
Line 426... |
|
|
ifs : array[0..maxifs] of byte;
|
ifs : array[0..maxifs] of byte;
|
ifli : array[0..maxifs] of dword;
|
ifli : array[0..maxifs] of dword;
|
bli : array[0..maxbs] of dword;
|
bli : array[0..maxbs] of dword;
|
|
|
|
disablelineinfo : boolean;
|
|
|
label endparse;
|
label endparse;
|
|
|
begin
|
begin
|
amacro:=nil;
|
amacro:=nil;
|
t4.s:=copy(' '+bc_pm, length(bc_pm)+1,4);
|
t4.s:=copy(' '+bc_pm, length(bc_pm)+1,4);
|
Line 447... |
Line 452... |
rbp:=0;
|
rbp:=0;
|
mode:=bm_plain;
|
mode:=bm_plain;
|
ifc:=-1;
|
ifc:=-1;
|
outfile:=1;
|
outfile:=1;
|
bm_expand:=bm_plain;
|
bm_expand:=bm_plain;
|
|
disablelineinfo:=false;
|
|
|
prevli:=dword(-1);
|
prevli:=dword(-1);
|
ampos:=0;
|
ampos:=0;
|
while (buf<>nil) and (bmp_exit<>bmp_exit_usererror) do
|
while (buf<>nil) and (bmp_exit<>bmp_exit_usererror) do
|
begin
|
begin
|
Line 837... |
Line 843... |
if macros[lastmacro]^.paramsep[macros[lastmacro]^.pn]='' then macros[lastmacro]^.paramsep[macros[lastmacro]^.pn]:=bc_cb;
|
if macros[lastmacro]^.paramsep[macros[lastmacro]^.pn]='' then macros[lastmacro]^.paramsep[macros[lastmacro]^.pn]:=bc_cb;
|
end;
|
end;
|
for i:=1 to macros[lastmacro]^.pn-1 do
|
for i:=1 to macros[lastmacro]^.pn-1 do
|
if macros[lastmacro]^.paramsep[i]='' then macros[lastmacro]^.paramsep[i]:=bc_cb+bc_ob;
|
if macros[lastmacro]^.paramsep[i]='' then macros[lastmacro]^.paramsep[i]:=bc_cb+bc_ob;
|
lastmodestr1(bm_def_scb3, macros[lastmacro]^.rsize, macros[lastmacro]^.r, macros[lastmacro]^.li);
|
lastmodestr1(bm_def_scb3, macros[lastmacro]^.rsize, macros[lastmacro]^.r, macros[lastmacro]^.li);
|
|
if disablelineinfo then
|
|
for i:=0 to macros[lastmacro]^.rsize-1 do
|
|
macros[lastmacro]^.li[i]:=macros[lastmacro]^.li[i] or 2048;
|
|
disablelineinfo:=false;
|
end;
|
end;
|
if (mode=bm_def_scbu) and (bl=0) then
|
if (mode=bm_def_scbu) and (bl=0) then
|
begin
|
begin
|
sx:=lastmodestr1(bm_def_scbu);
|
sx:=lastmodestr1(bm_def_scbu);
|
j:=0;
|
j:=0;
|
Line 1009... |
Line 1019... |
end;
|
end;
|
if matchstr(bc_pm+'disableout',bm_pm) then bufm[rbp]:=bm_outfile_a;
|
if matchstr(bc_pm+'disableout',bm_pm) then bufm[rbp]:=bm_outfile_a;
|
if matchstr(bc_pm+'enableout',bm_pm) then bufm[rbp]:=bm_outfile_a+1;
|
if matchstr(bc_pm+'enableout',bm_pm) then bufm[rbp]:=bm_outfile_a+1;
|
if matchstr(bc_pm+'ignorecase',bm_pm) then bp_icase:=true;
|
if matchstr(bc_pm+'ignorecase',bm_pm) then bp_icase:=true;
|
if matchstr(bc_pm+'exactcase',bm_pm) then bp_icase:=false;
|
if matchstr(bc_pm+'exactcase',bm_pm) then bp_icase:=false;
|
|
if matchstr(bc_pm+'disablelineinfo',bm_pm) then disablelineinfo:=true;
|
end;
|
end;
|
|
|
{expanding mode}
|
{expanding mode}
|
if ((mode>=bm_em_p0) and (mode<=bm_em_pz)) and (matchstr(bp_icase, amacro^.paramsep[mode-bm_em_p0], mode)) then
|
if ((mode>=bm_em_p0) and (mode<=bm_em_pz)) and (matchstr(bp_icase, amacro^.paramsep[mode-bm_em_p0], mode)) then
|
begin
|
begin
|