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 ... 45 46 [47] 48 49 ... 59
691
Round Table / Re: Missing documentation for XML module
« on: January 30, 2010, 07:53:55 PM »
As mentioned before, XML support is a first cut effort and seeing there is no working example programs I know of, looks like your pretty much on your own. Maybe someone else on the forum has used this extension module and can help you out.

Use the libxml2 link I posted and find the corresponding functions indicated by the alias function name in their docs. This should give your the required arguments and types. The interface.c file for the XML extension module should be easy enough to understand to get the functions in place working under scriba/sbhttpd.

Good luck and if you get something working please share.

If I find some time, I'll try and document what is there and create an example to get started with.

If I remember correctly, Armando wrote a quick SB XML program to test the module for the 2.1 release. Maybe he still has it floating around.

692
Round Table / Re: Missing documentation for XML module
« on: January 30, 2010, 09:21:12 AM »
Code: [Select]
module xml

REM """
The module xml.bas is based on the Gnome libxml2 library.
"""
' FUNCTION DECLARATIONS
declare sub     ::ParseFile    alias "sbxmlParseFile"     lib "xml"
declare sub     ::NewDoc       alias "sbxmlNewDoc"        lib "xml"
declare sub     ::FreeDoc      alias "sbxmlFreeDoc"       lib "xml"
declare sub     ::GetChildren  alias "getchildren"        lib "xml"
declare sub     ::SetChildren  alias "setchildren"        lib "xml"
declare sub     ::GetNext      alias "getnext"            lib "xml"
declare sub     ::SetNext      alias "setnext"            lib "xml"
declare sub     ::GetPrev      alias "getprev"            lib "xml"
declare sub     ::SetPrev      alias "setprev"            lib "xml"
declare sub     ::GetParent    alias "getparent"          lib "xml"
declare sub     ::SetParent    alias "setparent"          lib "xml"
declare sub     ::SetProp      alias "sbxmlSetProp"       lib "xml"
declare sub     ::GetProp      alias "sbxmlGetProp"       lib "xml"
declare sub     ::NewNs        alias "sbxmlNewNs"         lib "xml"
declare sub     ::FreeNs       alias "sbxmlFreeNs"        lib "xml"
declare sub     ::NewChild     alias "sbxmlNewChild"      lib "xml"
declare sub     ::NewTextChild alias "sbxmlNewTextChild"  lib "xml"
declare sub     ::NewDocNode   alias "sbxmlNewDocNode"    lib "xml"
declare sub     ::Doc2XML      alias "sbxmlDocDumpMemory" lib "xml"

end module

The XML extension module was released in 2.0 but only with a minimal function interface and documentation.

http://xmlsoft.org/

If you find some time to expand the XML extension module to cover more of the libxml2 API, please share.


693
Installation / Re: Help needed with installation
« on: January 22, 2010, 08:42:47 AM »
A few things to check.

Make sure your home directory in the config points to your app-bin directory. You are regenerating the binary format of the config with each change, correct? You are restarting sbhttpd each time you change the config, correct?

Keep in mind that sbhttpd doesn't process anything but Basic programs so images need to be served up by Apache.

Try a "Hello World" like CGI program first and then move on to echo.bas and beyond.

You could try running your echo.bas with scriba as a standard CGI script. (make sure it is in a executable cgi-bin directory in this case)

As an option, I offer setup and support services (fee based) if working through this on your own is getting frustrating. I remember my first time getting sbhttpd going and drove Peter Verhas nuts.  :)

694
Installation / Re: Help needed with installation
« on: January 21, 2010, 12:47:22 PM »
Rick,

http://www.scriptbasic.org/forum/index.php/topic,112.0.html

This is my tutorial how to bring up SBHTTPD under Windows, Apache and MySQL.

As mentioned in the private e-mail, get MySQL working with the console interpreter (scriba) before using sbhttpd as a proxy server with Apache.


John

