Using syx objects with c++

4 views
Skip to first unread message

Nordlys

unread,
Jul 21, 2008, 9:47:26 AM7/21/08
to Syx general discussion
In the other thread you suggested me to declare a primitive:

> [Smalltalk]
> Smalltalk cCall: 'setShader' withArguments: #(1)

> [C side]
> SYX_FUNC_PRIMITIVE(setShader)
> {
> SYX_PRIM_ARGS(1); /* ensure there's at least one parameter, it's optional */
> int type = SYX_SMALL_INTEGER (es->message_arguments[0]);
> shaders.current = type;
> return 1;
>
> }

> [Interpreting the smalltalk code]
> SyxOop process = syx_process_new ();
> SyxOop string = syx_string_new (CODE_TO_BE_INTERPRETED);
> SyxOop context = syx_send_unary_message (string, "doIt");
> syx_interp_enter_context (process, context);
> syx_process_execute_blocking (process);

And objects with code:

> Object subclass: #Application
> instanceVariableNames: ''!
>
> !Application methodsFor: 'primitives'
> shader: aValue
> <cCall: 'setShader'>
> ! !

> Then you can have a string to interpret like this:
> self shader: 1

That's in fact pretty much clean and nice.

I do the following, though i don't get whatthe es is, maybe I'm
missing that:

//Syx Primitives (Functions syx can call)
SYX_FUNC_PRIMITIVE(SyxSetShader)
{
//SYX_PRIM_ARGS(1); /* ensure there's at least one parameter,
it's optional */
int type = SYX_SMALL_INTEGER (es->message_arguments[0]);
shaders.current = type;
return 1;
}

and in do-me.st I wrote the following code:

Object subclass: #Application
instanceVariableNames: ''!

!Application methodsFor: 'primitives'
shader: aValue
Smalltalk cCall: 'SyxSetShader' withArguments: #(1)!
! !

It gives me back the following error:

Unhandled exception... process is going to be terminated.
= An error occurred during program execution.

Traceback:
PrimitiveFailed(Signal)>>#signal
PrimitiveFailed class(Signal class)>>#signal
CompilerParser(Object)>>#primitiveFailed
CompilerParser>>#primParseChunk:startingAt:
CompilerParser>>#runMultipleAndDeclarations
FileStream>>#fileIn
FileStream class>>#fileIn:

is it that I am supposed to have an object somewhere? Did I make any
smalltalk mistake? Other examples works fine, so now the interpreter
is up and running on linux.

D.

Nordlys

unread,
Jul 21, 2008, 11:41:01 AM7/21/08
to Syx general discussion
I got the es, there is a pointer in the syx-interp.h, used within the
interpreter, so I guess that one is all right.

a

Smalltalk cCall: 'syxSetShader' withArguments: #(1).

didn't get much more fortune.

Thanks for your always good-quality and quick enough support :D

D.

Luca Bruno

unread,
Jul 21, 2008, 6:51:31 PM7/21/08
to syx-d...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
You did the wrong stuff. First of all, you can't "return 1", but SYX_PRIM_RETURN (es->message_receiver); at least.
Then better
shader: aValue
<cCall: 'SyxSetShader'>
self primitiveFailed
!

Have you compiled your code with -rdynamic and syx with plugins support? It's like syx can't find your primitive.

- --
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkiFEvMACgkQw9Qj+8Kak3Fk3gCgksnKasSZGTx6UbsMIb4ELhx4
rXoAnj5x3aRYVQTbB/4D3CYEB4ab5rfz
=lMw3
-----END PGP SIGNATURE-----

Luca Bruno

unread,
Jul 21, 2008, 7:00:03 PM7/21/08
to syx-d...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Didn't catch what you mean.
You have to use SYX_PRIM_RETURN in the primitive and have you compiled with -rdynamic and syx with plugins support?

