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 ... 43 44 [45] 46 47 ... 59
661
General Discussions / Re: Embedding into application
« on: July 15, 2010, 08:53:09 AM »
Quote from: ScriptBasic Developer Docs
You can call this function to define a special standard output function. This pointer should point to a function that accepts a (char, void *) arguments. Whenever the ScriptBasic program tries to send a character to the standard output it calls this function. The first parameter is the character to write, the second is the embedder pointer.

If the standard output function is not defined or the parameter is NULL the interpreter will write the normal stdout stream.

void scriba_SetStdout(pSbProgram pProgram,
                      void *fpStdoutFunction
  ){
Embedding the Interpreter

662
Source / Re: Compiling the source in Windows
« on: July 14, 2010, 11:23:32 PM »
Quote
My objective is to embed it in MS VC7 desktop application

You don't have to recompile the 2.1 source to embed ScriptBasic in your application.

Here is a BCX example that might get you started.

BCX Windows Interpreter - bi.bas
Code: [Select]
#include "\scriptbasic\source\scriba.h"
#include "\scriptbasic\source\getopt.h"

$LIBRARY "libscriba.lib"

Global pProgram as pSbProgram
Global iError as int

pProgram = scriba_new(malloc,free)

scriba_LoadConfiguration(pProgram,"c:\scriptbasic\bin\scriba.conf")

scriba_SetFileName(pProgram, Command$(1))
scriba_LoadSourceProgram(pProgram)

iError=scriba_Run(pProgram,Command$(2))

scriba_destroy(pProgram)

ScriptBasic Script
Code: [Select]
cmd = command()

PRINT "ARG = ",cmd,"\n"

for x=1 to 10
print x,"\n"
next x

Results

C:\Program Files\BCX\sb>bi E01.bas JRS
ARG = JRS
1
2
3
4
5
6
7
8
9
10

C:\Program Files\BCX\sb>

Note:  The $LIBRARY "libscriba.lib" line is used to make the OS aware at runtime of the entry points of the exported functions in libscriba.dll when called by the executable. The bi.exe is 19KB.
Quote from: BCX docs
The library named as a parameter in a $LIBRARY statement will be linked to the program without the need, at link time, to specify explicitly, on the command line or in a makefile, the library.

$LIBRARY is an alias to the C compiler "#pragma lib" feature. $LIBRARY operates on the same level as #INCLUDE and will emit the appropriate library statements within the header section of the emitted C source code.

663
Source / Re: Compiling the source in Windows
« on: July 13, 2010, 08:42:07 PM »
Welcome to the ScriptBasic forum Zulfiqar.

The ScriptBasic 3.0 Windows version is using MinGW/GCC as the C compiler. If your using the MS VC7 compiler, I suggest that you use the 2.1 version of ScriptBasic. The 3.0 release is focused on a new make file system and using MinGW/GCC for 32/64 compiling.

NOTE: Don't mix libs compiled using different compilers. (linkers complain) VC7 will have the same problem using MinGW/GCC compiled libs. Accessing DLLs compiled by any of the compilers doesn't seem to be an issue.


664
Tutorials / cURL Example
« on: July 10, 2010, 10:41:36 PM »
The following cURL extension module example retrieves a web page HTML and saves it to your PC. (webget)

Code: [Select]
' cURL webget

INCLUDE curl.bas

ch = curl::init()
curl::option(ch,"URL","http://scriptbasic.com/html/general.html")
curl::option(ch,"FILE","general.html")
curl::perform(ch)
curl::finish(ch)

cURL extension module documentation


Here is a webget by opening a TCP socket using ScriptBasic.

Code: [Select]
OPEN "scriptbasic.com/html/general.html:80" for SOCKET AS #1
PRINT #1,"GET http://localhost/ HTTP/1.0\n\n"
WHILE NOT EOF(1)
  LINE INPUT #1, content
  PRINT content
WEND
CLOSE(1)

665
Download / Re: ScriptBasic 3.0 Windows 32/64
« on: July 09, 2010, 08:06:54 PM »
I have attached to this post the RC2 (Release Candidate) for the 3.0 release of ScriptBasic for Windows. Included is the 32-bit Windows pre-compiled binaries and source for ScriptBasic.

This release has all the extension modules that will be supported going forward. The 3rd party cross platform open source libraries that are supported as extension modules are as follows.

  • MySQL - C API
  • ODBC
  • mini-XML
  • cURL
  • zlib

RUNTIME - ScriptBasic 3.0 RC2 (32-bit Windows) Precompiled Binaries

SOURCE - ScriptBasic 3.0 Source

Your comments and testing feedback is appreciated.


666
Tutorials / REF for complex structures
« on: July 09, 2010, 04:36:54 PM »
The ScriptBasic REF statement allows for building complex variable structures in a more nature Basic way.

Code: [Select]
REF customer = addr
REF customer = phone
REF customer = bal

customer{"id"} = 1

addr{"name"} = "John Doe"
addr{"street"} = "Main St."
addr{"city"} = "Anytown"
addr{"state"} = "Unknown"

phone{"work"} = "800-555-1234"
phone{"home"} = "888-4444"

bal[30] = 100
bal[60] = 250
bal[90] = 0

PRINT customer{"id"},"\n"
PRINT customer{"name"},"\n"
PRINT customer{"street"},"\n"
PRINT customer{"city"},"\n"
PRINT customer{"state"},"\n"
PRINT customer{"work"},"\n"
PRINT customer{"home"},"\n"
PRINT customer[30],"\n"
PRINT customer[60],"\n"
PRINT customer[90],"\n"

C:\scriptbasic\test>reftest
1
John Doe
Main St.
Anytown
Unknown
800-555-1234
888-4444
100
250
0

REF

Array Mix Mode

Another example of accessing an associative array.

Code: [Select]
addr{"name"} = "John Doe"
addr{"street"} = "Main St."
addr{"city"} = "Anytown"
addr{"state"} = "Unknown"

FOR x = LBOUND(addr) TO UBOUND(addr)STEP 2
  PRINT addr[x],"=",addr{addr[x]},"\n"
NEXT x

C:\scriptbasic\test>aatest
name=John Doe
street=Main St.
city=Anytown
state=Unknown

667
Tutorials / MySQL & ODBC Examples
« on: July 08, 2010, 11:53:28 PM »
I thought I would post a couple quick examples of using the MySQL C API and ODBC extension modules with ScriptBasic.

Code: MySQL
  1. include "C:\scriptbasic\include\mysql.bas"
  2.  
  3. dbh = mysql::RealConnect("host","user","password","DB")
  4.  
  5. mysql::query(dbh,"SELECT * FROM bible WHERE word_name LIKE 'am%'")
  6.  
  7. WHILE mysql::FetchHash(dbh, column)
  8.  
  9.   PRINT LEFT(column{"word_name"} & STRING(30," "),30),column{"word_count"},"\n"
  10.  
  11. WEND
  12.  
  13. mysql::Close(dbh)
  14.  

Code: Text
  1. include "C:\scriptbasic\include\odbc.bas"
  2.  
  3. dbh = odbc::RealConnect("DSN","user","password")
  4.  
  5. odbc::query(dbh,"SELECT * FROM bible WHERE word_name LIKE 'am%'")
  6.  
  7. WHILE odbc::FetchHash(dbh,column)
  8.  
  9.   PRINT LEFT(column{"word_name"} & STRING(30," "),30),column{"word_count"},"\n"
  10.  
  11. WEND
  12.  
  13. odbc::Close(dbh)
  14.  

Code: Text
  1. C:\scriptbasic\test>odbctest
  2. am                            164
  3. ama                           1
  4. amabit                        1
  5. amad                          1
  6. amalek                        15
  7. amalekites                    9
  8. amam                          1
  9. amazed                        1
  10. ambassadors                   2
  11. ambrose                       2
  12. ambrosianum                   1
  13. ambush                        7
  14. amen                          15
  15. amend                         1
  16. amending                      1
  17. amends                        1
  18. amerce                        1
  19. amethyst                      2
  20. ammiel                        1
  21. ammihud                       7
  22. amminadab                     6
  23. ammishaddai                   5
  24. ammon                         38
  25. ammonite                      1
  26. ammonites                     1
  27. among                         281
  28. amongst                       2
  29. amorite                       9
  30. amorites                      62
  31. amos                          1
  32. amram                         6
  33. amram's                       1
  34. amramites                     1
  35. amraphel                      2
  36.  

The ODBC example is using the MySQL ODBC Connector driver. Both examples are accessing the same MySQL database table and produce the same results.

668
Download / ScriptBasic 3.0 Windows 32/64
« on: July 05, 2010, 11:18:41 AM »


The ScriptBasic open source project development team has made available a release candidate for the new 3.0 release for Windows 32/64 platforms. The source has been compiled with the TDM MinGW/GCC C/C++ compiler. The pre-compiled runtime binaries for both 32 and 64 Windows platforms are available for download as is the common source for ScriptBasic. Please help the project out with testing and providing feedback for the new 3.0 pre-release.

Quote from: Armando Rivera
Source.

New makefile target:  install

After building with -m32 or -m64, do:

make install DIR={where you want to install}

For example, after building the 64bit version, I did:

make install DIR=c:\Scriptbasic64.

The DIR= part is REQUIRED.  Limitation of the Windows Shell (bash would have made the entire Makefile a piece of cake).

There's no target for uninstall; it's easy to implement but I want YOU to do it (only way to learn).

libxml is removed, and replaced with mxml.

mxml module currently has the following functions:

"LoadDoc"
"GetNext"
"GetChild"
"GetNodeValue"
"GetNode"
"SaveDoc"
"NewDoc"
"FreeDoc"
"GetProperty"

See the interface.c file for more info about each function (you should be able to generate the html pages, I think, using Perl).

The mxml.zip file contains libmxml.a files for 32 and 64 bit modes and should be copied to your MinGW include directory by platform.

ScriptBasic 3.0 Windows 64 Binaries






669
What's New / Re: ScriptBasic 32 bit Windows
« on: July 05, 2010, 12:58:54 AM »
Armando,

Your new XML extension module could be used to treat Gtk XML project files as GUI object templates. I could then load XML template files, extract the GUI definitions I'm interested in and process the request as direct calls to the Gtk-Server extension module. (which hasn't been converted to MinGW/GCC yet under Windows)

