1
0
Fork 0

isup: Implement the subclass handling of some of the types

This commit is contained in:
Holger Hans Peter Freyther 2011-03-04 00:17:30 +01:00
parent afe63b2f91
commit 0ba1f5cf7e
1 changed files with 40 additions and 2 deletions

View File

@ -250,8 +250,42 @@ ISUPMessage subclass: ISUP%1 [
]
]
Object subclass: SubclassCreator [
| structs |
<comment: 'I will create subclasses for identical structs but with a different
message type.'>
file: aName [
| className baseName |
className := (aName copyFrom: 6 to: (aName indexOf: $.) - 1) asUppercase.
baseName := ((FileStream open: aName) lines next copyFrom: 9) asUppercase.
self structs add: '
ISUP%1 subclass: ISUP%2 [
ISUP%2 class >> structure [
^ (super structure)
type: ISUPConstants msg%2; yourself
]
]' % {baseName. className}.
]
structsDo: aBlock [
self structs do: aBlock.
]
structs [
^ structs ifNil: [structs := OrderedCollection new]
]
]
Eval [
| struct outp |
| struct outp subs |
same := #('same_bla.txt' 'same_ccr.txt' 'same_cgba.txt' 'same_cgua.txt'
'same_cgu.txt' 'same_far.txt' 'same_gra.txt' 'same_lpa.txt'
'same_olm.txt' 'same_rsc.txt' 'same_sus.txt' 'same_uba.txt'
'same_ubl.txt' 'same_ucic.txt' 'same_upa.txt').
files := #('acm.txt' 'amn.txt' 'apt.txt' 'blo.txt' 'cfn.txt' 'cgb.txt' 'con.txt'
'cot.txt' 'cpg.txt' 'cqr.txt' 'faa.txt' 'fac.txt' 'fot.txt' 'frj.txt'
'gra.txt' 'grs.txt' 'iam.txt' 'idr.txt' 'ids.txt' 'inf.txt' 'inr.txt'
@ -267,5 +301,9 @@ Eval [
struct typesDo: [:each | outp nextPutAll: each. outp nextPut: Character nl. outp nextPut: Character nl.].
outp nextPutAll: '"MSGs for ISUP"'.
struct structsDo: [:struct | outp nextPutAll: struct. outp nextPut: Character nl. outp nextPut: Character nl]
struct structsDo: [:struct | outp nextPutAll: struct. outp nextPut: Character nl. outp nextPut: Character nl].
subs := SubclassCreator new.
same do: [:each | subs file: each. ].
subs structsDo: [:struct | outp nextPutAll: struct. outp nextPut: Character nl; nextPut: Character nl.]
]