mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2026-02-03 23:16:35 +01:00
jcf2: update from the main repository to r823
git-svn-id: trunk@22217 -
This commit is contained in:
parent
f6b8e564d0
commit
66216cd1eb
@ -36,7 +36,7 @@ uses
|
||||
SysUtils,
|
||||
FileCtrl,
|
||||
JcfStringUtils in '..\..\Utils\JcfStringUtils.pas',
|
||||
JcfFileUtils in '..\..\Utils\JcfFileUtils.pas',
|
||||
//JcfFileUtils in '..\..\Utils\JcfFileUtils.pas',
|
||||
JcfSystemUtils in '..\..\Utils\JcfSystemUtils.pas',
|
||||
Converter in '..\..\ReadWrite\Converter.pas',
|
||||
FileConverter in '..\..\ReadWrite\FileConverter.pas',
|
||||
@ -55,8 +55,8 @@ uses
|
||||
JcfLog in '..\..\Utils\JcfLog.pas',
|
||||
fShowParseTree in '..\..\Parse\UI\fShowParseTree.pas' {frmShowParseTree},
|
||||
SetUses in '..\..\Settings\SetUses.pas',
|
||||
JCFSetBase in '..\..\Settings\JCFSetBase.pas',
|
||||
JCFSettings in '..\..\Settings\JCFSettings.pas',
|
||||
JcfSetBase in '..\..\Settings\JcfSetBase.pas',
|
||||
JcfSettings in '..\..\Settings\JcfSettings.pas',
|
||||
SetAlign in '..\..\Settings\SetAlign.pas',
|
||||
SetCaps in '..\..\Settings\SetCaps.pas',
|
||||
SetClarify in '..\..\Settings\SetClarify.pas',
|
||||
@ -126,7 +126,7 @@ uses
|
||||
PreProcessorExpressionTokens in '..\..\Parse\PreProcessor\PreProcessorExpressionTokens.pas',
|
||||
PreProcessorExpressionParser in '..\..\Parse\PreProcessor\PreProcessorExpressionParser.pas',
|
||||
PreProcessorExpressionTokenise in '..\..\Parse\PreProcessor\PreProcessorExpressionTokenise.pas',
|
||||
JCFHelp in '..\..\Utils\JCFHelp.pas',
|
||||
JcfHelp in '..\..\Utils\JcfHelp.pas',
|
||||
SettingsTypes in '..\..\Settings\SettingsTypes.pas',
|
||||
SetPreProcessor in '..\..\Settings\SetPreProcessor.pas',
|
||||
UnitNameCaps in '..\..\Process\Capitalisation\UnitNameCaps.pas',
|
||||
@ -215,7 +215,7 @@ var
|
||||
{ look for something that is not a -/\ param }
|
||||
lsOpt := ParamStr(liLoop);
|
||||
|
||||
if (StrLeft(lsOpt, 1) <> '-') and (StrLeft(lsOpt, 1) <> '/') and
|
||||
if (StrLeft(lsOpt, 1) <> '-') and {$IFNDEF UNIX} (StrLeft(lsOpt, 1) <> '/') and {$ENDIF}
|
||||
(StrLeft(lsOpt, 1) <> '\') and (StrLeft(lsOpt, 1) <> '?') then
|
||||
begin
|
||||
// must be a path
|
||||
|
||||
@ -32,7 +32,7 @@ uses
|
||||
JcfRegistrySettings, JCFSetBase, JCFSettings, SetAlign, SetAsm, SetCaps,
|
||||
SetClarify, SetComments, SetIndent, SetObfuscate, SetPreProcessor,
|
||||
SetReplace, SetReturns, SetSpaces, SettingsTypes, SetTransform, SetUses,
|
||||
SetWordList, SettingsStream, fJcfErrorDisplay, Delay, FileUtils, IntList,
|
||||
SetWordList, SettingsStream, fJcfErrorDisplay, Delay, fileutils, IntList,
|
||||
JcfFontSetFunctions, JCFHelp, JcfLog, JcfMiscFunctions, fAbout,
|
||||
JcfVersionConsts, LazarusPackageIntf;
|
||||
|
||||
|
||||
@ -7,6 +7,14 @@
|
||||
|
||||
// define the appropriate DelphiXX constants
|
||||
|
||||
{$IFDEF VER210}
|
||||
{$IFDEF BCB}
|
||||
{$DEFINE BCB14}
|
||||
{$ELSE}
|
||||
{$DEFINE DELPHI14}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF VER200}
|
||||
{$IFDEF BCB}
|
||||
{$DEFINE BCB12}
|
||||
|
||||
@ -162,13 +162,13 @@
|
||||
<VersionInfoKeys>
|
||||
<VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileDescription">JEDI Code Format</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileVersion">2.43.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileVersion">2.44.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="InternalName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductVersion">2.43</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductVersion">2.44</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
|
||||
</VersionInfoKeys>
|
||||
</Delphi.Personality>
|
||||
|
||||
@ -162,13 +162,13 @@
|
||||
<VersionInfoKeys>
|
||||
<VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileDescription">JEDI Code Format</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileVersion">2.43.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileVersion">2.44.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="InternalName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductVersion">2.43</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductVersion">2.44</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
|
||||
</VersionInfoKeys>
|
||||
</Delphi.Personality>
|
||||
|
||||
@ -31,7 +31,7 @@ interface
|
||||
|
||||
const
|
||||
PROGRAM_VERSION = '2.44';
|
||||
PROGRAM_DATE = 'March 2009';
|
||||
PROGRAM_DATE = 'August 2009';
|
||||
PROGRAM_HOME_PAGE = 'http://jedicodeformat.sourceforge.net/';
|
||||
PROGRAM_SOURCEFORGE_HOME_PAGE = 'http://sourceforge.net/projects/jedicodeformat/';
|
||||
PROGRAM_SVN_TRUNK = 'http://jedicodeformat.svn.sourceforge.net/svnroot/jedicodeformat/trunk/CodeFormat/Jcf2/';
|
||||
|
||||
@ -162,13 +162,13 @@
|
||||
<VersionInfoKeys>
|
||||
<VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileDescription">JCF Notepad</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileVersion">2.43.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileVersion">2.44.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="InternalName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductVersion">2.43</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductVersion">2.44</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
|
||||
</VersionInfoKeys>
|
||||
</Delphi.Personality>
|
||||
|
||||
@ -162,13 +162,13 @@
|
||||
<VersionInfoKeys>
|
||||
<VersionInfoKeys Name="CompanyName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileDescription">JCF Notepad</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileVersion">2.43.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="FileVersion">2.44.0.0</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="InternalName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductVersion">2.43</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="ProductVersion">2.44</VersionInfoKeys>
|
||||
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
|
||||
</VersionInfoKeys>
|
||||
</Delphi.Personality>
|
||||
|
||||
@ -412,10 +412,13 @@ begin
|
||||
raise TEParseError.Create('Unexpected token, expected ' +
|
||||
DescribeTarget, lcCurrentToken);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
Inc(fiTokenCount);
|
||||
{$IFNDEF COMMAND_LINE}
|
||||
if (fiTokenCount mod UPDATE_INTERVAL) = 0 then
|
||||
Application.ProcessMessages;
|
||||
Application.ProcessMessages;
|
||||
{$ENDIF}
|
||||
|
||||
{ add trailing white space
|
||||
fixes some problems, causes others
|
||||
|
||||
@ -479,7 +479,7 @@ var
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
if not (CharInSet(Current, [':', '+', '-', '*', '/'])) then
|
||||
if not (CharInSet(Char(Current), [':', '+', '-', '*', '/'])) then
|
||||
exit;
|
||||
|
||||
TwoChars := CurrentChars(2);
|
||||
@ -760,11 +760,15 @@ const
|
||||
var
|
||||
lcList: TSourceTokenList;
|
||||
lcNew: TSourceToken;
|
||||
{$IFNDEF COMMAND_LINE}
|
||||
liCounter: integer;
|
||||
{$ENDIF}
|
||||
begin
|
||||
Assert(SourceCode <> '');
|
||||
|
||||
{$IFNDEF COMMAND_LINE}
|
||||
liCounter := 0;
|
||||
{$ENDIF}
|
||||
lcList := TSourceTokenList.Create;
|
||||
|
||||
while not EndOfFile do
|
||||
@ -772,9 +776,11 @@ begin
|
||||
lcNew := GetNextToken;
|
||||
lcList.Add(lcNew);
|
||||
|
||||
{$IFNDEF COMMAND_LINE}
|
||||
Inc(liCounter);
|
||||
if (liCounter mod UPDATE_INTERVAL) = 0 then
|
||||
Application.ProcessMessages;
|
||||
Application.ProcessMessages;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
Result := lcList;
|
||||
|
||||
@ -179,13 +179,17 @@ end;
|
||||
|
||||
|
||||
procedure TPreProcessorParseTree.NextToken;
|
||||
{$IFNDEF COMMAND_LINE}
|
||||
const
|
||||
UPDATE_INTERVAL = 512;
|
||||
UPDATE_INTERVAL = 512;
|
||||
{$ENDIF}
|
||||
begin
|
||||
Inc(fiCurrentTokenIndex);
|
||||
|
||||
|
||||
{$IFNDEF COMMAND_LINE}
|
||||
if (fiCurrentTokenIndex mod UPDATE_INTERVAL) = 0 then
|
||||
Application.ProcessMessages;
|
||||
Application.ProcessMessages;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TPreProcessorParseTree.CurrentToken: TSourceToken;
|
||||
|
||||
@ -156,8 +156,10 @@ begin
|
||||
|
||||
if lc.FinalSummary(lsMessage) then
|
||||
OnMessage('', lsMessage, mtFinalSummary, -1, -1);
|
||||
|
||||
|
||||
{$IFNDEF COMMAND_LINE}
|
||||
Application.ProcessMessages;
|
||||
{$ENDIF}
|
||||
|
||||
{ if the main process fired, do the follow set too }
|
||||
for liLoop := Low(pcFollowSet) to High(pcFollowSet) do
|
||||
|
||||
@ -72,6 +72,7 @@ const
|
||||
{$IFDEF DELPHI10} REG_ROOT_KEY = '\Software\Borland\BDS\4.0\Jedi\JCF'; {$ENDIF}
|
||||
{$IFDEF DELPHI11} REG_ROOT_KEY = '\Software\Borland\BDS\5.0\Jedi\JCF'; {$ENDIF}
|
||||
{$IFDEF DELPHI12} REG_ROOT_KEY = '\Software\CodeGear\BDS\6.0\Jedi\JCF'; {$ENDIF}
|
||||
{$IFDEF DELPHI14} REG_ROOT_KEY = '\Software\CodeGear\BDS\7.0\Jedi\JCF'; {$ENDIF}
|
||||
|
||||
const
|
||||
SOURCE_FILE_FILTERS =
|
||||
|
||||
@ -48,23 +48,23 @@ type
|
||||
private
|
||||
{ the strings for the in and out code }
|
||||
fsInputCode, fsOutputCode: WideString;
|
||||
fsFileName: string;
|
||||
fsFileName: String;
|
||||
|
||||
{ classes to lex and parse the source }
|
||||
fcTokeniser: TBuildTokenList;
|
||||
fcTokeniser: TBuildTokenList;
|
||||
fcBuildParseTree: TBuildParseTree;
|
||||
|
||||
{ used for testing - just run 1 process }
|
||||
fcSingleProcess: TTreeNodeVisitorType;
|
||||
|
||||
{ state }
|
||||
fiTokenCount: integer;
|
||||
fbConvertError: boolean;
|
||||
fiTokenCount: Integer;
|
||||
fbConvertError: Boolean;
|
||||
fOnStatusMessage: TStatusMessageProc;
|
||||
|
||||
{ false for commandline UI - don't put up a parse fail dialog
|
||||
This could be in batch file on a server }
|
||||
fbGuiMessages: boolean;
|
||||
fbGuiMessages: Boolean;
|
||||
|
||||
function GetOnStatusMessage: TStatusMessageProc;
|
||||
procedure SetOnStatusMessage(const Value: TStatusMessageProc);
|
||||
@ -72,9 +72,7 @@ type
|
||||
procedure SendExceptionMessage(const pe: Exception);
|
||||
|
||||
{ call this to report the current state of the proceedings }
|
||||
procedure SendStatusMessage(const psUnit, psMessage: string;
|
||||
const peMessageType: TStatusMessageType;
|
||||
const piY, piX: integer);
|
||||
procedure SendStatusMessage(const psUnit, psMessage: String; const peMessageType: TStatusMessageType; const piY, piX: Integer);
|
||||
|
||||
function GetRoot: TParseTreeNode;
|
||||
|
||||
@ -87,24 +85,24 @@ type
|
||||
destructor Destroy; override;
|
||||
|
||||
procedure Convert;
|
||||
procedure ConvertPart(const piStartIndex, piEndIndex: integer);
|
||||
procedure ConvertPart(const piStartIndex, piEndIndex: Integer);
|
||||
|
||||
procedure ShowParseTree;
|
||||
procedure Clear;
|
||||
|
||||
procedure CollectOutput(const pcRoot: TParseTreeNode);
|
||||
|
||||
property InputCode: WideString read fsInputCode write fsInputCode;
|
||||
property OutputCode: WideString read fsOutputCode write fsOutputCode;
|
||||
property FileName: string read fsFileName write fsFileName;
|
||||
property InputCode: WideString Read fsInputCode Write fsInputCode;
|
||||
property OutputCode: WideString Read fsOutputCode Write fsOutputCode;
|
||||
property FileName: String Read fsFileName Write fsFileName;
|
||||
|
||||
property TokenCount: integer Read fiTokenCount;
|
||||
property ConvertError: boolean Read fbConvertError;
|
||||
property GuiMessages: boolean read fbGuiMessages write fbGuiMessages;
|
||||
property TokenCount: Integer Read fiTokenCount;
|
||||
property ConvertError: Boolean Read fbConvertError;
|
||||
property GuiMessages: Boolean Read fbGuiMessages Write fbGuiMessages;
|
||||
|
||||
property Root: TParseTreeNode Read GetRoot;
|
||||
|
||||
property OnStatusMessage: TStatusMessageProc read GetOnStatusMessage write SetOnStatusMessage;
|
||||
property OnStatusMessage: TStatusMessageProc Read GetOnStatusMessage Write SetOnStatusMessage;
|
||||
property SingleProcess: TTreeNodeVisitorType Read fcSingleProcess Write fcSingleProcess;
|
||||
end;
|
||||
|
||||
@ -112,16 +110,16 @@ implementation
|
||||
|
||||
uses
|
||||
{ delphi }
|
||||
Controls, Forms,
|
||||
AllProcesses, Controls, Forms,
|
||||
{ local }
|
||||
JcfStringUtils,
|
||||
fShowParseTree, JcfRegistrySettings,
|
||||
JcfSettings, JcfStringUtils,
|
||||
JcfUnicode,
|
||||
SourceTokenList, SourceToken,
|
||||
fShowParseTree, JcfSettings, JcfRegistrySettings,
|
||||
AllProcesses, ParseError, PreProcessorParseTree,
|
||||
TreeWalker, VisitSetXY, VisitSetNesting;
|
||||
ParseError, PreProcessorParseTree,
|
||||
SourceToken,
|
||||
SourceTokenList, TreeWalker, VisitSetNesting, VisitSetXY;
|
||||
|
||||
function StrInsert(const psSub, psMain: string; const piPos: integer): string;
|
||||
function StrInsert(const psSub, psMain: String; const piPos: Integer): String;
|
||||
begin
|
||||
Result := StrLeft(psMain, piPos - 1) + psSub + StrRestOf(psMain, piPos);
|
||||
end;
|
||||
@ -132,11 +130,11 @@ begin
|
||||
inherited;
|
||||
|
||||
{ owned objects }
|
||||
fcTokeniser := TBuildTokenList.Create;
|
||||
fcTokeniser := TBuildTokenList.Create;
|
||||
fcTokeniser.FileName := FileName;
|
||||
fcBuildParseTree := TBuildParseTree.Create;
|
||||
fcSingleProcess := nil;
|
||||
fbGuiMessages := True; // use Ui to show parse errors by default
|
||||
fcSingleProcess := nil;
|
||||
fbGuiMessages := True; // use Ui to show parse errors by default
|
||||
end;
|
||||
|
||||
destructor TConverter.Destroy;
|
||||
@ -149,27 +147,31 @@ end;
|
||||
|
||||
procedure TConverter.Clear;
|
||||
begin
|
||||
fsInputCode := '';
|
||||
fsOutputCode := '';
|
||||
fsInputCode := '';
|
||||
fsOutputCode := '';
|
||||
fcSingleProcess := nil;
|
||||
end;
|
||||
|
||||
procedure TConverter.Convert;
|
||||
var
|
||||
lcTokenList: TSourceTokenList;
|
||||
{$IFNDEF COMMAND_LINE}
|
||||
leOldCursor: TCursor;
|
||||
{$ENDIF}
|
||||
begin
|
||||
fbConvertError := False;
|
||||
|
||||
{$IFNDEF COMMAND_LINE}
|
||||
leOldCursor := Screen.Cursor;
|
||||
try { finally normal cursor }
|
||||
|
||||
|
||||
// this can take a long time for large files
|
||||
Screen.Cursor := crHourGlass;
|
||||
{$ENDIF}
|
||||
|
||||
// turn text into tokens
|
||||
fcTokeniser.SourceCode := InputCode;
|
||||
fcTokeniser.FileName := FileName;
|
||||
fcTokeniser.FileName := FileName;
|
||||
|
||||
lcTokenList := fcTokeniser.BuildTokenList;
|
||||
try { finally free the list }
|
||||
@ -181,7 +183,7 @@ begin
|
||||
if FormatSettings.PreProcessor.Enabled then
|
||||
RemoveConditionalCompilation(lcTokenList);
|
||||
|
||||
// make a parse tree from it
|
||||
// make a parse tree from it
|
||||
fcBuildParseTree.TokenList := lcTokenList;
|
||||
fcBuildParseTree.BuildParseTree;
|
||||
|
||||
@ -211,7 +213,7 @@ begin
|
||||
lcTokenList.Free;
|
||||
end;
|
||||
|
||||
try
|
||||
try
|
||||
|
||||
if not fbConvertError then
|
||||
begin
|
||||
@ -239,9 +241,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFNDEF COMMAND_LINE}
|
||||
finally
|
||||
Screen.Cursor := leOldCursor;
|
||||
end;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{ this is what alters the code (in parse tree form) from source to output }
|
||||
@ -261,7 +265,7 @@ end;
|
||||
|
||||
procedure TConverter.ApplySingleProcess;
|
||||
var
|
||||
lcProcess: TBaseTreeNodeVisitor;
|
||||
lcProcess: TBaseTreeNodeVisitor;
|
||||
lcTreeWalker: TTreeWalker;
|
||||
begin
|
||||
lcTreeWalker := TTreeWalker.Create;
|
||||
@ -304,7 +308,7 @@ end;
|
||||
|
||||
procedure TConverter.CollectOutput(const pcRoot: TParseTreeNode);
|
||||
var
|
||||
liLoop: integer;
|
||||
liLoop: Integer;
|
||||
begin
|
||||
Assert(pcRoot <> nil);
|
||||
|
||||
@ -318,7 +322,7 @@ begin
|
||||
// recurse, write out all child nodes
|
||||
for liLoop := 0 to pcRoot.ChildNodeCount - 1 do
|
||||
begin
|
||||
CollectOutput(pcRoot.ChildNodes[liLoop])
|
||||
CollectOutput(pcRoot.ChildNodes[liLoop]);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -335,13 +339,13 @@ end;
|
||||
|
||||
procedure TConverter.SendExceptionMessage(const pe: Exception);
|
||||
var
|
||||
lsMessage: string;
|
||||
liX, liY: integer;
|
||||
leParseError: TEParseError;
|
||||
leMessageType: TStatusMessageType;
|
||||
lsMessage: String;
|
||||
liX, liY: Integer;
|
||||
leParseError: TEParseError;
|
||||
leMessageType: TStatusMessageType;
|
||||
begin
|
||||
lsMessage := 'Exception ' + pe.ClassName +
|
||||
' ' + pe.Message;
|
||||
' ' + pe.Message;
|
||||
|
||||
if pe is TEParseError then
|
||||
begin
|
||||
@ -361,9 +365,7 @@ begin
|
||||
SendStatusMessage('', lsMessage, leMessageType, liY, liX);
|
||||
end;
|
||||
|
||||
procedure TConverter.SendStatusMessage(const psUnit, psMessage: string;
|
||||
const peMessageType: TStatusMessageType;
|
||||
const piY, piX: integer);
|
||||
procedure TConverter.SendStatusMessage(const psUnit, psMessage: String; const peMessageType: TStatusMessageType; const piY, piX: Integer);
|
||||
begin
|
||||
if Assigned(fOnStatusMessage) then
|
||||
fOnStatusMessage(psUnit, psMessage, peMessageType, piY, piX);
|
||||
@ -375,13 +377,13 @@ begin
|
||||
fShowParseTree.ShowParseTree(fcBuildParseTree.Root);
|
||||
end;
|
||||
|
||||
procedure TConverter.ConvertPart(const piStartIndex, piEndIndex: integer);
|
||||
procedure TConverter.ConvertPart(const piStartIndex, piEndIndex: Integer);
|
||||
const
|
||||
FORMAT_START = '{<JCF_!*$>}';
|
||||
FORMAT_END = '{</JCF_!*$>}';
|
||||
FORMAT_END = '{</JCF_!*$>}';
|
||||
var
|
||||
liRealInputStart, liRealInputEnd: integer;
|
||||
liOutputStart, liOutputEnd: integer;
|
||||
liRealInputStart, liRealInputEnd: Integer;
|
||||
liOutputStart, liOutputEnd: Integer;
|
||||
lsNewOutput: WideString;
|
||||
begin
|
||||
Assert(piStartIndex >= 0);
|
||||
@ -390,17 +392,17 @@ begin
|
||||
|
||||
{ round to nearest end of line }
|
||||
liRealInputStart := piStartIndex;
|
||||
liRealInputEnd := piEndIndex;
|
||||
liRealInputEnd := piEndIndex;
|
||||
|
||||
{ get to the start of the line }
|
||||
while (liRealInputStart > 1) and (not WideCharIsReturn(InputCode[liRealInputStart -1 ])) do
|
||||
dec(liRealInputStart);
|
||||
while (liRealInputStart > 1) and (not WideCharIsReturn(InputCode[liRealInputStart - 1])) do
|
||||
Dec(liRealInputStart);
|
||||
|
||||
{ get to the start of the next line }
|
||||
while (liRealInputEnd < Length(InputCode)) and (not WideCharIsReturn(InputCode[liRealInputEnd])) do
|
||||
inc(liRealInputEnd);
|
||||
Inc(liRealInputEnd);
|
||||
while (liRealInputEnd < Length(InputCode)) and (WideCharIsReturn(InputCode[liRealInputEnd])) do
|
||||
inc(liRealInputEnd);
|
||||
Inc(liRealInputEnd);
|
||||
|
||||
{ put markers into the input }
|
||||
fsInputCode := StrInsert(FORMAT_END, fsInputCode, liRealInputEnd);
|
||||
@ -411,7 +413,7 @@ begin
|
||||
{ locate the markers in the output,
|
||||
and replace before and after }
|
||||
liOutputStart := Pos(WideString(FORMAT_START), fsOutputCode) + Length(FORMAT_START);
|
||||
liOutputEnd := Pos(WideString(FORMAT_END), fsOutputCode);
|
||||
liOutputEnd := Pos(WideString(FORMAT_END), fsOutputCode);
|
||||
|
||||
|
||||
{ splice }
|
||||
|
||||
@ -362,9 +362,11 @@ begin
|
||||
ProcessFile(lsDir + lsNames[liLoop]);
|
||||
if fbAbort then
|
||||
break;
|
||||
|
||||
|
||||
{$IFNDEF COMMAND_LINE}
|
||||
// refresh the GUI
|
||||
Application.ProcessMessages;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
{ all subdirs }
|
||||
@ -396,7 +398,11 @@ begin
|
||||
Assert(psFiles <> nil);
|
||||
|
||||
{ for all pas files in the dir }
|
||||
{$IFDEF FPC}
|
||||
lsSearch := psDir + AllFilesMask;
|
||||
{$ELSE}
|
||||
lsSearch := psDir + '*.*';
|
||||
{$ENDIF}
|
||||
FillChar(rSearch, Sizeof(TSearchRec), 0);
|
||||
bDone := (FindFirst(lsSearch, 0, rSearch) <> 0);
|
||||
|
||||
@ -426,7 +432,12 @@ begin
|
||||
Assert(psDir <> '');
|
||||
Assert(psFiles <> nil);
|
||||
|
||||
{$IFDEF FPC}
|
||||
lsSearch := psDir + AllFilesMask;
|
||||
{$ELSE}
|
||||
lsSearch := psDir + '*.*';
|
||||
{$ENDIF}
|
||||
|
||||
FillChar(rSearch, Sizeof(TSearchRec), 0);
|
||||
bDone := (FindFirst(lsSearch, faDirectory, rSearch) <> 0);
|
||||
|
||||
|
||||
@ -93,8 +93,10 @@ const
|
||||
|
||||
|
||||
{$IFNDEF DELPHI12}
|
||||
{$IFNDEF DELPHI14}
|
||||
function CharInSet(const C: Char; const testSet: TSysCharSet): Boolean;
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
function CharIsControl(const C: Char): Boolean;
|
||||
function CharIsAlpha(const C: Char): Boolean;
|
||||
function CharIsAlphaNum(const C: Char): Boolean;
|
||||
@ -164,17 +166,17 @@ uses
|
||||
Unix
|
||||
{$endif}
|
||||
{$ifdef fpc}
|
||||
, LCLIntf, FileUtil
|
||||
, LCLIntf, fileutil
|
||||
{$endif};
|
||||
|
||||
{$IFNDEF DELPHI12}
|
||||
|
||||
{$IFNDEF DELPHI14}
|
||||
// define CharInSet for Delphi 2007 or earlier
|
||||
function CharInSet(const C: Char; const testSet: TSysCharSet): Boolean;
|
||||
begin
|
||||
Result := C in testSet;
|
||||
end;
|
||||
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
function CharIsAlpha(const C: Char): Boolean;
|
||||
|
||||
@ -67,7 +67,7 @@ uses
|
||||
Unix
|
||||
{$endif}
|
||||
{$ifdef fpc}
|
||||
,LCLIntf, FileUtil, Dialogs
|
||||
,LCLIntf, fileutil, Dialogs
|
||||
{$endif}
|
||||
;
|
||||
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
This directory contains a copy (sometimes modified) of r803 jcf2 svn tree: https://jedicodeformat.svn.sourceforge.net/svnroot/jedicodeformat/trunk/CodeFormat/Jcf2
|
||||
This directory contains a copy (sometimes modified) of r823 jcf2 svn tree: https://jedicodeformat.svn.sourceforge.net/svnroot/jedicodeformat/trunk/CodeFormat/Jcf2
|
||||
|
||||
Only command line utility works currently.
|
||||
Loading…
Reference in New Issue
Block a user