Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Support

Pages: 1 ... 42 43 [44] 45 46 ... 59
646
General Discussions / Re: Embedding into application
« on: August 09, 2010, 01:40:55 AM »
When you get your project working, it would be great if you can say a few word about your experience with embedding ScriptBasic in your application. Any tips or tricks you can offer would be appreciated.

647
General Discussions / Re: Embedding into application
« on: August 06, 2010, 01:44:42 AM »
I would pass your embedded script a delimited string of values and use SPLITA() to create your array from the delimited string in your running script.


648
General Discussions / Re: Embedding into application
« on: August 06, 2010, 12:55:37 AM »
I think Peter Verhas showed you an example above of creating a string from an array that you could unpack from your C program.


649
General Discussions / Re: Embedding into application
« on: August 01, 2010, 12:14:18 PM »
I ran into the same array limitation using the MT module. (can't store arrays as session variables) I solved my problem using the T extension module functions ArrayToString() and StringToArray().

 

650
Download / Re: ScriptBasic 3.0 Windows 32/64
« on: August 01, 2010, 12:08:19 PM »
Peter,

The reason I'm moving to a 3.0 release is as follows.

  • Standardization on gcc for all major platforms and in 32/64 bit modes.
  • Abandoning traditional ScriptBasic build process for standard make system.
  • Using SB script to generate the HTML documentation from the source.
  • Dropping support from the distribution for the following extension modules.
    • BDB - Berkeley DB
    • PSQL - PostgreSQL
    • DYC - Generic DLL access - doesn't translate well to gcc
  • Implement the math stub functions that were never completed
  • Cross platform GUI using the IUP toolkit.
  • Build GUI IDE/Debugger using the new IUP extension module.

The core of ScriptBasic is solid and mature, I haven't sensed from Armando that he has any plans at enhancing the interpreter API at this point.

These are the 3.0 goals at this time and are open for discussion.

651
Source / Re: Compiling the source in Windows
« on: July 29, 2010, 02:01:47 PM »
Have you tried to get the array contents by using the scriba_LookupVariableByName() function to get the serial number of the variable contents you're looking for?

Use "a[100]" as the variable name (example array variable) with this function and see if it works. I sent Peter Verhas a e-mail asking if he could shed some light on this for you.


652
General Discussions / Re: Embedding into application
« on: July 27, 2010, 08:03:10 PM »
Maybe Armando or Peter can chime in and shed some light on accessing arrays.


653
General Discussions / Re: Embedding into application
« on: July 27, 2010, 07:27:06 PM »
Have you looked at the developer docs for embedding ScriptBasic?

The ScriptBasic WIki is a great place for information.

http://www.scriptbasic.org/wiki


654
General Discussions / Re: Getpid
« on: July 27, 2010, 09:54:50 AM »
Running scriba on the command line or as an embedded application?

655
Download / Re: ScriptBasic 2.1 Linux
« on: July 25, 2010, 12:19:17 PM »
Thanks for your feedback!

I will be creating new docs for the compiling process as time permits. If you can post your steps as a guide, it would help the project along.


656
Download / Re: ScriptBasic 3.0 w/GUI
« on: July 25, 2010, 12:16:45 PM »
Hey Guys, wake up!

There have been 50 or so downloads of ScriptBasic in the last few days and Armando needs your feedback. This is an incredible effort on Armando's part so don't let it die off because no one can find a couple minutes to reply to his request for feedback. It has taken me 5 years to find someone like Armando to get ScriptBasic moving forward again. PLEASE HELP the effort and participate.

 

657
Download / Re: ScriptBasic 3.0 w/GUI
« on: July 23, 2010, 01:52:54 PM »
I'm 100% behind your efforts and see this as putting ScriptBasic on the map.

Let me know if there is anything I can do to help.  (testing, documentation and project promotion is something I can contribute )

John

658
Round Table / Feedback Request
« on: July 21, 2010, 10:29:56 AM »
I have noticed that ScriptBasic is being downloaded on a daily basis yet no one is commenting on their experience with the Basic.

  • Did you have any issue getting ScriptBasic to work on your system?
  • What version of Windows did you try ScriptBasic on?
  • What areas do you plan to use ScriptBasic in your projects?
  • Have you tried ScriptBasic in the 64-bit environment yet?
  • Have you tried the Linux or Mac version yet?
  • What suggestions do you have to create more of a community around ScriptBasic?


659
Download / ScriptBasic 3.0 w/GUI
« on: July 19, 2010, 09:42:10 PM »
This ScriptBasic 3.0 Windows 32-bit runtime download includes the first release of the IUP GUI extension module.

DOWNLOAD

The Thesaurus IUP demo by Armando Rivera was based on Peter van Eerten's Gtk-Server Thesaurus demo.



Code: [Select]
import IUP.bas

GLOBAL CONST title = "Thesaurus!"

'Servers = "1=dict.org, 2=test.dict.org, 3=dict.die.net"
Servers[0]="dict.org"
Servers[1]="dict1.us.dict.org"
Servers[2]="all.dict.org"

about=""" This is a Demo
of the IUP GUI Binding
for Scriptbasic"""

const nl = "\n"

SUB CLEAR
IUP::AddItem(serverList,"")
END SUB

SUB Get_Dicts(svrAddr)

LOCAL dat$, total, count

ON ERROR GOTO G_NetError

OPEN svrAddr & ":2628" FOR SOCKET AS 1
PRINT#1,"SHOW DB\n"

LINE INPUT#1, dat$
LINE INPUT#1, dat$

count = 0
WHILE LEFT(dat$, 1) <> "."
LINE INPUT#1, dat$
IF LEFT(dat$, 1) <> "." THEN total[count] = TRIM(dat$)
count+=1
WEND
PRINT#1,"QUIT\n"
CLOSE 1


for cnt = 0 to count
IUP::AddItem(serverList, total[cnt])
next

EXIT SUB

G_NetError:
'IUP::Message("ERROR Connecting" , svrAddr & " is not available!")
print "Server not available",nl


END SUB

SUB Lookup_Word

LOCAL dict$, dat$, total$, info$

IUP::SetText(win, title & " -  " & IUP::GetText(entry))

IUP::SetText(text, "Fetching....")


ON ERROR GOTO L_NetError

selectedServer = Servers[IUP::GetSelection(serverCombo) -1]

'THIS DOESN'T WORK YET
'whichDictionary = IUP::GetText(serverList)

'print whichDictionary

'dict$ = LEFT(whichDictionary, INSTR(whichDictionary, " "))

'print dict$

OPEN selectedServer & ":2628" FOR SOCKET AS 1

IF IUP::GetState(chkAll) = "ON" THEN
PRINT#1,"DEFINE * " & IUP::GetText(entry) & "\n"
ELSE
PRINT#1,"DEFINE " & dict$ & " " & IUP::GetText(entry)& "\n"
END IF

REPEAT
LINE INPUT#1, dat$
'dat$ = REPLACE(dat$, CHR$(34), CHR$(92) & CHR$(34))
IF LEFT(dat$, 3) = "151" THEN
total$ &= "------------------------------\n"
total$ &= RIGHT(dat$, LEN(dat$) - LEN(IUP::GetText(entry)) - 9)
total$ &= "------------------------------\n"
REPEAT
LINE INPUT#1, info$
'info$ = REPLACE(info$, CHR$(34), CHR$(92) & CHR$(34))
IF LEFT(info$, 1) <> "." THEN total$ &= TRIM(info$) & nl
UNTIL LEFT(info$, 1) = "."
total$ &= "\n"
END IF
UNTIL LEFT(dat$, 3) = "250" OR VAL(LEFT(dat$, 3)) > 499

PRINT#1,"QUIT\n"
CLOSE 1

IF LEFT(dat$, 3) = "552" THEN
total$ = "No match found."
ELSE IF LEFT(dat$, 3) = "501" THEN
total$ = "Select a dictionary first!"
ELSE IF LEFT(dat$, 3) = "550" THEN
total$ = "Invalid database!"
END IF

IUP::SetText(text, total$)

EXIT SUB

L_NetError:
        dat$[0] = "Could not lookup word!"

        IUP::SetText(text, dat$)

END SUB

REM Initialize IUP
IUP::Init()

REM Create Main Window
win = IUP::Create("dialog","TITLE=Thesaurus, SIZE=500x300")

REM create container to house ALL GUI objects
vbox = IUP::Create("vbox","MARGIN=10x10")

REM Create Server panel
topBox = IUP::Create("hbox", " GAP=10", vbox)
serverFrame = IUP::Create("frame", "TITLE=Servers, EXPAND=YES", topBox)
serverBox= IUP::Create("hbox", "GAP=5", serverFrame)
serverCombo = IUP::Create("list", "DROPDOWN=YES, SIZE=120x, EXPAND=HORIZONTAL, VALUE=1", serverBox)
btnFetch = IUP::Create("button", "TITLE=Fetch, SIZE = 50x", serverBox)



REM Create control panel
controlFrame = IUP::Create("frame", "TITLE=Controls", topBox)
controlBox = IUP::Create("hbox", "Margin=6x6, GAP=5", controlFrame)
btnAbout = IUP::Create("button", "TITLE=About, SIZE = 50x", controlBox)
btnClear = IUP::Create("button", "TITLE=Clear, SIZE = 50x", controlBox)
btnExit = IUP::Create("button", "TITLE=Exit, SIZE = 50x", controlBox)

REM Create dictionary panel
dictFrame = IUP::Create("frame", "TITLE=Dictionaries", vbox)
serverList = IUP::Create("list", "EXPAND=YES, VISIBLELINES=1", dictFrame)

REM Create text part
transFrame = IUP::Create("frame", "TITLE=Translation", vbox)
text = IUP::Create("text", "MULTILINE=YES, EXPAND=YES", transFrame)

REM Create entry and search button
bottomBox = IUP::Create("hbox", "GAP=10", vbox)
label = IUP::Create("label", "TITLE=\"Enter Word to Search For:\", SIZE=x12", bottomBox)
entry = IUP::Create("text", " EXPAND=HORIZONTAL",bottomBox)
btnSearch = IUP::Create("button","TITLE=Search, SIZE=50x", bottomBox)
chkAll = IUP::Create("toggle", "TITLE=ALL, VALUE=ON,SIZE=x12", bottomBox)
chkUTF = IUP::Create("toggle", "TITLE=UTF-8, SIZE=x12", bottomBox)

REM Add the main GUI container to the Window
IUP::AddChild(win, vbox)

REM Show the Window
IUP::Show(win)

IUP::SetFocus(btnFetch)
for i = 0 to 2
IUP::AddItem(serverCombo, Servers[i])
next

repeat
IUP::Wait()

action = IUP::Event()
eventtype = IUP::EventType()

if action = btnAbout then
IUP::Message("ABOUT", about)
end if

if action = btnFetch then
selection = IUP::GetSelection(serverCombo)
Get_Dicts(Servers[selection-1])
end if

if action = btnClear then

end if

if action = btnSearch then
Lookup_Word()
end if

until action = win or action = btnExit


Print "All Done"

Code: [Select]
module iup

REM """
The module iup.bas is based on the iup library.
"""
' FUNCTION DECLARATIONS
declare sub     ::Init          alias "Init"        lib "iup"
declare sub     ::Show          alias "Show"        lib "iup"
declare sub     ::Destroy       alias "Destroy"     lib "iup"
declare sub     ::Close         alias "Close"       lib "iup"
declare sub     ::Create        alias "Create"      lib "iup"
declare sub     ::AddChild      alias "AddChild"    lib "iup"
declare sub     ::Wait          alias "Wait"        lib "iup"
declare sub     ::ExitLoop      alias "ExitLoop"    lib "iup"
declare sub     ::Event         alias "GetEvent"    lib "iup"
declare sub     ::SetText       alias "SetText"     lib "iup"
declare sub     ::GetText       alias "GetText"     lib "iup"
declare sub     ::SetItem       alias "SetItem"     lib "iup"
declare sub     ::GetItem       alias "GetItem"     lib "iup"
declare sub     ::GetState      alias "GetItem"     lib "iup"
declare sub     ::SetFocus      alias "Focus"       lib "iup"
declare sub     ::Message       alias "Message"     lib "iup"
declare sub     ::GetClass      alias "GetClass"    lib "iup"
declare sub     ::GetSelection  alias "GetItem"     lib "iup"
declare sub     ::AddItem       alias "AddItem"     lib "iup"
declare sub     ::EventType     alias "EventType"   lib "iup"
end module

660
General Discussions / Re: Embedding into application
« on: July 15, 2010, 09:36:41 PM »
Another BCX embedded example to help you take your next step. Notice this example shows the results if you just load your script and access functions and variables and what the results are if you run the script.

BCX_embed4.bas
Code: [Select]
#include "\scriptbasic\source\scriba.h"
#include "\scriptbasic\source\getopt.h"

$LIBRARY "libscriba.lib"

' NOTE: Windows specific above this line and generic BCX below.

Dim pProgram As pSbProgram
Dim v As long
Dim f1 As long
Dim f2 As long
Dim dVal=11 as long
Dim cArgs As long
Dim ReturnData As SbData
dim ArgData[4] As SbData

' LOADING AND RUNNING THE PROGRAM
pProgram = scriba_new(malloc, free)
scriba_SetFileName(pProgram, "E03.bas")
scriba_LoadSourceProgram(pProgram)
scriba_NoRun(pProgram)

'' ACCESSING GLOBAL DATA
v = scriba_LookupVariableByName(pProgram, "main::a")

scriba_SetVariable(pProgram, v, 2, 500, 0, "", 0)

'' CALLING SIMPLE SUBROUTINE
f1 = scriba_LookupFunctionByName(pProgram, "main::dprint")
scriba_Call(pProgram, f1)

' CALLING FUNCTION, RETURNING DATA AND GETTING ALTERED PARAMS
f2 = scriba_LookupFunctionByName(pProgram, "main::eprint")

' SETUP ARGUMENTS

for cArgs=0 to 3
  ArgData[cArgs].type = SBT_DOUBLE
  ArgData[cArgs].size = 0
  ArgData[cArgs].v.d = dVal+cArgs
next

scriba_CallArgEx(pProgram, f2, &ReturnData, cArgs, ArgData)
print "Return type:",ReturnData.type
print "Value:";

' READ RETURNED VALUE
select case ReturnData.type
 case SBT_UNDEF  :                print "Undefined"
 case SBT_DOUBLE :                print ReturnData.v.d
 case SBT_LONG   :                print ReturnData.v.l
 case =SBT_STRING or =SBT_ZCHAR : print (CHAR PTR)ReturnData.v.s
end select

scriba_destroy(pProgram)

ScriptBasic - E03.bas
Code: [Select]
' ----------------
' GLOBAL VARIABLES
' ================
'
a=42
b=sqr(2)
s="hello world!"

q=dprint()
q=eprint(1,2,3,4)

'print "Enter: "
'line input q

' ---------
' FUNCTIONS
' =========

function dprint
  sp="  "
  cr="\n"
  tab=chr$(9)
  print "Dprint Globals: " & s & sp & a & sp & b & cr
  ' line input q
  dprint=1
end function

function eprint(a,b,c,d)
  sp="  "
  cr="\n"
  tab=chr$(9)
  print "Eprint Args: " & a & sp & b & sp & c & sp & d & cr
  ' line input q
  ans=a+b+c+d
  eprint="Sum = " & ans
end function

Results:(scriba_NoRun)
Code: [Select]
C:\Program Files\BCX\sb>BCX_embed4
Dprint Globals:   500
Eprint Args: 11.000000  12.000000  13.000000  14.000000
Return type: 3
Value:Sum = 50

C:\Program Files\BCX\sb>

Results: (Scriba_Run)
Code: [Select]
C:\Program Files\BCX\sb>BCX_embed4
Dprint Globals: hello world!  42  1.414214
Eprint Args: 1  2  3  4
Dprint Globals: hello world!  500  1.414214
Eprint Args: 11.000000  12.000000  13.000000  14.000000
Return type: 3
Value:Sum = 50

C:\Program Files\BCX\sb>

Pages: 1 ... 42 43 [44] 45 46 ... 59