[extpascal] r812 committed - Fix overloads

11 views
Skip to first unread message

extp...@googlecode.com

unread,
Apr 3, 2013, 5:43:34 PM4/3/13
to extp...@googlegroups.com
Revision: 812
Author: wanderl...@gmail.com
Date: Wed Apr 3 14:43:01 2013
Log: Fix overloads
http://code.google.com/p/extpascal/source/detail?r=812

Modified:
/trunk/ExtJSWrapper/Ext.pas
/trunk/ExtJSWrapper/ExtFixes.txt
/trunk/ExtJSWrapper/ExtToPascal.dpr
/trunk/ExtJSWrapper/ExtToPascal.dsk

=======================================
--- /trunk/ExtJSWrapper/Ext.pas Tue Apr 2 10:52:37 2013
+++ /trunk/ExtJSWrapper/Ext.pas Wed Apr 3 14:43:01 2013
File is too large to display a diff.
=======================================
--- /trunk/ExtJSWrapper/ExtFixes.txt Tue Apr 2 10:52:37 2013
+++ /trunk/ExtJSWrapper/ExtFixes.txt Wed Apr 3 14:43:01 2013
@@ -29,11 +29,12 @@
<parameter name>,<type>
*
ExtComponent, split, Boolean, false, true,
-ExtComponent, cmargins, string, false, true,
+ExtComponent, margins, string, false, true,
ExtComponent, minSize, Integer, false, true,
ExtComponent, maxSize, Integer, false, true,
ExtComponent, anchor, string, false, true,
ExtDataRecord, TExtDataModel
+ExtEnumsWidget, String
ExtDataModel, Create,, true, false, Data, ExtObjectList, false

ExtEnumsLayout, (laAbsolute, laAccordion, laAnchor, laAutocomponent,
laAutocontainer, laBorder, laBox, laCard, laCheckboxgroup, laColumn,
laContainer, laFit, laForm, laHbox, laTable, laVbox)
@@ -87,11 +88,7 @@
ExtProgressWaitConfig, fn, ExtFunction, false, true,
ExtProgressWaitConfig, scope, ExtObject, false, true,

-*ExtComponent, xtype, (xtBox, xtButton, xtButtonGroup, xtColorPalette,
xtComponent, xtContainer, xtCycle, xtDataView, xtDatePicker, xtEditor,
xtEditorGrid, xtFlash, xtGrid, xtListView, xtPaging, xtPanel, xtProgress,
xtPropertyGrid, xtSlider, xtSpacer, xtSplitButton, xtStatusBar, xtTabPanel,
xtTreePanel, xtViewPort, xtWindow, xtToolbar, xtTBButton, xtTBFill,
xtTBItem, xtTBSeparator, xtTBSpacer, xtTBSplit, xtTBText, xtMenu,
xtColorMenu, xtDateMenu, xtMenuBaseItem, xtMenuCheckItem, xtMenuItem,
xtMenuSeparator, xtMenuTextItem, xtForm, xtCheckBox, xtCheckBoxGroup,
xtCombo, xtDateField, xtDisplayField, xtField, xtFieldSet, xtHidden,
xtHTMLEditor, xtLabel, xtNumberField, xtRadio, xtRadioGroup, xtTextArea,
xtTextField, xtTimeField, xtTrigger, xtChart, xtBarChart, xtCartesianChart,
xtColumnChart, xtLineChart, xtPieChart)
-*ExtContainer, defaultType, (ExtComponentXType)
-*ExtDomElement, defaultUnit, (CSSUnit)
-*ExtGridColumn, align, (alInherit, alLeft, alRight, alCenter, alJustify)
-*ExtPanel, buttonAlign, (baRight, baLeft, baCenter)
-*ExtFormFormPanel, buttonAlign, (ExtPanelButtonAlign)
-*ExtFormFormPanel, labelAlign, (laLeft, laTop, laRight)
+ExtGridColumn, align, (alLeft, alRight, alCenter)
+ExtPanel, buttonAlign, (buRight, buLeft, buCenter)
+ExtFormLabelable, labelAlign, (laLeft, laTop, laRight)

=======================================
--- /trunk/ExtJSWrapper/ExtToPascal.dpr Tue Apr 2 10:52:37 2013
+++ /trunk/ExtJSWrapper/ExtToPascal.dpr Wed Apr 3 14:43:01 2013
@@ -12,10 +12,10 @@

uses
SysUtils, StrUtils, Classes, ExtPascalUtils
-, Ext
+//, Ext
;

- {.$DEFINE USES_PUBLISHED}
+{.$DEFINE USES_PUBLISHED}

