misc: Add makefile to help with converting the code to Pharo
Work on automatically porting to Pharo.
This commit is contained in:
parent
854ab4b14b
commit
5ee3f64921
|
@ -0,0 +1,36 @@
|
|||
|
||||
GST_PACKAGE = gst-package
|
||||
GST_CONVERT = gst-convert
|
||||
|
||||
CONVERT_RULES = -r'Osmo.LogManager->LogManager' \
|
||||
-r'Osmo.LogArea->LogArea' \
|
||||
-r'Osmo.LogLevel->LogLevel' \
|
||||
-r'DateTime->DateAndTime' \
|
||||
-r'(Duration milliseconds: ``@args1) -> (Duration milliSeconds: ``@args1)' \
|
||||
-r'PP.PPCompositeParser->PPCompositeParser' \
|
||||
-r'PP.PPCompositeParserTest->PPCompositeParserTest' \
|
||||
-r'Osmo.MessageBuffer->MessageBuffer' \
|
||||
-r'SystemExceptions.NotFound->NotFound' \
|
||||
-r'(``@object substrings: ``@args1)->(``@object subStrings: ``@args1)' \
|
||||
-r'(Dictionary from: ``@args1)->(Dictionary newFrom: ``@args1)' \
|
||||
-r'(``@object copyFrom: ``@args1)->(``@object copyFrom: ``@args1 to: ``@object size)' \
|
||||
-C -IPAGSTTests
|
||||
|
||||
# Can not be parsed right now..
|
||||
# -r'(``@object => ``@args1)->(``@object ==> ``@args1)'
|
||||
|
||||
|
||||
|
||||
all:
|
||||
$(GST_PACKAGE) --test package.xml
|
||||
|
||||
convert:
|
||||
$(GST_CONVERT) $(CONVERT_RULES) -F squeak -f gst \
|
||||
-o fileout.st compat_for_pharo.st Extensions.st MessageStructure.st \
|
||||
ISUP.st isup_generated.st ISUPExtensions.st IPAConstants.st IPADispatcher.st \
|
||||
IPAMuxer.st IPAProtoHandler.st IPAMsg.st MessageBuffer.st SCCP.st \
|
||||
LogAreas.st M2UA.st SocketBase.st TLV.st OsmoCtrlLogging.st \
|
||||
OsmoCtrlGrammar.st OsmoAppConnection.st \
|
||||
Tests.st ISUPTests.st IPATests.st TLVTests.st OsmoCtrlGrammarTest.st
|
||||
sed -i s,"=>","==>",g fileout.st
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
Object subclass: StreamSocket [
|
||||
<category: 'OsmoNetwork-Pharo'>
|
||||
]
|
||||
|
||||
ByteArray extend [
|
||||
shortAt: index [
|
||||
<category: '*OsmoNetwork-Pharo'>
|
||||
|
||||
"This is not signed right now"
|
||||
^ self ushortAt: index
|
||||
]
|
||||
|
||||
ushortAt: index [
|
||||
<category: '*OsmoNetwork-Pharo'>
|
||||
|
||||
^ ((self at: index + 1) bitShift: 8) bitOr: (self at: index)
|
||||
]
|
||||
|
||||
uintAt: index [
|
||||
<category: '*OsmoNetwork-Pharo'>
|
||||
|
||||
| byte1 byte2 byte3 byte4 |
|
||||
byte1 := (self at: index).
|
||||
byte2 := (self at: index + 1) bitShift: 8.
|
||||
byte3 := (self at: index + 2) bitShift: 16.
|
||||
byte4 := (self at: index + 3) bitShift: 24.
|
||||
|
||||
^ (((byte4 bitOr: byte3) bitOr: byte2) bitOr: byte1)
|
||||
]
|
||||
]
|
||||
|
||||
NotFound class extend [
|
||||
signalOn: anObject what: aMessage [
|
||||
<category: '*OsmoNetwork-Pharo'>
|
||||
^ self new
|
||||
object: anObject;
|
||||
messageText: aMessage;
|
||||
signal
|
||||
]
|
||||
]
|
Reference in New Issue