Recent Posts

Pages: 1 ... 8 9 [10]
91
Scripting Languages / Re: ScriptBasic 3.0
« Last post by John on March 24, 2024, 07:32:42 PM »
Jack,

Here is an example of calling the libscriba.dll using the SBT extension module.

Code: ScriptBasic
  1. ' SBT Demo
  2.  
  3. IMPORT sbt.sbi
  4.  
  5. sb_code = """
  6. FUNCTION prtvars(a, b, c)
  7.  PRINT a,"\\n"
  8.  PRINT FORMAT("%g\\n", b)
  9.  PRINT c,"\\n"
  10.  prtvars = "Function Return"
  11. END FUNCTION
  12.  
  13. a = 0
  14. b = 0
  15. c = ""
  16. """
  17.  
  18. sb = SB_New()
  19. SB_Configure sb, "C:/Windows/SCRIBA.INI"
  20. SB_Loadstr sb, sb_code
  21. SB_NoRun sb
  22. ' Call function before running script
  23. funcrtn = SB_CallSubArgs(sb,"main::prtvars", 123, 1.23, "One, Two, Three")
  24. PRINT funcrtn,"\n"
  25. ' Run script initializing globals
  26. SB_Run sb, ""
  27. ' Assign variables values
  28. SB_SetInt sb, "main::a", 321
  29. SB_SetDbl sb, "main::b", 32.1
  30. SB_SetStr sb, "main::c", "Three,Two,One" & CHR(0)
  31. ' Call function again with variables assigned in the previous step
  32. SB_CallSubArgs sb, "main::prtvars", _
  33.           SB_GetVar(sb, "main::a"), _
  34.           SB_GetVar(sb, "main::b"), _
  35.           SB_GetVar(sb, "main::c")
  36. SB_Destroy sb
  37.  

Output

123
1.23
One, Two, Three
Function Return
321
32.1
Three,Two,One

Looking at the SBT extension module C source may be helpful as well.


Before Charles moved his hosting preference to Theo's forum I was testing embedding libscriba.dll with OxygenBasic.

O2 SB Embed
92
Scripting Languages / Re: ScriptBasic 3.0
« Last post by jack on March 24, 2024, 07:10:25 PM »
Hi John  :)
I am interested in using libscriba.dll, are there any examples?
with the help of fbfrog I translated scriba.h to scriba.bi, so I am ready to try using libscriba with FreeBasic but I need a skeleton example
an example in C would be good, I should be able to translate it to FB
93
Scripting Languages / Re: ScriptBasic 3.0
« Last post by John on March 24, 2024, 02:28:09 PM »
I have added the sbw gcc compiled interpreter to the repo as a zip. This version of ScriptBasic is compiled with no console and has Windows style / theme support for current common controls.

I plan to create a repo for Windows 64 / 32 bit builds using gcc which uses static .h files and creates no documentation from source. All that's needed to compile this version of ScriptBasic is the TDM-GCC-64/32. compiler (open source & free)

If you only need to extend ScriptBasic with C library extension modules the gcc version is a lightweight compile option. This version doesn't compile on Linux and is for Windows 32/64 bit only.

If you plan on modifying ScriptBasic core source, the MSVC version is the way to go.  It builds new .h files and documentation from source. The build system does all the heavy lifting for you.
94
Scripting Languages / Re: ScriptBasic 3.0
« Last post by AlyssonR on March 24, 2024, 01:30:16 PM »
Wonderful stuff.

I will take a look when I next take a break from hardware development.
95
Scripting Languages / Re: ScriptBasic 3.0
« Last post by John on March 24, 2024, 03:16:32 AM »
After running setup in your ScriptBasic cloned source directory, run setup --install --directory=C:\ScriptBasic64 for your runtime version. I've attached my examples directory so you can try out the extension modules below.

  • cio_colors.sb - Display all 256 colors and their value. This module allows you to control the console screen.
  • curl_wget.sb - Using the cURL extension module to download a file.
  • gmpmath.sb - GMP large integer math module. (+ - * /)
  • sbt_main.sb - Example of ScriptBasic running in threaded mode.
  • sql_odbc.sb - ODBC connected to a MS SQL Server displaying a couple columns in a table.
  • sqlite_demo.sb - Example of a create insert and select with a SQLite table.
  • testmysql.sb - Connecting to the MySQL example DB and get the data from the products table.
  • testmxml.sb - Example of using the Mini XML module.
96
Scripting Languages / Re: ScriptBasic 3.0
« Last post by John on March 24, 2024, 02:31:20 AM »
I have made AIR's MSVC portable C compiler with Perl included available as a download. This versions has all the updates that are include in the VC-3rdParty-Libs.7z for MSVC. It's a 342 MB zip file.

