Embedding ScriptBasic in FreeBASIC
I think you guys are being lame as #%$@.
No one asked you what you think about embedding scripting languages into FreeBASIC. The fact that you'd even question doing it is indicative of your unsuitability to be on this topic in the first place.
John was just showing an example of how to embed a scripting language into FB. Take it as it is!
I think you guys go crazy because of some past issues you've had with John, but it's unacceptable far as I'm concerned.
That said, John I'd second the recommendation to check out Lua... I'm using it in a project currently. Well, to be fair I'm still grokking it, but it's pretty cool :)
No one asked you what you think about embedding scripting languages into FreeBASIC. The fact that you'd even question doing it is indicative of your unsuitability to be on this topic in the first place.
John was just showing an example of how to embed a scripting language into FB. Take it as it is!
I think you guys go crazy because of some past issues you've had with John, but it's unacceptable far as I'm concerned.
That said, John I'd second the recommendation to check out Lua... I'm using it in a project currently. Well, to be fair I'm still grokking it, but it's pretty cool :)
Lua is pretty decent but not really suited for high-performance apps IMHUO. Tis great for traditional RPGs though...Ruby makes a good candidate for that too (RPGXP anyone?).
cha0s, I don't really see anyone being out of line here. I just don't think jcfuller and aurelVZAB understand the purpose of embedded scripting languages. English doesn't seem to be their first languages.
cha0s, I don't really see anyone being out of line here. I just don't think jcfuller and aurelVZAB understand the purpose of embedded scripting languages. English doesn't seem to be their first languages.
-
- Posts: 453
- Joined: Dec 24, 2005 2:32
- Location: WA - USA
- Contact:
Thanks cha0s for the heads-up about Lua. I'm still struggling with C. ;-)
I thought ScriptBasic might be attractive to this group because you don't have to learn a new language syntax. I think SB did rather well in the All Basic QuickBasic compatible code challenge. (FreeBASIC require zero changes)
James is a long time PowerBASIC developer and beta tester. He has earned my respect years ago. As for Aurel, he should spend more time on promoting his interpreter in Russian forums where folks might understand what his point might be.
I thought ScriptBasic might be attractive to this group because you don't have to learn a new language syntax. I think SB did rather well in the All Basic QuickBasic compatible code challenge. (FreeBASIC require zero changes)
James is a long time PowerBASIC developer and beta tester. He has earned my respect years ago. As for Aurel, he should spend more time on promoting his interpreter in Russian forums where folks might understand what his point might be.
I understand very well what you or what he mean.
Rusia - ha ha i'm not from Rusia - you obviusly dont know nothing
about geography- maby becose you speak only one language -ha ha...
But i'm really tired of that man speaches - if you wana this use SB if you
wana that use SB - it looks that we all need just SB for everything.
That is the point of universe....experts.....
Rusia - ha ha i'm not from Rusia - you obviusly dont know nothing
about geography- maby becose you speak only one language -ha ha...
But i'm really tired of that man speaches - if you wana this use SB if you
wana that use SB - it looks that we all need just SB for everything.
That is the point of universe....experts.....
-
- Posts: 255
- Joined: Jan 05, 2006 0:56
-
- Posts: 453
- Joined: Dec 24, 2005 2:32
- Location: WA - USA
- Contact:
I put a zip together for embedding ScriptBasic in your FreeBASIC application. This code was generated by Charles Pegge and part of the All Basic code challenge.
This example shows running a simple ScriptBasic script from FreeBASIC. I (or Charles) will post an example of loading a SB script of functions and subs and calling them from a FB application and allowing access to the scripts variables.
Project Files
Note: If you want to run the FB_embeds.exe included in the zip, you should first download the Windows version of ScriptBasic from the www.scriptbasic.org/forum (downloads) and unzip it in your root of C: which will create a C:\scriptbasic directory. Make sure your grab the zip of open source DLL libraries used by the ScriptBasic extension modules. (see last post in SB Windows download sticky post)
The SB install zip contains a default scriba.conf that is referenced in the example. If you haven't installed ScriptBasic and want to try the example, remove the reference to scriba.conf and recompile the example.
Code: Select all
#include once "windows.bi"
#include once "win/ole2.bi"
#include once "scriba.bi"
Dim as long pProgram,iError
function newmem CDECL (ByVal le As Long) As bstr Export
function=SysAllocStringByteLen (0,le)
end function
sub freemem CDECL (ByVal p As bstr) Export
SysFreeString p
end sub
SetConsoleTitle "FreeBasic ScriptBasic Embedding Test"
pProgram=scriba_new (cast(long,@newmem), cast(long,@freemem))
scriba_LoadConfiguration(pProgram,"c:\scriptbasic\bin\scriba.conf")
scriba_SetFileName(pProgram,"E02.bas")
scriba_LoadSourceProgram(pProgram)
iError=scriba_Run(pProgram,"Hello")
scriba_destroy(pProgram)
Project Files
Note: If you want to run the FB_embeds.exe included in the zip, you should first download the Windows version of ScriptBasic from the www.scriptbasic.org/forum (downloads) and unzip it in your root of C: which will create a C:\scriptbasic directory. Make sure your grab the zip of open source DLL libraries used by the ScriptBasic extension modules. (see last post in SB Windows download sticky post)
The SB install zip contains a default scriba.conf that is referenced in the example. If you haven't installed ScriptBasic and want to try the example, remove the reference to scriba.conf and recompile the example.
-
- Posts: 453
- Joined: Dec 24, 2005 2:32
- Location: WA - USA
- Contact:
-
- Posts: 453
- Joined: Dec 24, 2005 2:32
- Location: WA - USA
- Contact:
You can link to libscriba.lib statically if using the DLL is not your cup of tea. The Windows download contains per-compiled binaries and there is no need to install anything. Just unzip and run. If you add the C:\scriptbasic\bin directory to your path, you can run the command line interpreter from anywhere.
It couldn't be any simpler other then me doing your programming for you. ;-)
It couldn't be any simpler other then me doing your programming for you. ;-)
John,
If you wanted to distribute embedded ScriptBasic with an FB application, what files would you need to include apart from libscriba.dll and the manual?(assuming no extension modules were needed.)
Charles
PS: I have a more developed example in the pipeline demonstrating access to SB global variables and also passing parameters to and from SB functions.
- might need to make a few adjustments to the header file for easier pointering.
If you wanted to distribute embedded ScriptBasic with an FB application, what files would you need to include apart from libscriba.dll and the manual?(assuming no extension modules were needed.)
Charles
PS: I have a more developed example in the pipeline demonstrating access to SB global variables and also passing parameters to and from SB functions.
- might need to make a few adjustments to the header file for easier pointering.
-
- Posts: 453
- Joined: Dec 24, 2005 2:32
- Location: WA - USA
- Contact:
Charles,
Only libscriba.dll is needed to embed ScriptBasic in FreeBasic for Windows. Under Linux you may need to link in pthreads and the lmt_none.c stub (or equivalent)
If you want to static link you will need to install ScriptBasic which includes the source.
Glad to hear you made progress with ScriptBasic embedding to use a set of functions and subs and access to the scripts variables.
When your done, I'll show in a few lines of code a script returning a results set in an array from a MySQL database. (using a SB extension module)
Thanks for all your help with the SB embedding in the popular Windows Basic compilers.
Only libscriba.dll is needed to embed ScriptBasic in FreeBasic for Windows. Under Linux you may need to link in pthreads and the lmt_none.c stub (or equivalent)
If you want to static link you will need to install ScriptBasic which includes the source.
Glad to hear you made progress with ScriptBasic embedding to use a set of functions and subs and access to the scripts variables.
When your done, I'll show in a few lines of code a script returning a results set in an array from a MySQL database. (using a SB extension module)
Thanks for all your help with the SB embedding in the popular Windows Basic compilers.
This is not quite so minimalist - it demonstrates how to access global variables and pass parameters to and from ScriptBasic functions and get return values. - Just about all you need for embedding SB into an FB application.
Charles
PS: updated `A` file and header file included.
http://www.allbasic.info/forum/index.ph ... 35#msg2735
Charles
PS: updated `A` file and header file included.
http://www.allbasic.info/forum/index.ph ... 35#msg2735
-
- Posts: 1759
- Joined: May 23, 2007 21:52
- Location: Cut Bank, MT
- Contact:
For those who have to ask about why you would add scripting obviously, you don't have have a need for it. However you all use applications that depend almost entirely on scripts, such as your web browser, mIRC, Office, etc. Digest this for just a second; without scripting your web browser would be totally useless because no-one is going to download a web page and recompile it for viewing.
-
- Posts: 453
- Joined: Dec 24, 2005 2:32
- Location: WA - USA
- Contact:
I haven't tried Lua but ScriptBasic is available as a feature rich command line interpreter as a variation and is a great way to run/debug your scripts before embedding them in your application. I use the command line interpreter for all my utility/cron projects. (Linux) I use the multithreaded webserver variation as my server side scripting engine that includes session support.
The extension module interface API is a tight integration with the Basic and allows you expand the functionality of the language with other libraries available. The distribution comes with MySQL, PostgreSQL, ODBC/iODBC, Berkely DB, cURL, libxml2, zlib along with other SB specific extensions as part of the package.
The extension module interface API is a tight integration with the Basic and allows you expand the functionality of the language with other libraries available. The distribution comes with MySQL, PostgreSQL, ODBC/iODBC, Berkely DB, cURL, libxml2, zlib along with other SB specific extensions as part of the package.