695
Download / Re: ScriptBasic 2.1 Windows
« on: January 11, 2010, 01:39:31 AM »
I have changed the install instructions above. Arrmando already created the installed directory structure and removed the bin directory in source. (why install.cmd  didn't work) I didn't notice the change from RC1 to RC2. If you recompile ScriptBasic, a new bin directory will be created in the source directory and the install.cmd file install process can be used once again.


696
Download / Re: ScriptBasic 2.1 Windows
« on: January 03, 2010, 10:02:20 AM »
The 2.0 release is over 7 years old and I would be surprised if some of the extension modules like MySQL, Curl and others would work.

Can you be more specific to what didn't work with the 2.1 install?


697
Download / Re: ScriptBasic 2.1 Windows
« on: January 01, 2010, 08:22:54 PM »
Quote
An other point is that this is done in a dos window, dos box, at the command prompt, not a console. A console is for the linux system.

Windows no longer supports a 16 bit DOS console. The Windows console mode is a 32 bit Windows application for a text mode interface. A console mode interface means the same thing no matter what OS your using. IMO

I updated the install instructions above based on your comments.

So, were you able to get ScriptBasic installed and working?





698
Download / Re: ScriptBasic 2.1 Windows
« on: December 28, 2009, 10:25:50 PM »
Your will find install.cmd in your source directory.

Code: [Select]
REM
REM FILE: install.cmd
REM
REM Run this command script to install ScriptBasic after it was compiled
REM from source. The installation directory is T:\ScriptBasic
REM
REM This installation is needed by the setup program pack.cmd to build
REM the compressed binary installation package using the files put into
REM that directory.
REM
REM This script only checks that the two version of the compilers supported
REM and calls the basic program install.sb to do the work.
REM

IF EXIST bin\vc7\exe\scriba.exe GOTO VC7INSTALL
IF EXIST bin\bcc\exe\scriba.exe GOTO BCCINSTALL
GOTO ENDLABEL

:VC7INSTALL
IF "%1" == "" GOTO VC7IPRD
bin\vc7\exe\scriba install.sb %1 vc7
GOTO ENDLABEL
:VC7IPRD
bin\vc7\exe\scriba install.sb T:\ScriptBasic vc7
GOTO ENDLABEL

:BCCINSTALL
IF "%1" == "" GOTO BCCIPRD
bin\bcc\exe\scriba install.sb %1 bcc
GOTO ENDLABEL
:BCCIPRD
bin\bcc\exe\scriba install.sb T:\ScriptBasic bcc
GOTO ENDLABEL

:ENDLABEL

699
Download / Re: ScriptBasic 2.1 Windows
« on: December 25, 2009, 08:11:15 PM »
Quote
install.cmd d:\install_path

I assume your substituting d:\install_path for the directory you want ScriptBasic installed, correct?


700
Tutorials / ScriptBasic OOP - Feedback Request
« on: October 13, 2009, 02:49:29 AM »
This concludes the ScriptBasic OOP framework code project/tutorial from an introduction standpoint.

If you could respond to a few questions I have then it would help me fine tune and expand on ScriptBasic OOP.

Q. Do you see an advantage of using OO style programming with your projects?

Q. Is this code project tutorial enough to get you started using ScriptBasic OOP?

Q. If you have used OOP with other languages, do you see this implementation easy to use?

Q. What do you see as missing in this implementation of OOP?


701
Tutorials / ScriptBasic OOP - Extending Methods
« on: October 12, 2009, 12:06:53 PM »
Here is my first pass at extending object methods in user code. This example shows extending the interface properties and copying the the customer main address to the new shipto address block with an extended method call. This allows calling the user extended method function in user code or by the module. This is work in progress so things might change.

This example also shows how encapsulation can be done. In a user method, multiple objects references can be encapsulated with one call to the ObjExt() method of the object.


Code: [Select]
' ScriptBasic OOP Example

GLOBAL CONST NL = "\n"

MODULE Customer

IMPORT t.bas

instance = 0

_phone_num{"shop"} = "800-THE-SHOP"
_phone_num{"cell"} = "900-OUR-CELL"

_age_bal{"current"} = 0
_age_bal{"30"} = 0
_age_bal{"60"} = 0
_age_bal{"90"} = 0
_age_bal{"overdue"} = 0

_cust_rec{"name"} = "John Doe"
_cust_rec{"addr1"} = "123 St."
_cust_rec{"addr2"} = "Anytown,USA"
_cust_rec{"phone"} = _phone_num
_cust_rec{"aging"} = _age_bal

obj[0] = _cust_rec

FUNCTION New(base)
  instance += 1
  IF base = undef THEN
    obj[instance] = obj[0]
  ELSE
    REF obj[instance] = obj[base]
  END IF
  new = instance
END FUNCTION

FUNCTION Inherit(base)
  instance += 1
  obj[instance] = obj[base]
  Inherit = instance
END FUNCTION

FUNCTION ObjExt(fna,arg1,arg2,arg3)
  LOCAL r
  r = ICALL(fna,arg1,arg2,arg3)
END FUNCTION

FUNCTION ObjDef
  ObjDef = t::ArrayToXML(_cust_rec)
END FUNCTION

FUNCTION Destroy(object)
  obj[object] = undef
END FUNCTION

END MODULE

'
' MAIN
'

FUNCTION Copy2Ship(custobj)
  customer::obj[custobj]{"shipto"}{"name"} = customer::obj[custobj]{"name"}
  customer::obj[custobj]{"shipto"}{"addr1"} = customer::obj[custobj]{"addr1"}
  customer::obj[custobj]{"shipto"}{"addr2"} = customer::obj[custobj]{"addr2"}
END FUNCTION

updship = ADDRESS(Copy2Ship())

cust1 = customer::New()

customer::_ship_to{"name"} = ""
customer::_ship_to{"addr1"} = ""
customer::_ship_to{"addr2"} = ""

customer::_cust_rec{"shipto"} = customer::_ship_to
customer::obj[cust1] = customer::_cust_rec

customer::ObjExt(updship,cust1)

PRINT customer::obj[cust1]{"shipto"}{"name"},NL
PRINT customer::obj[cust1]{"shipto"}{"addr1"},NL
PRINT customer::obj[cust1]{"shipto"}{"addr2"},NL
PRINTNL

customer::Destroy(cust1)

C:\scriptbasic\test>oop2me
John Doe
123 St.
Anytown,USA

C:\scriptbasic\test>

702
Tutorials / ScriptBasic OOP - Extending Interfaces
« on: October 11, 2009, 11:45:54 PM »
Here is an example of extending the customer record with a shipto address block within the user code. I prefixed all module interface structures with the underscore character to specify property elements from the object interface.

Code: [Select]
' ScriptBasic OOP Example

GLOBAL CONST NL = "\n"

MODULE Customer

IMPORT t.bas

instance = 0

_phone_num{"shop"} = "800-THE-SHOP"
_phone_num{"cell"} = "900-OUR-CELL"

_age_bal{"current"} = 0
_age_bal{"30"} = 0
_age_bal{"60"} = 0
_age_bal{"90"} = 0
_age_bal{"overdue"} = 0

_cust_rec{"name"} = "John Doe"
_cust_rec{"addr1"} = "123 St."
_cust_rec{"addr2"} = "Anytown,USA"
_cust_rec{"phone"} = _phone_num
_cust_rec{"aging"} = _age_bal

obj[0] = _cust_rec

FUNCTION New(base)
  instance += 1
  IF base = undef THEN
    obj[instance] = obj[0]
  ELSE
    REF obj[instance] = obj[base]
  END IF
  new = instance
END FUNCTION

FUNCTION Inherit(base)
  instance += 1
  obj[instance] = obj[base]
  Inherit = instance
END FUNCTION

FUNCTION ObjDef
  ObjDef = t::ArrayToXML(_cust_rec)
END FUNCTION

FUNCTION Destroy(object)
  obj[object] = undef
END FUNCTION

END MODULE

'
' MAIN
'

cust1 = customer::New()

customer::_ship_to{"name"} = customer::obj[cust1]{"name"}
customer::_ship_to{"addr1"} = customer::obj[cust1]{"addr1"}
customer::_ship_to{"addr2"} = customer::obj[cust1]{"addr2"}

customer::_cust_rec{"shipto"} = customer::_ship_to
customer::obj[cust1] = customer::_cust_rec

PRINT customer::obj[cust1]{"shipto"}{"name"},NL
PRINT customer::obj[cust1]{"shipto"}{"addr1"},NL
PRINT customer::obj[cust1]{"shipto"}{"addr2"},NL
PRINTNL

PRINT customer::ObjDef()

customer::Destroy(cust1)

Results:
Code: [Select]
C:\scriptbasic\test>oop2ep
John Doe
123 St.
Anytown,USA

<?xml version="1.0" encoding="UTF-8"?><V><A l="0" h="11"><S>name</S><S>John Doe</S><S>addr1</S><S>123 St.</S><S>addr2</S><S>Anytown,USA</S><S>phone</S><A l="0" h="3"><S>shop</S><S>800-THE-SHOP</S><S>cell</S><S>9
00-OUR-CELL</S></A><S>aging</S><A l="0" h="9"><S>current</S><I>0</I><S>30</S><I>0</I><S>60</S><I>0</I><S>90</S><I>0</I><S>overdue</S><I>0</I></A><S>shipto</S><A l="0" h="5"><S>name</S><S>John Doe</S><S>addr1</S>
<S>123 St.</S><S>addr2</S><S>Anytown,USA</S></A></A></V>
C:\scriptbasic\test>



The next installment will show extending module methods from user code.

703
Tutorials / ScriptBasic OOP II - Polymorphism
« on: October 11, 2009, 11:45:01 PM »
Here the polymorphism example redone with OOP II. Once again, the module was untouched from the first OOP II example.

Code: [Select]
' ScriptBasic OOP Example

GLOBAL CONST NL = "\n"

MODULE Customer

IMPORT t.bas

instance = 0

phone_num{"shop"} = "800-THE-SHOP"
phone_num{"cell"} = "900-OUR-CELL"

age_bal{"current"} = 0
age_bal{"30"} = 0
age_bal{"60"} = 0
age_bal{"90"} = 0
age_bal{"overdue"} = 0

cust_rec{"name"} = "John Doe"
cust_rec{"addr1"} = "123 St."
cust_rec{"addr2"} = "Anytown,USA"
cust_rec{"phone"} = phone_num
cust_rec{"aging"} = age_bal

obj[0] = cust_rec

FUNCTION New(base)
  instance += 1
  IF base = undef THEN
    obj[instance] = obj[0]
  ELSE
    REF obj[instance] = obj[base]
  END IF
  new = instance
END FUNCTION

FUNCTION Inherit(base)
  instance += 1
  obj[instance] = obj[base]
  Inherit = instance
END FUNCTION

FUNCTION ObjDef
  ObjDef = t::ArrayToXML(cust_rec)
END FUNCTION

FUNCTION Destroy(object)
  obj[object] = undef
END FUNCTION

END MODULE

'
' MAIN
'

cust1 = customer::New()

cust2 = customer::New(cust1)

PRINT customer::obj[cust2]{"name"},NL

customer::obj[cust2]{"name"} = "Mary Smith"

PRINT customer::obj[cust1]{"name"},NL

customer::Destroy(cust1)
customer::Destroy(cust2)

C:\scriptbasic\test>oop2p
John Doe
Mary Smith

C:\scriptbasic\test>

704
Tutorials / ScriptBasic OOP II - Inheritance
« on: October 11, 2009, 11:44:06 PM »
This is an example of inheritance. (see previous example) The module (CLASS) was untouched from the first OOP II example.

Code: [Select]
' ScriptBasic OOP Example

GLOBAL CONST NL = "\n"

MODULE Customer

IMPORT t.bas

instance = 0

phone_num{"shop"} = "800-THE-SHOP"
phone_num{"cell"} = "900-OUR-CELL"

age_bal{"current"} = 0
age_bal{"30"} = 0
age_bal{"60"} = 0
age_bal{"90"} = 0
age_bal{"overdue"} = 0

cust_rec{"name"} = "John Doe"
cust_rec{"addr1"} = "123 St."
cust_rec{"addr2"} = "Anytown,USA"
cust_rec{"phone"} = phone_num
cust_rec{"aging"} = age_bal

obj[0] = cust_rec

FUNCTION New(base)
  instance += 1
  IF base = undef THEN
    obj[instance] = obj[0]
  ELSE
    REF obj[instance] = obj[base]
  END IF
  new = instance
END FUNCTION

FUNCTION Inherit(base)
  instance += 1
  obj[instance] = obj[base]
  Inherit = instance
END FUNCTION

FUNCTION ObjDef
  ObjDef = t::ArrayToXML(cust_rec)
END FUNCTION

FUNCTION Destroy(object)
  obj[object] = undef
END FUNCTION

END MODULE

'
' MAIN
'

cust1 = customer::New()

cust2 = customer::Inherit(cust1)

PRINT customer::obj[cust2]{"name"},NL
PRINT customer::obj[cust2]{"phone"}{"shop"},NL
PRINT customer::obj[cust2]{"aging"}{"current"},NL
PRINTNL

customer::obj[cust2]{"name"} = "Mary Smith"

PRINT customer::obj[cust1]{"name"},NL
PRINT customer::obj[cust2]{"name"},NL

customer::Destroy(cust1)
customer::Destroy(cust2)

C:\scriptbasic\test>oop2i
John Doe
800-THE-SHOP
0

John Doe
Mary Smith

C:\scriptbasic\test>

705
Tutorials / ScriptBasic OOP II
« on: October 11, 2009, 07:56:02 PM »
This is the first example using the object/property in the right precedence order. This example is displaying the default property values for the new instance of the customer object.

Code: [Select]
' ScriptBasic OOP Example

GLOBAL CONST NL = "\n"

MODULE Customer

IMPORT t.bas

instance = 0

phone_num{"shop"} = "800-THE-SHOP"
phone_num{"cell"} = "900-OUR-CELL"

age_bal{"current"} = 0
age_bal{"30"} = 0
age_bal{"60"} = 0
age_bal{"90"} = 0
age_bal{"overdue"} = 0

cust_rec{"name"} = "John Doe"
cust_rec{"addr1"} = "123 St."
cust_rec{"addr2"} = "Anytown,USA"
cust_rec{"phone"} = phone_num
cust_rec{"aging"} = age_bal

obj[0] = cust_rec

FUNCTION New(base)
  instance += 1
  IF base = undef THEN
    obj[instance] = obj[0]
  ELSE
    REF obj[instance] = obj[base]
  END IF
  new = instance
END FUNCTION

FUNCTION Inherit(base)
  instance += 1
  obj[instance] = obj[base]
  Inherit = instance
END FUNCTION

FUNCTION ObjDef
  ObjDef = t::ArrayToXML(cust_rec)
END FUNCTION

FUNCTION Destroy(object)
  obj[object] = undef
END FUNCTION

END MODULE

'
' MAIN
'

this_cust = customer::New()

PRINT customer::obj[this_cust]{"name"},NL
PRINT customer::obj[this_cust]{"addr1"},NL
PRINT customer::obj[this_cust]{"addr2"},NL
PRINT customer::obj[this_cust]{"phone"}{"shop"},NL
PRINT customer::obj[this_cust]{"phone"}{"cell"},NL
PRINT customer::obj[this_cust]{"aging"}{"current"},NL
PRINT customer::obj[this_cust]{"aging"}{"30"},NL
PRINT customer::obj[this_cust]{"aging"}{"60"},NL
PRINT customer::obj[this_cust]{"aging"}{"90"},NL
PRINT customer::obj[this_cust]{"aging"}{"overdue"},NL
PRINT NL
PRINT customer::ObjDef(),NL

customer::Destroy(this_cust)

Results:
Code: [Select]
C:\scriptbasic\test>oop2
John Doe
123 St.
Anytown,USA
800-THE-SHOP
900-OUR-CELL
0
0
0
0
0

<?xml version="1.0" encoding="UTF-8"?><V><A l="0" h="9"><S>name</S><S>John Doe</S><S>addr1</S><S>123 St.</S><S>addr2</S><S>Anytown,USA</S><S>phone</S><A l="0" h="3"><S>shop</S><S>800-THE-SHOP</S><S>cell</S><S>90
0-OUR-CELL</S></A><S>aging</S><A l="0" h="9"><S>current</S><I>0</I><S>30</S><I>0</I><S>60</S><I>0</I><S>90</S><I>0</I><S>overdue</S><I>0</I></A></A></V>

C:\scriptbasic\test>



Inheritance and Polymorphism examples are next up.

Pages: 1 ... 45 46 [47] 48 49 ... 59