Recent Posts

Pages: [1] 2 3 ... 10
1
Open Forum / Forum Profile
« Last post by John on June 05, 2021, 04:32:49 am »
I was able to fix the forum Profile access for members. It seems the template file was mysteriously deleted.  :-[

Members should be able to send PM's to each other again.

2
Scripting Languages / Re: SBIDE
« Last post by John on June 01, 2021, 05:15:13 pm »
If you want to get a good feel for what the Scintilla editor can do there is a great demo editor (SciTE) that shows its features
3
Scripting Languages / Re: SBIDE
« Last post by John on May 30, 2021, 01:08:13 am »
I was able to create a simple ScriptBasic based editor with highlighting and intellisense support just adding the scivb2 control and the intellisense support module from the SBIDE project.

Creating a new look with additional functionality shouldn't be that difficult.

4
Scripting Languages / Re: SBIDE
« Last post by John on May 29, 2021, 11:10:02 pm »
I'm seriously thinking about redoing the SBIDE editor / debugger using VBCCR to update the common controls used. I would also like to incorporate some of the additional features of scivb2 like code folding. I would  like a FUNCTION/SUB listbox for quick access as well.

One possibility is to use IUP for the IDE which supports a COM object container which scivb2 could live in. This would allow me to use ScriptBasic as the primary language of design rather than VB6. Another advantage of using IUP is it has a dialog layout feature that would allow me to incorporate forms designer into the IDE.

I really don't want to take on this project alone and looking for others that would like to contribute.

 
5
Scripting Languages / Re: SBIDE - SCIVB
« Last post by John on May 29, 2021, 07:02:37 pm »
The ScriptBasic IDE / Debugger uses an OCX control that wraps the Scintilla source code editor.


This ActiveX control is a non visual component which wraps
Scintilla's features into an easy to use control.  It also provides
easy access to many features supported by Scintilla such as
AutoComplete, Code Tips, Folding, Syntax Highlighting, and more.

It comes in the form of two non visual components.  The first is
the actual Scintilla Wrapper.  The second smaller control provides
a basic binary style file format and support for setting the style
settings and several other options to scintilla.  It also includes
an ExportToHTML function.


I have created a project in the SandBox for scivb2.

https://basic-sandbox.us/John/scivb2
 
6
Scripting Languages / SBIDE
« Last post by John on May 28, 2021, 08:16:28 pm »
I'm adding the core extension module FUNCTION/SUB syntax helpers to SBIDE's syntax tip help. After entering a keyword or extension function name and a ( the syntax tool tip will display. As you enter arguments the tool tip will move to the next argument. Once I completed the SBIDE enhancements I will post it here. I will include the updated SBIDE in the next Inno install build.

Hot Keys

ctrl-f - find/replace
ctrl-g - goto line
ctrl-z - undo
ctrl-y - redo

F2     - set breakpoint (runtime only)
F5     - go
F7     - single step
F8     - step over
F9     - step out

7
Scripting Languages / Re: ScriptBasic Core Windows 32 bit - Embedding
« Last post by John on May 25, 2021, 04:25:45 pm »
Here is my Hello World for ScriptBasic embedding. I typically IMPORT the script resources I need for the project as a source string for ScriptBasic to run.

Code: C
  1. // gcc for_embed.c -I C:\\sbgcc\\source ..\\lib\\libscriba.dll -lpthread -o for_embed
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. #include <getopt.h>
  7. #include "scriba.h"
  8.  
  9. int main (int argc, char** argv)
  10. {
  11.   pSbProgram pProgram;
  12.   char src[] = "FOR i = 1 TO 5\nPRINT i,\"\\n\"\nNEXT\n";
  13.  
  14.   pProgram = scriba_new(malloc,free);
  15.   scriba_SetFileName(pProgram, "none");
  16.   scriba_LoadProgramString(pProgram, src, strlen(src));
  17.   scriba_Run(pProgram, "");
  18.  
  19.   scriba_destroy(pProgram);
  20.  
  21.   return(0);
  22. }  
  23.  


C:\sb_build\examples>gcc for_embed.c -I C:\\sbgcc\\source ..\\lib\\libscriba.dll -lpthread -o for_embed

C:\sb_build\examples>for_embed
1
2
3
4
5

C:\sb_build\examples>

8
Scripting Languages / Re: ScriptBasic Core Windows 32 bit - SQLite
« Last post by John on May 25, 2021, 01:29:47 am »
This is an example of using the SQLite extension module.

Code: Script BASIC
  1. IMPORT sqlite.sbi
  2.  
  3. db = sqlite::open("sqlite_demo.db")
  4.  
  5. sqlite::execute(db,"create table demo (someval integer, sometxt text);")
  6. sqlite::execute(db,"insert into demo values (123,'hello');")
  7. sqlite::execute(db, "INSERT INTO demo VALUES (234, 'cruel');")
  8. sqlite::execute(db, "INSERT INTO demo VALUES (345, 'world');")
  9.  
  10. stmt = sqlite::query(db,"SELECT * FROM demo")
  11. WHILE sqlite::row(stmt) = sqlite::SQLITE3_ROW
  12.   IF sqlite::fetchhash(stmt, column) THEN
  13.     PRINT column{"someval"},"\t-\t",column{"sometxt"},"\n"
  14.   END IF
  15. WEND
  16.  
  17. sqlite::close(db)
  18.  


C:\sb_build\examples>sbc sqlite_demo.sb
123     -       hello
234     -       cruel
345     -       world

C:\sb_build\examples>

9
Scripting Languages / Re: ScriptBasic Core Windows 32 bit - Synchronous Thread
« Last post by John on May 25, 2021, 01:26:30 am »
This example creates a synchronous thread with the main program running a FOR/NEXT loop in unison with its thread.

sbt_main.sb
Code: Script BASIC
  1. ' SBT Main
  2.  
  3. IMPORT mt.sbi
  4. IMPORT sbt.sbi
  5.  
  6. SB_ThreadStart("sbt_thread.sb", "","C:/Windows/SCRIBA.INI")
  7.  
  8. FOR x = 1 TO 10
  9.   PRINT "M:",x,"\n"
  10.   sb_msSleep(20)
  11. NEXT
  12.  
  13. SB_msSleep(1000)
  14.  
  15. PRINT "Thread ",mt::GetVariable("thread_status"),"\n"
  16.  

sbt_thread.sb
Code: Script BASIC
  1. ' SBT Main
  2.  
  3. IMPORT mt.sbi
  4. IMPORT sbt.sbi
  5.  
  6. SB_ThreadStart("sbt_thread.sb", "","C:/Windows/SCRIBA.INI")
  7.  
  8. FOR x = 1 TO 10
  9.   PRINT "M:",x,"\n"
  10.   sb_msSleep(20)
  11. NEXT
  12.  
  13. SB_msSleep(1000)
  14.  
  15. PRINT "Thread ",mt::GetVariable("thread_status"),"\n"
  16.  


C:\sb_build\examples>sbc sbt_main.sb
T:1
M:1
T:2
M:2
M:3
T:3
T:4
M:4
M:5
T:5
T:6
M:6
T:7
M:7
T:8
M:8
M:9
T:9
T:10
M:10
Thread Completed

C:\sb_build\examples>

10
Scripting Languages / Re: ScriptBasic Core Windows 32 bit - Asynchronous Thread
« Last post by John on May 25, 2021, 01:21:07 am »
This example creates a ScriptBasic asynchronous thread from a string of source code, sets / gets variables and calls a function.

Code: Script BASIC
  1. ' SBT - Create and call child process script as text source
  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.  


C:\sb_build\examples>sbc sbt_demo.sb
123
1.23
One, Two, Three
Function Return
321
32.1
Three,Two,One

C:\sb_build\examples>

Pages: [1] 2 3 ... 10