- --
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkiFFPMACgkQw9Qj+8Kak3FP9gCeJxgx+ZLHwPjW8fN7eSQU37mV
yOQAn2w1yeATxAKPRcqpd8Jjm6S75ysF
=tMNS
-----END PGP SIGNATURE-----

Nordlys

unread,
Jul 21, 2008, 1:07:37 PM7/21/08
to Syx general discussion
I pasted what you passed me for gcc but it didn't work. Giving all the
option to the compiler resulted in several errors.
The previous code was the one you posted me, so I religiously taken it
as true :P
Could you pass me the line I need to type, possibly with the very
least commands, so I see if it raises other errors?

Thank you thousand
D.

Nordlys

unread,
Jul 21, 2008, 1:13:40 PM7/21/08
to Syx general discussion
P.S. I also tried -Wall -rdynamic as used in the following example
gcc -o average average.c -lsyx -Wall -rdynamic
in the ExampleEmbeddinLua

D.

Luca Bruno

unread,
Jul 21, 2008, 8:18:58 PM7/21/08
to syx-d...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

And what's the error?

- --
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkiFJ3IACgkQw9Qj+8Kak3G7mQCfZnDwnpoQcl3+NEknUMYnKGup
ehcAnR15+mnMob15h54Esv4/E5MHMwtg
=gju9
-----END PGP SIGNATURE-----

Nordlys

unread,
Jul 21, 2008, 1:33:26 PM7/21/08
to Syx general discussion
with -Wall -rdynamic... compilation goes right, but then I get the
same error I reported in the first post.

with
-std=gnu99 -DHAVE_CONFIG_H -I. -I.. -ansi -pedantic -Wall
-Wno-strict-aliasing -DROOT_PATH=/usr/local/share/syx
-DIMAGE_PATH=/usr/local/share/syx/default.sim
-DPLUGIN_PATH=/usr/local/lib/syx -g -O2 -MT libsyx_la-syx-bytecode.lo
-MD -MP -MF .deps/libsyx_la-syx-bytecode.Tpo -c syx-bytecode.c -fPIC
-DPIC -o .libs/libsyx_la-syx-bytecode.o

errors such as gnu99 works with c/objc not c++, can't use either -o
and -c or -S on multiple files, then something about -M and -MM

Luca Bruno

unread,
Jul 21, 2008, 8:49:49 PM7/21/08
to syx-d...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Aren't you compiling Syx with gnu autotools? What are you compiling? :(

... I'm confused...

- --
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkiFLq0ACgkQw9Qj+8Kak3GFeACaA9vl3FaXDl2ObKZyhdGwtCLO
/Z8An2858oar39uWyeSRRZt4as2vJs/i
=HgCq
-----END PGP SIGNATURE-----

Luca Bruno

unread,
Jul 21, 2008, 8:51:20 PM7/21/08
to syx-d...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

It's so simple:
1) Get the tarball from internet
2) ./configure
3) make
4) make install (as root)
5) Compile your program with -rdynamic -lsyx

That's it!

- --
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkiFLwgACgkQw9Qj+8Kak3FuLwCfTz8r89hIbBomNVDNo1smFScd
WM0AnRakRjEIIEZouuHnqJAafQJ5O48v
=IN90
-----END PGP SIGNATURE-----

Nordlys

unread,
Jul 21, 2008, 2:02:14 PM7/21/08
to Syx general discussion
I followed all the points.
Syx is installed, compiled with that exact commands. And it works
using gcc compiler under linux.
It runs the do-me test inside my app. But it doesn't run primitives.

I use gcc via code::blocks which has a play button, as well as visual
c, that launch the compiler with all the options. -rdynamic has been
inserted amongst the user selected flags.
Everything DO work but the code I copied-pasted from your posts prints
on console that there has been an unhandled exception.
The unhandled exception is the one at post 1. :|

