Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Hi,
Dr. Geo script are becoming first class citizen -- before it was just a method hooked to an existing DrGeoUserScripts class ; then, it was easy to export the script method as a string to include it in the XML sketch file. Now to save a Dr. Geo sketch using a script, the whole script class needs to be embedded in the sketch XML representation. Is it possible to export a whole class as a string, then import it back from a string representation to a class? Thanks Hilaire -- Dr. Geo - http://drgeo.eu iStoa - http://istoa.drgeo.eu |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Isn't that a fileOut/fileIn thing? Phil |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Le 12/11/2014 09:08, [hidden email] a écrit :
>> Is it possible to export a whole class as a string, then import it back >> from a string representation to a class? > > Isn't that a fileOut/fileIn thing? > Yes, however I don't want it on a .st file (to avoid possible trouble on the end user DrGeo installation) but on a string within Smalltalk. Hilaire -- Dr. Geo - http://drgeo.eu iStoa - http://istoa.drgeo.eu |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
String streamContents: [ :out | Association fileOutOn: out ]
I am not sure it covers everything, but for some script methods this will do. > On 12 Nov 2014, at 09:21, Hilaire <[hidden email]> wrote: > > Le 12/11/2014 09:08, [hidden email] a écrit : >>> Is it possible to export a whole class as a string, then import it back >>> from a string representation to a class? >> >> Isn't that a fileOut/fileIn thing? >> > > Yes, however I don't want it on a .st file (to avoid possible trouble on > the end user DrGeo installation) but on a string within Smalltalk. > > Hilaire > > > > -- > Dr. Geo - http://drgeo.eu > iStoa - http://istoa.drgeo.eu > > ... [show rest of quote] |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
In reply to this post by HilaireFernandes
On Wed, Nov 12, 2014 at 9:21 AM, Hilaire <[hidden email]> wrote: Le 12/11/2014 09:08, [hidden email] a écrit : Why not use FileSystem memory for those things? This would keep the files inside the image. Phil
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
and if you want a json like implementation there is filetree. I think json is a much better format than XML but I am nowhere near to an experienced web developer. On Wed, Nov 12, 2014 at 11:15 AM, [hidden email] <[hidden email]> wrote:
... [show rest of quote] |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
In reply to this post by Sven Van Caekenberghe-2
Thanks, interesting hack I need to learn from.
Filout works well as long as only ascii appear in the body of the method. When a method contains non ascii (for example for a string) fileout get irrational with a ZNInvalidUTF8, but not always! For example, a script method as: scriptName ^ 'téte' does not lead to the error, but as following: scriptName ^ 'tété' leads to the error. Note the scriptName method works from Pharo To build the script I use the following code. createScriptFrom: dialog "Build a new script from the dialog, return the newly created script object" |scriptClass stream| scriptClass := DrGeoUserScript subclass: ('DrGeoScript', dialog scriptName hash printString) asSymbol instanceVariableNames: '' classVariableNames: '' category: 'DrGeoII-User'. "name" stream := WriteStream on: String new. stream << 'scriptName'; << Character cr; << Character tab; << $^; <<$'; << dialog scriptName; << $'. scriptClass compile: stream contents classified: 'public'. Later I test directly from the browser with a dummy class with one method with non ascii character. Fileout sometimes work (for example, I add a space in the method body, save, remove the space, save again,...), some time not. tested on Pharo 3.0 Hilaire Le 12/11/2014 09:33, Sven Van Caekenberghe a écrit : > String streamContents: [ :out | Association fileOutOn: out ] > > I am not sure it covers everything, but for some script methods this will do. -- Dr. Geo - http://drgeo.eu iStoa - http://istoa.drgeo.eu |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
In reply to this post by philippeback
Le 12/11/2014 10:15, [hidden email] a écrit :
> Why not use FileSystem memory for those things? This would keep the > files inside the image. > because I didn't know about it :) But fileout(UTF8 conversion, again...) seems to be broken, see my other post. Hilaire -- Dr. Geo - http://drgeo.eu iStoa - http://istoa.drgeo.eu |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
In reply to this post by HilaireFernandes
Le 12/11/2014 10:22, Hilaire a écrit :
> Later I test directly from the browser with a dummy class with one > method with non ascii character. Fileout sometimes work (for example, I > add a space in the method body, save, remove the space, save again,...), > some time not. > > tested on Pharo 3.0 Reported here https://pharo.fogbugz.com/f/cases/14462/ZNInvalidUTF8-when-fileout-method-body-with-non-ascii-characters -- Dr. Geo - http://drgeo.eu iStoa - http://istoa.drgeo.eu |
Free forum by Nabble | Edit this page |