Squirrel static lib

Mac OSX specific forum
User avatar
grabiller
Enthusiast
Enthusiast
Posts: 309
Joined: Wed Jun 01, 2011 9:38 am
Location: France - 89220 Rogny-Les-Septs-Ecluses
Contact:

Squirrel static lib

Post by grabiller »

Hi,

For the raafal project I'm looking for someone who would be kind enough to compile Squirrel as a 64bit static library for Mac OS/X so I could use it with an Import statement in PB. I already have it for Windows and Linux.

Squirrel is a small and fast scripting language (based on Lua code) with Javascript like syntax but with native classes instead of prototypes.
http://www.squirrel-lang.org/

The latest source package can be downloaded here:
http://code.google.com/p/squirrel/
(squirrel_3_0_3_stable.tar.gz)

raafal will use Squirrel as its official scripting language (others like Python,.. may be added in the future) for a lot of things including expressions evaluation inside numeric input fields.

As I'm working on the UI Widgets, I've already done the numeric/slider input widget and I just need to finish it with expressions evaluation for which I need Squirrel.

My Mac setup is not very 'academic' to say the least and it's a pain to use so any help on this would be appreciated.

On a side note the raafal project is still looking for its first Mac OS/X support team member :wink:
If you are interested, do not hesitate to contact me.

Cheers,
Guy.
guy rabiller | radfac founder / ceo | raafal.org
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3944
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Squirrel static lib

Post by wilbert »

I don't know if everything was compiled properly but you can try if it works.
http://www.w73.nl/pb/squirrel.zip
Last edited by wilbert on Wed May 31, 2017 3:11 pm, edited 1 time in total.
User avatar
grabiller
Enthusiast
Enthusiast
Posts: 309
Joined: Wed Jun 01, 2011 9:38 am
Location: France - 89220 Rogny-Les-Septs-Ecluses
Contact:

Re: Squirrel static lib

Post by grabiller »

Awesome. Thanks wilbert!

I just did a quick test and it seems to work as expected. I'll do more extensive tests this week.

Thanks again!

Cheers
guy rabiller | radfac founder / ceo | raafal.org
User avatar
grabiller
Enthusiast
Enthusiast
Posts: 309
Joined: Wed Jun 01, 2011 9:38 am
Location: France - 89220 Rogny-Les-Septs-Ecluses
Contact:

Re: Squirrel static lib

Post by grabiller »

After more extensive tests, everything appears to work properly.

However, and this is my fault, I forgot to mention the SQUSEDOUBLE preprocessor definition to compile Squirrel with SQFloat as double instead of float.

Could it be possible for you to recompile the libraries with the SQUSEDOUBLE defined ?
guy rabiller | radfac founder / ceo | raafal.org
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3944
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Squirrel static lib

Post by wilbert »

Maybe a silly question but how do I set that flag ?
User avatar
grabiller
Enthusiast
Enthusiast
Posts: 309
Joined: Wed Jun 01, 2011 9:38 am
Location: France - 89220 Rogny-Les-Septs-Ecluses
Contact:

Re: Squirrel static lib

Post by grabiller »

It depends on how you compile the library. If you just do a "make sq64" then you will have to add the -DSQUSEDOUBLE to the gcc command lines in the squirrel and sqstdlib makefiles.

Once compiled you can check the result with the "sq" executable from the bin folder and type "print(_floatsize_)" in the console. It should print 8 instead of 4.
guy rabiller | radfac founder / ceo | raafal.org
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3944
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Squirrel static lib

Post by wilbert »

Try again, same download location.
User avatar
grabiller
Enthusiast
Enthusiast
Posts: 309
Joined: Wed Jun 01, 2011 9:38 am
Location: France - 89220 Rogny-Les-Septs-Ecluses
Contact:

Re: Squirrel static lib

Post by grabiller »

Yep, that's it.

Thank you again very much, wilbert.

You can test it here:
http://www.raafal.org/download/raafal.x ... macosx.zip