https://scriptbasic.org/files/MSVC-AIR.zip

Just clone the repo and download AIR's MSVC and you're set to compile a 64 bit ScriptBasic for Windows.
97
Scripting Languages / Re: ScriptBasic 3.0
« Last post by John on March 23, 2024, 12:14:02 AM »
I have finished testing AIR's MSVC build and it's ready for use. You will need the following tools to build the executables and documentation

MSVC from Microsoft Visual Studio  (Free version works fine)

Strawberry Perl for Windows the ScriptBasic build system uses.

Included in the repo is VC-3rdParty-Libs.7z which contains module runtime DLLs and lib / include files for MSVC.

This devcmd.bat file sets up the environment to build the ScriptBasic Windows 64 bit distribution. This batch file is for AIR's custom portable MSVC version. (all inclusive) You will need to setup your paths accordingly. The devcmd.bat file is run within this custom MSVC directory.
Code: DOS
  1. @echo off
  2.  
  3. set WindowsSDKDir=%~dp0\Windows Kits\10
  4. set WindowsSDKVersion=10.0.22621.0
  5. set VCToolsInstallDir=%~dp0\VC\Tools\MSVC\14.39.33519\
  6. set VSCMD_ARG_TGT_ARCH=x64
  7.  
  8. set MSVC_BIN=%~dp0\VC\Tools\MSVC\14.39.33519\bin\Hostx64\x64
  9. set SDK_BIN=%~dp0\Windows Kits\10\bin\10.0.22621.0\x64;%~dp0\Windows Kits\10\bin\10.0.22621.0\x64\ucrt
  10. set PATH=%MSVC_BIN%;%SDK_BIN%;%PATH%
  11. set INCLUDE=%~dp0\VC\Tools\MSVC\14.39.33519\include;%~dp0\Windows Kits\10\Include\10.0.22621.0\ucrt;%~dp0\Windows Kits\10\Include\10.0.22621.0\shared;%~dp0\Windows Kits\10\Include\10.0.22621.0\um;%~dp0\Windows Kits\10\Include\10.0.22621.0\winrt;%~dp0\Windows Kits\10\Include\10.0.22621.0\cppwinrt
  12. set INCLUDE=%INCLUDE%;%~dp0\VC-3rdParty\include
  13. set LIB=%~dp0\VC\Tools\MSVC\14.39.33519\lib\x64;%~dp0\Windows Kits\10\Lib\10.0.22621.0\ucrt\x64;%~dp0\Windows Kits\10\Lib\10.0.22621.0\um\x64;%~dp0\VC-3rdParty\lib\x64
  14.  
  15. call %~dp0\Perl\portableshell.bat
  16.  

Here is an example to show how %~dp0 works.
Code: DOS
  1. Here is D:\dirshow.bat:
  2.  
  3. @echo off
  4. echo this is %%~dp0 %~dp0
  5.  
  6. Run it from C:\ and this is what you see
  7.  
  8. C:\>D:\dirshow.bat
  9.  
  10. this is %~dp0 D:\
  11.  


I have attached the directory tree structure for AIR's MSVC.

After you run the devcmd.bat file, change directory to where your your ScriptBasic source is located. This source directory must be from a git clone https://gitlab.com/scriptbasic/sb-dev-msvc.git command. The ZIP and other download methods don't seem to get everything. Once in the source directory run this command. setup If you add --help to the command it will show the option commands.

Once the build process is complete, you can use the setup --install --directory=C:\ScriptBasic64 command to create a runtime directory. Copy the DLL directory contents from VC-3rdParty-Libs.7z to your runtime lib directory. The last step is to add the bin and lib directory to your system PATH.

ScriptBasic MSVC Repository
98
NOT BASIC / Re: Minesweeper game for Windows using Fortran programming language
« Last post by John on March 21, 2024, 10:53:39 AM »
Congrats Jalih!

Your post was number 7200.

Cool minesweeper game.
99
NOT BASIC / Minesweeper game for Windows using Fortran programming language
« Last post by jalih on March 20, 2024, 12:22:38 PM »
Hi all,

I wrote a simple Minesweeper game for Windows using Simply Fortran and it's AppGraphics library.

Source code + runnable binary
100
Scripting Languages / Re: ScriptBasic 3.0
« Last post by John on March 19, 2024, 11:44:55 PM »
The Gitlab ScriptBasic repository supports a markdown wiki. The ScriptBasic build system generates its html documentation from the C source. My plan is to tweak the build system to generate a like markdown alternative.

The Gitlab wiki is treated like a repository which git can work with. Updating the wiki after a new build that may have documentation added is as simple as a git push.
Pages: 1 ... 8 9 [10]