home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic 4 Unleashed
/
Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso
/
codebsic
/
codebase.bas
< prev
next >
Wrap
BASIC Source File
|
1995-02-01
|
37KB
|
899 lines
' Data Types Used by CodeBasic
Type FIELD4INFOCB
fname As Long ' C string (which is different than a Basic String)
ftype As Integer
flength As Integer
fdecimals As Integer
End Type
Type FIELD4INFO ' Corresponding Basic structure
fname As String
ftype As String * 1
flength As Integer
fdecimals As Integer
End Type
Type TAG4INFOCB
name As Long ' C string
expression As Long ' C string
filter As Long ' C string
unique As Integer
descending As Integer
End Type
Type TAG4INFO
name As String
expression As String
filter As String
unique As Integer
descending As Integer
End Type
'===================================================================================
'
' CODE4 Access function prototypes
'
'===================================================================================
Declare Function code4autoOpen% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4createError% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4dateFormatCB& Lib "cb5demo.dll" Alias "code4dateFormat" (ByVal c4&, ByVal pic$)
Declare Function code4defaultUniqueError% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4errorCode% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4exclusive% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4exprError% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4fieldNameError% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4fileFlush% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4goError% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4hWnd% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4lockAttempts% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4memExpandBlock% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4memExpandData% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4memExpandIndex% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4memExpandTag% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4memSizeBlock& Lib "cb5demo.dll" (ByVal c4&, ByVal value&)
Declare Function code4memSizeBuffer& Lib "cb5demo.dll" (ByVal c4&, ByVal value&)
Declare Function code4memSizeMemo% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4memSizeMemoExpr& Lib "cb5demo.dll" (ByVal c4&, ByVal value&)
Declare Function code4memSizeSortBuffer& Lib "cb5demo.dll" (ByVal c4&, ByVal value&)
Declare Function code4memSizeSortPool& Lib "cb5demo.dll" (ByVal c4&, ByVal value&)
Declare Function code4memStartBlock% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4memStartData% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4memStartIndex% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4memStartMax& Lib "cb5demo.dll" (ByVal c4&, ByVal value&)
Declare Function code4memStartTag% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4offError% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4openError% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4optimize% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4optimizeWrite% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4readLock% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4readOnly% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4relateError% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4safety% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4skipError% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
Declare Function code4tagNameError% Lib "cb5demo.dll" (ByVal c4&, ByVal value%)
'===============================================================================================
'
' CodeControls function prototypes
'
'-----------------------------------------------------------------------------------------------
Declare Function ctrl4init Lib "cc2.vbx" Alias "ctrl4initVB" () As Long
Declare Function ctrl4initUndo Lib "cc2.vbx" Alias "ctrl4initUndoVB" (ByVal code As Long) As Integer
'===============================================================================================
'
' Data File Functions' Prototypes
'
'-----------------------------------------------------------------------------------------------
Declare Function d4aliasCB& Lib "cb5demo.dll" Alias "d4alias" (ByVal d4&)
Declare Sub d4aliasSet Lib "cb5demo.dll" Alias "d4alias_set" (ByVal d4&, ByVal AliasValue$)
Declare Function d4append% Lib "cb5demo.dll" (ByVal d4&)
Declare Function d4appendblank% Lib "cb5demo.dll" Alias "d4append_blank" (ByVal d4&)
Declare Function d4appendStart% Lib "cb5demo.dll" Alias "d4append_start" (ByVal d4&, ByVal UseMemoEntries%)
Declare Sub d4blank Lib "cb5demo.dll" (ByVal d4&)
Declare Function d4bof% Lib "cb5demo.dll" (ByVal d4&)
Declare Function d4bottom% Lib "cb5demo.dll" (ByVal d4&)
Declare Function d4changed% Lib "cb5demo.dll" (ByVal d4&, ByVal intFlag%)
Declare Function d4check% Lib "cb5demo.dll" (ByVal d4&)
Declare Function d4close% Lib "cb5demo.dll" (ByVal d4&)
Declare Function d4closeAll% Lib "cb5demo.dll" Alias "d4close_all" (ByVal c4&)
Declare Function d4createCB& Lib "cb5demo.dll" Alias "d4create" (ByVal c4&, ByVal DbfName$, fieldinfo As Any, tagInfo As Any)
Declare Function d4data& Lib "cb5demo.dll" (ByVal c4&, ByVal AliasName$)
Declare Sub d4delete Lib "cb5demo.dll" (ByVal d4&)
Declare Function d4deleted% Lib "cb5demo.dll" (ByVal d4&)
Declare Function d4eof% Lib "cb5demo.dll" (ByVal d4&)
Declare Function d4field& Lib "cb5demo.dll" (ByVal d4&, ByVal FieldName$)
Declare Function d4fieldInfo& Lib "cb5demo.dll" Alias "d4field_info" (ByVal d4&)
Declare Function d4fieldJ& Lib "cb5demo.dll" Alias "d4field_j" (ByVal d4&, ByVal JField%)
Declare Function d4fieldNumber% Lib "cb5demo.dll" Alias "d4field_number" (ByVal d4&, ByVal FieldName$)
Declare Function d4fileNameCB& Lib "cb5demo.dll" Alias "d4fileName" (ByVal d4&)
Declare Function d4flush% Lib "cb5demo.dll" (ByVal d4&)
Declare Function d4flushData% Lib "cb5demo.dll" Alias "d4flush_data" (ByVal d4&)
Declare Function d4flushFiles% Lib "cb5demo.dll" Alias "d4flush_files" (ByVal c4&)
Declare Function d4freeBlocks% Lib "cb5demo.dll" Alias "d4free_blocks" (ByVal d4&)
Declare Function d4go% Lib "cb5demo.dll" (ByVal d4&, ByVal RecNum&)
Declare Function d4goData% Lib "cb5demo.dll" Alias "d4go_data" (ByVal d4&, ByVal RecNum&)
Declare Function d4goEof% Lib "cb5demo.dll" Alias "d4go_eof" (ByVal d4&)
Declare Function d4index& Lib "cb5demo.dll" (ByVal d4&, ByVal IndexName$)
Declare Function d4init& Lib "cb5demo.dll" Alias "d4init_v" ()
Declare Function d4initUndo% Lib "cb5demo.dll" (ByVal c4&)
Declare Function d4lock% Lib "cb5demo.dll" (ByVal d4&, ByVal RecordNum&)
Declare Function d4lockAll% Lib "cb5demo.dll" Alias "d4lock_all" (ByVal d4&)
Declare Function d4lockAppend% Lib "cb5demo.dll" Alias "d4lock_append" (ByVal d4&)
Declare Function d4lockFile% Lib "cb5demo.dll" Alias "d4lock_file" (ByVal d4&)
Declare Function d4lockGroup% Lib "cb5demo.dll" Alias "d4lock_group" (ByVal d4&, RecordsArray&, ByVal NumRecords%)
Declare Function d4lockIndex% Lib "cb5demo.dll" Alias "d4lock_index" (ByVal d4&)
Declare Function d4lockTest% Lib "cb5demo.dll" Alias "d4lock_test" (ByVal d4&, ByVal RecNum&)
Declare Function d4lockTestAppend% Lib "cb5demo.dll" Alias "d4lock_test_append" (ByVal d4&)
Declare Function d4lockTestFile% Lib "cb5demo.dll" Alias "d4lock_test_file" (ByVal d4&)
Declare Function d4lockTestIndex% Lib "cb5demo.dll" Alias "d4lock_test_index" (ByVal d4&)
Declare Function d4memoCompress% Lib "cb5demo.dll" Alias "d4memo_compress" (ByVal d4&)
Declare Function d4numFields% Lib "cb5demo.dll" Alias "d4num_fields" (ByVal d4&)
Declare Function d4open& Lib "cb5demo.dll" (ByVal c4&, ByVal DbfName$)
Declare Function d4optStart% Lib "cb5demo.dll" Alias "d4opt_start" (ByVal c4&)
Declare Function d4optSuspend% Lib "cb5demo.dll" Alias "d4opt_suspend" (ByVal c4&)
Declare Function d4optimize% Lib "cb5demo.dll" (ByVal d4&, ByVal OptFlag%)
Declare Function d4optimizeWrite% Lib "cb5demo.dll" Alias "d4optimize_write" (ByVal d4&, ByVal OptFlag%)
Declare Function d4pack% Lib "cb5demo.dll" (ByVal d4&)
Declare Function d4packData% Lib "cb5demo.dll" Alias "d4pack_data" (ByVal d4&)
Declare Function d4position# Lib "cb5demo.dll" (ByVal d4&)
Declare Function d4positionSet% Lib "cb5demo.dll" Alias "d4position_set" (ByVal d4&, ByVal Percentage#)
Declare Sub d4recall Lib "cb5demo.dll" (ByVal d4&)
Declare Function d4reccount& Lib "cb5demo.dll" (ByVal d4&)
Declare Function d4recno& Lib "cb5demo.dll" (ByVal d4&)
Declare Function d4record& Lib "cb5demo.dll" (ByVal d4&)
Declare Function d4recordWidth& Lib "cb5demo.dll" Alias "d4record_width" (ByVal d4&)
Declare Function d4refresh% Lib "cb5demo.dll" (ByVal d4&)
Declare Function d4refreshRecord% Lib "cb5demo.dll" Alias "d4refresh_record" (ByVal d4&)
Declare Function d4reindex% Lib "cb5demo.dll" (ByVal d4&)
Declare Function d4seek% Lib "cb5demo.dll" (ByVal d4&, ByVal seekValue$)
Declare Function d4seekDouble% Lib "cb5demo.dll" Alias "d4seek_double" (ByVal d4&, ByVal value#)
Declare Function d4skip% Lib "cb5demo.dll" (ByVal d4&, ByVal NumberRecords&)
Declare Function d4tag& Lib "cb5demo.dll" (ByVal d4&, ByVal TagName$)
Declare Function d4tagDefault& Lib "cb5demo.dll" Alias "d4tag_default" (ByVal d4&)
Declare Function d4tagNext& Lib "cb5demo.dll" Alias "d4tag_next" (ByVal d4&, ByVal TagOn As Any)
Declare Function d4tagPrev& Lib "cb5demo.dll" Alias "d4tag_prev" (ByVal d4&, ByVal TagOn As Any)
Declare Sub d4tagSelect Lib "cb5demo.dll" Alias "d4tag_select" (ByVal d4&, ByVal tPtr As Any)
Declare Function d4tagSelected& Lib "cb5demo.dll" Alias "d4tag_selected" (ByVal d4&)
Declare Function d4top% Lib "cb5demo.dll" (ByVal d4&)
Declare Function d4unlock% Lib "cb5demo.dll" (ByVal d4&)
Declare Function d4unlockFiles% Lib "cb5demo.dll" Alias "d4unlock_files" (ByVal d4&)
Declare Function d4write% Lib "cb5demo.dll" (ByVal d4&, ByVal RecNum&)
Declare Function d4zap% Lib "cb5demo.dll" (ByVal d4&, ByVal StartRecord&, ByVal EndRecord&)
'===============================================================================================
'
' Date Functions' Prototypes
'
'-----------------------------------------------------------------------------------------------
Declare Sub date4assign Lib "cb5demo.dll" (ByVal DateForm$, ByVal JulianDay&)
Declare Function date4cdowCB& Lib "cb5demo.dll" Alias "date4cdow" (ByVal DateForm$)
Declare Function date4cmonthCB& Lib "cb5demo.dll" Alias "date4cmonth" (ByVal DateForm$)
Declare Function date4day% Lib "cb5demo.dll" (ByVal DateForm$)
Declare Function date4dow% Lib "cb5demo.dll" (ByVal DateForm$)
Declare Sub date4formatCB Lib "cb5demo.dll" Alias "date4format" (ByVal DateForm$, ByVal Result$, ByVal pic$)
Declare Sub date4initCB Lib "cb5demo.dll" Alias "date4init" (ByVal DateForm$, ByVal value$, ByVal pic$)
Declare Function date4long& Lib "cb5demo.dll" (ByVal DateForm$)
Declare Function date4month% Lib "cb5demo.dll" (ByVal DateForm$)
Declare Sub date4timeNow Lib "cb5demo.dll" Alias "date4time_now" (ByVal TimeForm$)
Declare Sub date4todayCB Lib "cb5demo.dll" Alias "date4today" (ByVal DateForm$)
Declare Function date4year% Lib "cb5demo.dll" (ByVal DateForm$)
'===============================================================================================
'
' Expression Evaluation Functions' Prototypes
'
'-----------------------------------------------------------------------------------------------
Declare Function expr4double# Lib "cb5demo.dll" (ByVal ExprPtr&)
Declare Sub expr4free Lib "cb5demo.dll" (ByVal ExprPtr&)
Declare Function expr4Len% Lib "cb5demo.dll" (ByVal ExprPtr&)
Declare Function expr4parse& Lib "cb5demo.dll" (ByVal d4&, ByVal expression$)
Declare Function expr4true% Lib "cb5demo.dll" (ByVal ExprPtr&)
Declare Function expr4type% Lib "cb5demo.dll" (ByVal ExprPtr&)
'===============================================================================================
'
' Field Functions' Prototypes
'
'-----------------------------------------------------------------------------------------------
Declare Sub f4assign Lib "cb5demo.dll" (ByVal fPtr&, ByVal value$)
Declare Sub f4assignChar Lib "cb5demo.dll" Alias "f4assign_char" (ByVal fPtr&, ByVal Char%)
Declare Sub f4assignDouble Lib "cb5demo.dll" Alias "f4assign_double" (ByVal fPtr&, ByVal value#)
Declare Sub f4assignField Lib "cb5demo.dll" Alias "f4assign_field" (ByVal fPtrTo&, ByVal fPtrFrom&)
Declare Sub f4assignInt Lib "cb5demo.dll" Alias "f4assign_int" (ByVal fPtr&, ByVal value%)
Declare Sub f4assignLong Lib "cb5demo.dll" Alias "f4assign_long" (ByVal fPtr&, ByVal value&)
Declare Sub f4assignN Lib "cb5demo.dll" Alias "f4assign_n" (ByVal fPtr&, ByVal value$, ByVal Length%)
Declare Sub f4blank Lib "cb5demo.dll" (ByVal fPtr&)
Declare Function f4char% Lib "cb5demo.dll" (ByVal fPtr&)
Declare Function f4data& Lib "cb5demo.dll" (ByVal fPtr&)
Declare Function f4decimals% Lib "cb5demo.dll" (ByVal fPtr&)
Declare Function f4double# Lib "cb5demo.dll" (ByVal fPtr&)
Declare Function f4int% Lib "cb5demo.dll" (ByVal fPtr&)
Declare Function f4len% Lib "cb5demo.dll" Alias "f4len_v" (ByVal fPtr&)
Declare Function f4long& Lib "cb5demo.dll" (ByVal fPtr&)
Declare Function f4memoAssign% Lib "cb5demo.dll" Alias "f4memo_assign" (ByVal fPtr&, ByVal value$)
Declare Function f4memoAssignN% Lib "cb5demo.dll" Alias "f4memo_assign_n" (ByVal fPtr&, ByVal value$, ByVal Length%)
Declare Sub f4memoFree Lib "cb5demo.dll" Alias "f4memo_free" (ByVal fPtr&)
Declare Function f4memoLen& Lib "cb5demo.dll" (ByVal fPtr&)
Declare Function f4memoNcpy% Lib "cb5demo.dll" Alias "f4memo_ncpy" (ByVal fPtr&, ByVal memPtr$, ByVal memLen%)
Declare Function f4memoPtr& Lib "cb5demo.dll" Alias "f4memo_ptr" (ByVal fPtr&)
Declare Function f4memoStrCB& Lib "cb5demo.dll" Alias "f4memo_str" (ByVal fPtr&)
Declare Function f4nameCB& Lib "cb5demo.dll" Alias "f4name" (ByVal fPtr&)
Declare Function f4ncpy% Lib "cb5demo.dll" (ByVal fPtr&, ByVal memPtr$, ByVal memLength%)
Declare Function f4ptr& Lib "cb5demo.dll" (ByVal fPtr&)
Declare Function f4strCB& Lib "cb5demo.dll" Alias "f4str" (ByVal fPtr&)
Declare Function f4true% Lib "cb5demo.dll" (ByVal fPtr&)
Declare Function f4type% Lib "cb5demo.dll" (ByVal fPtr&)
'===============================================================================================
'
' Index Functions' Prototypes
'
'-----------------------------------------------------------------------------------------------
Declare Function i4close% Lib "cb5demo.dll" (ByVal i4&)
Declare Function i4createCB& Lib "cb5demo.dll" Alias "i4create" (ByVal d4&, ByVal fileName As Any, tagInfo As TAG4INFOCB)
Declare Function i4lock% Lib "cb5demo.dll" (ByVal i4&)
Declare Function i4openCB& Lib "cb5demo.dll" Alias "i4open" (ByVal d4&, ByVal fileName As Any)
Declare Function i4reindex% Lib "cb5demo.dll" (ByVal i4&)
Declare Function i4tag& Lib "cb5demo.dll" (ByVal i4&, ByVal fileName$)
Declare Function i4tagInfo& Lib "cb5demo.dll" Alias "i4tag_info" (ByVal i4&)
Declare Function i4unlock% Lib "cb5demo.dll" (ByVal i4&)
'===============================================================================================
'
' Relate Functions' Prototypes
'
'-----------------------------------------------------------------------------------------------
Declare Function relate4bottom% Lib "cb5demo.dll" (ByVal r4&)
Declare Sub relate4changed Lib "cb5demo.dll" (ByVal r4&)
Declare Function relate4createSlave& Lib "cb5demo.dll" Alias "relate4create_slave" (ByVal r4&, ByVal d4&, ByVal mExpr$, ByVal t4 As Any)
Declare Function relate4data& Lib "cb5demo.dll" (ByVal r4&)
Declare Function relate4dataTag& Lib "cb5demo.dll" (ByVal r4&)
Declare Function relate4do% Lib "cb5demo.dll" (ByVal r4&)
Declare Function relate4doOne% Lib "cb5demo.dll" Alias "relate4do_one" (ByVal r4&)
Declare Function relate4errorAction% Lib "cb5demo.dll" Alias "relate4error_action" (ByVal r4&, ByVal ErrAction%)
Declare Function relate4free% Lib "cb5demo.dll" (ByVal r4&, ByVal CloseFlag%)
Declare Function relate4init& Lib "cb5demo.dll" (ByVal d4&)
Declare Function relate4lock% Lib "cb5demo.dll" (ByVal r4&)
Declare Function relate4matchLen% Lib "cb5demo.dll" Alias "relate4match_len" (ByVal r4&, ByVal Length%)
Declare Function relate4master& Lib "cb5demo.dll" (ByVal r4&)
Declare Function relate4next% Lib "cb5demo.dll" (r4&)
Declare Function relate4querySet% Lib "cb5demo.dll" Alias "relate4query_set" (ByVal r4&, ByVal expr As String)
Declare Function relate4retrieve& Lib "cb5demo.dll" (ByVal c4&, ByVal fileName$, ByVal openFiles%, ByVal dataPathName$)
Declare Function relate4save% Lib "cb5demo.dll" (ByVal rel4&, ByVal fileName$, ByVal savePathNames%)
Declare Function relate4skip% Lib "cb5demo.dll" (ByVal r4&, ByVal NumRecs&)
Declare Function relate4skipEnable% Lib "cb5demo.dll" Alias "relate4skip_enable" (ByVal r4&, ByVal DoEnable%)
Declare Function relate4sortSet% Lib "cb5demo.dll" Alias "relate4sort_set" (ByVal r4&, ByVal expr As String)
Declare Function relate4top% Lib "cb5demo.dll" (ByVal r4&)
Declare Function relate4topMaster& Lib "cb5demo.dll" (ByVal r4&)
Declare Function relate4type% Lib "cb5demo.dll" (ByVal r4&, ByVal rType%)
Declare Function relate4unlock% Lib "cb5demo.dll" (ByVal r4&)
'===============================================================================================
'
' Report function prototypes
'
'================================================================================================
Declare Function report4caption% Lib "cb5demo.dll" (ByVal r4&, ByVal caption$)
Declare Function report4currency% Lib "cb5demo.dll" (ByVal r4&, ByVal currncy$)
Declare Function report4dateFormat% Lib "cb5demo.dll" (ByVal r4&, ByVal dateFmt$)
Declare Function report4decimal% Lib "cb5demo.dll" Alias "report4decimal_v" (ByVal r4&, ByVal decChar$)
Declare Function report4do% Lib "cb5demo.dll" Alias "report4do_v" (ByVal r4&)
Declare Sub report4free Lib "cb5demo.dll" (ByVal r4&, ByVal freeRelate%, ByVal closeFiles%)
Declare Function report4margins% Lib "cb5demo.dll" (ByVal r4&, ByVal mLeft&, ByVal mRight&, ByVal mTop&, ByVal mBottom&, ByVal uType%)
Declare Function report4pageSize% Lib "cb5demo.dll" (ByVal r4&, ByVal pHeight&, ByVal pWidth&, ByVal uType%)
Declare Function report4parent% Lib "cb5demo.dll" (ByVal r4&, ByVal hWnd%)
Declare Sub report4printerSelect Lib "cb5demo.dll" (ByVal r4&)
Declare Function report4querySet% Lib "cb5demo.dll" (ByVal r4&, ByVal queryExpr$)
Declare Function report4relate& Lib "cb5demo.dll" (ByVal r4&)
Declare Function report4retrieve& Lib "cb5demo.dll" (ByVal c4&, ByVal fileName$, ByVal openFiles%, ByVal dataPath$)
Declare Function report4save% Lib "cb5demo.dll" (ByVal r4&, ByVal fileName$, ByVal savePaths%)
Declare Function report4separator% Lib "cb5demo.dll" Alias "report4separator_v" (ByVal r4&, ByVal separator$)
Declare Function report4sortSet% Lib "cb5demo.dll" (ByVal r4&, ByVal sortExpr$)
Declare Function report4toScreen% Lib "cb5demo.dll" (ByVal r4&, ByVal toScreen%)
'===============================================================================================
'
' TAG4 Access function prototypes
'
'================================================================================================
Declare Function tag4aliasCB& Lib "cb5demo.dll" Alias "tag4alias" (ByVal t4&)
Declare Function tag4Descending% Lib "cb5demo.dll" (ByVal t4&)
Declare Function tag4exprCB& Lib "cb5demo.dll" Alias "tag4expr" (ByVal t4&)
Declare Function tag4filterCB& Lib "cb5demo.dll" Alias "tag4filter" (ByVal t4&)
Declare Function tag4KeyLen% Lib "cb5demo.dll" (ByVal t4&)
Declare Function tag4Unique% Lib "cb5demo.dll" (ByVal t4&)
Declare Function tag4UniqueError% Lib "cb5demo.dll" (ByVal t4&, ByVal value%)
'===============================================================================================
'
' Tag Functions' Prototypes
'
'-----------------------------------------------------------------------------------------------
Declare Function t4bottom% Lib "cb5demo.dll" (ByVal t4&)
Declare Function t4eof% Lib "cb5demo.dll" (ByVal t4&)
Declare Function t4go% Lib "cb5demo.dll" (ByVal t4&, ByVal key$, ByVal RecNum&)
Declare Function t4keyCB& Lib "cb5demo.dll" Alias "t4key" (ByVal t4&)
Declare Function t4open& Lib "cb5demo.dll" Alias "t4open_v" (ByVal dbPtr&, ByVal IndexName$)
Declare Function t4position# Lib "cb5demo.dll" (ByVal t4&)
Declare Function t4positionSet% Lib "cb5demo.dll" Alias "t4position_set" (ByVal t4&, ByVal Position#)
Declare Function t4recno& Lib "cb5demo.dll" (ByVal t4&)
Declare Function t4seek% Lib "cb5demo.dll" (ByVal t4&, ByVal key As Any, ByVal keyLength%)
Declare Function t4skip& Lib "cb5demo.dll" (ByVal t4&, ByVal NumRecs&)
Declare Function t4top% Lib "cb5demo.dll" (ByVal t4&)
'=======================================================================================
'
' Utility function prototypes
'
'========================================================================================
Declare Function u4alloc& Lib "cb5demo.dll" (ByVal amt&)
Declare Function u4allocFree& Lib "cb5demo.dll" Alias "u4alloc_free" (ByVal c4&, ByVal amt&)
Declare Sub u4free Lib "cb5demo.dll" (ByVal memPtr&)
Declare Function u4ncpy% Lib "cb5demo.dll" (ByVal MemPtr1$, ByVal memptr2&, ByVal memLength%)
Declare Function u4ncpy2% Lib "cb5demo.dll" Alias "u4ncpy" (ByVal MemPtr1&, ByVal memptr2$, ByVal memLength%)
Declare Sub u4memCpy Lib "cb5demo.dll" (ByVal dest$, ByVal source&, ByVal numCopy%)
'=======================================================================================
'
' Misc. function prototypes
'
'========================================================================================
Declare Function v4Cstring& Lib "cb5demo.dll" (ByVal s$)
Declare Sub v4Cstringfree Lib "cb5demo.dll" (ByVal s&)
'CodeBase Return Code Constants
Global Const r4success% = 0
Global Const r4found% = 1
Global Const r4after = 2
Global Const r4eof = 3
Global Const r4bof = 4
Global Const r4entry = 5
Global Const r4descending = 10
Global Const r4unique = 20
Global Const r4uniqueContinue = 25
Global Const r4ignore = 40
Global Const r4keep = 45
Global Const r4locked = 50
Global Const r4noCreate = 60
Global Const r4noOpen = 70
Global Const r4notag = 80
Global Const relate4filterRecord = 101
Global Const relate4doRemove = 102
Global Const relate4skipped = 104
Global Const relate4blank = 105
Global Const relate4skipRec = 106
Global Const relate4terminate = 107
Global Const relate4exact = 108
Global Const relate4scan = 109
Global Const relate4approx = 110
Global Const relate4sortSkip = 120
Global Const relate4sortDone = 121
'CodeBasic Field Definition Constants
Global Const r4logLen = 1
Global Const r4dateLen = 8
Global Const r4memoLen = 10
Global Const r4str$ = "C"
Global Const r4float$ = "F"
Global Const r4num$ = "N"
Global Const r4date$ = "D"
Global Const r4log$ = "L"
Global Const r4memo$ = "M"
'Other CodeBasic Constants
Global Const r4check = -5
'CodeBasic Error Code Constants
Global Const e4close = -10
Global Const e4create = -20
Global Const e4len = -30
Global Const e4lenSet = -40
Global Const e4lock = -50
Global Const e4open = -60
Global Const e4read = -70
Global Const e4remove = -80
Global Const e4rename = -90
Global Const e4seek = -100
Global Const e4unlock = -110
Global Const e4write = -120
Global Const e4data = -200
Global Const e4fieldName = -210
Global Const e4fieldType = -220
Global Const e4recordLen = -230
Global Const e4entry = -300
Global Const e4index = -310
Global Const e4tagName = -330
Global Const e4unique = -340
Global Const e4commaExpected = -400
Global Const e4complete = -410
Global Const e4dataName = -420
Global Const e4lengthErr = -422
Global Const e4notConstant = -425
Global Const e4numParms = -430
Global Const e4overflow = -440
Global Const e4rightMissing = -450
Global Const e4typeSub = -460
Global Const e4unrecFunction = -470
Global Const e4unrecOperator = -480
Global Const e4unrecValue = -490
Global Const e4undetermined = -500
Global Const e4opt = -610
Global Const e4optSuspend = -620
Global Const e4optFlush = -630
Global Const e4relate = -710
Global Const e4lookupErr = -720
Global Const e4info = -910
Global Const e4memory = -920
Global Const e4parm = -930
Global Const e4result = -950
'CodeControls Constants
Global Const CB_TOP = 1
Global Const CB_PREV = 2
Global Const CB_SEARCH = 3
Global Const CB_NEXT = 4
Global Const CB_BOTTOM = 5
Global Const CB_APPEND = 6
Global Const CB_DEL = 7
Global Const CB_UNDO = 8
Global Const CB_FLUSH = 9
Global Const CB_GO = 10
'=======================================================================================
'
' CodeControls function prototypes
'
'========================================================================================
'CodeControls Constants
Global Const MASTER4NODATA% = 1
Global Const MASTER4NOTAG% = 2
Global Const MASTER4BADEXPR% = 3
Global Const CTRL4BADFIELD% = 4
Global Const CTRL4NOTAG% = 5
Global Const CTRL4BADEXPR% = 6
Function b4String$ (p&)
'This is a utility function for copying a 'C' string to a VB string.
Dim s As String * 256, rc As Integer
s$ = ""
rc = u4ncpy(s, p, 256)
b4String$ = Left$(s, rc)
End Function
Function code4dateFormat$ (c4Ptr&, Fmt$)
'This function returns and optionally modifies the CODE4.dateFormat member
Dim inString As String * 19
Dim DatePtr&, rc%
'If Fmt$ = "" then return present date format,
'otherwise change date format to Fmt$
DatePtr = code4dateFormatCB(c4Ptr&, Fmt$)
code4dateFormat = b4String(DatePtr)
End Function
Function d4alias$ (dbPtr&)
'This function returns the data file alias
Dim AliasPtr&
'Get pointer to alias string
AliasPtr& = d4aliasCB(dbPtr)
If AliasPtr& = 0 Then Exit Function
d4alias = b4String(AliasPtr)
End Function
Function d4create& (ByVal cb&, dbname$, d() As FIELD4INFO, n() As TAG4INFO)
' d4create calls d4createCB() to create a new database.
' This function is the same as d4createData() except that
' it requires an additional parameter which it uses to
' create tag information for a database.
'
' Variable n is an array of type TAG4INFO which corresponds
' to TAG4INFOCB, a structure that can be used by d4create.
' The difference once again is merely the difference in the
' representation of strings between C and Basic.
' d4create takes the contents from the TAG4INFO structure
' and builds a TAG4INFOCB structure which it passes to d4createCB().
' Note: the TAG4INFOCB array is one size larger than the TAG4INFO
' array. The extra empty (zero filled) array element is the
' way that d4createCB() detects the end of the array.
Dim i%
Dim flb%
Dim fub%
Dim fs%
Dim tlb%
Dim tub%
Dim ts%
flb = LBound(d)
fub = UBound(d)
fs = fub - flb + 1
ReDim f(1 To (fs + 1)) As FIELD4INFOCB
For i = 1 To fs
f(i).fname = v4Cstring(d((flb - 1) + i).fname) ' note: this function allocates memory
f(i).ftype = Asc(d((flb - 1) + i).ftype)
f(i).flength = d((flb - 1) + i).flength
f(i).fdecimals = d((flb - 1) + i).fdecimals
Next i
tlb = LBound(n)
tub = UBound(n)
ts = tub - tlb + 1
ReDim t(1 To (ts + 1)) As TAG4INFOCB
For i = 1 To ts
t(i).name = v4Cstring(n((tlb - 1) + i).name)
t(i).expression = v4Cstring(n((tlb - 1) + i).expression)
t(i).filter = v4Cstring(n((tlb - 1) + i).filter)
t(i).unique = n((tlb - 1) + i).unique
t(i).descending = n((tlb - 1) + i).descending
Next i
d4create = d4createCB(cb&, ByVal (dbname$), f(1), t(1))
' Since v4Cstring allocates memory for the storage of
' C strings, we must free the memory after it has been
' used.
For i = 1 To fs
Call v4Cstringfree(f(i).fname)
Next i
For i = 1 To ts
Call v4Cstringfree(t(i).name)
Call v4Cstringfree(t(i).expression)
Call v4Cstringfree(t(i).filter)
Next i
End Function
Function d4createData& (ByVal cb&, dbname$, d() As FIELD4INFO)
' d4createData() calls d4createCB() to create a new database.
' d4create() builds the FIELD4INFOCB array which is
' the one recognized by d4create (note that the only difference
' is that the fname field is a string in type FIELD4INFO
' and type long in FIELD4INFOCB which is how strings are represented
' in C). Furthermore, the size of f (our FIELD4INFOCB array) is one
' larger than the size s of FIELD4INFO d. This is because
' d4create doesn't know the size of the array f and therefore it stops
' when it reaches an array element that is filled with zeros which
' the extra (s+1)'th element of f provides.
Dim i%
Dim lb%
Dim ub%
Dim s%
lb = LBound(d)
ub = UBound(d)
s = ub - lb + 1
ReDim f(1 To (s + 1)) As FIELD4INFOCB
For i = 1 To s
f(i).fname = v4Cstring(d((lb - 1) + i).fname)' note: this function allocates memory
f(i).ftype = Asc(d((lb - 1) + i).ftype)
f(i).flength = d((lb - 1) + i).flength
f(i).fdecimals = d((lb - 1) + i).fdecimals
Next i
d4createData = d4createCB(cb&, ByVal (dbname$), f(1), ByVal (0&))
' Since v4Cstring allocates memory for the storage of
' C strings, we must free the memory after it has been
' used.
For i = 1 To s
Call v4Cstringfree(f(i).fname)
Next i
End Function
Function d4fileName$ (dbfPtr&)
d4fileName$ = b4String(d4fileNameCB(dbfPtr))
End Function
Function date4cdow$ (dateString$)
'This function returns the day of the week in a character
'string based on the value in 'DateString'
'Validate "dateString"
If dateString = "" Or Len(dateString) < 8 Then Exit Function
Dim DatePtr&
DatePtr& = date4cdowCB(dateString) 'Get pointer to day
If DatePtr = 0 Then Exit Function 'Illegal date
date4cdow = b4String(DatePtr)
End Function
Function date4cmonth$ (dateString$)
'This function returns the month in 'DateString' as a
'character string
'Validate "DateString"
If dateString = "" Or Len(dateString) < 8 Then Exit Function
Dim DatePtr&
DatePtr& = date4cmonthCB(dateString) 'Get pointer to month
If DatePtr = 0 Then Exit Function 'Illegal date
date4cmonth = b4String(DatePtr) 'Return month name
End Function
Sub date4format (dateString$, Result$, pic$)
'This functions formats Result$ using the date value
' in 'dateString$' and the format info. in 'Pic$'
'Size Result$
Result$ = Space$(Len(pic$) + 1)
Call date4formatCB(dateString$, Result$, pic$)
Result$ = Left$(Result$, Len(pic$))
End Sub
Sub date4init (Result$, dateString$, pic$)
'This functions copies the date, specified by dateString,
'and formatted according to pic, into Result. The date copied
'will be in standard dBASE format,
'Size Result$
Result$ = Space$(9)
Call date4initCB(Result$, dateString$, pic$)
Result$ = Left$(Result$, 8)
End Sub
Sub date4today (dateS As String)
If Len(dateS) < 8 Then dateS = Space$(8)
Call date4todayCB(dateS)
End Sub
Function f4memoStr$ (fPtr&)
'This function returns a string corresponding to the memo
'field pointer argument.
Dim MemoLen&, MemoPtr&
MemoLen& = f4memoLen(fPtr) 'Get memo length
MemoPtr& = f4memoPtr(fPtr)
If MemoPtr& = 0 Then Exit Function
Dim MemoString$
MemoString = String$(MemoLen&, " ")
'Copy 'MemoPtr' to VB string 'MemoString'
u4memCpy MemoString, MemoPtr, MemoLen
f4memoStr = MemoString
End Function
Function f4name$ (fPtr&)
'This function returns the name of a field
Dim FldNamePtr& 'Pointer to field name
Dim FldName As String * 11 'String to hold info
FldNamePtr& = f4nameCB(fPtr) 'Get pointer
f4name = b4String(FldNamePtr)
End Function
Function f4str$ (Field&)
'This function returns the contents of a field
Dim s$, fPtr&, flen%
flen = f4len(Field) 'Get field length
s = Space$(flen) 'Make s$ one byte longer for null character that u4ncpy adds
fPtr& = f4ptr(Field)
If fPtr& = 0 Then Exit Function
u4memCpy s, fPtr, flen
f4str = s
End Function
Function i4create& (ByVal dbPtr&, IndexName$, n() As TAG4INFO)
' i4create() calls i4createCB() to create a new
' index file. Variable n is an array of type TAG4INFO
' which corresponds to TAG4INFOCB, a structure that
' can be used by i4createCB(). The difference once
' again is merely the difference in the representation
' of strings between C and Basic.
'
' i4create() takes the contents from the TAG4INFO
' structure and builds a TAG4INFOCB structure which
' it passes to i4createCB(). Note: the TAG4INFOCB
' arrary is one size larger than the TAG4INFO array.
' The extra empty (zero filled) array element is the
' way that d4create detects the end of the array.
'
' Note also, that if 'IndexName' is an empty string,
' the index file that is created will become a
' "production" index file. i.e. it will be opened every
' time the corresponding data file is opened.
Dim i%
Dim tlb%
Dim tub%
Dim ts%
tlb = LBound(n)
tub = UBound(n)
ts = tub - tlb + 1
ReDim t(1 To (ts + 1)) As TAG4INFOCB
For i = 1 To ts
t(i).name = v4Cstring(n((tlb - 1) + i).name)
t(i).expression = v4Cstring(n((tlb - 1) + i).expression)
t(i).filter = v4Cstring(n((tlb - 1) + i).filter)
t(i).unique = n((tlb - 1) + i).unique
t(i).descending = n((tlb - 1) + i).descending
Next i
If IndexName$ = "" Then 'User wants production index file
i4create = i4createCB(dbPtr&, ByVal 0&, t(1))
Else
i4create = i4createCB(dbPtr&, IndexName$, t(1))
End If
' Since v4Cstring allocates memory for the storage of
' C strings, we must free the memory after it has been
' used.
For i = 1 To ts
Call v4Cstringfree(t(i).name)
Call v4Cstringfree(t(i).expression)
Call v4Cstringfree(t(i).filter)
Next i
End Function
Function i4open& (d4&, fname$)
If fname = "" Then
i4open = i4openCB(d4&, ByVal 0&) 'Use data file name
Else
i4open = i4openCB(d4&, fname$) 'Use supplied name
End If
End Function
Function t4key$ (tPtr&)
'This function returns the value of the current key
Dim KeyPtr&, KeyLen%, KeyBuf$
KeyLen = tag4KeyLen(tPtr)
KeyBuf = Space(KeyLen)
'Get pointer to key info
KeyPtr = t4keyCB(tPtr)
If KeyPtr = 0 Then Exit Function
'Copy to VB String
u4memCpy KeyBuf, KeyPtr, KeyLen
t4key = KeyBuf
End Function
Function tag4alias$ (tPtr&)
'This function returns the alias of an index tag
Dim AliasPtr&
Dim AliasName As String * 10
'Get pointer to alias string
AliasPtr = tag4aliasCB(tPtr)
tag4alias = b4String(AliasPtr)
End Function
Function tag4expr$ (tPtr&)
'This function returns the original tag expression
Dim ExprPtr&
Dim expr As String * 255
'Get pointer to parsed dBASE expression
ExprPtr = tag4exprCB(tPtr)
tag4expr = b4String(ExprPtr)
End Function
Function tag4Filter$ (tPtr&)
'This function returns the tag filter expression
Dim FilterPtr&
Dim filter As String * 255
'Get pointer to parsed filter expression
FilterPtr& = tag4filterCB(tPtr&)
If FilterPtr& = 0 Then Exit Function 'No filter
tag4Filter = b4String(FilterPtr)
End Function
Function u4descend$ (charString$)
Dim Result$, i%
For i = 1 To Len(charString)
Result = Result + Chr$(128 And Asc(Mid$(charString, i, 1)))
Next
u4descend = Result
End Function