If you wanted to, you could use the web as a repository for GUI template definitions. The cURL extension module would come in handy with that task.


Just some low hanging fruit to salivate over.  :o

670
What's New / Re: ScriptBasic 32 bit Windows
« on: July 04, 2010, 10:47:04 PM »
I now understand that the XML extension module you sent in the Windows 32 build is a fixed version of what we had already.

Your new XML effort looks great with a slimmer look and less baggage is a welcome addition.




671
What's New / ScriptBasic 32 bit Windows
« on: July 04, 2010, 02:14:42 AM »
I will be posting a release candidate for the 32 bit version of Armando's work with the 64 bit ScriptBasic effort using the GCC / MinGW C/C++ compiler. Armando has sent me the ZLIB and new XML extension modules to test. I will include a batch file to convert ScriptBasic applications to a standalone executable using a shared object runtime using this same compiler.

I have noticed in the site logs that there have been daily downloads of ScriptBasic. It would be great to hear some feedback from the users for a change.  :(

672
Round Table / Re: Missing documentation for XML module
« on: July 02, 2010, 04:57:13 AM »
Quote
I'm playing around with  mini-xml as a replacement for libxml.  The static library of libxml is about 3megs now.  mini-xml's static lib is about 250k, with debugging turned on (should be about 40-90k without).

That's great news Armando. I will be happy to test your new XML extension module when your ready.


673
What's New / Re: ScriptBasic 64 bit Windows
« on: June 28, 2010, 04:11:30 PM »


I was crying in my beer about not having a 64-bit box to play with and Peter Verhas suggested I buy time on a 64 bit instance of Windows Server from Amazon EC2. At .52 cents an hour for a large instance virtual 64-bit system I can use to test with seems affordable.

Large Instance 7.5 GB of memory, 4 EC2 Compute Units (2 virtual cores with 2 EC2 Compute Units each), 850 GB of local instance storage, 64-bit platform

Until now, small developers did not have the capital to acquire massive compute resources and insure they had the capacity they needed to handle unexpected spikes in load. Amazon EC2  enables any developer to leverage Amazon’s own benefits of massive scale with no up-front investment or performance compromises. Developers are now free to innovate knowing that no matter how successful their businesses become, it will be inexpensive and simple to ensure they have the compute capacity they need to meet their business requirements.

The “Elastic” nature of the service allows developers to instantly scale to meet spikes in traffic or demand. When computing requirements unexpectedly change (up or down), Amazon EC2 can instantly respond, meaning that developers have the ability to control how many resources are in use at any given point in time. In contrast, traditional hosting services generally provide a fixed number of resources for a fixed amount of time, meaning that users have a limited ability to easily respond when their usage is rapidly changing, unpredictable, or is known to experience large peaks at various intervals.

Amazon EC2 Running Microsoft Windows Server & SQL Server

Amazon EC2 running Microsoft Windows Server® 2003 or 2008 is a fast and dependable environment for deploying applications using the Microsoft Web Platform, including ASP.NET, ASP.NET AJAX, Silverlight™, and Internet Information Server (IIS). Amazon EC2 enables you to run any compatible Windows-based solution on AWS’ high-performance, reliable, cost-effective, cloud computing platform. Common Windows use cases include Enterprise Windows-based application hosting, website and web-service hosting, data processing, media transcoding, distributed testing, ASP.NET application hosting, and any other application requiring Windows software. Amazon EC2 also now supports the SQL Server® Express and SQL Server Standard 2005 and 2008 databases, and makes those offerings available to customers on an hourly basis.

Using Amazon EC2 with Windows Server is similar to using Amazon EC2 with any other operating system. Amazon EC2 running Windows Server 2003 or 2008 provides seamless integration with existing Amazon EC2 features like Amazon Elastic Block Store (EBS), Amazon CloudWatch, Elastic-Load Balancing, and Elastic IPs. Windows instances are available in multiple Availability Zones in all Regions.



Tips & Tricks

  • Suspended instances are not billed but retains your environment
  • Uploading to EC2 is FREE till Nov. 2010 (after that there will be a small charge / gig)
  • Max 2 suspended instances at a time. (Windows Server 2008 64-bit & Ubuntu Linux 64-bit will be my two working/suspended instances)
  • RDP (Windows Remote Desktop) is a pain to get going becuase you need to download an encrypted admin password before connecting with RDP
  • You can save a image on the Amazon S3 (storage service) easily from your control panel
  • SSH is your connection to a Linux instance
  • You have full root/administrator privileges with your instances

674
What's New / Re: ScriptBasic 64 bit Windows - RC4
« on: June 27, 2010, 10:41:56 PM »
Armando added the MySQL extension module to the 64-bit version of the release.

Quote from: Armando Rivera
I downloaded the mysql-connector-c-noinstall-6.0.2-winx64.zip file, since I didn't want to clutter up my system using the installer with something I'm not going to be using.

In order to get the dll to work with MinGW64, I had to do the following (gcc doesn't understand the import lib that ships with the connector (or pretty much any MS generated import lib, I think):
1.   Download pexports from http://sourceforge.net/projects/mingw/files/MinGW/pexports/pexports-0.44-1/pexports-0.44-1-mingw32-bin.tar.lzma/download
2.   After unpacking, copy that to the MinGW64/bin folder
3.   Navigate to the folder containing the libmysql.dll file, and do: pexports libmysql.dll > libmysql.def
4.   Next, I created the actual import lib with:  dlltool -k --input-def libmysql.def --dllname libmysql.dll --output-lib libmysql.a
5.   Next, I copied that into the MinGW64/lib folder
6.   Then, I copied the  ibmysql.dll file into the Windows\SysWOW64 folder
7.   Finally, I copied the "include" folder that comes with the connector package to MinGW64/include, and then RENAMED IT TO "mysql".  <--very important

BTW, in case you didn't realize this, the MinGW64 package that James provided the link for on the BCX forum is 32bit.  Meaning, you can install it on your 32 bit system and use it to compile both 32 AND 64 bit binaries.

DOWNLOAD ScriptBasic 64/32 for Windows

TMD-GCC - A GCC / MinGW / MinGW-w64 compiler suite for 32-bit and 64-bit Windows

A big Thank You Armando for helping the ScriptBasic project out once again.


675
What's New / Re: ScriptBasic 64 bit Windows - RC3
« on: June 27, 2010, 08:03:05 PM »
Armando completed the default ScriptBasic Windows 64-Bit distribution set with the RC3 release. This release candidate adds the MT (session manager) and ODBC extension modules to the distribution. Armando also worked on the make file (see below) and added a make clean option to clear the bin directory before a new compile.

If you want to generate a Windows 32-Bit version of ScriptBasic, change the -m64 to -m32 in the make file(s).

Quote from: Armando Rivera
The main Makefile now compiles everything that the cmd script I wrote did, so that script no longer works.  I've also added a clean target to the makefile, so you can nuke your bin folder with:  make clean.  The makefile handles the creation of the bin folder structure now.

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