Legacy SDK

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC SDK >

Legacy SDK

 

Legacy SDK documentation, do not use.

 

 

ThinBASIC Software Development Kit (SDK) - Legacy, use at own risk

 

 

Brief Description

ThinBASIC SDK - February 2006 Edition

The ThinBASIC SDK contains the information, source templates and library you need to develop ThinBASIC based applications. You can use this SDK to develop your own module.

 

 

Overview

ThinBASIC Software Development Kit (SDK) provides the documentation, samples, header files, libraries, and tools you need to develop applications that run on Windows with the TinBASIC engine. The applications you develop with this edition of the SDK can run on the x86, x64 and Itanium-based versions of Windows Server 2003 SP1, Windows XP SP2, Windows XP x64 Pro Edition, and Windows 2000 as well Windows NT 4.0, Windows ME, Windows 98 and Windows 95.

This edition of the SDK replaces the previous ThinBASIC SDKs for all Windows platforms.

 

 

System Requirements

Supported Operating Systems: Windows 2000; Windows Server 2003; Windows XP (both 32 and 64-bit) all edition; Windows NT 4.0; Windows ME; Windows 98; Windows 95.

 

 

Hardware Requirements

Intel or AMD CPU running at 500 MHz, 128 MB RAM and 5 MB of disk space.

 

 

Development Tools

To build the samples, you must have an adequate compiler. Supported compilers are PowerBASIC for Windows 7.x or above, IBasic professional 1.2, Microsoft Visual C/C++ 6.0, Borland C/C++ 5.5, GCC C/C++ 3.4.2, Microsoft Macro Assembler Version 6.0 or above.

 

 

Details

ThinBASIC is a powerful lightweight BASIC interpreter. Beside the large availability of solutions provides by the standard modules the SDK let a developer to build his totally owned top quality and high performance solution in form of .DLL module.

SDK rely upon a small set of API exported by the thincore.dll dynamic library.

Depending on which language you use (BASIC or C/C++ or ASSEMBLER)  you should use appropriate include file and static library that provide the correct use of thincores’ API.

 

 

 

Predefined Constants

thinBasic_DoNotForceOverWrite

thinBasic_ForceOverWrite

 

thinBasic_ReturnNone

thinBasic_ReturnNumber

thinBasic_ReturnString

thinBasic_ReturnCodeByte

thinBasic_ReturnCodeInteger

thinBasic_ReturnCodeWord

thinBasic_ReturnCodeDWord

thinBasic_ReturnCodeLong

thinBasic_ReturnCodeQuad

thinBasic_ReturnCodeSingle

thinBasic_ReturnCodeDouble

thinBasic_ReturnCodeCurrency

thinBasic_ReturnCodeExt

 

thinBasic_ConstTypeAuto

thinBasic_ConstTypeNumeric

thinBasic_ConstTypeString

 

thinBasic_TRUE

thinBasic_FALSE

thinBasic_ON

thinBasic_OFF

 

 

THINCORE.DLL API

thinBasic_AddEquate

thinBasic_CheckCloseParens

thinBasic_CheckComma

thinBasic_CheckOpenParens

thinBasic_LoadSymbol

thinBasic_ParseDouble

thinBasic_ParseDWord

thinBasic_ParseString

thinBasic_SetReturnString

 

 

THINCORE.DLL API REFERENCE

(C/C++ only for others languages please see include file in the table below)

 

Function thinBasic_AddEquate()

 

Description

 

The thinBasic_AddEquate() function adds a new equate (constant).

 

Syntax

 

 DWORD thinBasic_AddEquate(char * szEquate,

                           char * szStringValue,

                           DWORD  dwNumericValue,

                           DWORD  dwConstType);

 

 

Returns

 

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

 

Parameters

 

szEquate

   Pointer to a null-terminated string to be used as equate name.

szStringValue

   Pointer to a null-terminated string to be used as value of equate it the equate is a string type.

szNumericValue

   32 bit numeric value (could be signed or unsigned) of equate it the equate is a numeric type.

dwConstType

   A flag that indicate the type of equate, it could be one of following predefined constants:

thinBasic_ConstTypeAuto

thinBasic_ConstTypeNumeric

thinBasic_ConstTypeString

 

 

Remarks

 

 

Restrictions

 

 