On 22 Lug, 02:51, Luca Bruno <lethalma...@gmail.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> It's so simple:
> 1) Get the tarball from internet
> 2) ./configure
> 3) make
> 4) make install (as root)
> 5) Compile your program with -rdynamic -lsyx
>
> That's it!
>
> - --http://syx.googlecode.com- Smalltalk YXhttp://lethalman.blogspot.com- Thoughts about computer technologieshttp://www.ammazzatecitutti.org- Ammazzateci tutti

Luca Bruno

unread,
Jul 21, 2008, 9:13:05 PM7/21/08
to syx-d...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 21 Jul 2008 11:02:14 -0700 (PDT)
Nordlys <itma...@gmail.com> wrote:

>
> I followed all the points.
> Syx is installed, compiled with that exact commands. And it works
> using gcc compiler under linux.
> It runs the do-me test inside my app. But it doesn't run primitives.
>
> I use gcc via code::blocks which has a play button, as well as visual
> c, that launch the compiler with all the options. -rdynamic has been
> inserted amongst the user selected flags.
> Everything DO work but the code I copied-pasted from your posts prints
> on console that there has been an unhandled exception.
> The unhandled exception is the one at post 1. :|
>

I'm afraid it hasn't been compiled with plugins support.
What you get after the ./configure? Is plugins support enabled?

- --
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkiFNCEACgkQw9Qj+8Kak3EgzgCfTfzcImRYUgVG9ideBmMTk1fm
/zsAni74Tb9m7/x3nWfTgCKvnI2p/Ok4
=6+sf
-----END PGP SIGNATURE-----

Nordlys

unread,
Jul 21, 2008, 2:36:18 PM7/21/08
to Syx general discussion
Smalltalk YX was configured with the following options:

Debug level : normal
Big numbers support : yes
Plugins support : yes


The following plugins will be built:

GTK+ : yes
Readline : no
X11 : yes
WinGui : no

Do you have any messenger client? I guess communication is difficult,
so that we waste time just because we have problems understanding each
other
D.

On 22 Lug, 03:13, Luca Bruno <lethalma...@gmail.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Mon, 21 Jul 2008 11:02:14 -0700 (PDT)
>
> Nordlys <itmarr...@gmail.com> wrote:
>
> > I followed all the points.
> > Syx is installed, compiled with that exact commands. And it works
> > using gcc compiler under linux.
> > It runs the do-me test inside my app. But it doesn't run primitives.
>
> > I use gcc via code::blocks which has a play button, as well as visual
> > c, that launch the compiler with all the options. -rdynamic has been
> > inserted amongst the user selected flags.
> > Everything DO work but the code I copied-pasted from your posts prints
> > on console that there has been an unhandled exception.
> > The unhandled exception is the one at post 1. :|
>
> I'm afraid it hasn't been compiled with plugins support.
> What you get after the ./configure? Is plugins support enabled?
>
> - --http://syx.googlecode.com- Smalltalk YXhttp://lethalman.blogspot.com- Thoughts about computer technologieshttp://www.ammazzatecitutti.org- Ammazzateci tutti

Luca Bruno

unread,
Jul 21, 2008, 9:39:44 PM7/21/08
to syx-d...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Mon, 21 Jul 2008 11:36:18 -0700 (PDT)
Nordlys <itma...@gmail.com> wrote:

> Do you have any messenger client? I guess communication is difficult,
> so that we waste time just because we have problems understanding each
> other
> D.
>

MSN: letha...@hotmail.com
Jabber: leth...@jabber.org
IRC: irc://irc.freenode.org/syx

- --
http://syx.googlecode.com - Smalltalk YX
http://lethalman.blogspot.com - Thoughts about computer technologies
http://www.ammazzatecitutti.org - Ammazzateci tutti
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkiFOmAACgkQw9Qj+8Kak3H/JQCfRy9IhIAVbSz8q4Qfzziyaqnp
5HUAn2gyttAUM7+XcrSvaEkqpNbGjPHe
=z/Yo
-----END PGP SIGNATURE-----
Reply all
Reply to author
Forward
0 new messages