diff --git a/src/BaselineOfEsope/BaselineOfEsope.class.st b/src/BaselineOfEsope/BaselineOfEsope.class.st index 617a142..bcd440f 100644 --- a/src/BaselineOfEsope/BaselineOfEsope.class.st +++ b/src/BaselineOfEsope/BaselineOfEsope.class.st @@ -21,14 +21,9 @@ BaselineOfEsope >> baseline: spec [ { #category : #baselines } BaselineOfEsope >> defineDependencies: spec [ spec - baseline: 'PetitParser2' - with: [ spec repository: 'github://kursjan/petitparser2' ]; - - baseline: 'FamixFortran' - with: [ spec repository: 'github://moosetechnology/Famix-Fortran' ] ; - - baseline: 'NeoJSON' - with: [ spec repository: 'github://svenvc/NeoJSON' ] + baseline: 'PetitParser2' with: [ spec repository: 'github://kursjan/petitparser2' ]; + baseline: 'FamixFortran' with: [ spec repository: 'github://moosetechnology/Famix-Fortran' ]; + baseline: 'NeoJSON' with: [ spec repository: 'github://svenvc/NeoJSON' ] ] @@ -46,7 +41,7 @@ BaselineOfEsope >> definePackages: spec [ repository: 'github://moosetechnology/Esope'; package: 'EsopeImporter' with: [ spec requires: #('Famix-Esope-Entities' PetitParser2 NeoJSON) ]; package: 'EsopeImporter-Tests' with: [ spec requires: #(EsopeImporter) ]; - package: 'Famix-Esope-Entities' with: [ spec requires: #(FamixFortran) ] ; - package: 'Famix-Esope-Generator' with: [ spec requires: #(FamixFortran) ] ; + package: 'Famix-Esope-Entities' with: [ spec requires: #(FamixFortran) ]; + package: 'Famix-Esope-Generator' with: [ spec requires: #(FamixFortran) ]; package: 'Famix-Esope-Tests' with: [ spec requires: #(FamixFortran) ] ] diff --git a/src/EsopeImporter-Tests/FamixFortran77ResolverTest.class.st b/src/EsopeImporter-Tests/FamixFortran77ResolverTest.class.st index ef24c8a..48f98fb 100644 --- a/src/EsopeImporter-Tests/FamixFortran77ResolverTest.class.st +++ b/src/EsopeImporter-Tests/FamixFortran77ResolverTest.class.st @@ -12,7 +12,7 @@ Class { { #category : #'default values' } FamixFortran77ResolverTest >> anchorFrom: startPoint to: endPoint [ - ^ FamixFortran77IndexedFileAnchor new + ^ FamixF77IndexedFileAnchor new mooseModel: mooseModel; startLine: startPoint x; startColumn: startPoint y; @@ -25,7 +25,7 @@ FamixFortran77ResolverTest >> anchorFrom: startPoint to: endPoint [ { #category : #'default values' } FamixFortran77ResolverTest >> defaultAccess: varName isWrite: boolean [ - ^ FamixFortran77Access new + ^ FamixF77Access new mooseModel: mooseModel; attributeAt: #entity put: (self defaultIASTVarAccess: varName isWrite: boolean); @@ -42,7 +42,7 @@ FamixFortran77ResolverTest >> defaultAnchor [ { #category : #running } FamixFortran77ResolverTest >> defaultAttribute: varName withType: typeName [ - ^ (self newEntity: FamixEsopeAttribute) + ^ (self newEntity: FamixFortranAttribute) sourceAnchor: (self anchorFrom: 2 @ 7 to: 2 @ 19); name: varName; declaredType: (self defaultType: typeName) @@ -51,7 +51,7 @@ FamixFortran77ResolverTest >> defaultAttribute: varName withType: typeName [ { #category : #'default values' } FamixFortran77ResolverTest >> defaultFunction: name [ - ^ (self newNamedEntity: name toFamix: FamixFortran77PUFunction) + ^ (self newNamedEntity: name toFamix: FamixF77PUFunction) programFile: famixProgFile ] @@ -100,7 +100,7 @@ FamixFortran77ResolverTest >> defaultImplicitNone [ { #category : #'default values' } FamixFortran77ResolverTest >> defaultInvocation: name [ - ^ FamixFortran77Invocation new + ^ FamixF77Invocation new mooseModel: mooseModel; attributeAt: #entity put: (self defaultIASTInvocation: name); sourceAnchor: self defaultAnchor; @@ -110,20 +110,20 @@ FamixFortran77ResolverTest >> defaultInvocation: name [ { #category : #'default values' } FamixFortran77ResolverTest >> defaultMain: name [ - ^ (self newNamedEntity: name toFamix: FamixFortran77PUMain) + ^ (self newNamedEntity: name toFamix: FamixF77PUMain) programFile: famixProgFile ] { #category : #'default values' } FamixFortran77ResolverTest >> defaultParameter: name [ - ^ self newNamedEntity: name toFamix: FamixFortran77Parameter + ^ self newNamedEntity: name toFamix: FamixF77Parameter ] { #category : #'default values' } FamixFortran77ResolverTest >> defaultProgramFile: aFilename [ - ^ (self newNamedEntity: aFilename toFamix: FamixFortran77ProgramFile) + ^ (self newNamedEntity: aFilename toFamix: FamixF77ProgramFile) filename: aFilename; yourself ] @@ -149,21 +149,21 @@ FamixFortran77ResolverTest >> defaultSegment: segmentName with: dictDeclarations { #category : #'default values' } FamixFortran77ResolverTest >> defaultSubroutine: name [ - ^ (self newNamedEntity: name toFamix: FamixFortran77PUSubroutine) + ^ (self newNamedEntity: name toFamix: FamixF77PUSubroutine) programFile: famixProgFile ] { #category : #'default values' } FamixFortran77ResolverTest >> defaultSubroutine: name belongsTo: aFamixProgramFile [ - ^ (self newNamedEntity: name toFamix: FamixFortran77PUSubroutine) + ^ (self newNamedEntity: name toFamix: FamixF77PUSubroutine) programFile: aFamixProgramFile ] { #category : #'default values' } FamixFortran77ResolverTest >> defaultType: anIntrinsicFortranType [ - ^ FamixFortran77Type new + ^ FamixF77Type new name: anIntrinsicFortranType; sourceAnchor: self defaultAnchor; yourself @@ -172,7 +172,7 @@ FamixFortran77ResolverTest >> defaultType: anIntrinsicFortranType [ { #category : #'default values' } FamixFortran77ResolverTest >> defaultVariable: name withType: type [ - ^ (self newNamedEntity: name toFamix: FamixFortran77Variable) + ^ (self newNamedEntity: name toFamix: FamixF77Variable) declaredType: (self defaultType: type) ] @@ -211,7 +211,7 @@ FamixFortran77ResolverTest >> testCreateFamixFortran77Access [ addAccess: (self defaultAccess: 'var' isWrite: false); yourself. - main := (resolver model allWithSubTypesOf: FamixFortran77ProgramUnit) first. + main := (resolver model allWithSubTypesOf: FamixF77ProgramUnit) first. resolver resolve. @@ -234,7 +234,7 @@ FamixFortran77ResolverTest >> testCreateFamixFortran77AccessNonDeclaredVariable addAccess: (self defaultAccess: 'var' isWrite: false); yourself. - main := (resolver model allWithType: FamixFortran77PUMain) first. + main := (resolver model allWithType: FamixF77PUMain) first. self assert: main localVariables size equals: 0. @@ -261,13 +261,13 @@ FamixFortran77ResolverTest >> testCreateFamixFortran77InvocationCalleeBeforeCall resolver resolve. - main := (resolver model allWithType: FamixFortran77PUMain) first. - sub := (resolver model allWithType: FamixFortran77PUSubroutine) first. + main := (resolver model allWithType: FamixF77PUMain) first. + sub := (resolver model allWithType: FamixF77PUSubroutine) first. self assert: main outgoingInvocations size equals: 1. invocation := main outgoingInvocations first. - self assert: invocation class equals: FamixFortran77Invocation. + self assert: invocation class equals: FamixF77Invocation. self assert: invocation sender equals: main. self assert: invocation candidates size equals: 1. @@ -285,13 +285,13 @@ FamixFortran77ResolverTest >> testCreateFamixFortran77InvocationCallerBeforeCall resolver resolve. - main := (resolver model allWithType: FamixFortran77PUMain) first. - sub := (resolver model allWithType: FamixFortran77PUSubroutine) first. + main := (resolver model allWithType: FamixF77PUMain) first. + sub := (resolver model allWithType: FamixF77PUSubroutine) first. self assert: main outgoingInvocations size equals: 1. invocation := main outgoingInvocations first. - self assert: invocation class equals: FamixFortran77Invocation. + self assert: invocation class equals: FamixF77Invocation. self assert: invocation sender equals: main. self assert: invocation candidates size equals: 1. @@ -313,13 +313,13 @@ FamixFortran77ResolverTest >> testCreateFamixFortran77InvocationInDifferentFiles resolver resolve. - main := (resolver model allWithType: FamixFortran77PUMain) anyOne. - sub := (resolver model allWithType: FamixFortran77PUSubroutine) anyOne. + main := (resolver model allWithType: FamixF77PUMain) anyOne. + sub := (resolver model allWithType: FamixF77PUSubroutine) anyOne. self assert: main outgoingInvocations size equals: 1. invocation := main outgoingInvocations first. - self assert: invocation class equals: FamixFortran77Invocation. + self assert: invocation class equals: FamixF77Invocation. self assert: invocation sender equals: main. self assert: invocation candidates size equals: 1. @@ -339,14 +339,14 @@ FamixFortran77ResolverTest >> testCreateFamixFortran77InvocationMultipleCalleeBe resolver resolve. - main := (resolver model allWithType: FamixFortran77PUMain) first. - fct := (resolver model allWithType: FamixFortran77PUFunction) first. - sub := (resolver model allWithType: FamixFortran77PUSubroutine) first. + main := (resolver model allWithType: FamixF77PUMain) first. + fct := (resolver model allWithType: FamixF77PUFunction) first. + sub := (resolver model allWithType: FamixF77PUSubroutine) first. self assert: main outgoingInvocations size equals: 2. invocation := main outgoingInvocations first. - self assert: invocation class equals: FamixFortran77Invocation. + self assert: invocation class equals: FamixF77Invocation. self assert: invocation sender equals: main. self assert: invocation candidates size equals: 1. @@ -354,7 +354,7 @@ FamixFortran77ResolverTest >> testCreateFamixFortran77InvocationMultipleCalleeBe invocation := main outgoingInvocations second. - self assert: invocation class equals: FamixFortran77Invocation. + self assert: invocation class equals: FamixF77Invocation. self assert: invocation sender equals: main. self assert: invocation candidates size equals: 1. @@ -376,8 +376,8 @@ FamixFortran77ResolverTest >> testCreateFamixFortran77LocalVariableAsFunction [ self defaultFunction: 'f'. - famixMain := (resolver model allWithType: FamixFortran77PUMain) first. - famixFunction := (resolver model allWithType: FamixFortran77PUFunction) first. + famixMain := (resolver model allWithType: FamixF77PUMain) first. + famixFunction := (resolver model allWithType: FamixF77PUFunction) first. self assert: famixFunction declaredType isNil. self assert: famixMain localVariables size equals: 1. @@ -385,7 +385,7 @@ FamixFortran77ResolverTest >> testCreateFamixFortran77LocalVariableAsFunction [ resolver resolve. self assert: famixMain localVariables isEmpty. - self assert: famixFunction declaredType class equals: FamixFortran77Type. + self assert: famixFunction declaredType class equals: FamixF77Type. self assert: famixFunction declaredType name equals: 'real'. ] @@ -399,7 +399,7 @@ FamixFortran77ResolverTest >> testCreateFamixFortran77LocalVariableAsParameter [ addAccess: (self defaultAccess: 'var' isWrite: false); addAccess: (self defaultAccess: 'var' isWrite: false). - subroutine := (resolver model allWithSubTypesOf: FamixFortran77ProgramUnit) first. + subroutine := (resolver model allWithSubTypesOf: FamixF77ProgramUnit) first. self assert: subroutine localVariables size equals: 1. @@ -410,12 +410,12 @@ FamixFortran77ResolverTest >> testCreateFamixFortran77LocalVariableAsParameter [ self assert: subroutine accesses size equals: 2. access := subroutine accesses first. - self assert: access class equals: FamixFortran77Access. + self assert: access class equals: FamixF77Access. self assert: access variable equals: subroutine parameters first. access := subroutine accesses second. - self assert: access class equals: FamixFortran77Access. + self assert: access class equals: FamixF77Access. self assert: access variable equals: subroutine parameters first. ] @@ -429,7 +429,7 @@ FamixFortran77ResolverTest >> testCreateFamixFortran77ParameterWithLocalVariable addAccess: (self defaultAccess: 'var' isWrite: false); yourself. - subroutine := (resolver model allWithSubTypesOf: FamixFortran77ProgramUnit) first. + subroutine := (resolver model allWithSubTypesOf: FamixF77ProgramUnit) first. self assert: subroutine localVariables size equals: 1. resolver resolve. @@ -438,7 +438,7 @@ FamixFortran77ResolverTest >> testCreateFamixFortran77ParameterWithLocalVariable self assert: subroutine accesses size equals: 1. access := subroutine accesses first. - self assert: access class equals: FamixFortran77Access. + self assert: access class equals: FamixF77Access. self assert: access variable equals: subroutine parameters first. ] @@ -454,9 +454,9 @@ FamixFortran77ResolverTest >> testCreateFamixFortran77ResolveImplicitNone [ resolver resolve. - self assert: (resolver model allWithSubTypesOf: FamixFortran77ProgramUnit) size equals: 1. + self assert: (resolver model allWithSubTypesOf: FamixF77ProgramUnit) size equals: 1. - famixSubroutine := (resolver model allWithSubTypesOf: FamixFortran77ProgramUnit) first. + famixSubroutine := (resolver model allWithSubTypesOf: FamixF77ProgramUnit) first. self assert: famixSubroutine dicImplicit size equals: 26. @@ -478,9 +478,9 @@ FamixFortran77ResolverTest >> testCreateFamixFortran77ResolveImplicits [ resolver resolve. - self assert: (resolver model allWithSubTypesOf: FamixFortran77ProgramUnit) size equals: 1. + self assert: (resolver model allWithSubTypesOf: FamixF77ProgramUnit) size equals: 1. - famixSubroutine := (resolver model allWithSubTypesOf: FamixFortran77ProgramUnit) first. + famixSubroutine := (resolver model allWithSubTypesOf: FamixF77ProgramUnit) first. self assert: famixSubroutine dicImplicit size equals: 26. @@ -512,19 +512,19 @@ FamixFortran77ResolverTest >> testCreateFamixFortran77ResolveParametersType [ resolver resolve. - self assert: (resolver model allWithSubTypesOf: FamixFortran77ProgramUnit) size equals: 1. + self assert: (resolver model allWithSubTypesOf: FamixF77ProgramUnit) size equals: 1. - entity := (resolver model allWithSubTypesOf: FamixFortran77ProgramUnit) first. + entity := (resolver model allWithSubTypesOf: FamixF77ProgramUnit) first. self assert: entity accesses size equals: 2. access := entity accesses first. - self assert: access class equals: FamixFortran77Access. + self assert: access class equals: FamixF77Access. self assert: access variable equals: entity parameters first. access := entity accesses second. - self assert: access class equals: FamixFortran77Access. + self assert: access class equals: FamixF77Access. self assert: access variable equals: entity parameters first. ] @@ -541,19 +541,19 @@ FamixFortran77ResolverTest >> testCreateFamixFortran77ResolveParametersTypeWithD resolver resolve. - self assert: (resolver model allWithSubTypesOf: FamixFortran77ProgramUnit) size equals: 1. + self assert: (resolver model allWithSubTypesOf: FamixF77ProgramUnit) size equals: 1. - entity := (resolver model allWithSubTypesOf: FamixFortran77ProgramUnit) first. + entity := (resolver model allWithSubTypesOf: FamixF77ProgramUnit) first. self assert: entity accesses size equals: 2. access := entity accesses first. - self assert: access class equals: FamixFortran77Access. + self assert: access class equals: FamixF77Access. self assert: access variable equals: entity parameters first. access := entity accesses second. - self assert: access class equals: FamixFortran77Access. + self assert: access class equals: FamixF77Access. self assert: access variable equals: entity parameters first. ] @@ -707,7 +707,7 @@ FamixFortran77ResolverTest >> testResolveIncludeDirective [ dummySub := (self defaultProgramUnit: 'point.seg' - forType: FamixFortran77IncludedFile + forType: FamixF77IncludedFile belongsTo: includedFile) types: { (self defaultSegment: 'point' with: { (#x -> #real). @@ -718,42 +718,42 @@ FamixFortran77ResolverTest >> testResolveIncludeDirective [ main := (self defaultProgramUnit: 'main' - forType: FamixFortran77PUMain + forType: FamixF77PUMain belongsTo: mainFile) - includes: { ((self newEntity: FamixFortran77Include) + includes: { ((self newEntity: FamixF77Include) filename: 'point.seg'; yourself) }; yourself. initSub := (self defaultProgramUnit: 'init' - forType: FamixFortran77PUSubroutine + forType: FamixF77PUSubroutine belongsTo: mpointFile) - includes: { ((self newEntity: FamixFortran77Include) + includes: { ((self newEntity: FamixF77Include) filename: 'point.seg'; yourself) }; yourself. printSub := (self defaultProgramUnit: 'print' - forType: FamixFortran77PUSubroutine + forType: FamixF77PUSubroutine belongsTo: mpointFile) - includes: { ((self newEntity: FamixFortran77Include) + includes: { ((self newEntity: FamixF77Include) filename: 'point.seg'; yourself) }; yourself. resolver resolve. - pUnits := resolver model allWithSubTypesOf: FamixFortran77ProgramUnit. + pUnits := resolver model allWithSubTypesOf: FamixF77ProgramUnit. self assert: pUnits size equals: 4. - puIncFile := resolver model allWithType: FamixFortran77IncludedFile. + puIncFile := resolver model allWithType: FamixF77IncludedFile. self assert: puIncFile size equals: 1. - puSubs := resolver model allWithType: FamixFortran77PUSubroutine. + puSubs := resolver model allWithType: FamixF77PUSubroutine. self assert: puSubs size equals: 2. - puMain := resolver model allWithType: FamixFortran77PUMain. + puMain := resolver model allWithType: FamixF77PUMain. self assert: puMain size equals: 1. self assert: puMain first includes size equals: 1. @@ -796,7 +796,7 @@ FamixFortran77ResolverTest >> testResolveSegment [ " accessor := (self newNamedEntity: 'demo' - toFamix: FamixFortran77PUSubroutine) + toFamix: FamixF77PUSubroutine) programFile: famixProgFile; addType: ((self @@ -804,60 +804,60 @@ FamixFortran77ResolverTest >> testResolveSegment [ toFamix: FamixEsopeSegment) attributes: { ((self newNamedEntity: 'x' - toFamix: FamixEsopeAttribute) + toFamix: FamixFortranAttribute) declaredType: (self newNamedEntity: 'integer' - toFamix: FamixFortran77Type); + toFamix: FamixF77Type); isEsope: true; yourself). ((self newNamedEntity: 'y' - toFamix: FamixEsopeAttribute) + toFamix: FamixFortranAttribute) declaredType: (self newNamedEntity: 'integer' - toFamix: FamixFortran77Type); + toFamix: FamixF77Type); isEsope: true; yourself) }); addLocalVariable: ((self newNamedEntity: 'p' - toFamix: FamixFortran77Variable) declaredType: + toFamix: FamixF77Variable) declaredType: (self newNamedEntity: 'point' - toFamix: FamixFortran77Type)); + toFamix: FamixF77Type)); accesses: { ((self newEntity: FamixEsopeSegini) attributeAt: #entity put: (self defaultIASTEsopeCommand: 'segini' name: 'p'); yourself). - ((self newEntity: FamixFortran77Access) + ((self newEntity: FamixF77Access) attributeAt: #entity put: (self defaultIASTVarAccess: 'p' isWrite: true); yourself). - ((self newEntity: FamixFortran77Access) + ((self newEntity: FamixF77Access) attributeAt: #entity put: (self defaultIASTVarAccess: 'x' isWrite: true); attributeAt: #pointer put: (self defaultIASTVarAccess: 'p' isWrite: true); yourself). - ((self newEntity: FamixFortran77Access) + ((self newEntity: FamixF77Access) attributeAt: #entity put: (self defaultIASTVarAccess: 'p' isWrite: true); yourself). - ((self newEntity: FamixFortran77Access) + ((self newEntity: FamixF77Access) attributeAt: #entity put: (self defaultIASTVarAccess: 'y' isWrite: true); attributeAt: #pointer put: (self defaultIASTVarAccess: 'p' isWrite: true); yourself). - ((self newEntity: FamixFortran77Access) + ((self newEntity: FamixF77Access) attributeAt: #entity put: (self defaultIASTVarAccess: 'p' isWrite: true); yourself). - ((self newEntity: FamixFortran77Access) + ((self newEntity: FamixF77Access) attributeAt: #entity put: (self defaultIASTVarAccess: 'x' isWrite: true); attributeAt: #pointer @@ -865,7 +865,7 @@ FamixFortran77ResolverTest >> testResolveSegment [ yourself) }. - sub := (resolver model allWithSubTypesOf: FamixFortran77ProgramUnit) + sub := (resolver model allWithSubTypesOf: FamixF77ProgramUnit) first. resolver resolve. @@ -912,7 +912,7 @@ FamixFortran77ResolverTest >> testResolveSegmentWithImplicitPointer [ " accessor := (self newNamedEntity: 'demo' - toFamix: FamixFortran77PUSubroutine) + toFamix: FamixF77PUSubroutine) programFile: famixProgFile; addType: ((self @@ -920,20 +920,20 @@ FamixFortran77ResolverTest >> testResolveSegmentWithImplicitPointer [ toFamix: FamixEsopeSegment) attributes: { ((self newNamedEntity: 'x' - toFamix: FamixEsopeAttribute) + toFamix: FamixFortranAttribute) declaredType: (self newNamedEntity: 'integer' - toFamix: FamixFortran77Type); + toFamix: FamixF77Type); isEsope: true; yourself). ((self newNamedEntity: 'y' - toFamix: FamixEsopeAttribute) + toFamix: FamixFortranAttribute) declaredType: (self newNamedEntity: 'integer' - toFamix: FamixFortran77Type); + toFamix: FamixF77Type); isEsope: true; yourself) }); accesses: { @@ -944,36 +944,36 @@ FamixFortran77ResolverTest >> testResolveSegmentWithImplicitPointer [ defaultIASTEsopeCommand: 'segini' name: 'point'); yourself). - ((self newEntity: FamixFortran77Access) + ((self newEntity: FamixF77Access) attributeAt: #entity put: (self defaultIASTVarAccess: 'point' isWrite: true); yourself). - ((self newEntity: FamixFortran77Access) + ((self newEntity: FamixF77Access) attributeAt: #entity put: (self defaultIASTVarAccess: 'x' isWrite: true); attributeAt: #pointer put: (self defaultIASTVarAccess: 'point' isWrite: true); yourself). - ((self newEntity: FamixFortran77Access) + ((self newEntity: FamixF77Access) attributeAt: #entity put: (self defaultIASTVarAccess: 'point' isWrite: true); yourself). - ((self newEntity: FamixFortran77Access) + ((self newEntity: FamixF77Access) attributeAt: #entity put: (self defaultIASTVarAccess: 'y' isWrite: true); attributeAt: #pointer put: (self defaultIASTVarAccess: 'point' isWrite: true); yourself). - ((self newEntity: FamixFortran77Access) + ((self newEntity: FamixF77Access) attributeAt: #entity put: (self defaultIASTVarAccess: 'point' isWrite: true); yourself). - ((self newEntity: FamixFortran77Access) + ((self newEntity: FamixF77Access) attributeAt: #entity put: (self defaultIASTVarAccess: 'x' isWrite: true); attributeAt: #pointer @@ -982,7 +982,7 @@ FamixFortran77ResolverTest >> testResolveSegmentWithImplicitPointer [ yourself) }. - sub := (resolver model allWithSubTypesOf: FamixFortran77ProgramUnit) + sub := (resolver model allWithSubTypesOf: FamixF77ProgramUnit) first. self assert: sub localVariables size equals: 0. @@ -1039,7 +1039,7 @@ FamixFortran77ResolverTest >> testResolveSegmentWithImplicitPointerAndNoPrefix [ " accessor := (self newNamedEntity: 'demo' - toFamix: FamixFortran77PUSubroutine) + toFamix: FamixF77PUSubroutine) programFile: famixProgFile; addType: ((self @@ -1047,20 +1047,20 @@ FamixFortran77ResolverTest >> testResolveSegmentWithImplicitPointerAndNoPrefix [ toFamix: FamixEsopeSegment) attributes: { ((self newNamedEntity: 'x' - toFamix: FamixEsopeAttribute) + toFamix: FamixFortranAttribute) declaredType: (self newNamedEntity: 'integer' - toFamix: FamixFortran77Type); + toFamix: FamixF77Type); isEsope: true; yourself). ((self newNamedEntity: 'y' - toFamix: FamixEsopeAttribute) + toFamix: FamixFortranAttribute) declaredType: (self newNamedEntity: 'integer' - toFamix: FamixFortran77Type); + toFamix: FamixF77Type); isEsope: true; yourself) }); accesses: { @@ -1071,21 +1071,21 @@ FamixFortran77ResolverTest >> testResolveSegmentWithImplicitPointerAndNoPrefix [ defaultIASTEsopeCommand: 'segini' name: 'point'); yourself). - ((self newEntity: FamixFortran77Access) + ((self newEntity: FamixF77Access) attributeAt: #entity put: (self defaultIASTVarAccess: 'x' isWrite: true); yourself). - ((self newEntity: FamixFortran77Access) + ((self newEntity: FamixF77Access) attributeAt: #entity put: (self defaultIASTVarAccess: 'y' isWrite: true); yourself). - ((self newEntity: FamixFortran77Access) + ((self newEntity: FamixF77Access) attributeAt: #entity put: (self defaultIASTVarAccess: 'x' isWrite: true); yourself) }. - sub := (resolver model allWithSubTypesOf: FamixFortran77ProgramUnit) + sub := (resolver model allWithSubTypesOf: FamixF77ProgramUnit) first. self assert: sub localVariables size equals: 0. diff --git a/src/EsopeImporter-Tests/IASTToFamixVisitorTest.class.st b/src/EsopeImporter-Tests/IASTToFamixVisitorTest.class.st index 505735b..916a8fa 100644 --- a/src/EsopeImporter-Tests/IASTToFamixVisitorTest.class.st +++ b/src/EsopeImporter-Tests/IASTToFamixVisitorTest.class.st @@ -217,7 +217,7 @@ c@_ end segment self assert: entity programUnits size equals: 1. entity := entity programUnits first. - self assert: entity class equals: FamixFortran77IncludedFile. + self assert: entity class equals: FamixF77IncludedFile. self assert: entity name equals: 'point.seg'. self assert: entity programFile isNotNil. @@ -575,12 +575,12 @@ IASTToFamixVisitorTest >> testCreateFamixEsopePointerDeclaration [ self assert: entity programUnits size equals: 1. self - assert: (visitor model allWithType: FamixFortran77Variable) size + assert: (visitor model allWithType: FamixF77Variable) size equals: 1. "p1" - entity := (visitor model allWithType: FamixFortran77Variable) first. + entity := (visitor model allWithType: FamixF77Variable) first. self assert: entity name equals: 'p1'. - self assert: entity declaredType class equals: FamixFortran77Type. + self assert: entity declaredType class equals: FamixF77Type. self assert: entity declaredType name equals: 'pers'. ] @@ -618,17 +618,17 @@ IASTToFamixVisitorTest >> testCreateFamixEsopeSegment [ self assert: entity attributes size equals: 3. attribute := entity attributes first. - self assert: attribute class equals: FamixEsopeAttribute. + self assert: attribute class equals: FamixFortranAttribute. self assert: attribute name equals: 'uname'. self assert: attribute declaredType name equals: 'character'. attribute := entity attributes second. - self assert: attribute class equals: FamixEsopeAttribute. + self assert: attribute class equals: FamixFortranAttribute. self assert: attribute name equals: 'status'. self assert: attribute declaredType name equals: 'logical'. attribute := entity attributes third. - self assert: attribute class equals: FamixEsopeAttribute. + self assert: attribute class equals: FamixFortranAttribute. self assert: attribute name equals: 'age'. self assert: attribute declaredType name equals: 'integer'. ] @@ -691,11 +691,11 @@ IASTToFamixVisitorTest >> testCreateFamixFortran77 [ self assert: visitor model size equals: 2. - entity := visitor model detect: [:each | each class = FamixFortran77ProgramFile ]. + entity := visitor model detect: [:each | each class = FamixF77ProgramFile ]. self assert: entity programUnits size equals: 1. entity := entity programUnits first. - self assert: entity class equals: FamixFortran77PUSubroutine. + self assert: entity class equals: FamixF77PUSubroutine. self assert: entity name equals: 'sub'. ] @@ -718,7 +718,7 @@ IASTToFamixVisitorTest >> testCreateFamixFortran77Comment [ self assert: entity programUnits first comments size equals: 1. comment := entity programUnits first comments first. - self assert: comment class equals: FamixFortran77Comment. + self assert: comment class equals: FamixF77Comment. self assert: comment content equals: 'a normal comment'. self deny: comment isEsope. @@ -739,8 +739,8 @@ IASTToFamixVisitorTest >> testCreateFamixFortran77ESOAtWithArrayArgument [ programFile := self jsonToIAST: '{"meta":{"miVersion":"fortran77","miFilename":"fortran77.f"},"program_units":[{"anno":[],"arguments":null,"blocks":[{"anno":[],"label":null,"span":"(2:9)-(2:23)","statement":{"anno":[],"attributes":null,"declarators":{"anno":[],"list":[{"anno":[],"dims":{"anno":[],"list":[{"anno":[],"lower":null,"span":"(2:21)-(2:22)","upper":{"anno":[],"span":"(2:21)-(2:22)","tag":"value","value":{"contents":["10",null],"tag":"integer"}}}],"span":"(2:21)-(2:22)"},"initial":null,"length":null,"span":"(2:17)-(2:23)","type":"array","variable":{"anno":[],"span":"(2:17)-(2:19)","tag":"value","value":{"contents":"arr","tag":"variable"}}}],"span":"(2:17)-(2:23)"},"span":"(2:9)-(2:23)","tag":"declaration","type":{"anno":[],"base_type":"integer","selector":null,"span":"(2:9)-(2:15)"}},"tag":"statement"},{"anno":[],"label":null,"span":"(3:9)-(3:25)","statement":{"anno":[],"expression":{"anno":[],"arguments":{"anno":[],"list":[{"anno":[],"expr":{"contents":{"anno":[],"span":"(3:17)-(3:17)","tag":"value","value":{"contents":"y","tag":"variable"}},"tag":"expr"},"name":null,"span":"(3:17)-(3:17)"},{"anno":[],"expr":{"contents":{"anno":[],"expression":{"anno":[],"span":"(3:19)-(3:21)","tag":"value","value":{"contents":"arr","tag":"variable"}},"indices":{"anno":[],"list":[{"anno":[],"index":{"anno":[],"span":"(3:23)-(3:23)","tag":"value","value":{"contents":"z","tag":"variable"}},"name":null,"span":"(3:23)-(3:23)","tag":"single"}],"span":"(3:23)-(3:23)"},"span":"(3:19)-(3:24)","tag":"subscript"},"tag":"expr"},"name":null,"span":"(3:19)-(3:24)"}],"span":"(3:17)-(3:24)"},"function":{"anno":[],"span":"(3:13)-(3:15)","tag":"value","value":{"contents":"d__","tag":"variable"}},"span":"(3:13)-(3:25)","tag":"function_call"},"span":"(3:9)-(3:25)","tag":"assign_expression","target":{"anno":[],"span":"(3:9)-(3:9)","tag":"value","value":{"contents":"x","tag":"variable"}}},"tag":"statement"}],"name":"hello","options":[null,null],"span":"(1:7)-(4:9)","subprograms":null,"tag":"subroutine"}]}'. programFile accept: visitor. - self assert: (visitor model allWithType: FamixFortran77Variable) size equals: 5. "x, y, y.arr, arr, z" - self assert: (visitor model allWithType: FamixFortran77Access) size equals: 4. "x, y, y.arr, z" + self assert: (visitor model allWithType: FamixF77Variable) size equals: 5. "x, y, y.arr, arr, z" + self assert: (visitor model allWithType: FamixF77Access) size equals: 4. "x, y, y.arr, z" ] @@ -759,15 +759,15 @@ IASTToFamixVisitorTest >> testCreateFamixFortran77Invocation [ programFile progUnits: { callee . caller }. programFile accept: visitor. - entity := visitor model detect: [:each | each class = FamixFortran77ProgramFile ]. + entity := visitor model detect: [:each | each class = FamixF77ProgramFile ]. - self assert: entity programUnits first class equals: FamixFortran77PUSubroutine. - self assert: entity programUnits second class equals: FamixFortran77PUMain. + self assert: entity programUnits first class equals: FamixF77PUSubroutine. + self assert: entity programUnits second class equals: FamixF77PUMain. self assert: entity programUnits second outgoingInvocations size equals: 1. invocation := entity programUnits second outgoingInvocations first. - self assert: invocation class equals: FamixFortran77Invocation. + self assert: invocation class equals: FamixF77Invocation. self assert: invocation sender equals: entity programUnits second. self assert: (invocation attributeAt: #entity ifAbsent: [ nil ] ) isNotNil ] @@ -782,14 +782,14 @@ IASTToFamixVisitorTest >> testCreateFamixFortran77LocalVariable [ yourself }. programFile accept: visitor. - entity := visitor model detect: [:each | each class = FamixFortran77ProgramFile ]. + entity := visitor model detect: [:each | each class = FamixF77ProgramFile ]. self assert: entity programUnits first localVariables size equals: 1. var := entity programUnits first localVariables first. - self assert: var class equals: FamixFortran77Variable. + self assert: var class equals: FamixF77Variable. self assert: var name equals: 'aVar'. - self assert: var declaredType class equals: FamixFortran77Type. + self assert: var declaredType class equals: FamixF77Type. self assert: var declaredType name equals: 'integer'. self assert: var parentBehaviouralEntity isNotNil. self @@ -811,7 +811,7 @@ IASTToFamixVisitorTest >> testCreateFamixFortran77PUBlockdata [ self assert: entity programUnits size equals: 1. entity := entity programUnits first. - self assert: entity class equals: FamixFortran77PUBlockdata. + self assert: entity class equals: FamixF77PUBlockdata. self assert: entity name equals: 'bdata'. self assert: entity programFile isNotNil. ] @@ -830,7 +830,7 @@ IASTToFamixVisitorTest >> testCreateFamixFortran77PUComment [ self assert: entity programUnits size equals: 1. entity := entity programUnits first. - self assert: entity class equals: FamixFortran77PUComment. + self assert: entity class equals: FamixF77PUComment. self assert: entity content equals: ' a comment'. self assert: entity programFile isNotNil. ] @@ -848,7 +848,7 @@ IASTToFamixVisitorTest >> testCreateFamixFortran77PUFunction [ self assert: entity programUnits size equals: 1. entity := entity programUnits first. - self assert: entity class equals: FamixFortran77PUFunction. + self assert: entity class equals: FamixF77PUFunction. self assert: entity name equals: 'fct'. self assert: entity programFile isNotNil. ] @@ -867,13 +867,13 @@ IASTToFamixVisitorTest >> testCreateFamixFortran77PUFunctionWithParameter [ self assert: entity programUnits size equals: 1. entity := entity programUnits first. - self assert: entity class equals: FamixFortran77PUFunction. + self assert: entity class equals: FamixF77PUFunction. self assert: entity name equals: 'fct'. self assert: entity programFile isNotNil. self assert: entity parameters size equals: 1. param := entity parameters first. - self assert: param class equals: FamixFortran77Parameter. + self assert: param class equals: FamixF77Parameter. self assert: param name equals: 'var'. self assert: param parentBehaviouralEntity equals: entity. ] @@ -891,7 +891,7 @@ IASTToFamixVisitorTest >> testCreateFamixFortran77PUMain [ self assert: entity programUnits size equals: 1. entity := entity programUnits first. - self assert: entity class equals: FamixFortran77PUMain. + self assert: entity class equals: FamixF77PUMain. self assert: entity name equals: 'main'. self assert: entity programFile isNotNil. ] @@ -904,7 +904,7 @@ IASTToFamixVisitorTest >> testCreateFamixFortran77ProgramFile [ self assert: visitor model size equals: 1. entity := visitor model first. - self assert: entity class equals: FamixFortran77ProgramFile. + self assert: entity class equals: FamixF77ProgramFile. self assert: entity filename equals: 'fortran77.f'. self assert: entity programUnits size equals: 0 ] @@ -914,7 +914,7 @@ IASTToFamixVisitorTest >> testCreateFamixFortran77SourceAnchor [ | entity | entity := self defaultAnchor accept: visitor. - self assert: entity class equals: FamixFortran77IndexedFileAnchor. + self assert: entity class equals: FamixF77IndexedFileAnchor. self assert: entity fileName equals: 'fortran77.f'. self assert: entity startLine equals: 1. self assert: entity startColumn equals: 7. @@ -935,7 +935,7 @@ IASTToFamixVisitorTest >> testCreateFamixFortran77Subroutine [ self assert: entity programUnits size equals: 1. entity := entity programUnits first. - self assert: entity class equals: FamixFortran77PUSubroutine. + self assert: entity class equals: FamixF77PUSubroutine. self assert: entity name equals: 'sub'. self assert: entity programFile isNotNil. self assert: entity parameters size equals: 0 @@ -958,7 +958,7 @@ IASTToFamixVisitorTest >> testCreateFamixFortran77SubroutineWithSimpleImplicit [ self assert: entity programUnits size equals: 1. sub := entity programUnits first. - self assert: sub class equals: FamixFortran77PUSubroutine. + self assert: sub class equals: FamixF77PUSubroutine. self assert: sub name equals: 'sub'. self assert: sub programFile isNotNil. @@ -992,11 +992,11 @@ c@_#include ""point.seg"" self assert: pf programUnits size equals: 1. sub := pf programUnits first. - self assert: sub class equals: FamixFortran77PUSubroutine. + self assert: sub class equals: FamixF77PUSubroutine. self assert: sub includes size equals: 1. include := sub includes first. - self assert: include class equals: FamixFortran77Include. + self assert: include class equals: FamixF77Include. self assert: include filename equals: 'point.seg'. self assert: include includedBy equals: sub " self assert: include source equals: programFile." diff --git a/src/EsopeImporter/FamixEsopeSegment.extension.st b/src/EsopeImporter/FamixEsopeSegment.extension.st index e796205..c64cba0 100644 --- a/src/EsopeImporter/FamixEsopeSegment.extension.st +++ b/src/EsopeImporter/FamixEsopeSegment.extension.st @@ -7,5 +7,5 @@ FamixEsopeSegment >> addLocalVariable: aVariable [ { #category : #'*EsopeImporter' } FamixEsopeSegment >> localVariableClass [ - ^FamixEsopeAttribute + ^FamixFortranAttribute ] diff --git a/src/EsopeImporter/FamixFortran77PUProcedure.extension.st b/src/EsopeImporter/FamixF77PUProcedure.extension.st similarity index 74% rename from src/EsopeImporter/FamixFortran77PUProcedure.extension.st rename to src/EsopeImporter/FamixF77PUProcedure.extension.st index d56442e..f1b4799 100644 --- a/src/EsopeImporter/FamixFortran77PUProcedure.extension.st +++ b/src/EsopeImporter/FamixF77PUProcedure.extension.st @@ -1,7 +1,7 @@ -Extension { #name : #FamixFortran77PUProcedure } +Extension { #name : #FamixF77PUProcedure } { #category : #'*EsopeImporter' } -FamixFortran77PUProcedure >> allLocalVariables [ +FamixF77PUProcedure >> allLocalVariables [ self flag: #FIXME. "Find better way to flatmap types" ^self localVariables @@ -11,7 +11,7 @@ FamixFortran77PUProcedure >> allLocalVariables [ ] { #category : #'*EsopeImporter' } -FamixFortran77PUProcedure >> allTypes [ +FamixF77PUProcedure >> allTypes [ self flag: #FIXME. "Find better way to flatmap types" ^self types diff --git a/src/EsopeImporter/FamixF77PUSubroutine.extension.st b/src/EsopeImporter/FamixF77PUSubroutine.extension.st new file mode 100644 index 0000000..299fed0 --- /dev/null +++ b/src/EsopeImporter/FamixF77PUSubroutine.extension.st @@ -0,0 +1,7 @@ +Extension { #name : #FamixF77PUSubroutine } + +{ #category : #'*EsopeImporter' } +FamixF77PUSubroutine >> isSubroutine [ + + ^true +] diff --git a/src/EsopeImporter/FamixF77ProgramUnit.extension.st b/src/EsopeImporter/FamixF77ProgramUnit.extension.st new file mode 100644 index 0000000..4227e15 --- /dev/null +++ b/src/EsopeImporter/FamixF77ProgramUnit.extension.st @@ -0,0 +1,13 @@ +Extension { #name : #FamixF77ProgramUnit } + +{ #category : #'*EsopeImporter' } +FamixF77ProgramUnit >> isSubroutine [ + + ^false +] + +{ #category : #'*EsopeImporter' } +FamixF77ProgramUnit >> localVariableClass [ + + ^FamixF77Variable +] diff --git a/src/EsopeImporter/FamixFortran77PUSubroutine.extension.st b/src/EsopeImporter/FamixFortran77PUSubroutine.extension.st deleted file mode 100644 index 7ed304a..0000000 --- a/src/EsopeImporter/FamixFortran77PUSubroutine.extension.st +++ /dev/null @@ -1,7 +0,0 @@ -Extension { #name : #FamixFortran77PUSubroutine } - -{ #category : #'*EsopeImporter' } -FamixFortran77PUSubroutine >> isSubroutine [ - - ^true -] diff --git a/src/EsopeImporter/FamixFortran77ProgramUnit.extension.st b/src/EsopeImporter/FamixFortran77ProgramUnit.extension.st deleted file mode 100644 index 8f0b0ca..0000000 --- a/src/EsopeImporter/FamixFortran77ProgramUnit.extension.st +++ /dev/null @@ -1,13 +0,0 @@ -Extension { #name : #FamixFortran77ProgramUnit } - -{ #category : #'*EsopeImporter' } -FamixFortran77ProgramUnit >> isSubroutine [ - - ^false -] - -{ #category : #'*EsopeImporter' } -FamixFortran77ProgramUnit >> localVariableClass [ - - ^FamixFortran77Variable -] diff --git a/src/EsopeImporter/FamixFortran77Resolver.class.st b/src/EsopeImporter/FamixFortran77Resolver.class.st index 50212ef..ab20f7a 100644 --- a/src/EsopeImporter/FamixFortran77Resolver.class.st +++ b/src/EsopeImporter/FamixFortran77Resolver.class.st @@ -71,7 +71,7 @@ FamixFortran77Resolver >> requalifyFunction: function [ defaultImplicitTyping: function name fromProgramUnit: function. name ifNotNil: [ - type := (self newEntity: FamixFortran77Type) name: name. + type := (self newEntity: FamixF77Type) name: name. function declaredType: type ] ] @@ -89,7 +89,7 @@ FamixFortran77Resolver >> requalifyParameter: parameter [ defaultImplicitTyping: parameter name fromProgramUnit: parameter parentBehaviouralEntity. name ifNotNil: [ - type := (self newEntity: FamixFortran77Type) name: name. + type := (self newEntity: FamixF77Type) name: name. parameter declaredType: type ] ] @@ -145,19 +145,19 @@ FamixFortran77Resolver >> requalifyVariableDeclarations: variableDeclarations [ { #category : #'symbols resolution' } FamixFortran77Resolver >> resolve [ - self resolveIncludes: (self model allWithType: FamixFortran77Include). + self resolveIncludes: (self model allWithType: FamixF77Include). self resolveImplicitsDeclarations: - (self model allWithSubTypesOf: FamixFortran77ProgramUnit). + (self model allWithSubTypesOf: FamixF77ProgramUnit). self requalifyParameters: - (self model allWithType: FamixFortran77Parameter). + (self model allWithType: FamixF77Parameter). self requalifyFunctions: - (self model allWithType: FamixFortran77PUFunction). + (self model allWithType: FamixF77PUFunction). self requalifyVariableDeclarations: - (self model allWithType: FamixFortran77Variable). + (self model allWithType: FamixF77Variable). self resolveAccesses: - (self model allWithSubTypesOf: FamixFortran77Access). + (self model allWithSubTypesOf: FamixF77Access). self resolveInvocations: - (self model allWithType: FamixFortran77Invocation) + (self model allWithType: FamixF77Invocation) ] { #category : #'symbols resolution' } @@ -200,7 +200,7 @@ FamixFortran77Resolver >> resolveAsImplicit: anImplicitVariable fromProgramUnit: type := progUnit types ifEmpty: [ - (self newEntity: FamixFortran77Type) + (self newEntity: FamixF77Type) name: (self defaultImplicitTyping: anImplicitVariable entityName fromProgramUnit: progUnit); @@ -210,7 +210,7 @@ FamixFortran77Resolver >> resolveAsImplicit: anImplicitVariable fromProgramUnit: retrieveEntity: anImplicitVariable entityName fromList: progUnit types ]. - ^ (self newEntity: FamixFortran77Variable) + ^ (self newEntity: FamixF77Variable) name: anImplicitVariable entityName; declaredType: type; yourself @@ -247,7 +247,7 @@ FamixFortran77Resolver >> resolveImplicitsFor: programUnit [ FamixFortran77Resolver >> resolveIncludes: includes [ | includedFiles | - includedFiles := self model allWithType: FamixFortran77IncludedFile. + includedFiles := self model allWithType: FamixF77IncludedFile. includes do: [ :include | includedFiles detect: [ :includedFile | includedFile name = include filename ] @@ -287,7 +287,7 @@ FamixFortran77Resolver >> retrieveInvocables: name [ ^ self retrieveEntity: name - fromList: (model allWithSubTypesOf: FamixFortran77PUProcedure) + fromList: (model allWithSubTypesOf: FamixF77PUProcedure) ] { #category : #'symbols resolution' } diff --git a/src/EsopeImporter/IASTAbstractFamixVisitor.class.st b/src/EsopeImporter/IASTAbstractFamixVisitor.class.st index e461a65..80e55cc 100644 --- a/src/EsopeImporter/IASTAbstractFamixVisitor.class.st +++ b/src/EsopeImporter/IASTAbstractFamixVisitor.class.st @@ -11,7 +11,7 @@ Class { { #category : #'private-creation' } IASTAbstractFamixVisitor >> createFamixF77Access: anIastObject [ - ^ (self newEntity: FamixFortran77Access) + ^ (self newEntity: FamixF77Access) sourceAnchor: (self visitIndexedFileAnchor: anIastObject sourceAnchor); attributeAt: #entity put: anIastObject; @@ -104,7 +104,7 @@ IASTAbstractFamixVisitor >> symbolTable: anEntity at: key put: value [ { #category : #visiting } IASTAbstractFamixVisitor >> visitIASTParameter: aParameter [ - ^ (self newEntity: FamixFortran77Parameter) + ^ (self newEntity: FamixF77Parameter) sourceAnchor: (self visitIndexedFileAnchor: aParameter sourceAnchor); name: aParameter entityName; @@ -118,7 +118,7 @@ IASTAbstractFamixVisitor >> visitIASTTypeRef: aType [ - sourceAnchor: ... - entityName: TypeCharacter - kind: nil" - ^(self newEntity: FamixFortran77Type) + ^(self newEntity: FamixF77Type) sourceAnchor: (self visitIndexedFileAnchor: aType sourceAnchor); name: aType entityName; length: aType length; @@ -138,7 +138,7 @@ IASTAbstractFamixVisitor >> visitIndexedFileAnchor: aSourceAnchor [ ^ aSourceAnchor ifNil: [ nil ] ifNotNil: [ - (self newEntity: FamixFortran77IndexedFileAnchor) + (self newEntity: FamixF77IndexedFileAnchor) startLine: aSourceAnchor startLine; endLine: aSourceAnchor endLine; startColumn: aSourceAnchor startColumn; diff --git a/src/EsopeImporter/IASTToEsopeVisitor.class.st b/src/EsopeImporter/IASTToEsopeVisitor.class.st index 30c6f3f..fbdc132 100644 --- a/src/EsopeImporter/IASTToEsopeVisitor.class.st +++ b/src/EsopeImporter/IASTToEsopeVisitor.class.st @@ -8,7 +8,7 @@ Class { IASTToEsopeVisitor >> newType: typeName sourceAnchor: sourceAnchor [ sourceAnchor startColumn: sourceAnchor endColumn - typeName size. - ^ (self newEntity: FamixFortran77Type) + ^ (self newEntity: FamixF77Type) sourceAnchor: (self visitIndexedFileAnchor: sourceAnchor); name: typeName; yourself @@ -21,7 +21,7 @@ IASTToEsopeVisitor >> visitIASTEsopePointer: aPointerVar [ varsNames := aPointerVar entityName substrings: '.'. varsNames size < 2 ifTrue: [ ^ self ]. - ^ (self newEntity: FamixFortran77Variable) + ^ (self newEntity: FamixF77Variable) sourceAnchor: (self visitIndexedFileAnchor: aPointerVar sourceAnchor); name: varsNames first; diff --git a/src/EsopeImporter/IASTToFortranVisitor.class.st b/src/EsopeImporter/IASTToFortranVisitor.class.st index ad8e40c..062e0af 100644 --- a/src/EsopeImporter/IASTToFortranVisitor.class.st +++ b/src/EsopeImporter/IASTToFortranVisitor.class.st @@ -40,7 +40,7 @@ IASTToFortranVisitor >> defaultImplicitTyping: firstLetter [ { #category : #visiting } IASTToFortranVisitor >> ensureInclude: name [ - ^ (self model allWithType: FamixFortran77Include) + ^ (self model allWithType: FamixF77Include) detect: [ :each | each name = name ] ifFound: [ :each | each ] ifNone: [ nil ] @@ -50,27 +50,27 @@ IASTToFortranVisitor >> ensureInclude: name [ IASTToFortranVisitor >> f77InstrinsicTypes [ ^ { - (#integer -> (FamixFortran77Type new + (#integer -> (FamixF77Type new name: 'integer'; mooseModel: model; yourself)). - (#real -> (FamixFortran77Type new + (#real -> (FamixF77Type new name: 'real'; mooseModel: model; yourself)). - (#complex -> (FamixFortran77Type new + (#complex -> (FamixF77Type new name: 'complex'; mooseModel: model; yourself)). - (#logical -> (FamixFortran77Type new + (#logical -> (FamixF77Type new name: 'logical'; mooseModel: model; yourself)). - (#character -> (FamixFortran77Type new + (#character -> (FamixF77Type new name: 'character'; mooseModel: model; yourself)). - (#doublePrecision -> (FamixFortran77Type new + (#doublePrecision -> (FamixF77Type new name: 'double precision'; mooseModel: model; yourself)) } asDictionary @@ -115,7 +115,7 @@ IASTToFortranVisitor >> isDummySubroutine: name [ IASTToFortranVisitor >> newIndexedFileAnchor: filename [ | file | file := filename asFileReference. - ^ (self newEntity: FamixFortran77IndexedFileAnchor) + ^ (self newEntity: FamixF77IndexedFileAnchor) startLine: 1; endLine: (file ifExists: [ (self class getLines: filename) size ] @@ -139,7 +139,7 @@ IASTToFortranVisitor >> visitIASTBlockData: aBlockData [ | blockdata | - blockdata := (self newEntity: FamixFortran77PUBlockdata) + blockdata := (self newEntity: FamixF77PUBlockdata) sourceAnchor: (self visitIndexedFileAnchor: aBlockData sourceAnchor); name: aBlockData entityName; yourself. @@ -162,9 +162,9 @@ IASTToFortranVisitor >> visitIASTComment: aComment [ | comment | comment := aComment isProgUnit - ifTrue: [ self newEntity: FamixFortran77PUComment ] + ifTrue: [ self newEntity: FamixF77PUComment ] ifFalse: [ - (self newEntity: FamixFortran77Comment) + (self newEntity: FamixF77Comment) isEsope: aComment isEsope; commentedEntity: stack top ]. ^ comment @@ -208,7 +208,7 @@ IASTToFortranVisitor >> visitIASTFunction: aFunction [ | function | function := self visitIASTProgramUnit: aFunction - toFamix: FamixFortran77PUFunction. + toFamix: FamixF77PUFunction. aFunction parameters do: [ :parameter | function addParameter: (parameter accept: self) ]. @@ -227,7 +227,7 @@ IASTToFortranVisitor >> visitIASTInclude: anInclude [ self flag: #FIXME. "how to set the source ?" - ^ (self newEntity: FamixFortran77Include) + ^ (self newEntity: FamixF77Include) sourceAnchor: (self visitIndexedFileAnchor: anInclude sourceAnchor); filename: anInclude entityName; @@ -244,13 +244,13 @@ IASTToFortranVisitor >> visitIASTIncludedFile: anIncludedFile [ ^ self visitIASTProgramUnit: anIncludedFile - toFamix: FamixFortran77IncludedFile + toFamix: FamixF77IncludedFile ] { #category : #visiting } IASTToFortranVisitor >> visitIASTInvocation: anInvocation [ - ^ (self newEntity: FamixFortran77Invocation) + ^ (self newEntity: FamixF77Invocation) sourceAnchor: (self visitIndexedFileAnchor: anInvocation sourceAnchor); attributeAt: #entity put: anInvocation; @@ -263,7 +263,7 @@ IASTToFortranVisitor >> visitIASTMainProgram: aMainProgram [ ^ self visitIASTProgramUnit: aMainProgram - toFamix: FamixFortran77PUMain + toFamix: FamixF77PUMain ] { #category : #visiting } @@ -271,7 +271,7 @@ IASTToFortranVisitor >> visitIASTProgramFile: aProgramFile [ | progFile | self f77sourcefile: aProgramFile filename. - progFile := (self newEntity: FamixFortran77ProgramFile) + progFile := (self newEntity: FamixF77ProgramFile) filename: aProgramFile filename; name: aProgramFile filename; yourself. @@ -314,7 +314,7 @@ IASTToFortranVisitor >> visitIASTSubroutine: aSubroutine [ | subroutine | subroutine := self visitIASTProgramUnit: aSubroutine - toFamix: FamixFortran77PUSubroutine. + toFamix: FamixF77PUSubroutine. aSubroutine parameters do: [ :parameter | subroutine addParameter: (parameter accept: self) ]. diff --git a/src/Famix-Esope-Entities/FamixEsopeAttribute.class.st b/src/Famix-Esope-Entities/FamixEsopeAttribute.class.st deleted file mode 100644 index 1c6734e..0000000 --- a/src/Famix-Esope-Entities/FamixEsopeAttribute.class.st +++ /dev/null @@ -1,37 +0,0 @@ -" -# Attribute -A `segment` entity is a grouping of Fortran variables defined by the programmer. -This such of variable called `attribute` - -In the follow example: -```fortran77 -c 1 2 3 4 5 6 7 -c23456789012345678901234567890123456789012345678901234567890123456789012 -c a example of segment definition - segment myseg - integer scalar, array(size), matrix(row, col) - real x, xx(n) - real*8 Y, YY(3, MM) - character*nbca icha(8, ik), chai - end segment -``` -the segment `myseg` have the following attributes: `scalar`, `array`, `matrix`, `x`, `xx`, `Y`, `YY`, `icha`, `chai`, - - -" -Class { - #name : #FamixEsopeAttribute, - #superclass : #FamixFortran77Variable, - #traits : 'FamixTAttribute', - #classTraits : 'FamixTAttribute classTrait', - #category : #'Famix-Esope-Entities-Entities' -} - -{ #category : #meta } -FamixEsopeAttribute class >> annotation [ - - - - - ^ self -] diff --git a/src/Famix-Esope-Entities/FamixEsopeCommand.class.st b/src/Famix-Esope-Entities/FamixEsopeCommand.class.st index ecc0e66..66828ae 100644 --- a/src/Famix-Esope-Entities/FamixEsopeCommand.class.st +++ b/src/Famix-Esope-Entities/FamixEsopeCommand.class.st @@ -14,7 +14,7 @@ As in Fortran, we are led to have a declarative instruction of the SEGMENT and t " Class { #name : #FamixEsopeCommand, - #superclass : #FamixFortran77Access, + #superclass : #FamixF77Access, #instVars : [ '#commandName => FMProperty' ], @@ -24,7 +24,7 @@ Class { { #category : #meta } FamixEsopeCommand class >> annotation [ - + ^ self diff --git a/src/Famix-Esope-Entities/FamixEsopeDimentionalInteger.class.st b/src/Famix-Esope-Entities/FamixEsopeDimentionalInteger.class.st new file mode 100644 index 0000000..f740e44 --- /dev/null +++ b/src/Famix-Esope-Entities/FamixEsopeDimentionalInteger.class.st @@ -0,0 +1,40 @@ +" +Im an 'Entier Dimentionnel' +" +Class { + #name : #FamixEsopeDimentionalInteger, + #superclass : #FamixF77Variable, + #category : #'Famix-Esope-Entities-Entities' +} + +{ #category : #meta } +FamixEsopeDimentionalInteger class >> annotation [ + + + + + ^ self +] + +{ #category : #accessing } +FamixEsopeDimentionalInteger >> segment [ + "Relation named: #segment type: #FamixEsopeSegment opposite: #dimentionalIntegers" + + + + ^ segment +] + +{ #category : #accessing } +FamixEsopeDimentionalInteger >> segment: anObject [ + + + segment := anObject +] + +{ #category : #navigation } +FamixEsopeDimentionalInteger >> segmentGroup [ + + + ^ MooseSpecializedGroup with: self segment +] diff --git a/src/Famix-Esope-Entities/FamixEsopeImplicitPointer.class.st b/src/Famix-Esope-Entities/FamixEsopeImplicitPointer.class.st index 47ca05d..3b9f7ff 100644 --- a/src/Famix-Esope-Entities/FamixEsopeImplicitPointer.class.st +++ b/src/Famix-Esope-Entities/FamixEsopeImplicitPointer.class.st @@ -4,14 +4,14 @@ Im an implicit pointer, Im created when a segment is defined. " Class { #name : #FamixEsopeImplicitPointer, - #superclass : #FamixFortran77Variable, + #superclass : #FamixF77Variable, #category : #'Famix-Esope-Entities-Entities' } { #category : #meta } FamixEsopeImplicitPointer class >> annotation [ - + ^ self diff --git a/src/Famix-Esope-Entities/FamixEsopeImportingContext.class.st b/src/Famix-Esope-Entities/FamixEsopeImportingContext.class.st index 26d76ab..cfc693a 100644 --- a/src/Famix-Esope-Entities/FamixEsopeImportingContext.class.st +++ b/src/Famix-Esope-Entities/FamixEsopeImportingContext.class.st @@ -16,17 +16,17 @@ FamixEsopeImportingContext class >> importedMetamodel [ ] { #category : #importing } -FamixEsopeImportingContext >> importAttribute [ +FamixEsopeImportingContext >> importCommand [ - ^ self importConcreteEntity: (self class fm3ClassNamed: #Attribute) + ^ self importConcreteEntity: (self class fm3ClassNamed: #Command) ] { #category : #importing } -FamixEsopeImportingContext >> importCommand [ +FamixEsopeImportingContext >> importDimentionalInteger [ - ^ self importConcreteEntity: (self class fm3ClassNamed: #Command) + ^ self importConcreteEntity: (self class fm3ClassNamed: #DimentionalInteger) ] { #category : #importing } @@ -86,17 +86,17 @@ FamixEsopeImportingContext >> importSegsup [ ] { #category : #testing } -FamixEsopeImportingContext >> shouldImportAttribute [ +FamixEsopeImportingContext >> shouldImportCommand [ - ^ self shouldImport: #Attribute + ^ self shouldImport: #Command ] { #category : #testing } -FamixEsopeImportingContext >> shouldImportCommand [ +FamixEsopeImportingContext >> shouldImportDimentionalInteger [ - ^ self shouldImport: #Command + ^ self shouldImport: #DimentionalInteger ] { #category : #testing } diff --git a/src/Famix-Esope-Entities/FamixEsopeModel.class.st b/src/Famix-Esope-Entities/FamixEsopeModel.class.st index d343c74..8d2cf56 100644 --- a/src/Famix-Esope-Entities/FamixEsopeModel.class.st +++ b/src/Famix-Esope-Entities/FamixEsopeModel.class.st @@ -1,15 +1,15 @@ Class { #name : #FamixEsopeModel, #superclass : #MooseModel, - #traits : 'FamixEsopeTEntityCreator + FamixFortran77TEntityCreator', - #classTraits : 'FamixEsopeTEntityCreator classTrait + FamixFortran77TEntityCreator classTrait', + #traits : 'FamixEsopeTEntityCreator + FamixF77TEntityCreator + FamixFortranTEntityCreator', + #classTraits : 'FamixEsopeTEntityCreator classTrait + FamixF77TEntityCreator classTrait + FamixFortranTEntityCreator classTrait', #category : #'Famix-Esope-Entities-Model' } { #category : #accessing } FamixEsopeModel class >> allSubmetamodelsPackagesNames [ - ^ #(#'Moose-Query' #'Famix-Traits' #'Famix-Fortran77-Entities') + ^ #(#'Moose-Query' #'Famix-Traits' #'Famix-FortranUDT-Entities' #'Famix-Fortran77-Entities') ] { #category : #meta } diff --git a/src/Famix-Esope-Entities/FamixEsopeSegment.class.st b/src/Famix-Esope-Entities/FamixEsopeSegment.class.st index 43fbd44..0ccc123 100644 --- a/src/Famix-Esope-Entities/FamixEsopeSegment.class.st +++ b/src/Famix-Esope-Entities/FamixEsopeSegment.class.st @@ -23,17 +23,49 @@ The statement is included between the words `SEGMENT` and `ENDSEGMENT`. Remember " Class { #name : #FamixEsopeSegment, - #superclass : #FamixFortran77Type, + #superclass : #FamixF77Type, #traits : 'FamixTWithAttributes', #classTraits : 'FamixTWithAttributes classTrait', + #instVars : [ + '#dimentionalIntegers => FMMany type: #FamixEsopeDimentionalInteger opposite: #segment' + ], #category : #'Famix-Esope-Entities-Entities' } { #category : #meta } FamixEsopeSegment class >> annotation [ - + ^ self ] + +{ #category : #adding } +FamixEsopeSegment >> addDimentionalInteger: anObject [ + + ^ self dimentionalIntegers add: anObject +] + +{ #category : #accessing } +FamixEsopeSegment >> dimentionalIntegers [ + "Relation named: #dimentionalIntegers type: #FamixEsopeDimentionalInteger opposite: #segment" + + + + ^ dimentionalIntegers +] + +{ #category : #accessing } +FamixEsopeSegment >> dimentionalIntegers: anObject [ + + + dimentionalIntegers value: anObject +] + +{ #category : #navigation } +FamixEsopeSegment >> dimentionalIntegersGroup [ + + + ^ MooseSpecializedGroup withAll: self dimentionalIntegers asSet +] diff --git a/src/Famix-Esope-Entities/FamixEsopeTEntityCreator.trait.st b/src/Famix-Esope-Entities/FamixEsopeTEntityCreator.trait.st index 433918d..5d022f5 100644 --- a/src/Famix-Esope-Entities/FamixEsopeTEntityCreator.trait.st +++ b/src/Famix-Esope-Entities/FamixEsopeTEntityCreator.trait.st @@ -17,24 +17,17 @@ FamixEsopeTEntityCreator classSide >> annotation [ ] { #category : #'entity creation' } -FamixEsopeTEntityCreator >> newAttribute [ - - - ^ self add: FamixEsopeAttribute new -] - -{ #category : #'entity creation' } -FamixEsopeTEntityCreator >> newAttributeNamed: aName [ +FamixEsopeTEntityCreator >> newCommand [ - ^ self add: (FamixEsopeAttribute named: aName) + ^ self add: FamixEsopeCommand new ] { #category : #'entity creation' } -FamixEsopeTEntityCreator >> newCommand [ +FamixEsopeTEntityCreator >> newDimentionalInteger [ - ^ self add: FamixEsopeCommand new + ^ self add: FamixEsopeDimentionalInteger new ] { #category : #'entity creation' } diff --git a/src/Famix-Esope-Generator/FamixEsopeGenerator.class.st b/src/Famix-Esope-Generator/FamixEsopeGenerator.class.st index 8d818d6..cf67058 100644 --- a/src/Famix-Esope-Generator/FamixEsopeGenerator.class.st +++ b/src/Famix-Esope-Generator/FamixEsopeGenerator.class.st @@ -87,27 +87,30 @@ Class { 'segdes', 'segini', 'segprt', - 'segsup' + 'segsup', + 'dimentionalInteger' ], #category : #'Famix-Esope-Generator' } -{ #category : #generating } +{ #category : #accessing } FamixEsopeGenerator class >> packageName [ ^ #'Famix-Esope-Entities' ] -{ #category : #generating } +{ #category : #accessing } FamixEsopeGenerator class >> prefix [ ^ #FamixEsope ] -{ #category : #generating } +{ #category : #accessing } FamixEsopeGenerator class >> submetamodels [ - ^ { FamixFortran77Generator } + ^ { + FamixFortran77Generator. + FamixFortranUDTGenerator } ] { #category : #comment } @@ -530,16 +533,18 @@ FamixEsopeGenerator >> defineClasses [ super defineClasses. - access := self remoteEntity: #Access withPrefix: #FamixFortran77. + access := self remoteEntity: #Access withPrefix: #FamixF77. - attribute := builder - newClassNamed: #Attribute - comment: self commentAttribute. + attribute := self remoteEntity: #Attribute withPrefix: #FamixFortran. command := builder newClassNamed: #Command comment: self commentCommand. + dimentionalInteger := builder + newClassNamed: #DimentionalInteger + comment: self dimentionalIntegerComment. + implicitPointer := builder newClassNamed: #ImplicitPointer comment: self commentImplicitPointer. @@ -560,9 +565,9 @@ FamixEsopeGenerator >> defineClasses [ segsup := builder newClassNamed: #Segsup comment: self commentSegsup. - type := self remoteEntity: #Type withPrefix: #FamixFortran77. + type := self remoteEntity: #Type withPrefix: #FamixF77. - variable := self remoteEntity: #Variable withPrefix: #FamixFortran77 + variable := self remoteEntity: #Variable withPrefix: #FamixF77 ] { #category : #definition } @@ -585,7 +590,9 @@ FamixEsopeGenerator >> defineHierarchy [ segdes --|> command. segini --|> command. segprt --|> command. - segsup --|> command + segsup --|> command. + + dimentionalInteger --|> variable ] { #category : #definition } @@ -600,6 +607,20 @@ FamixEsopeGenerator >> defineProperties [ it can be a better solution to use inheritance.' ] +{ #category : #definition } +FamixEsopeGenerator >> defineRelations [ + + super defineRelations. + + segment <>-* dimentionalInteger +] + +{ #category : #definition } +FamixEsopeGenerator >> dimentionalIntegerComment [ + + ^ 'Im an ''Entier Dimentionnel''' +] + { #category : #definition } FamixEsopeGenerator >> newBuilder [ ^super newBuilder diff --git a/src/Famix-Esope-Tests/FamixEsopeTest.class.st b/src/Famix-Esope-Tests/FamixEsopeTest.class.st index d3d1283..093f693 100644 --- a/src/Famix-Esope-Tests/FamixEsopeTest.class.st +++ b/src/Famix-Esope-Tests/FamixEsopeTest.class.st @@ -10,7 +10,7 @@ Class { { #category : #running } FamixEsopeTest >> defaultAnchorFrom: startPoint to: endPoint [ - ^ (self newEntity: FamixFortran77IndexedFileAnchor) + ^ (self newEntity: FamixF77IndexedFileAnchor) startLine: startPoint x; startColumn: startPoint y; endLine: endPoint x; @@ -22,7 +22,7 @@ FamixEsopeTest >> defaultAnchorFrom: startPoint to: endPoint [ { #category : #running } FamixEsopeTest >> defaultAttribute: varName withType: typeName [ - ^ (self newEntity: FamixEsopeAttribute) + ^ (self newEntity: FamixFortranAttribute) sourceAnchor: (self defaultAnchorFrom: 2 @ 7 to: 2 @ 19); name: varName; declaredType: (self defaultType: typeName) @@ -61,7 +61,7 @@ FamixEsopeTest >> defaultSegmentComand: commandName on: varPointer [ { #category : #running } FamixEsopeTest >> defaultType: typeName [ - ^ (self newEntity: FamixFortran77Type) + ^ (self newEntity: FamixF77Type) sourceAnchor: (self defaultAnchorFrom: 2 @ 7 to: 2 @ 19); name: typeName ] @@ -69,7 +69,7 @@ FamixEsopeTest >> defaultType: typeName [ { #category : #running } FamixEsopeTest >> defaultVariable: varName withType: typeName [ - ^ (self newEntity: FamixFortran77Variable) + ^ (self newEntity: FamixF77Variable) sourceAnchor: (self defaultAnchorFrom: 2 @ 7 to: 2 @ 19); name: varName; declaredType: (self defaultType: typeName) @@ -103,7 +103,7 @@ FamixEsopeTest >> testCreateSegmentCommandSegini [ self assert: segini class equals: FamixEsopeSegini. - self assert: segini variable class equals: FamixFortran77Variable. + self assert: segini variable class equals: FamixF77Variable. self assert: segini variable name equals: 'ptr'. self assert: segini variable declaredType name equals: 'pointeur' ] @@ -126,9 +126,9 @@ FamixEsopeTest >> testCreateSegmentWithMultipleAttributes [ self assert: segment name equals: 'myseg'. self assert: segment attributes size equals: 3. - self assert: segment attributes first class equals: FamixEsopeAttribute. + self assert: segment attributes first class equals: FamixFortranAttribute. self assert: segment attributes first name equals: 'uname'. - self assert: segment attributes first declaredType class equals: FamixFortran77Type. + self assert: segment attributes first declaredType class equals: FamixF77Type. self assert: segment attributes first declaredType name equals: 'character'. ] @@ -142,7 +142,7 @@ FamixEsopeTest >> testCreateVariablePointeur [ | pointeur | pointeur := self defaultVariable: 'ptr' withType: 'book'. - self assert: pointeur class equals: FamixFortran77Variable. + self assert: pointeur class equals: FamixF77Variable. self assert: pointeur name equals: 'ptr'. self assert: pointeur declaredType name equals: 'book' ]