Question on translating some code from VisualSmalltalk to GST..

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Question on translating some code from VisualSmalltalk to GST..

Rick Flower-2
Ok.. GST is barfing on the following construct -- I think this is an
array
of associations -- correct?

someMethod

  ^#(
  ('foo' someClassName)
  ('bar' someOtherClassName)
...
)

Any suggestions on what this might translate to in GST?


_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Question on translating some code from VisualSmalltalk to GST..

Rick Flower-2
 

Just a quick followup.. The error that gst is giving is :


foo.st:1234: expected true, false or nil

Any ideas?
_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Question on translating some code from VisualSmalltalk to GST..

Ladislav Marek
Only constants are allowed within #() syntax, so #(1 2 3 true nil
etc.) is allowed, but no variables or expressions.

On Wed, Sep 26, 2012 at 1:43 AM, Rick Flower <[hidden email]> wrote:

>
>
> Just a quick followup.. The error that gst is giving is :
>
>
> foo.st:1234: expected true, false or nil
>
> Any ideas?
> _______________________________________________
> help-smalltalk mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/help-smalltalk

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Question on translating some code from VisualSmalltalk to GST..

Rick Flower-2
On 25.09.2012 23:13, Ladislav Marek wrote:

> Only constants are allowed within #() syntax, so #(1 2 3 true nil
> etc.) is allowed, but no variables or expressions.

Hmm.. So a disconnect of sorts.. Doh!  I was thinking about
porting some code over that I found for VisualSmalltalk that
could write RTF files from scratch but the code seems to use
these as a quasi-lookup table of sorts -- mapping statements
to classes that handle/parse those statements.. I'm wondering
at this point if it might not be easier to find an external
RTF writer written in "C" (for instance) and build some
bindings for GST to use it.. Is that route painful -- ?

I guess another possible option (perhaps?) would be to
generate some sort of input file that directs an offline
(e.g. perl module) tool to write the RTF based on directions..
Not sure if such a beastie exists or not..

One last thought would be to have my code use pre-canned
templates of sorts and just fill-in the details to flesh
out the document -- that might be my easiest choice and
certainly the fastest to get me to my end-point..

If you can think of any other suggestions or libraries
that are license compatible with GST, drop me a note..
Thanks all!!

--Rick

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Question on translating some code from VisualSmalltalk to GST..

Ladislav Marek
Maybe you can replace #() syntax with {}:

 ^{
 ('foo' someClassName).
 ('bar' someOtherClassName).
...
}

On Wed, Sep 26, 2012 at 4:30 PM, Rick Flower <[hidden email]> wrote:

> On 25.09.2012 23:13, Ladislav Marek wrote:
>
>> Only constants are allowed within #() syntax, so #(1 2 3 true nil
>> etc.) is allowed, but no variables or expressions.
>
>
> Hmm.. So a disconnect of sorts.. Doh!  I was thinking about
> porting some code over that I found for VisualSmalltalk that
> could write RTF files from scratch but the code seems to use
> these as a quasi-lookup table of sorts -- mapping statements
> to classes that handle/parse those statements.. I'm wondering
> at this point if it might not be easier to find an external
> RTF writer written in "C" (for instance) and build some
> bindings for GST to use it.. Is that route painful -- ?
>
> I guess another possible option (perhaps?) would be to
> generate some sort of input file that directs an offline
> (e.g. perl module) tool to write the RTF based on directions..
> Not sure if such a beastie exists or not..
>
> One last thought would be to have my code use pre-canned
> templates of sorts and just fill-in the details to flesh
> out the document -- that might be my easiest choice and
> certainly the fastest to get me to my end-point..
>
> If you can think of any other suggestions or libraries
> that are license compatible with GST, drop me a note..
> Thanks all!!
>
> --Rick
>
>
> _______________________________________________
> help-smalltalk mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/help-smalltalk

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Question on translating some code from VisualSmalltalk to GST..

Rick Flower-2
In reply to this post by Rick Flower-2
By the way.. In the off chance this might be of interest to someone
down the road.. It turns out that Microsoft's docx format is actually
a zip file with a bunch of XML files embedded within subfolders.. You
could, in theory, write some code to parse the XML file(s) and re-write
when the necessary changes have been made.. However, the auto-genned
XML
is not pretty by any means!

In my case I've decided to go with a brute-force method and will have
my code generate some 'sed' commands to make the necessary updates to
an
RTF template file I will have available -- that would be WAY easier
than
either dealing with RTF writing or monkeying around with MS's docx
files
or even easier than building HTML output for reading by MS Word..
(which is my end goal)

Thanks all! I will keep trudging forward!


_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Question on translating some code from VisualSmalltalk to GST..

Rick Flower-2
In reply to this post by Ladislav Marek
On 26.09.2012 08:03, Ladislav Marek wrote:

> Maybe you can replace #() syntax with {}:
>
> ^{
> ('foo' someClassName).
> ('bar' someOtherClassName).
> ...
> }

Hmm.. I guess I'll have to read up on what the
difference is -- not sure I know off the top of
my head. Thanks for the heads-up!

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Question on translating some code from VisualSmalltalk to GST..

Paolo Bonzini-2
In reply to this post by Rick Flower-2
Il 25/09/2012 23:54, Rick Flower ha scritto:

>
> someMethod
>
>  ^#(
>  ('foo' someClassName)
>  ('bar' someOtherClassName)
> ...
> )
>
> Any suggestions on what this might translate to in GST?

It's an array of arrays.  In GST you need to prefix symbols with # always:

  ^#(
  ('foo' #someClassName)
  ('bar' #someOtherClassName)
 ...
 )

Otherwise true/false/nil would conflict.

Paolo

_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Question on translating some code from VisualSmalltalk to GST..

Rick Flower-2
On 26.09.2012 08:59, Paolo Bonzini wrote:

> It's an array of arrays. In GST you need to prefix symbols with #
> always:
>
> ^#(
> ('foo' #someClassName)
> ('bar' #someOtherClassName)
> ...
> )
>
> Otherwise true/false/nil would conflict.

Ahh.. That makes sense!  Thanks!



_______________________________________________
help-smalltalk mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-smalltalk