See also

 

  thinBasic_LoadSymbol

 

Examples

 

#define TB_myC_ONETIME        1

 

thinBasic_AddEquate("%TB_myC_ONETIME",

                   "",

                   TB_myC_ONETIME,

                   thinBasic_ConstTypeAuto);

 

 

 

Function thinBasic_CheckCloseParens()

 

Description

 

The thinBasic_CheckCloseParens() function checks if the parenthesis sequence is close correctly.

 

Syntax

 

DWORD thinBasic_CheckOpenParens(DWORD HideError, DWORD AutoPutBack);

 

Returns

 

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

 

Parameters

 

HideError

   If nonzero hide the error caused by an invalid close sequence (don’t generate a run time error).

AutoPutBack

   If nonzero leave the current token on the parsed stack.

 

Remarks

For both HideError and AutoPutBack you cold use one of following predefined constants:

thinBasic_TRUE

thinBasic_FALSE

 

Restrictions

 

 

See also

 

  thinBasic_CheckComma, thinBasic_CheckOpenParens

 

Examples

 

if(thinBasic_CheckOpenParens(thinBasic_FALSE, thinBasic_FALSE))

{

  nLen = thinBasic_ParseString(&szMyString);

  if(thinBasic_CheckCloseParens(thinBasic_FALSE, thinBasic_FALSE))

  {

     if(nLen)

     {

          MessageBox(NULL, szMyString, "thinBasic SDK", MB_OK);

     }

   }

}

Function thinBasic_CheckComma()

 

Description

 

The thinBasic_CheckComma() function checks if the current token (on the interpreter stack) is a comma character.

 

Syntax

 

DWORD thinBasic_CheckComma(void);

 

Returns

 

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

 

Parameters

 

 

Remarks

 

 

Restrictions

 

 

See also

  thinBasic_CheckCloseParens, thinBasic_CheckOpenParens

 

Examples

 

if(thinBasic_CheckOpenParens(thinBasic_TRUE, thinBasic_TRUE))

{

 thinBasic_ParseString(&fname1);

 if(thinBasic_CheckComma())

 {

         thinBasic_ParseString(&fname2);

       if(thinBasic_CheckCloseParens(thinBasic_TRUE, thinBasic_TRUE))

             {

                 printf("File1 = %s, File2 = %s\n ",fname1, fname2);

       }

 }

 }

Function thinBasic_CheckOpenParens()

 

Description

 

The thinBasic_CheckOpenParens() function checks if the parenthesis sequence is close correctly.

 

Syntax

 

DWORD thinBasic_CheckOpenParens(DWORD HideError, DWORD AutoPutBack);

 

Returns

 

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

 

Parameters

 

HideError

   If nonzero hide the error caused by an invalid open sequence (don’t generate a run time error).

AutoPutBack

   If nonzero leave the current token on the parsed stack.

 

Remarks

For both HideError and AutoPutBack you cold use one of following predefined constants:

thinBasic_TRUE

thinBasic_FALSE

 

Restrictions

 

 

See also

 

  thinBasic_CheckComma, thinBasic_CheckOpenParens

 

Examples

 

if(thinBasic_CheckOpenParens(thinBasic_FALSE, thinBasic_FALSE))

{

  nLen = thinBasic_ParseString(&szMyString);

  if(thinBasic_CheckCloseParens(thinBasic_FALSE, thinBasic_FALSE))

  {

     if(nLen)

     {

          MessageBox(NULL, szMyString, "thinBasic SDK", MB_OK);

     }

   }

}

 

Function thinBasic_LoadSymbol()

 

Description

 

The thinBasic_AddLoadSymbol() function adds a new symbol. This function is used to load and create a new keyword inside the interpreter.

 

Syntax

 

DWORD   thinBasic_LoadSymbol(char * szFunctionName,

                            DWORD  dwReturnType,

                            void * FunctionCode,

                            DWORD  dwForceOverWrite);

 

Returns

 

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

 

Parameters

 

szFunctionName

   Pointer to a null-terminated string to be used as function name.

dwReturnType

   A flag that specify what kind of value your function returns, it could be one of following predefined

  constants:

thinBasic_ReturnNone

thinBasic_ReturnNumber

thinBasic_ReturnString

