You've already forked lazarus-ccr
Unit renaming option in ws_helper.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1000 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -29,7 +29,8 @@ Type
|
||||
TComandLineOption = (
|
||||
cloInterface, cloProxy, cloImp, cloBinder, cloWsdl, cloXsd,
|
||||
cloOutPutDirRelative, cloOutPutDirAbsolute, cloHandleWrappedParameters,
|
||||
cloGenerateDocAsComments, cloGenerateObjectCollection
|
||||
cloGenerateDocAsComments, cloGenerateObjectCollection,
|
||||
cloFileRenaming
|
||||
);
|
||||
TComandLineOptions = set of TComandLineOption;
|
||||
|
||||
@ -54,7 +55,7 @@ begin
|
||||
AAppOptions := [];
|
||||
c := #0;
|
||||
repeat
|
||||
c := GetOpt('u:pibo:a:wxydg:');
|
||||
c := GetOpt('u:pibo:a:wxydg:f:');
|
||||
case c of
|
||||
'u' :
|
||||
begin
|
||||
@ -83,6 +84,11 @@ begin
|
||||
Include(AAppOptions,cloGenerateObjectCollection);
|
||||
OptionsArgsMAP[cloGenerateObjectCollection] := OptArg;
|
||||
end;
|
||||
'f' :
|
||||
begin
|
||||
Include(AAppOptions,cloFileRenaming);
|
||||
OptionsArgsMAP[cloFileRenaming] := OptArg;
|
||||
end;
|
||||
end;
|
||||
until ( c = EndOfOptions );
|
||||
Result := OptInd;
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
resourcestring
|
||||
sUSAGE = 'ws_helper [-uMODE] [-gOPTION] [-p] [-b] [-i] [-w] [-x] [-y] [-d] [-oPATH] [-aPATH] inputFilename' + sNEW_LINE +
|
||||
sUSAGE = 'ws_helper [-uMODE] [-gOPTION] [-p] [-b] [-i] [-w] [-x] [-y] [-d] -[fSPECIFACTIONS] [-oPATH] [-aPATH] inputFilename' + sNEW_LINE +
|
||||
' -u MODE Generate the pascal translation of the WSDL input file ' + sNEW_LINE +
|
||||
' MODE value may be U for used types or A for all types' + sNEW_LINE +
|
||||
' -g Code generation option, with the following options : ' + sNEW_LINE +
|
||||
@ -14,7 +14,8 @@ resourcestring
|
||||
' -w Generate WSDL file; Can be used to get wsdl from pascal' + sNEW_LINE +
|
||||
' -x Generate XSD file; Can be used to get xsd from pascal' + sNEW_LINE +
|
||||
' -y Generate easy access interface for wrapped parameters' + sNEW_LINE +
|
||||
' -d Generate documentation as comment in the interface file.';
|
||||
' -d Generate documentation as comment in the interface file' + sNEW_LINE +
|
||||
' -f Specify unit(s) renaming option : oldName= NewName(;oldName= NewName)* ';
|
||||
sCOPYRIGHT = 'ws_helper, Web Service Toolkit 0.6 Copyright (c) 2006, 2007, 2008 by Inoussa OUEDRAOGO';
|
||||
|
||||
type
|
||||
@ -167,6 +168,41 @@ var
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure HandleUnitRenaming();
|
||||
var
|
||||
namesSpecif, strBuffer, oldName, newName : string;
|
||||
k : Integer;
|
||||
mdlList : TList;
|
||||
mdl : TPasModule;
|
||||
found : Boolean;
|
||||
begin
|
||||
namesSpecif := Trim(GetOptionArg(cloFileRenaming));
|
||||
Write('Handling unit renaming ... ');
|
||||
WriteLn(namesSpecif);
|
||||
mdlList := symtable.Package.Modules;
|
||||
strBuffer := namesSpecif;
|
||||
while True do begin
|
||||
oldName := GetToken(strBuffer,'=');
|
||||
if IsStrEmpty(oldName) then
|
||||
Break;
|
||||
newName := GetToken(strBuffer,';');
|
||||
if IsStrEmpty(newName) then
|
||||
raise Exception.CreateFmt('Invalid option unit renaming specification : "%s".',[namesSpecif]);
|
||||
found := False;
|
||||
for k := 0 to Pred(mdlList.Count) do begin
|
||||
mdl := TPasModule(mdlList[k]);
|
||||
if SameText(oldName,mdl.Name) then begin
|
||||
mdl.Name := newName;
|
||||
WriteLn(Format('Unit renamed, old name = "%s", new name = "%s".',[oldName,newName]));
|
||||
found := True;
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
if not found then
|
||||
WriteLn(Format('Unit not found : "%s".',[oldName]));
|
||||
end;
|
||||
end;
|
||||
|
||||
function ProcessFile():Boolean;
|
||||
Var
|
||||
mtdaFS: TMemoryStream;
|
||||
@ -177,6 +213,7 @@ var
|
||||
wrappedParams : Boolean;
|
||||
begin
|
||||
Result := False;
|
||||
HandleUnitRenaming();
|
||||
wrappedParams := ( cloHandleWrappedParameters in AppOptions );
|
||||
strStream := nil;
|
||||
rsrcStrm := nil;
|
||||
@ -232,7 +269,7 @@ var
|
||||
rsrcStrm := TMemoryStream.Create();
|
||||
mtdaFS.Position := 0;
|
||||
BinToWstRessource(UpperCase(symtable.CurrentModule.Name),mtdaFS,rsrcStrm);
|
||||
rsrcStrm.SaveToFile(outPath + ChangeFileExt(ExtractFileName(inFileName),'.' + sWST_EXTENSION));
|
||||
rsrcStrm.SaveToFile(outPath + ChangeFileExt(ExtractFileName(symtable.CurrentModule.Name),'.' + sWST_EXTENSION));
|
||||
end;
|
||||
|
||||
if ( cloWsdl in AppOptions ) then begin
|
||||
|
Reference in New Issue
Block a user