[Cuis-dev] How to import code in string
Hilaire Fernandes
hilaire at drgeo.eu
Sat Sep 25 09:47:25 PDT 2021
Hi,
Does one of you know how to import code contained in a string?
The string contains a class definition with method. I use to it that way
with Pharo:
parseScript: drgeoNode "First do one pass to compile all the script
Smalltalk source code" drgeoNode elementsDo: [: node | (node
tag = #value and: [(node attributeAt: #type) = #script]) ifTrue:
[CodeImporter evaluateString: (node contentStringAt: #code)]]
The string content from an XML file (does YAXO parse entities?):
DrGeoUserScript subclass:
#DrGeoScript126328658
instanceVariableNames:
''
classVariableNames: ''
poolDictionaries:
''
category: 'DrGeoII-User'!
!DrGeoScript126328658
commentStamp: '<historical>' prior:
0!
!
!DrGeoScript126328658 methodsFor: 'public' stamp:
'HilaireFernandes 12/9/2014 15:28'!
compute
"Edit
me"
^[:x | x cos ]! !
"-- -- -- -- -- -- --
-- -- -- -- -- -- -- -- -- -- -- "!
DrGeoScript126328658
class
instanceVariableNames: ''!
!DrGeoScript126328658 class
commentStamp: '<historical>' prior:
0!
!
!DrGeoScript126328658 class methodsFor: 'public'
stamp: 'HilaireFernandes 12/9/2014 14:50'!
description
^'The
function to be plotted. Return a bloc of code'!
!
!DrGeoScript126328658 class methodsFor: 'public' stamp:
'HilaireFernandes 12/9/2014 14:43'!
scriptName
^'Function'!
!
!DrGeoScript126328658 class methodsFor: 'private' stamp:
'HilaireFernandes 12/9/2014 14:43'!
newArgumentsType
^{}! !
Thanks
--
GNU Dr. Geo
http://drgeo.eu
http://blog.drgeo.eu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20210925/9d4c0a0c/attachment.htm>
More information about the Cuis-dev
mailing list