thinBasic_ReturnCodeByte

thinBasic_ReturnCodeInteger

thinBasic_ReturnCodeWord

thinBasic_ReturnCodeDWord

thinBasic_ReturnCodeLong

thinBasic_ReturnCodeQuad

thinBasic_ReturnCodeSingle

thinBasic_ReturnCodeDouble

thinBasic_ReturnCodeCurrency

thinBasic_ReturnCodeExt

 

FunctionCode

   A pointer to the function code that will be called from the interpreter.

dwForceOverWrite

   A flag that indicate if the SymbolName already exists as a keyword, you want to overwrite it with a

   new one. It could be one of following predefined constants:

thinBasic_DoNotForceOverWrite

thinBasic_ForceOverWrite

 

 

Remarks

 

 

Restrictions

 

 

See also

 

  thinBasic_AddEquate

 

Examples

 

void GreetingFromC(void)

{

 MessageBox(NULL, "Hello from C world!", "thinBasic SDK", MB_OK);

}

.

.

.

 

thinBasic_LoadSymbol("myC_GreetingFromC",

                    thinBasic_ReturnNone,

                    &GreetingFromC,

                    thinBasic_ForceOverWrite);

 

Function thinBasic_ParseDouble()

 

Description

 

The thinBasic_ParseDouble() retrieve a double value from the interpreter.

 

Syntax

 

double thinBasic_ParseDouble(void);

 

Returns

 

The value returned is the data itself.

 

Parameters

 

 

Remarks

 

 

Restrictions

 

 

See also

  thinBasic_ParseDWord, thinBasic_ParseString

 

Examples

 

if(thinBasic_CheckOpenParens(thinBasic_TRUE, thinBasic_TRUE))

{

 d1 = thinBasic_ParseDouble();

 if(thinBasic_CheckComma())

 {

         d2 = thinBasic_ParseDouble();

       if(thinBasic_CheckCloseParens(thinBasic_TRUE, thinBasic_TRUE))

             {

                 printf("Value1 = %d, Value2 = %d\n ", d1, d2);

       }

 }

  }

Function thinBasic_ParseDWord()

 

Description

 

The thinBasic_ParseDword() retrieve a DWORD value (32 bit) from the interpreter.

 

Syntax

 

DWORD thinBasic_ParseDword(void);

 

Returns

 

The value returned is the data itself.

 

Parameters

 

 

Remarks

 

 

Restrictions

 

 

See also

  thinBasic_ParseDouble, thinBasic_ParseString

 

Examples

 

if(thinBasic_CheckOpenParens(thinBasic_TRUE, thinBasic_TRUE))

{

 dw1 = thinBasic_ParseDWord();

 if(thinBasic_CheckComma())

 {

         dw2 = thinBasic_ParseDWord();

       if(thinBasic_CheckCloseParens(thinBasic_TRUE, thinBasic_TRUE))

             {

                 printf("Value1 = %d, Value2 = %d\n ", dw1, dw2);

       }

 }

  }

Function thinBasic_ParseString()

 

Description

 

The thinBasic_ParseString() function retrieves a pointer to a null-terminated string.

 

Syntax

 

 DWORD thinBasic_ParseString(char ** pszString);

 

Returns

 

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

 

Parameters

pszString

   Pointer to a pointer that will point to a null-terminated string retrived.

 

 

Remarks

 

 

Restrictions

 

 

See also

  thinBasic_ParseDouble, thinBasic_ParseDWord

 

Examples

 

if(thinBasic_CheckOpenParens(thinBasic_TRUE, thinBasic_TRUE))

{

 thinBasic_ParseString(&fname1);

 if(thinBasic_CheckComma())

 {

         thinBasic_ParseString(&fname2);

       if(thinBasic_CheckCloseParens(thinBasic_TRUE, thinBasic_TRUE))

             {

                 printf("File1 = %s, File2 = %s\n ",fname1, fname2);

       }

 }

 }

Function thinBasic_SetReturnString()

 

Description

 

The thinBasic_SetReturnString() pass retrieve a pointer to a null-terminated string.

 

Syntax

 

 LPVOID thinBasic_SetReturnString(char * szMsg);

 

Returns

 

A pointer of to the string for the interpreter.

If the function fails, the return value is a null pointer.

 

Parameters