const
AP = '''';
@@ -90,28 +90,24 @@
9 : Result := 'TDateTime';
10, 13 : Result := 'Double';
else
- if pos('mixedcollection', lowercase(Ident)) <> 0 then
- Result := 'TExtObjectList'
- else begin
- I := pos('/', Ident);
- if I = 0 then I := LastDelimiter('[:', Ident);
- if I <> 0 then begin
- if Ident[I] <> '/' then begin
- Result := FixType(copy(Ident, 1, I-1)); // for alternative
types at methods' return choose first option
- if (Result <> 'Integer') and (Result <> 'string') then
- Result := 'TExtObjectList'
- else
- Result := 'TArrayOf' + Result;
- end
+ I := pos('/', Ident);
+ if I = 0 then I := LastDelimiter('[:', Ident);
+ if I <> 0 then begin
+ if Ident[I] <> '/' then begin
+ Result := FixType(copy(Ident, 1, I-1)); // for alternative types
at methods' return choose first option
+ if (Result <> 'Integer') and (Result <> 'String') then
+ Result := 'TExtObjectList'
else
- Result := Ident;
- exit;
- end;
- if pos('T' + JS_LIB, Ident) = 1 then
- Result := Ident
+ Result := 'TArrayOf' + Result;
+ end
else
- Result := FixIdent(Ident, true);
+ Result := Ident;
+ exit;
end;
+ if pos('T' + JS_LIB, Ident) = 1 then
+ Result := Ident
+ else
+ Result := FixIdent(Ident, true);
end
else
Result := ''
@@ -177,6 +173,7 @@
Properties.Sorted := true;
Properties.Duplicates := dupIgnore;
Methods.Sorted := true;
+ Methods.Duplicates := dupAccept;
Events.Sorted := true;
end;

@@ -447,6 +444,8 @@
while pos('@param', Params) <> 0 do begin
if not Extract(['@param', '{', '} ', ' ', ' '], Params, Matches) then
break;
+ if (Trim(Matches[2]) = '') or (pos('.', Matches[2]) <> 0) then
+ continue; // Discard embedded config objects
Optional := pos('[', Matches[2]) = 1;
if Matches.Count = 4 then
Optional := Optional or (pos('(optional)', LowerCase(Matches[3]))
<> 0);
@@ -508,7 +507,7 @@
if IsUppercase(PropName) then Static := true;
PropName := Unique(FixIdent(PropName), CurClass.Properties);
if not Static then PropName[1] := LowerCase(PropName)[1];
- if pos('__', Unique(FixIdent(PropName), CurClass.Properties)) <> 0 then
+ if pos('_', Unique(FixIdent(PropName), CurClass.Properties)) <> 0 then
exit; // Discard duplicates
Matches[0] := ReplaceStr(Matches[0], 'Object/Object[]', 'Object[]');
Matches[0] := ReplaceStr(Matches[0], 'String/Number', 'Number/String');
@@ -742,9 +741,10 @@
end
else // Update
with TMethod(Methods.Objects[J]) do begin
- Return := FixType(Fields[2]);
- Static := lowercase(Fields[3]) = 'true';
- Overload := lowercase(Fields[4]) = 'true';
+ Return := FixType(Fields[2]);
+ Static := lowercase(Fields[3]) = 'true';
+ if not Overload then
+ Overload := LowerCase(Fields[4]) = 'true';
Params.Clear;
for K := 0 to ((Fields.Count-4) div 3)-1 do
Params.AddObject(Fields[K*3+5],
TParam.Create(Fields[K*3+5], FixType(Fields[K*3+6]),
lowercase(Fields[K*3+7]) = 'true'))
@@ -879,7 +879,7 @@
if K = -1 then
AddUnresolved(Typ)
else
- Enum := Unresolved.Values[Unresolved.Names[K]] <> ''
+ Enum := pos('(', Unresolved.Values[Unresolved.Names[K]]) <> 0
end;
for J := 0 to C.Methods.Count - 1 do begin
Met := TMethod(C.Methods.Objects[J]);
@@ -896,16 +896,22 @@

procedure MixInto(C, M : TClass);
var
- I : integer;
+ I, J : integer;
begin
for I := 0 to M.Properties.Count - 1 do
if C.Properties.IndexOf(M.Properties[I]) = -1 then
C.Properties.AddObject(M.Properties[I], M.Properties.Objects[I]);
- for I := 0 to M.Methods.Count - 1 do
- if C.Methods.IndexOf(M.Methods[I]) = -1 then
+ for I := 0 to M.Methods.Count - 1 do begin
+ J := C.Methods.IndexOf(M.Methods[I]);
+ if (M.Methods[I] <> 'Create') and
+ ((J = -1) or TMethod(M.Methods.Objects[I]).Overload) then begin
+ if J <> -1 then
+ TMethod(C.Methods.Objects[J]).Overload := True;
C.Methods.AddObject(M.Methods[I], M.Methods.Objects[I]);
+ end;
+ end;
for I := 0 to M.Events.Count - 1 do
- if C.Events.IndexOf(M.Events[I]) = -1 then
+ if (C.Events.IndexOf(M.Events[I]) = -1) or
TMethod(M.Events.Objects[I]).Overload then
C.Events.AddObject(M.Events[I], M.Events.Objects[I]);
end;

@@ -1066,10 +1072,18 @@
end;
end;

+function Alias(Type_ : string) : boolean;
+var
+ I : integer;
+begin
+ I := Unresolved.IndexOfName(Type_);
+ Alias := (I <> -1) and (Unresolved.Values[Unresolved.Names[I]] <> '');
+end;
+
// Add boolean additional param to identify TExtFunction param type
function AddBoolParam(Type_ : string) : string; begin
Result := '';
- if (Type_ <> '') and (Type_[1] = 'T') and (pos('TArrayOf', Type_) = 0)
and
+ if (Type_ <> '') and not Alias(Type_) and (Type_[1] = 'T') and
(pos('TArrayOf', Type_) = 0) and
(pos('.' + Type_ + '.', '.TDateTime.TRegExp.TRegion.Tel.TVisMode.') =
0) then
if Type_ = 'TExtFunction' then
Result := ', true'
@@ -1342,7 +1356,7 @@
if Typ = 'TExtObjectList' then
writeln(Pas, Tab, 'F', Name, ' :=
TExtObjectList.Create(Self, ''', JSName, ''');')
else
- if (pos('T' + JS_LIB, Typ) = 1) and (Typ
<> 'TExtFunction') and not Enum then
+ if (pos('T' + JS_LIB, Typ) = 1) and (Typ
<> 'TExtFunction') and not Enum and not Alias(Typ) then
writeln(Pas, Tab, 'F', Name, ' := ',
Typ, '.CreateInternal(Self, ''', JSName, ''');');
writeln(Pas, 'end;'^M^J);
end;
@@ -1374,7 +1388,7 @@
writeln(Pas, Tab, 'try');
for K := 0 to Properties.Count-1 do
with TProp(Properties.Objects[K]) do
- if not Static and not Enum and (pos('T' + JS_LIB, Typ) = 1)
and (Typ <> 'TExtFunction') then
+ if not Static and not Enum and not Alias(Typ) and (pos('T' +
JS_LIB, Typ) = 1) and (Typ <> 'TExtFunction') then
writeln(Pas, Tab(2), 'F' + Name + '.Free;');
writeln(Pas, Tab, 'except end;');
writeln(Pas, Tab, 'inherited;');
=======================================
--- /trunk/ExtJSWrapper/ExtToPascal.dsk Tue Apr 2 10:52:37 2013
+++ /trunk/ExtJSWrapper/ExtToPascal.dsk Wed Apr 3 14:43:01 2013
@@ -1,35 +1,38 @@
[Closed Files]
-File_0=TSourceModule,'E:\extpascal\ext-4.2.0\src\window\MessageBox.js',0,1,353,1,148,0,0,,
-File_1=TSourceModule,'E:\extpascal\ext-4.2.0\src\data\reader\Reader.js',0,1,280,23,302,0,0,,
-File_2=TSourceModule,'E:\extpascal\ext-4.2.0\src\draw\Sprite.js',0,1,133,25,160,0,0,,
-File_3=TSourceModule,'E:\extpascal\ext-4.2.0\src\data\proxy\JsonP.js',0,1,145,16,180,0,0,,
-File_4=TSourceModule,'E:\extpascal\ext-4.2.0\src\view\View.js',0,1,389,27,390,0,0,,
-File_5=TSourceModule,'E:\extpascal\ext-4.2.0\src\selection\Model.js',0,1,76,16,89,0,0,,
-File_6=TSourceModule,'E:\extpascal\ext-4.2.0\src\data\SortTypes.js',0,1,44,24,65,0,0,,
-File_7=TSourceModule,'E:\extpascal\ext-4.2.0\src\Ext.js',0,1,1,14,6,0,0,,
-File_8=TSourceModule,'E:\extpascal\ext-4.2.0\src\data\Model.js',0,1,692,12,689,0,0,,
-File_9=TSourceModule,'E:\extpascal\ext-4.2.0\src\util\History.js',0,1,22,8,51,0,0,,
-File_10=TSourceModule,'E:\extpascal\ext-4.2.0\src\form\action\Action.js',0,1,269,12,292,0,0,,
-File_11=TSourceModule,'c:\program files (x86)\embarcadero\rad
studio\10.0\SOURCE\RTL\SYS\System.pas',0,1,22052,1,22073,0,0,,
-File_12=TSourceModule,'E:\extpascal\ext-4.2.0\src\draw\Surface.js',0,1,211,16,216,0,0,,
-File_13=TSourceModule,'E:\extpascal\ext-4.2.0\src\tab\Panel.js',0,1,413,47,415,0,0,,
-File_14=TSourceModule,'E:\extpascal\ext-4.2.0\src\dom\AbstractElement.js',0,1,5,46,9,0,0,,
-File_15=TSourceModule,'E:\extpascal\ext-4.2.0\src\draw\Component.js',0,1,261,60,262,0,0,,
-File_16=TSourceModule,'E:\extpascal\ext-4.2.0\src\draw\CompositeSprite.js',0,1,69,70,70,0,0,,
-File_17=TSourceModule,'E:\extpascal\ext-4.2.0\docs\resources\prettify\prettify.css',0,1,1,59,2,0,0,,
-File_18=TSourceModule,'E:\extpascal\ext-4.2.0\examples\build\KitchenSink\ext-theme-access\lib\prettify\prettify.css',0,1,16,5,35,0,0,,
-File_19=TSourceModule,'E:\extpascal\ext-4.2.0\examples\build\KitchenSink\ext-theme-access\resources\KitchenSink-example.css',0,1,15618,24,15641,0,0,,
+File_0=TSourceModule,'c:\program files (x86)\embarcadero\rad
studio\10.0\SOURCE\RTL\SYS\System.pas',0,1,22052,1,22073,0,0,,
+File_1=TSourceModule,'c:\program files (x86)\embarcadero\rad
studio\10.0\source\rtl\common\System.Classes.pas',0,1,6619,1,6644,0,0,,
+File_2=TSourceModule,'E:\extpascal\ext-4.2.0\src\window\MessageBox.js',0,1,353,1,148,0,0,,
+File_3=TSourceModule,'E:\extpascal\ext-4.2.0\src\data\reader\Reader.js',0,1,280,23,302,0,0,,
+File_4=TSourceModule,'E:\extpascal\ext-4.2.0\src\draw\Sprite.js',0,1,133,25,160,0,0,,
+File_5=TSourceModule,'E:\extpascal\ext-4.2.0\src\data\proxy\JsonP.js',0,1,145,16,180,0,0,,
+File_6=TSourceModule,'E:\extpascal\ext-4.2.0\src\view\View.js',0,1,389,27,390,0,0,,
+File_7=TSourceModule,'E:\extpascal\ext-4.2.0\src\selection\Model.js',0,1,76,16,89,0,0,,
+File_8=TSourceModule,'E:\extpascal\ext-4.2.0\src\data\SortTypes.js',0,1,44,24,65,0,0,,
+File_9=TSourceModule,'E:\extpascal\ext-4.2.0\src\Ext.js',0,1,1,14,6,0,0,,
+File_10=TSourceModule,'E:\extpascal\ext-4.2.0\src\data\Model.js',0,1,692,12,689,0,0,,
+File_11=TSourceModule,'E:\extpascal\ext-4.2.0\src\util\History.js',0,1,22,8,51,0,0,,
+File_12=TSourceModule,'E:\extpascal\ext-4.2.0\src\form\action\Action.js',0,1,269,12,292,0,0,,
+File_13=TSourceModule,'E:\extpascal\ext-4.2.0\src\draw\Surface.js',0,1,211,16,216,0,0,,
+File_14=TSourceModule,'E:\extpascal\ext-4.2.0\src\tab\Panel.js',0,1,413,47,415,0,0,,
+File_15=TSourceModule,'E:\extpascal\ext-4.2.0\src\dom\AbstractElement.js',0,1,5,46,9,0,0,,
+File_16=TSourceModule,'E:\extpascal\ext-4.2.0\src\draw\Component.js',0,1,261,60,262,0,0,,
+File_17=TSourceModule,'E:\extpascal\ext-4.2.0\src\draw\CompositeSprite.js',0,1,69,70,70,0,0,,
+File_18=TSourceModule,'E:\extpascal\ext-4.2.0\docs\resources\prettify\prettify.css',0,1,1,59,2,0,0,,
+File_19=TSourceModule,'E:\extpascal\ext-4.2.0\examples\build\KitchenSink\ext-theme-access\lib\prettify\prettify.css',0,1,16,5,35,0,0,,

[Modules]
-Module0=E:\extpascal\ExtJSWrapper\ExtFixes.txt
-Module1=E:\extpascal\ExtJSWrapper\Ext.pas
-Module2=E:\extpascal\ExtPascal.pas
-Module3=E:\extpascal\ExtJSWrapper\ExtToPascal.dproj
+Module0=E:\extpascal\ExtJSWrapper\ExtToPascal.dproj
+Module1=E:\extpascal\ExtJSWrapper\ExtFixes.txt
+Module2=E:\extpascal\ExtJSWrapper\Ext.pas
+Module3=E:\extpascal\ExtPascal.pas
Module4=E:\extpascal\ExtPascalUtils.pas
Module5=E:\extpascal\ExtJSWrapper\ExtOld.pas
Count=6
EditWindowCount=1

+[E:\extpascal\ExtJSWrapper\ExtToPascal.dproj]
+ModuleType=TBaseProject
+
[E:\extpascal\ExtJSWrapper\ExtFixes.txt]
ModuleType=TSourceModule

@@ -43,9 +46,6 @@
FormState=0
FormOnTop=0

-[E:\extpascal\ExtJSWrapper\ExtToPascal.dproj]
-ModuleType=TBaseProject
-
[E:\extpascal\ExtPascalUtils.pas]
ModuleType=TSourceModule
FormState=0
@@ -58,7 +58,7 @@

[EditWindow0]
ViewCount=6
-CurrentEditView=E:\extpascal\ExtJSWrapper\ExtFixes.txt
+CurrentEditView=E:\extpascal\ExtJSWrapper\ExtToPascal.dpr
View0=0
View1=1
View2=2
@@ -95,9 +95,9 @@
[View0]
CustomEditViewType=TEditView
Module=E:\extpascal\ExtJSWrapper\Ext.pas
-CursorX=19
-CursorY=6052
-TopLine=5913
+CursorX=18
+CursorY=491
+TopLine=472
LeftCol=1
Elisions=
Bookmarks=
@@ -106,9 +106,9 @@
[View1]
CustomEditViewType=TEditView
Module=E:\extpascal\ExtJSWrapper\ExtToPascal.dpr
-CursorX=1
-CursorY=15
-TopLine=1
+CursorX=32
+CursorY=746
+TopLine=726
LeftCol=1
Elisions=
Bookmarks=
@@ -117,9 +117,9 @@
[View2]
CustomEditViewType=TEditView
Module=E:\extpascal\ExtPascal.pas
-CursorX=27
-CursorY=239
-TopLine=1896
+CursorX=1
+CursorY=815
+TopLine=794
LeftCol=1
Elisions=
Bookmarks=
@@ -128,9 +128,9 @@
[View3]
CustomEditViewType=TEditView
Module=E:\extpascal\ExtJSWrapper\ExtFixes.txt
-CursorX=1
-CursorY=35
-TopLine=16
+CursorX=24
+CursorY=37
+TopLine=28
LeftCol=1
Elisions=
Bookmarks=
@@ -159,12 +159,11 @@
EditViewName=E:\extpascal\ExtJSWrapper\ExtOld.pas

[Watches]
-Count=5
-Watch0='V',256,0,18,1,0,'Watches',1
-Watch1='Result',256,0,18,1,0,'Watches',1
-Watch2='I',256,0,18,1,0,'Watches',1
-Watch3='J',256,0,18,1,0,'Watches',1
-Watch4='CurClass.Name',256,0,18,1,0,'Watches',1
+Count=4
+Watch0='Matches[2]',256,0,18,1,0,'Watches',1
+Watch1='CurClass.Name',256,0,18,1,0,'Watches',1
+Watch2='M.Methods[I]',256,0,18,1,0,'Watches',1
+Watch3='TMethod(M.Methods.Objects[I]).Overload',256,0,18,1,0,'Watches',1

[WatchWindow]
WatchColumnWidth=120
@@ -730,5 +729,5 @@
StayOnTop=0
TabPosition=1
ActiveTabID=ProjectManager
-TabDockClients=ProjectManager,ToolForm,PropertyInspector,StructureView,DataExplorerContainer,ModelViewTool,TFileExplorerForm,TemplateView,ClassBrowserTool
+TabDockClients=ProjectManager,ToolForm,PropertyInspector,StructureView,DataExplorerContainer,ModelViewTool,ClassBrowserTool,TemplateView,TFileExplorerForm

Reply all
Reply to author
Forward
0 new messages