Ignore:
Timestamp:
Dec 8, 2010, 10:00:30 AM (14 years ago)
Author:
george
Message:
  • Removed: Generic template usage form project code. Replaced by TListObject descendants.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Compiler/USourceCode.pas

    r25 r26  
    5858
    5959  // TListExpression = TGObjectList<Integer, TExpression>
    60   {$DEFINE TGObjectListIndex := Integer}
    61   {$DEFINE TGObjectListItem := TExpression}
    62   {$DEFINE TGObjectListList := TObjectListExpression}
    63   {$DEFINE TGObjectList := TListExpression}
    64   {$DEFINE TGObjectListSortCompare := TObjectListSortCompareExpression}
    65   {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterExpression}
    66   {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterExpression}
    67   {$DEFINE INTERFACE}
    68   {$I 'GenericObjectList.inc'}
     60  TListExpression = class(TListObject);
    6961
    7062  { TFunctionCall }
     
    129121
    130122  // TListCaseOfEndBranche = TGObjectList<Integer, TCaseOfEndBranche>
    131   {$DEFINE TGObjectListIndex := Integer}
    132   {$DEFINE TGObjectListItem := TCaseOfEndBranche}
    133   {$DEFINE TGObjectListList := TObjectListCaseOfEndBranche}
    134   {$DEFINE TGObjectList := TListCaseOfEndBranche}
    135   {$DEFINE TGObjectListSortCompare := TObjectListSortCompareCaseOfEndBranche}
    136   {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterCaseOfEndBranche}
    137   {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterCaseOfEndBranche}
    138   {$DEFINE INTERFACE}
    139   {$I 'GenericObjectList.inc'}
     123  TListCaseOfEndBranche = class(TListObject);
    140124
    141125  TCaseOfEnd = class(TCommand)
     
    158142
    159143  // TCommandList = TGObjectList<Integer, TCommand>
    160   {$DEFINE TGObjectListIndex := Integer}
    161   {$DEFINE TGObjectListItem := TCommand}
    162   {$DEFINE TGObjectListList := TObjectListCommand}
    163   {$DEFINE TGObjectList := TCommandList}
    164   {$DEFINE TGObjectListSortCompare := TObjectListSortCompareCommand}
    165   {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterCommand}
    166   {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterCommand}
    167   {$DEFINE INTERFACE}
    168   {$I 'GenericObjectList.inc'}
     144  TCommandList = class(TListObject);
    169145
    170146  TCommonBlockSection = (cbsVariable, cbsType, cbsConstant);
     
    203179
    204180  // TListType = TGObjectList<Integer, TType>
    205   {$DEFINE TGObjectListIndex := Integer}
    206   {$DEFINE TGObjectListItem := TType}
    207   {$DEFINE TGObjectListList := TObjectListType}
    208   {$DEFINE TGObjectList := TListType}
    209   {$DEFINE TGObjectListSortCompare := TObjectListSortCompareType}
    210   {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterType}
    211   {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterType}
    212   {$DEFINE INTERFACE}
    213   {$I 'GenericObjectList.inc'}
     181  TListType = class(TListObject);
    214182
    215183  TTypeList = class(TListType)
     
    247215
    248216  // TListEnumItem = TGObjectList<Integer, TEnumItem>
    249   {$DEFINE TGObjectListIndex := Integer}
    250   {$DEFINE TGObjectListItem := TEnumItem}
    251   {$DEFINE TGObjectListList := TObjectListEnumItem}
    252   {$DEFINE TGObjectList := TListEnumItem}
    253   {$DEFINE TGObjectListSortCompare := TObjectListSortCompareEnumItem}
    254   {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterEnumItem}
    255   {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterEnumItem}
    256   {$DEFINE INTERFACE}
    257   {$I 'GenericObjectList.inc'}
     217  TListEnumItem = class(TListObject);
    258218
    259219  TTypeEnumeration = class(TType)
     
    266226
    267227  TTypeClass = class(TType)
    268     Items: TListType;
     228    CommonBlock: TCommonBlock;
    269229    constructor Create;
    270230    destructor Destroy; override;
     
    280240
    281241  // TListConstant = TGObjectList<Integer, TConstant>
    282   {$DEFINE TGObjectListIndex := Integer}
    283   {$DEFINE TGObjectListItem := TConstant}
    284   {$DEFINE TGObjectListList := TObjectListConstant}
    285   {$DEFINE TGObjectList := TListConstant}
    286   {$DEFINE TGObjectListSortCompare := TObjectListSortCompareConstant}
    287   {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterConstant}
    288   {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterConstant}
    289   {$DEFINE INTERFACE}
    290   {$I 'GenericObjectList.inc'}
     242  TListConstant = class(TListObject);
    291243
    292244  TConstantList = class(TListConstant)
     
    304256
    305257  // TListVariable = TGObjectList<Integer, TVariable>
    306   {$DEFINE TGObjectListIndex := Integer}
    307   {$DEFINE TGObjectListItem := TVariable}
    308   {$DEFINE TGObjectListList := TObjectListVariable}
    309   {$DEFINE TGObjectList := TListVariable}
    310   {$DEFINE TGObjectListSortCompare := TObjectListSortCompareVariable}
    311   {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterVariable}
    312   {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterVariable}
    313   {$DEFINE INTERFACE}
    314   {$I 'GenericObjectList.inc'}
     258  TListVariable = class(TListObject);
    315259
    316260  TVariableList = class(TListVariable)
     
    324268
    325269  // TListParameter = TGObjectList<Integer, TParameter>
    326   {$DEFINE TGObjectListIndex := Integer}
    327   {$DEFINE TGObjectListItem := TParameter}
    328   {$DEFINE TGObjectListList := TObjectListParameter}
    329   {$DEFINE TGObjectList := TListParameter}
    330   {$DEFINE TGObjectListSortCompare := TObjectListSortCompareParameter}
    331   {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterParameter}
    332   {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterParameter}
    333   {$DEFINE INTERFACE}
    334   {$I 'GenericObjectList.inc'}
     270  TListParameter = class(TListObject);
    335271
    336272  TParameterList = class(TListParameter)
     
    373309
    374310  // TListFunction = TGObjectList<Integer, TFunction>
    375   {$DEFINE TGObjectListIndex := Integer}
    376   {$DEFINE TGObjectListItem := TFunction}
    377   {$DEFINE TGObjectListList := TObjectListFunction}
    378   {$DEFINE TGObjectList := TListFunction}
    379   {$DEFINE TGObjectListSortCompare := TObjectListSortCompareFunction}
    380   {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterFunction}
    381   {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterFunction}
    382   {$DEFINE INTERFACE}
    383   {$I 'GenericObjectList.inc'}
     311  TListFunction = class(TListObject);
    384312
    385313  TFunctionList = class(TListFunction)
     
    397325
    398326  // TListUsedModule = TGObjectList<Integer, TUsedModule>
    399   {$DEFINE TGObjectListIndex := Integer}
    400   {$DEFINE TGObjectListItem := TUsedModule}
    401   {$DEFINE TGObjectListList := TObjectListUsedModule}
    402   {$DEFINE TGObjectList := TListUsedModule}
    403   {$DEFINE TGObjectListSortCompare := TObjectListSortCompareUsedModule}
    404   {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterUsedModule}
    405   {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterUsedModule}
    406   {$DEFINE INTERFACE}
    407   {$I 'GenericObjectList.inc'}
     327  TListUsedModule = class(TListObject);
    408328
    409329  TUsedModuleList = class(TListUsedModule)
     
    452372
    453373  // TListModule = TGObjectList<Integer, TModule>
    454   {$DEFINE TGObjectListIndex := Integer}
    455   {$DEFINE TGObjectListItem := TModule}
    456   {$DEFINE TGObjectListList := TObjectListModule}
    457   {$DEFINE TGObjectList := TListModule}
    458   {$DEFINE TGObjectListSortCompare := TObjectListSortCompareModule}
    459   {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterModule}
    460   {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterModule}
    461   {$DEFINE INTERFACE}
    462   {$I 'GenericObjectList.inc'}
     374  TListModule = class(TListObject);
    463375
    464376  { TModuleList }
     
    491403implementation
    492404
    493 {$DEFINE IMPLEMENTATION_USES}
    494 {$I 'GenericObjectList.inc'}
    495 
    496 // TListExpression = TGObjectList<Integer, TExpression>
    497 {$DEFINE TGObjectListIndex := Integer}
    498 {$DEFINE TGObjectListItem := TExpression}
    499 {$DEFINE TGObjectListList := TObjectListExpression}
    500 {$DEFINE TGObjectList := TListExpression}
    501 {$DEFINE TGObjectListSortCompare := TObjectListSortCompareExpression}
    502 {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterExpression}
    503 {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterExpression}
    504 {$DEFINE IMPLEMENTATION}
    505 {$I 'GenericObjectList.inc'}
    506 
    507 // TListCaseOfEndBranche = TGObjectList<Integer, TCaseOfEndBranche>
    508 {$DEFINE TGObjectListIndex := Integer}
    509 {$DEFINE TGObjectListItem := TCaseOfEndBranche}
    510 {$DEFINE TGObjectListList := TObjectListCaseOfEndBranche}
    511 {$DEFINE TGObjectList := TListCaseOfEndBranche}
    512 {$DEFINE TGObjectListSortCompare := TObjectListSortCompareCaseOfEndBranche}
    513 {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterCaseOfEndBranche}
    514 {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterCaseOfEndBranche}
    515 {$DEFINE IMPLEMENTATION}
    516 {$I 'GenericObjectList.inc'}
    517 
    518 // TCommandList = TGObjectList<Integer, TCommand>
    519 {$DEFINE TGObjectListIndex := Integer}
    520 {$DEFINE TGObjectListItem := TCommand}
    521 {$DEFINE TGObjectListList := TObjectListCommand}
    522 {$DEFINE TGObjectList := TCommandList}
    523 {$DEFINE TGObjectListSortCompare := TObjectListSortCompareCommand}
    524 {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterCommand}
    525 {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterCommand}
    526 {$DEFINE IMPLEMENTATION}
    527 {$I 'GenericObjectList.inc'}
    528 
    529 // TListEnumItem = TGObjectList<Integer, TEnumItem>
    530 {$DEFINE TGObjectListIndex := Integer}
    531 {$DEFINE TGObjectListItem := TEnumItem}
    532 {$DEFINE TGObjectListList := TObjectListEnumItem}
    533 {$DEFINE TGObjectList := TListEnumItem}
    534 {$DEFINE TGObjectListSortCompare := TObjectListSortCompareEnumItem}
    535 {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterEnumItem}
    536 {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterEnumItem}
    537 {$DEFINE IMPLEMENTATION}
    538 {$I 'GenericObjectList.inc'}
    539 
    540 // TListType = TGObjectList<Integer, TType>
    541 {$DEFINE TGObjectListIndex := Integer}
    542 {$DEFINE TGObjectListItem := TType}
    543 {$DEFINE TGObjectListList := TObjectListType}
    544 {$DEFINE TGObjectList := TListType}
    545 {$DEFINE TGObjectListSortCompare := TObjectListSortCompareType}
    546 {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterType}
    547 {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterType}
    548 {$DEFINE IMPLEMENTATION}
    549 {$I 'GenericObjectList.inc'}
    550 
    551 // TListConstant = TGObjectList<Integer, TConstant>
    552 {$DEFINE TGObjectListIndex := Integer}
    553 {$DEFINE TGObjectListItem := TConstant}
    554 {$DEFINE TGObjectListList := TObjectListConstant}
    555 {$DEFINE TGObjectList := TListConstant}
    556 {$DEFINE TGObjectListSortCompare := TObjectListSortCompareConstant}
    557 {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterConstant}
    558 {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterConstant}
    559 {$DEFINE IMPLEMENTATION}
    560 {$I 'GenericObjectList.inc'}
    561 
    562 // TListVariable = TGObjectList<Integer, TVariable>
    563 {$DEFINE TGObjectListIndex := Integer}
    564 {$DEFINE TGObjectListItem := TVariable}
    565 {$DEFINE TGObjectListList := TObjectListVariable}
    566 {$DEFINE TGObjectList := TListVariable}
    567 {$DEFINE TGObjectListSortCompare := TObjectListSortCompareVariable}
    568 {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterVariable}
    569 {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterVariable}
    570 {$DEFINE IMPLEMENTATION}
    571 {$I 'GenericObjectList.inc'}
    572 
    573 // TListParameter = TGObjectList<Integer, TParameter>
    574 {$DEFINE TGObjectListIndex := Integer}
    575 {$DEFINE TGObjectListItem := TParameter}
    576 {$DEFINE TGObjectListList := TObjectListParameter}
    577 {$DEFINE TGObjectList := TListParameter}
    578 {$DEFINE TGObjectListSortCompare := TObjectListSortCompareParameter}
    579 {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterParameter}
    580 {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterParameter}
    581 {$DEFINE IMPLEMENTATION}
    582 {$I 'GenericObjectList.inc'}
    583 
    584 // TListFunction = TGObjectList<Integer, TFunction>
    585 {$DEFINE TGObjectListIndex := Integer}
    586 {$DEFINE TGObjectListItem := TFunction}
    587 {$DEFINE TGObjectListList := TObjectListFunction}
    588 {$DEFINE TGObjectList := TListFunction}
    589 {$DEFINE TGObjectListSortCompare := TObjectListSortCompareFunction}
    590 {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterFunction}
    591 {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterFunction}
    592 {$DEFINE IMPLEMENTATION}
    593 {$I 'GenericObjectList.inc'}
    594 
    595 // TListUsedModule = TGObjectList<Integer, TUsedModule>
    596 {$DEFINE TGObjectListIndex := Integer}
    597 {$DEFINE TGObjectListItem := TUsedModule}
    598 {$DEFINE TGObjectListList := TObjectListUsedModule}
    599 {$DEFINE TGObjectList := TListUsedModule}
    600 {$DEFINE TGObjectListSortCompare := TObjectListSortCompareUsedModule}
    601 {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterUsedModule}
    602 {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterUsedModule}
    603 {$DEFINE IMPLEMENTATION}
    604 {$I 'GenericObjectList.inc'}
    605 
    606 // TListModule = TGObjectList<Integer, TModule>
    607 {$DEFINE TGObjectListIndex := Integer}
    608 {$DEFINE TGObjectListItem := TModule}
    609 {$DEFINE TGObjectListList := TObjectListModule}
    610 {$DEFINE TGObjectList := TListModule}
    611 {$DEFINE TGObjectListSortCompare := TObjectListSortCompareModule}
    612 {$DEFINE TGObjectListToStringConverter := TObjectListToStringConverterModule}
    613 {$DEFINE TGObjectListFromStringConverter := TObjectListFromStringConverterModule}
    614 {$DEFINE IMPLEMENTATION}
    615 {$I 'GenericObjectList.inc'}
    616 
    617405{ TFunction }
    618406
     
    661449begin
    662450  I := 0;
    663   while (I < Count) and (LowerCase(Items[I].Name) <> LowerCase(Name)) do Inc(I);
    664   if I < Count then Result := Items[I] else begin
     451  while (I < Count) and (LowerCase(TConstant(Items[I]).Name) <> LowerCase(Name)) do Inc(I);
     452  if I < Count then Result := TConstant(Items[I]) else begin
    665453    if Assigned(Parent.Parent) then Result := Parent.Parent.Constants.Search(Name)
    666454      else begin
     
    742530  // Search in own list
    743531  I := 0;
    744   while (I < Count) and (LowerCase(Items[I].Name) <> LowerCase(Name)) do Inc(I);
    745   if I < Count then Result := Items[I]
     532  while (I < Count) and (LowerCase(TType(Items[I]).Name) <> LowerCase(Name)) do Inc(I);
     533  if I < Count then Result := TType(Items[I])
    746534    else Result := nil;
    747535
     
    769557  // Search in own list
    770558  I := 0;
    771   while (I < Count) and (LowerCase(Items[I].Name) <> LowerCase(Name)) do Inc(I);
     559  while (I < Count) and (LowerCase(TVariable(Items[I]).Name) <> LowerCase(Name)) do Inc(I);
    772560  if I < Count then Result := TVariable(Items[I]) else Result := nil;
    773561
     
    814602  // Search in own list
    815603  I := 0;
    816   while (I < Count) and (LowerCase(Items[I].Name) <> LowerCase(Name)) do Inc(I);
    817   if I < Count then Result := Items[I] else Result := nil;
     604  while (I < Count) and (LowerCase(TFunction(Items[I]).Name) <> LowerCase(Name)) do Inc(I);
     605  if I < Count then Result := TFunction(Items[I]) else Result := nil;
    818606
    819607  // Search parent block list
     
    865653begin
    866654  I := 0;
    867   while (I < Count) and (LowerCase(Items[I].Name) <> LowerCase(Name)) do Inc(I);
    868   if I < Count then Result := Items[I]
     655  while (I < Count) and (LowerCase(TParameter(Items[I]).Name) <> LowerCase(Name)) do Inc(I);
     656  if I < Count then Result := TParameter(Items[I])
    869657    else Result := nil;
    870658end;
     
    995783begin
    996784  I := 0;
    997   while (I < Count) and (LowerCase(Items[I].Name) <> LowerCase(Name)) do Inc(I);
    998   if I < Count then Result := Items[I] else Result := nil;
     785  while (I < Count) and (LowerCase(TModule(Items[I]).Name) <> LowerCase(Name)) do Inc(I);
     786  if I < Count then Result := TModule(Items[I])
     787    else Result := nil;
    999788end;
    1000789
     
    1010799    I := 0;
    1011800    while (I < UsedModules.Count) and (not Assigned(Result)) do begin
    1012       Result := UsedModules[I].Module.SearchVariable(Name, False);
     801      Result := TUsedModule(UsedModules[I]).Module.SearchVariable(Name, False);
    1013802      Inc(I);
    1014803    end;
     
    1030819    I := 0;
    1031820    while (I < UsedModules.Count) and (not Assigned(Result)) do begin
    1032       with UsedModules[I] do
     821      with TUsedModule(UsedModules[I]) do
    1033822        if Assigned(Module) then
    1034823        with Module do
     
    1048837    I := 0;
    1049838    while (I < UsedModules.Count) and (not Assigned(Result)) do begin
    1050     if Assigned(UsedModules[I].Module) then
    1051       Result := UsedModules[I].Module.SearchFunction(Name, False);
     839    if Assigned(TUsedModule(UsedModules[I]).Module) then
     840      Result := TUsedModule(UsedModules[I]).Module.SearchFunction(Name, False);
    1052841      Inc(I);
    1053842    end;
     
    1103892begin
    1104893  inherited;
    1105   Items := TListType.Create;
     894  CommonBlock := TCommonBlock.Create;
    1106895end;
    1107896
    1108897destructor TTypeClass.Destroy;
    1109898begin
    1110   Items.Free;
     899  CommonBlock.Free;
    1111900  inherited Destroy;
    1112901end;
     
    1125914      NewType := TType.Create;
    1126915      //NewType := TType(Source.Parameters[I].ClassType.Create);
    1127       NewType.Assign(Source.Parameters[I]);
     916      NewType.Assign(TType(Source.Parameters[I]));
    1128917      Parameters.Add(NewType);
    1129918    end;
Note: See TracChangeset for help on using the changeset viewer.