szMsg

   Pointer to a null-terminated string to pass back to the interpreter.

 

 

Remarks

After a successfully call to thinBasic_SetRetunString the szMsg could be safety released.

 

Restrictions

 

 

See also

  thinBasic_ParseDouble, thinBasic_ParseDWord

 

Examples

 

char * StringFromC(char * szMsg)

{

 return thinBasic_SetReturnString(szMsg);

}

 

 

INCLUDE FILE AND STATIC LIBRARY INFO

COMPILER                INCUDE                STATIC LIBRARY                IMPORT LIBRARY

PowerBASIC                thinCore.inc                n.a.                                n.a.

IBASIC                thinCore.inc                thinIB.lib                        thinCore.lib

Borland C/C++        thinCore.h                thinC.lib                        thinCore.lib

Gnu C/C++                thinCore.h                thinC.a                                thinCore.lib        

Microsoft C/C++        thinCore.h                thinC.lib *                        thinCore.lib        

MASM                thinCore.inc                thinASM.lib                        thinCore.lib

 

Note: * For Microsoft C/C++ we provide also thinC.dll (the dynamic version of thinC.lib) with its import library thinC.lib.

 

 

HINTS AND TIPS

 

In order to use your module successfully, you should put it into a right folder.

For example, focusing on IBASIC module you should put the thinBasic_myIB.dll module into the C:\thinBasic\Lib folder.

 

 

SAMPLES MODULE

Microsoft Macro Assembler :

 Template:        UserDefinedLib.bas

 Default folder:        C:\thinBasic\SDK\thinBasic ASSEMBLER SDK\MASM\Lib

 Purpose:                Example of how can gain ultra high speed in math calculation (summary

of first <nItem> of natural numbers).

Function:        myASM_SumDWord (aArrayOfNA, nItems)

 Script:                TB_myASM.tbasicc

 Default folder:        C:\thinBasic\SDK\thinBasic ASSEMBLER SDK\MASM\SampleScripts\myASM

 

Borland C/C++ :

 Template:        thinBasic_myC.c

 Default folder:        C:\thinBasic\SDK\thinBasic C SDK\BCC\Lib

 Purpose:                Example of file compare functions.

Function:        myC_CompareFile(sFile1, sFile2)

 Script:                TB_myC.tbasic

 Default folder:        C:\thinBasic\SDK\thinBasic C SDK\BCC\SampleScripts

 

GNU Compiler Collection C/C++ :

 Template:        thinBasic_myC.c

 Default folder:        C:\thinBasic\SDK\thinBasic C SDK\GCC\Lib

 Purpose:                Example of how print some text.

Function:        myC_PrintPage (sText)

 Script:                TB_myC.tbasic

 Default folder:        C:\thinBasic\SDK\thinBasic C SDK\GCC\SampleScripts

 

IBASIC :

 Template:        thinBasic_myIB.ibp

 Default folder:        C:\thinBasic\SDK\thinBasic BASIC SDK\IB\Lib

 Purpose:                Example of how manage sprites.

 Function:        myIB_GetLogos()

                 myIB_RunLogos()

                 myIB_SetGreeting(sGreeting)

                 myIB_SetLogos(nNumberOfLogos)

 Script:                TB_myIB.tbasic

 Default folder:        C:\thinBasic\SDK\thinBasic BASIC SDK\IB\SampleScripts\myIB

 

Microsoft C/C++ :

 Template:        thinBasic_myC.c

 Default folder:        C:\thinBasic\SDK\thinBasic C SDK\MS-C++\Lib

 Purpose:                Example of how provide some custom functions.

Functions:        myC_PowC(x, y)

myC_GreetingFromC()

myC_StringFromC(sMsg)

myC_MultByTenC(n)

myC_StringLenC(sString)

 Script:                TB_myC.tbasic

 Default folder:        C:\thinBasic\SDK\thinBasic C SDK\MS-C++\SampleScripts

 

PowerBASIC :

 Template:        UserDefinedLib.bas

 Default folder:        C:\thinBasic\Lib\thinBasic_LibTemplate        

Purpose:                Example of how provide custom functions.

Functions:        HEX$(numeric_expression [, digits])

Console_fColor ( Red, Green, Blue, Intense)

 Script:                        

 Default folder: