The single entry point calling sequence is based on the following function prototype:
COUNT ctree(COUNT fn, COUNT filno, pVOID ptr1, pLONG plong,
pVOID ptr2, pVRLEN psize, COUNT mode);
fn is the function number, filno is usually a file number, ptr1 and ptr2 point to various types of data or parameter blocks, plong points to a long integer, psize points to a long integer used to convey or return the size of an object, and mode is a short integer for various specifications.
Because of the manner in which C functions pass parameters, it is not necessary to supply all seven parameters all of the time. Generally, you need only supply enough parameters to satisfy the particular function, BUT you cannot skip parameters.
Note: ctree() always returns an error code. If the traditional function does not return an error code, a return value is passed back as one of the parameters to ctree().
For example, GetKey() returns a long value corresponding to the record position containing the target key value. In the traditional FairCom DB approach, call:
recpos = GetKey(keyno,target);
With the ctree() form, call:
errcod = ctree(FN_EQLKEY,keyno,target,&recpos);
recpos is passed back as an output parameter of ctree(). In the following listing, retval denotes the parameter that contains the return value of the function. FairCom DB functions which return an error code do not use a retval parameter.
Several FairCom DB functions are listed below with their traditional call by name form and the ctree(FN_...) form. The extended functions, those that have a suffix of Xtd, use the same single entry point call as the equivalent standard function. The function numbers are based on the short function name listed in Upgrade Previous Editions.
COUNT Abort()
ctree(FN_TRANABT)
COUNT AddKey(keyno,target,recbyt,typadd)
ctree(FN_ADDKEY,keyno,target,&recbyt,NULL,NULL,typadd)
COUNT AddRecord(datno,recptr)
ctree(FN_ADDREC,datno,recptr)
COUNT AddCtResource(datno,resptr,varlen)
ctree(FN_ADDRES,datno,resptr,NULL,NULL,&varlen)
COUNT AddVRecord(datno,recptr,varlen)
ctree(FN_ADDVREC,datno,recptr,NULL,NULL,&varlen)
COUNT AllocateSet(numset)
ctree(FN_ALCSET,numset)
COUNT AvailableFileNbr(numfils)
ctree(FN_AVLFILNUM,numfils,retval)
LONG Begin(mode)
ctree(FN_TRANBEG,mode,NULL,&retval)
COUNT ChangeSet(setnum)
ctree(FN_CHGSET,setnum)
COUNT ClearTranError()
ctree(FN_TRANCLR)
COUNT CloseFile(filno,filmod)
ctree(FN_CLSFIL,filno)
COUNT CloseIFile(ifilptr)
ctree(FN_CLIFIL,0,&ifilblk)
COUNT CloseISAM()
ctree(FN_CLISAM)
COUNT CloseRFile(datno)
ctree(FN_CLRFIL,datno)
COUNT Commit(mode)
ctree(FN_TRANEND,mode)
COUNT CreateDataFile(datno,filnam,datlen,xtdsiz,filmod)
COUNT CreateDataFileXtd(datno,filnam,datlen,xtdsiz,filmod,
permmask,groupid,fileword)
ctree(FN_CREDAT,datno,&createblk)
COUNT CreateIFile(ifilptr)
COUNT CreateIFileXtd(ifilptr,dataextn,indxextn,permmask,groupid,fileword)
ctree(FN_CREIFIL,0,&ifilblk)
COUNT CreateIndexFile(keyno,filnam,keylen,keytyp,keydup,
nomemb,xtdsiz,filmod)
COUNT CreateIndexFileXtd(keyno,filnam,keylen,keytyp,keydup,
nomemb,xtdsiz,filmod,permmask,groupid,fileword)
ctree(FN_CREIDX,keyno,&createblk)
COUNT CreateIndexMember(keyno,keylen,keytyp,keydup,membno)
ctree(FN_CREMEM,keyno,&createblk)
COUNT CreateISAM(filnam)
COUNT CreateISAMXtd(filnam,userprof,userid,userword,servname,
permmask,groupid,fileword)
ctree(FN_CREISAM,0,&isamblk)
pTEXT CurrentISAMKey(keyno,idxval,plen)
ctree(FN_GETCURK,keyno,idxval,NULL,plen)
LONG CurrentFileOffset(datno)
ctree(FN_GETCURP,datno,NULL,&retval)
COUNT DeleteCtFile(filno)
ctree(FN_DELFIL,filno)
COUNT DeleteKey(keyno,target,recbyt)
ctree(FN_DELCHK,keyno,target,&recbyt)
LONG DeleteKeyBlind(keyno,target)
ctree(FN_DELBLD,keyno,target,&retval)
COUNT DeleteRecord(datno)
ctree(FN_DELREC,datno)
COUNT DeleteCtResource(datno,resptr)
ctree(FN_DELRES,datno,resptr)
COUNT DeleteVRecord(datno)
ctree(FN_DELVREC,datno)
COUNT DoBatch(filno,request,bufptr,bufsiz,mode)
ctree(FN_BATSET,filno,request,NULL,bufptr,&bufsiz,mode)
COUNT EnableCtResource(datno)
ctree(FN_ENARES,datno)
LONG EstimateKeySpan(keyno,idxval1,idxval2)
ctree(FN_ESTKEY,keyno,&estm,&retval)
COUNT FirstInSet(keyno,target,recptr,siglen)
ctree(FN_FRSSET,keyno,target,NULL,recptr,NULL,siglen)
LONG FirstKey(keyno,idxval)
ctree(FN_FRSKEY,keyno,idxval,&retval)
COUNT FirstRecord(filno,recptr)
ctree(FN_FRSREC,filno,recptr)
COUNT FreeSet()
ctree(FN_FRESET)
COUNT GetAlternateSequence(keyno,altseq)
ctree(FN_GETALTSEQ,keyno,altseq)
VRLEN GetDODA(datno,bufsiz,bufptr,mode)
ctree(FN_GETDODA,datno,bufptr,&bufsiz,NULL,&retval,mode)
LONG GetFileInfo(filno,mode)
ctree(FN_GETFIL,filno,NULL,&retval,NULL,NULL,mode)
LONG GetGTEKey(keyno,target,idxval)
ctree(FN_GTEKEY,keyno,target,&retval,idxval)
COUNT GetGTERecord(keyno,target,recptr)
ctree(FN_GTEREC,keyno,target,NULL,recptr)
LONG GetGTKey(keyno,target,idxval)
ctree(FN_GTKEY,keyno,target,&retval,idxval)
VRLEN GetIFile(datno,bufsiz,bufptr)
ctree(FN_GETIFIL,datno,bufptr,&bufsiz,NULL,&retval)
LONG GetKey(keyno,target)
ctree(FN_EQLKEY,keyno,target,&retval)
LONG GetLTEKey(keyno,target,idxval)
ctree(FN_LTEKEY,keyno,target,&retval,idxval)
COUNT GetLTERecord(keyno,target,recptr)
ctree(FN_LTEREC,keyno,target,NULL,recptr)
LONG GetLTKey(keyno,target,idxval)
ctree(FN_LTKEY,keyno,target,&retval,idxval)
COUNT GetRecord(keyno,target,recptr)
ctree(FN_EQLREC,keyno,target,NULL,recptr)
LONG GetCtResource(datno,resptr,bufptr,bufsiz,resmode)
ctree(FN_GETRES,datno,resptr,&retval,bufptr,&bufsiz,resmode)
LONG GetSerialNbr(datno)
ctree(FN_SERIALNUM,datno,NULL,&retval)
COUNT GetSymbolicNames(filno,nambuf,buflen,mode)
ctree(FN_GETNAM,filno,nambuf,NULL,NULL,&buflen,mode)
COUNT GetTempCtFileName(bufptr,bufsiz)
ctree(FN_TMPNAME,0,bufptr,NULL,NULL,&bufsiz)
COUNT InitISAM(bufs,fils,sect)
COUNT InitISAMXtd(bufs,fils,sect,dbufs,userprof,userid,userword,servname)
ctree(FN_INTISAM,0,&logonblk)
COUNT InitCTree(bufs,fils,sect)
COUNT InitCTreeXtd(bufs,fils,sect,dbufs,userprof,userid,userword,servname)
ctree(FN_INTREE,0,&logonblk)
logonblk is defined above under the discussion of the Logon Block found in CTPARM.H.
LONG KeyAtPercentile(keyno,idxval,fractal)
ctree(FN_FRCKEY,keyno,idxval,&retval,NULL,NULL,fractal)
COUNT LastInSet(keyno,target,recptr,siglen)
ctree(FN_LSTSET,keyno,target,NULL,recptr,NULL,siglen)
LONG LastKey(keyno,idxval)
ctree(FN_LSTKEY,keyno,idxval,&retval)
COUNT LastRecord(filno,recptr)
ctree(FN_LSTREC,filno,recptr)
COUNT LoadKey(keyno,target,recbyt,typadd)
ctree(FN_LOADKEY,keyno,target,&recbyt,NULL,NULL,typadd)
COUNT LockISAM(lokmod)
ctree(FN_LKISAM,lokmod)
COUNT LockCtData(datno,lokmod,recbyt)
ctree(FN_LOKREC,datno,NULL,&recbyt,NULL,NULL,lokmod)
LONG NbrOfKeyEntries(keyno)
ctree(FN_IDXENT,keyno,NULL,&retval)
LONG NbrOfRecords(datno)
ctree(FN_DATENT,datno,NULL,&retval)
LONG NewData(datno)
ctree(FN_NEWREC,datno,NULL,&retval)
LONG NewVData(datno,varlen)
ctree(FN_NEWVREC,datno,NULL,&retval,NULL,&varlen)
COUNT NextInSet(keyno,recptr)
ctree(FN_NXTSET,keyno,recptr)
LONG NextKey(keyno,idxval)
ctree(FN_NXTKEY,keyno,idxval,&retval)
COUNT NextRecord(filno,recptr)
ctree(FN_NXTREC,filno,recptr)
COUNT OpenCtFile(filno,filnam,filmod)
COUNT OpenCtFileXtd(filno,filnam,filmod,fileword)
ctree(FN_OPNFIL,filno,&openblk)
COUNT OpenFileWithResource(filno,filnam,filmod)
COUNT OpenFileWithResourceXtd(filno,filnam,filmod,fileword)
ctree(FN_OPNRFIL,filno,&openblk,&retval)
openblk is defined above under the discussion of the Open Block found in CTPARM.H.
COUNT OpenIFile(ifilptr)
COUNT OpenIFileXtd(ifilptr,dataextn,indxextn,fileword)
ctree(FN_OPNIFIL,0,&ifilblk)
COUNT OpenISAM(filnam)
COUNT OpenISAMXtd(filnam,userprof,userid,userword,servname,
fileword)
ctree(FN_OPNISAM,0,&isamblk)
COUNT PermIIndex(ifilptr)
ctree(FN_PRMIIDX,0,&ifilblk)
COUNT PositionSet(keyno,recptr,siglen)
ctree(FN_MIDSET,keyno,recptr,NULL,NULL,NULL,siglen)
LONG PreviousKey(keyno,idxval)
ctree(FN_PRVKEY,keyno,idxval,&retval)
COUNT PreviousInSet(keyno,recptr)
ctree(FN_PRVSET,keyno,recptr)
COUNT PreviousRecord(filno,recptr)
ctree(FN_PRVREC,filno,recptr)
COUNT PutDODA(datno,doda,numfld)
ctree(FN_PUTDODA,datno,doda,NULL,NULL,NULL,numfld)
COUNT ReadData(datno,recbyt,recptr)
ctree(FN_REDREC,datno,recptr,&recbyt)
COUNT ReadVData(datno,recbyt,recptr,bufsiz)
ctree(FN_RDVREC,datno,recptr,&recbyt,NULL,&bufsiz)
COUNT RebuildIFile(ifilptr)
COUNT RebuildIFileXtd(ifilptr)
ctree(FN_RBLIFIL,0,&ifilblk)
COUNT ReleaseData(datno,recbyt)
ctree(FN_RETREC,datno,NULL,&recbyt)
COUNT ReleaseVData(datno,recbyt)
ctree(FN_RETVREC,datno,NULL,&recbyt)
COUNT ReReadRecord(datno,recptr)
ctree(FN_RRDREC,datno,recptr)
COUNT ReReadVRecord(datno,recptr,bufsiz)
ctree(FN_REDVREC,datno,recptr,NULL,NULL,&bufsiz)
COUNT ResetRecord(datno,mode)
ctree(FN_UPDCURI,datno,NULL,NULL,NULL,NULL,mode)
COUNT RestoreSavePoingTRANRST(savpnt)
ctree(FN_TRANRST,savpnt)
COUNT ReWriteRecord(datno,recptr)
ctree(FN_RWTREC,datno,recptr)
COUNT ReWriteVRecord(datno,recptr,varlen)
ctree(FN_RWTVREC,datno,recptr,NULL,NULL,&varlen)
COUNT SetAlternateSequence(keyno,altseq)
ctree(FN_SETALTSEQ,keyno,altseq)
COUNT SetRecord(datno,recbyt,recptr,datlen)
ctree(FN_SETCURI,datno,recptr,&recbyt,NULL,&datlen)
COUNT SetSavePoint()
ctree(FN_TRANSAV,0,&retval2)
retval2 is a short integer in which the save point number is returned.
COUNT SetVariableBytes(filno,pvbyte)
ctree(FN_SETVARBYTS,filno,pvbyte)
COUNT StopUser()
ctree(FN_STPUSR)
COUNT TempIIndex(ifilptr)
ctree(FN_TMPIIDX,0,&ifilblk)
pTEXT TransformKey(keyno,tarptr)
ctree(FN_TFRMKEY,keyno,tarptr)
COUNT UpdateFileMode(filno,filmod)
ctree(FN_PUTFIL,filno,NULL,NULL,NULL,NULL,filmod)
COUNT UpdateCtResource(datno,resptr,varlen)
ctree(FN_UPDRES,datno,resptr,NULL,NULL,&varlen)
VRLEN VDataLength(datno,recbyt)
ctree(FN_GTVLEN,datno,NULL,&recbyt,NULL,&retval)
VRLEN VRecordLength(datno)
ctree(FN_GETVLEN,datno,NULL,NULL,NULL,&retval)
COUNT WriteData(datno,recbyt,recptr)
ctree(FN_WRTREC,datno,recptr,&recbyt)
COUNT WriteVData(datno,recbyt,recptr,varlen)
ctree(FN_WRTVREC,datno,recptr,&recbyt,NULL,&varlen)