I would be interested to know the result on a 'real' Mac :wink:

The last widget (slider/numeric) on the dialog is where you can enter expressions evaluated with Squirrel. You have to right click on it to enter edit mode. You can preview the result of an expression by SHIFT+ENTER, and go back to the expression with CMD+Z. ESC will undo everything since you entered edit mode. ENTER to validate.

Aside the usual operators (+,-,/,*,%) here are the usable functions:
abs(x), acos(x), asin(x), atan(x), atan2(x,y), ceil(x), cos(x), exp(x), fabs(x), floor(x), log(x), log10(x), pow(x,y), rand(x), sin(x), sqrt(x), srand(seed), tan(x), PI or pi, RAND_MAX.

You can use variables too and separate expressions with commas, the last expression on the right is the one returned:
x=0.1,y=0.2,x+y
should returns 0.3

Bitwise operators are also supported:
&,^,|,~,>>,<<,>>>

Logical operators are supported as well but I made a little mistake and they wont work properly with '=' because normaly, in Squirrel, when you create a new variable, if it's not local to a function, you have to create a new 'slot':
x <- 5.0
Is equivalent to x = 5.0 except it will create 'x' in the context environment. For convenience I replace '=' with '<-' before compiling but I forgot the logical operators '==', '!=', '<==>' so they wont work properly for now. (as well as '+=', '-=', '/=' and '*='. I'll fix that later.

A message requester is shown (for now, later one it will use the framework logging system) on compile error or on runtime error.
guy rabiller | radfac founder / ceo | raafal.org
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3944
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Squirrel static lib

Post by wilbert »

It seems to work fine.
Didn't you compile with PB 5.0 beta 4 ?
I thought the problem of the wrong colors for stretched images was solved with beta 4 but I still see it in your application.
User avatar
grabiller
Enthusiast
Enthusiast
Posts: 309
Joined: Wed Jun 01, 2011 9:38 am
Location: France - 89220 Rogny-Les-Septs-Ecluses
Contact:

Re: Squirrel static lib

Post by grabiller »

Oops, I didn't paid attention the beta 4 was available.
Downloading now.
guy rabiller | radfac founder / ceo | raafal.org
User avatar
grabiller
Enthusiast
Enthusiast
Posts: 309
Joined: Wed Jun 01, 2011 9:38 am
Location: France - 89220 Rogny-Les-Septs-Ecluses
Contact:

Re: Squirrel static lib

Post by grabiller »

Ok I got it working.

Here is the version compiled with PB 5.00 beta4:
http://www.raafal.org/download/raafal.x ... macosx.zip

From what I can see here, the problem is still present.

Is it on your side ?
guy rabiller | radfac founder / ceo | raafal.org
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3944
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Squirrel static lib

Post by wilbert »

For the box with 'subscription' inside it, the problem indeed still exists.
The other controls are looking better now. I don't know if that one is drawn in another way.
User avatar
grabiller
Enthusiast
Enthusiast
Posts: 309
Joined: Wed Jun 01, 2011 9:38 am
Location: France - 89220 Rogny-Les-Septs-Ecluses
Contact:

Re: Squirrel static lib

Post by grabiller »

That's interesting.

No, that one is drawn exactly the same way as the other ones. It renders correctly on Windows and Linux.

Odd.
guy rabiller | radfac founder / ceo | raafal.org
User avatar
grabiller
Enthusiast
Enthusiast
Posts: 309
Joined: Wed Jun 01, 2011 9:38 am
Location: France - 89220 Rogny-Les-Septs-Ecluses
Contact:

Re: Squirrel static lib

Post by grabiller »

Btw, out of curiosity, what did you do to compile the lib on Mac ?

Just a "make sq64" ? Or did you use XCode or something ?
guy rabiller | radfac founder / ceo | raafal.org
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3944
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Squirrel static lib

Post by wilbert »

I didn't see any .xcodeproj file so I just used the make command that compiled everything with gcc.
That worked fine :)
Post Reply