2001-12-30 13:47 UTC+0100 Patrick Mast <email@patrickmast.com>
* contrib/apollo/apollo.c
+ Added function sx_GetDateJulian()
+ Added function sx_GetVariant()
+ Added function sx_SetCentury()
+ Added function sx_SetDateFormat()
+ Added function sx_GetLogical()
* modified function sx_Replace()
Note: Replace a logical value with sx_Replace() does not work yet.
* contrib/apollo/test/apollo.prg
* Added added functions in the test application.
* enhanced code
* Added and changed defines
This commit is contained in:
@@ -7,6 +7,21 @@
|
||||
For example:
|
||||
2002-12-01 23:12 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
* include/hbtypes.h
|
||||
! Fixed CVS header and self guard.
|
||||
|
||||
2001-12-31 18:00 UTC+0700 Andi Jahja <harbour@cbn.net.id>
|
||||
* source/vm/maindllp.c
|
||||
! commented unused iReturn variables
|
||||
! BOOL WINAPI HB_EXPORT => BOOL HB_EXPORT WINAPI
|
||||
* include/hbapi.h
|
||||
! extern * HB_EXPORT => extern HB_EXPORT *
|
||||
|
||||
2001-12-30 14:35 UTC-0300 Luiz Rafael Culik <culik@sl.conex.net>
|
||||
* source/vm/maindllp.c
|
||||
* Added FM api functions hb_xyy()
|
||||
% added somes cast to quite Borland
|
||||
* include/hbtypes.h
|
||||
* Added declaration for FM api functons
|
||||
* source/vm/fm.c
|
||||
include/hbapi.h
|
||||
|
||||
@@ -133,12 +133,47 @@ HB_FUNC( SX_EOF )
|
||||
}
|
||||
|
||||
|
||||
/* -----------------29/12/2001 20:13-----------------
|
||||
* sx_GetDateJulian() => The date expressed as a long integer. Useful for date arithmetic.
|
||||
* Extracts the contents of a date field as a Julian number.
|
||||
* This number is equal to the number of days since January 1, 4713 BC.
|
||||
* However, only JULIAN dates equal or greater than January 1, 1000 are supported.
|
||||
* --------------------------------------------------*/
|
||||
HB_FUNC( SX_GETDATEJULIAN )
|
||||
{
|
||||
hb_retni(
|
||||
sx_GetDateJulian( hb_parc( 1 ) ) ); /* Field name */
|
||||
}
|
||||
|
||||
|
||||
/* -----------------30/12/2001 13:04-----------------
|
||||
* sx_GetLogical() => True if the field evaluates as True, and False if not.
|
||||
* Determines whether a logical field contains a True or False value.
|
||||
* --------------------------------------------------*/
|
||||
HB_FUNC( SX_GETLOGICAL )
|
||||
{
|
||||
hb_retl(
|
||||
sx_GetLogical( hb_parc( 1 ) ) ); /* Field name */
|
||||
}
|
||||
|
||||
|
||||
/* -----------------29/12/2001 20:13-----------------
|
||||
* sx_GetString()
|
||||
* --------------------------------------------------*/
|
||||
HB_FUNC( SX_GETSTRING )
|
||||
{
|
||||
hb_retc( ( char * )sx_GetString( hb_parc( 1 ) ) ); /* Field name */
|
||||
hb_retc(
|
||||
( char * )sx_GetString( hb_parc( 1 ) ) ); /* Field name */
|
||||
}
|
||||
|
||||
|
||||
/* -----------------30/12/2001 12:21-----------------
|
||||
* sx_GetVariant() => Character fields are returned as untrimmed strings.
|
||||
* --------------------------------------------------*/
|
||||
HB_FUNC( SX_GETVARIANT )
|
||||
{
|
||||
hb_retc(
|
||||
( char * )sx_GetVariant( hb_parc( 1 ) ) ); /* Field name */
|
||||
}
|
||||
|
||||
|
||||
@@ -218,9 +253,32 @@ HB_FUNC( SX_REINDEX )
|
||||
* --------------------------------------------------*/
|
||||
HB_FUNC( SX_REPLACE )
|
||||
{
|
||||
sx_Replace( hb_parc( 1 ), /* Field name */
|
||||
hb_parni( 2 ), /* Data type */
|
||||
hb_parc( 3) ); /* Data */
|
||||
|
||||
switch ( hb_parni( 2 ) )
|
||||
{
|
||||
case R_INTEGER :
|
||||
case R_JULIAN : sx_Replace( hb_parc( 1 ), hb_parni( 2 ), ( void * ) hb_parni( 3) ) ; break;
|
||||
case R_LOGICAL : sx_Replace( hb_parc( 1 ), hb_parni( 2 ), ( void * ) hb_parni( 3) ) ; break; /* TODO: somthing is wrong here... */
|
||||
case R_LONG : sx_Replace( hb_parc( 1 ), hb_parni( 2 ), ( void * ) hb_parnl( 3) ) ; break;
|
||||
case R_DOUBLE :
|
||||
{
|
||||
double d = hb_parnd( 3 );
|
||||
sx_Replace( hb_parc( 1 ), hb_parni( 2 ), ( void * ) &d );
|
||||
break;
|
||||
}
|
||||
case R_CHAR :
|
||||
case R_DATESTR :
|
||||
case R_MEMO :
|
||||
case R_BITMAP :
|
||||
case R_BLOBFILE:
|
||||
case R_BLOBPTR : sx_Replace( hb_parc( 1 ), hb_parni( 2 ), ( void * ) hb_parc( 3) ) ; break;
|
||||
default: sx_Replace( hb_parc( 1 ), hb_parni( 2 ), ( void * ) hb_parc( 3) );
|
||||
}
|
||||
|
||||
// sx_Replace( hb_parc( 1 ), /* Field name */
|
||||
// hb_parni( 2 ), /* Data type */
|
||||
// hb_parc( 3) ); /* Data */
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -243,13 +301,37 @@ HB_FUNC( SX_SEEK )
|
||||
}
|
||||
|
||||
|
||||
/* -----------------30/12/2001 12:30-----------------
|
||||
* sx_SetCentury() => NILL
|
||||
* Indicates whether or not the two digits of the year designating
|
||||
* century are to be returned by sx_GetDateString as part of a date
|
||||
* string formatted according to the sx_SetDateFormat setting.
|
||||
* --------------------------------------------------*/
|
||||
HB_FUNC( SX_SETCENTURY )
|
||||
{
|
||||
sx_SetCentury( hb_parl( 1 ) ); /* If True, the century digits will be returned.
|
||||
* If False, they will not. */
|
||||
}
|
||||
|
||||
|
||||
/* -----------------30/12/2001 12:32-----------------
|
||||
* sx_SetDateFormat() => NILL
|
||||
* Defines the format of date strings returned by sx_GetDateString.
|
||||
* --------------------------------------------------*/
|
||||
HB_FUNC( SX_SETDATEFORMAT )
|
||||
{
|
||||
sx_SetDateFormat( hb_parni( 1 ) ); /* If True, the century digits will be returned.
|
||||
* If False, they will not. */
|
||||
}
|
||||
|
||||
|
||||
/* -----------------29/12/2001 19:59-----------------
|
||||
* sx_SetMemoBlockSize()
|
||||
* --------------------------------------------------*/
|
||||
HB_FUNC( SX_SETMEMOBLOCKSIZE )
|
||||
{
|
||||
sx_SetMemoBlockSize( hb_parni( 1 ) ); /* The new default block size. */
|
||||
/* The size must be a value from 1 through 1024. */
|
||||
sx_SetMemoBlockSize( hb_parni( 1 ) ); /* The new default block size.
|
||||
* The size must be a value from 1 through 1024. */
|
||||
}
|
||||
|
||||
|
||||
@@ -289,7 +371,8 @@ HB_FUNC( SX_USE )
|
||||
* --------------------------------------------------*/
|
||||
HB_FUNC( SX_VERSION )
|
||||
{
|
||||
hb_retc( ( char * ) sx_Version() );
|
||||
hb_retc(
|
||||
( char * ) sx_Version() );
|
||||
}
|
||||
|
||||
|
||||
@@ -304,30 +387,51 @@ HB_FUNC( SX_ZAP )
|
||||
|
||||
|
||||
/*
|
||||
2001-12-28 20:39 UTC+0100 Patrick Mast <email@patrickmast.com>
|
||||
* contrib/apollo
|
||||
+ Added function sx_GoBottom()
|
||||
+ Added function sx_Go()
|
||||
+ Added function sx_Seek()
|
||||
+ Added function sx_SetSoftSeek()
|
||||
+ Added function sx_RLock()
|
||||
+ Added function sx_Reindex()
|
||||
+ Added function sx_RecCount()
|
||||
+ Added function sx_SetMemoBlockSize()
|
||||
+ Added function sx_CreateNew()
|
||||
+ Added function sx_CreateField()
|
||||
+ Added function sx_CreateExec()
|
||||
|
||||
|
||||
|
||||
*
|
||||
*
|
||||
+ Added function sx_IndexTag()
|
||||
+ Added function sx_RecNo()
|
||||
+ Added function sx_Replace()
|
||||
+ Added function sx_Skip()
|
||||
+ Added function sx_Use()
|
||||
+ Added function sx_Zap()
|
||||
* contrib/apollo/test
|
||||
2001-12-30 13:47 UTC+0100 Patrick Mast <email@patrickmast.com>
|
||||
* contrib/apollo/apollo.c
|
||||
+ Added function sx_GetDateJulian()
|
||||
+ Added function sx_GetVariant()
|
||||
+ Added function sx_SetCentury()
|
||||
+ Added function sx_SetDateFormat()
|
||||
+ Added function sx_GetLogical()
|
||||
* modified function sx_Replace()
|
||||
Note: Replace a logical value with sx_Replace() does not work yet.
|
||||
* contrib/apollo/test/apollo.prg
|
||||
* Added added functions in the test application.
|
||||
* enhanced code
|
||||
* Added and changed defines
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
sx_AppendBlank()
|
||||
sx_Close()
|
||||
sx_Commit()
|
||||
sx_CreateExec()
|
||||
sx_CreateField()
|
||||
sx_CreateNew()
|
||||
sx_Eof()
|
||||
sx_GetDateJulian()
|
||||
sx_GetLogical()
|
||||
sx_GetString()
|
||||
sx_GetVariant()
|
||||
sx_Go()
|
||||
sx_GoBottom()
|
||||
sx_GoTop()
|
||||
sx_IndexTag()
|
||||
sx_RecCOunt()
|
||||
sx_RecNo()
|
||||
sx_Reindex()
|
||||
sx_Replace()
|
||||
sx_RLock()
|
||||
sx_Seek()
|
||||
sx_SetDateFormat()
|
||||
sx_SetCentury()
|
||||
sx_SetMemoBlockSize()
|
||||
sx_SetSoftSeek()
|
||||
sx_Skip()
|
||||
sx_Use()
|
||||
sx_Version()
|
||||
sx_Zap()
|
||||
*/
|
||||
@@ -50,34 +50,50 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/* ************* */
|
||||
/* date types */
|
||||
/* ************* */
|
||||
#define SX_AMERICAN 0
|
||||
#define SX_ANSI 1
|
||||
#define SX_BRITISH 2
|
||||
#define SX_FRENCH 3
|
||||
#define SX_GERMAN 4
|
||||
#define SX_ITALIAN 5
|
||||
#define SX_SPANISH 6
|
||||
|
||||
/* ************************************ */
|
||||
/* Data type identifiers for sx_Replace */
|
||||
/* ************************************ */
|
||||
#define R_INTEGER 1
|
||||
#define R_LONG 2
|
||||
#define R_DOUBLE 8
|
||||
#define R_JULIAN 32
|
||||
#define R_LOGICAL 128
|
||||
#define R_CHAR 1024
|
||||
#define R_DATESTR 1056
|
||||
#define R_MEMO 3072
|
||||
#define R_BITMAP 4096
|
||||
#define R_BLOBFILE 8192
|
||||
#define R_BLOBPTR 8193
|
||||
#define R_GENERAL 8195
|
||||
#define SX_R_INTEGER 1
|
||||
#define SX_R_LONG 2
|
||||
#define SX_R_DOUBLE 8
|
||||
#define SX_R_JULIAN 32
|
||||
#define SX_R_LOGICAL 128
|
||||
#define SX_R_CHAR 1024
|
||||
#define SX_R_DATESTR 1056
|
||||
#define SX_R_MEMO 3072
|
||||
#define SX_R_BITMAP 4096
|
||||
#define SX_R_BLOBFILE 8192
|
||||
#define SX_R_BLOBPTR 8193
|
||||
#define SX_R_GENERAL 8195
|
||||
|
||||
#define SDENTX 1 // CA-Clipper compatible DBF-NTX driver
|
||||
#define SDEFOX 2 // FoxPro compatible DBF-IDX/CDX driver
|
||||
#define SDENSX 3 // Vista DBF-NSX driver
|
||||
#define SX_SDENTX 1 // CA-Clipper compatible DBF-NTX driver
|
||||
#define SX_SDEFOX 2 // FoxPro compatible DBF-IDX/CDX driver
|
||||
#define SX_SDENSX 3 // Vista DBF-NSX driver
|
||||
|
||||
#define READWRITE 0
|
||||
#define READONLY 1
|
||||
#define EXCLUSIVE 2
|
||||
#define SX_READWRITE 0
|
||||
#define SX_READONLY 1
|
||||
#define SX_EXCLUSIVE 2
|
||||
|
||||
Function Main()
|
||||
LOCAL nAlias,f
|
||||
|
||||
sx_SetMemoBlockSize(32)
|
||||
SET DATE FRENCH
|
||||
SET CENTURY ON
|
||||
|
||||
sx_SetMemoBlockSize( 32 )
|
||||
sx_SetDateFormat( SX_FRENCH )
|
||||
sx_SetCentury( .t. )
|
||||
|
||||
? "Apollo version " + sx_Version()
|
||||
|
||||
@@ -92,7 +108,7 @@ LOCAL nAlias,f
|
||||
? "Creating a new database file.."
|
||||
nAlias:=sx_CreateNew("TEST.DBF",; // full path filename
|
||||
"test1",; // Alias
|
||||
SDENSX,; // rdeType
|
||||
SX_SDENSX,; // rdeType
|
||||
6) // Maximum fields added by sx_CreateField
|
||||
IF nAlias=0
|
||||
? "Error creating database"
|
||||
@@ -102,7 +118,7 @@ LOCAL nAlias,f
|
||||
sx_CreateField("FIRST" ,"C",40,0)
|
||||
sx_CreateField("LAST" ,"C",40,0)
|
||||
sx_CreateField("NOTES" ,"M",10,0)
|
||||
sx_CreateField("AGE" ,"N", 3,0)
|
||||
sx_CreateField("AGE" ,"N", 4,0)
|
||||
sx_CreateField("MARRIED" ,"L", 1,0)
|
||||
sx_CreateField("BIRTDATE","D", 8,0)
|
||||
|
||||
@@ -110,7 +126,7 @@ LOCAL nAlias,f
|
||||
sx_Close()
|
||||
?? "OK!"
|
||||
|
||||
nAlias:=sx_Use("TEST.DBF","test2",EXCLUSIVE,SDENSX)
|
||||
nAlias:=sx_Use("TEST.DBF","test2",SX_EXCLUSIVE,SX_SDENSX)
|
||||
sx_Zap()
|
||||
IF Valtype(nAlias)="N" .AND. nAlias # 0
|
||||
? "OK opening 'TEST.DBF'"
|
||||
@@ -119,9 +135,12 @@ LOCAL nAlias,f
|
||||
? "Adding 1000 records..."
|
||||
FOR f=1 to 1000
|
||||
sx_AppendBlank()
|
||||
sx_Replace("FIRST", R_CHAR, "Patrick " + Str( f ) )
|
||||
sx_Replace("LAST" , R_CHAR, LTrim( Str( f ) ) + " Mast" )
|
||||
sx_Replace("NOTES", R_MEMO, "This is record " + LTrim( Str( f ) ) )
|
||||
sx_Replace("FIRST" , SX_R_CHAR , "Patrick " + Str( f ) )
|
||||
sx_Replace("LAST" , SX_R_CHAR , LTrim( Str( f ) ) + " Mast" )
|
||||
sx_Replace("NOTES" , SX_R_MEMO , "This is record " + LTrim( Str( f ) ) )
|
||||
sx_Replace("AGE" , SX_R_DOUBLE , f )
|
||||
sx_Replace("BIRTDATE" , SX_R_DATESTR, DtoC( Date() ) )
|
||||
*sx_Replace("MARRIED" , SX_R_LOGICAL, If(f%5=2,1,0) ) /* Logical does not work yet.. */
|
||||
sx_Commit()
|
||||
NEXT
|
||||
|
||||
@@ -133,8 +152,11 @@ LOCAL nAlias,f
|
||||
|
||||
sx_GoTop()
|
||||
WHILE !sx_Eof()
|
||||
@ 17,2 SAY "RecNo: "+ LTrim( Str( sx_RecNo() ) )
|
||||
@ 18,2 SAY sx_GetString( "LAST" )
|
||||
? ""
|
||||
? "RecNo...... : " + LTrim( Str( sx_RecNo() ) )
|
||||
? "Last name.. : " + sx_GetVariant( "LAST" )
|
||||
? "Birth date. : " + sx_GetVariant( "BIRTDATE" )
|
||||
? "Married.... : " + If( sx_GetLogical( "MARRIED" ) , "Yes", "No, SINGLE!!")
|
||||
sx_Skip(1)
|
||||
ENDDO
|
||||
|
||||
@@ -158,8 +180,6 @@ LOCAL nAlias,f
|
||||
?? "OK!"
|
||||
|
||||
|
||||
|
||||
|
||||
sx_Close()
|
||||
|
||||
ELSE
|
||||
|
||||
Reference in New Issue
Block a user