\ DataMgr 05.3.21 NAB

variable cardnum

: ?DmErr
2dup or 0= DmGetLastErr and throw ;

: UseCard ( n -- )  cardnum ! ;
0 UseCard

: OpenDB ( mode zaddr len -- dbr. )
  drop
  >abs cardnum @ DmFindDatabase
  ?DmErr
  cardnum @ DmOpenDatabase ;

: CloseDB ( dbr. -- )
  dmCloseDatabase throw ;

: CreateDB
( resDB? type. creator. &zname zlen -- )
\ Note: &zname must be a zstring.
  drop  >abs  cardnum @
  DmCreateDatabase throw ;
