I can indeed be specific.
When I wrote the Quanta LibGuide using DBAS way back min 1992, on DBAS version 1.x, I had to write a user selection function to allow the "select" function to be used. This was because the C68 function fsd_incld() didn't work. In order to include the records I wanted, I had to fsd_excld() the ones I didn't want using a user function, C68 library doesn't let the internal comparaison function be used---see later.
I have this comment in the libselect.C file:
Code: Select all
/*------------------------------------------------------*
* Very strange, I have to EXCLUDE records I don't want *
* as INCLUDING those I do want, doesn't work ! *
* *
* If any records are selected, position at the first, *
* otherwise perform an automatic reset. *
*------------------------------------------------------*/
The c68 function mentioned use the underlying assembly functions fsd.sel function with a parameter list as follows:
Code: Select all
Byte 0: Bit 7 clear = use internal compare, set = use user supplied compare.
Bit 6 clear = exclude selected records, set = include selected records.
Bits 5-0 = unused.
Byte 1: How many parameters follow.
then, each parameter:
0.W = Field number.
2.B: 0 = field greater than; 1 = field equals; 2 = field less than.
3.B = Unused.
4.L = Offset of comparison data from start of parameter list.
8.W: 0 = no more parameters; 4 = OR this parameter with next; 8 = AND this parameter with next; $C = XOR this parameter wit next.
There can be up to 4 conditions.
This piece of assembly code, running against the Quanta libguide database is not working:
Code: Select all
selectInclude equ 64 ; Bit 6 is set, should include records.
...
gg01Select
dc.b selectInclude ; Include records which match.
dc.b 1 ; One parameter.
dc.w 1 ; Field = Disc Name.
dc.b 1 ; Must be equal.
dc.b 0 ; Unused.
dc.l gg01Data-gg01Select ; Offset to data.
dc.w 0 ; No more parameters.
gg01Data
dc.w 5
dc.b "UG 04"
Here I'm asking for all the records with disc name "UG 04" to be included. I get zero records. If I change "selectInclude" from 64 to zero, I get records selected. However, I I try with another disc name instead of "CG 04" I get a whole lot more records, the vast majority are not for the disc I'm "selecting" for inclusion.
The C68 functions are in the file "fsdsel.s" which looks like this:
Code: Select all
.text
.even
.globl fsd_excld
.globl _fsd_excld
.globl fsd_incld
.globl _fsd_incld
; C library modules - Database handler
fsd.sel equ $40
; Routine to perform include/exclude from a database
; short fsd_excld(long dbid, char routine, void application)
; short fsd_incld(long dbid, char routine, void application)
; routine = 0 for all
; return recnum / -1
fsd_excld:
_fsd_excld:
moveq #0,d0 ; do exclude (byte 0, bit 6 clear)
bra fsd_sel
fsd_incld:
_fsd_incld:
move.w #$4000,d0 ; do include (byte 0, bit 6 set)
fsd_sel:
link a6,#0
movem.l d1/d7/a0-a2,-(a7)
move.l 8(a6),a0 ; get database ID
move.l __database,a2 ; get database VBR
; Call the database package
lea __fsd_sel,a1 ; parameter block
move.w d0,(a1) ; store ex/include flag & no params
move.l 12(a6),d7 ; routine ptr / 0
beq call ; do all if ptr 0
bset #7,(a1) ; signal user routine
;
call:
jsr fsd.sel(a2)
move.l d0,_dberr
move.l d0,_oserr ; set error
beq ok
moveq #-1,d0
bra fin
ok:
move.w d1,d0
fin:
movem.l (a7)+,d1/d7/a0-a2
unlk a6
rts
The parameter bit 6 settings match the docs. If the user function passed is zero, all records are selected or unselected depending on the function called. The user function has to do the compare as it doesn't appear that the internal compare function can be used.
I'm currently using DBAS version 2.13 if that makes any difference?
I am in the process of attempting to get a minimal working program so that I can test this out further.
HTH
Cheers,
Norm.