;
; +----------------------------------------------------------------------+
; |                           pro_ext.inc                                |
; +----------------------------------------------------------------------+
;
;
; ================                   ===========
;   ==         ===                     ==       ==
;   ==           =                     ==        ==
;   ==                                 ==        ==
;   ==          ===     =====  =====   ==       ==  ===   ====        ===
;   =====    ==     ==    ==    ==     =========      == ==   ==   ==     ==
;   ==      ==       ==    ==  ==      ==             ===         ==       ==
;   ==     ==         ==    ===        ==             ==         ==         ==
;   ==      ==       ==    == ==       ==             ==          ==       ==
;   ==       ==     ==    ==   ==      ==             ==           ==     ==
; =======       ===     =====  ====  ======         ======            ===
;
; +--------------------------------------------------------------------------+
; |                   FoxPro -- Relational Database System                   |
; +--------------------------------------------------------------------------+
; |                                                                          |
; |     Copyright (c) 1991 Fox Holdings Inc., Toledo, Ohio 43615             |
; |     as an unpublished licensed proprietary work.  All rights reserved.   |
; |                                                                          |
; |     This software contains valuable trade secrets and proprietary        |
; |     information, and is protected by federal copyright laws, the         |
; |     violation of which can result in civil damages and criminal pro-     |
; |     secution.  Access to these source materials is granted only by       |
; |     explicit written permission from Fox Holdings Inc.                   |
; |                                                                          |
; +--------------------------------------------------------------------------+
;
;
FarEnter MACRO
    inc     bp
    push    bp
    mov     bp, sp
ENDM

FarExit MACRO
    pop     bp
    dec     bp
ENDM

NearEnter MACRO
    push    bp
    mov     bp, sp
ENDM

NearExit MACRO
    pop     bp
ENDM
;
;   The API callbacks
;
IF @CodeSize EQ 0
        EXTRN   _ErrorInfo_:NEAR
        EXTRN   _UserError_:NEAR
        EXTRN   _Error_:NEAR
        EXTRN   _Evaluate_:NEAR
        EXTRN   _Execute_:NEAR
        EXTRN   _OnSelection_:NEAR
        EXTRN   _MenuInteract_:NEAR
        EXTRN   _GetItemId_:NEAR
        EXTRN   _SetItemCmdKey_:NEAR
        EXTRN   _GetItemCmdKey_:NEAR
        EXTRN   _SetItemText_:NEAR
        EXTRN   _GetItemText_:NEAR
        EXTRN   _SetItemSubMenu_:NEAR
        EXTRN   _SetItemColor_:NEAR
        EXTRN   _SetMenuColor_:NEAR
        EXTRN   _SetMenuPoint_:NEAR
        EXTRN   _DisposeItem_:NEAR
        EXTRN   _NewItem_:NEAR
        EXTRN   __MenuAction_:NEAR
        EXTRN   _NewMenu_:NEAR
        EXTRN   __MenuStat_:NEAR
        EXTRN   _Dialog_:NEAR
        EXTRN   _PutValue_:NEAR
        EXTRN   _PutStr_:NEAR
        EXTRN   _PutChr_:NEAR
        EXTRN   _RefreshDisplay_:NEAR
        EXTRN   _WPutStr_:NEAR
        EXTRN   _WPutChr_:NEAR
        EXTRN   _WSetAttr_:NEAR
        EXTRN   _WAttr_:NEAR
        EXTRN   _WGetCursor_:NEAR
        EXTRN   _WScroll_:NEAR
        EXTRN   __WSetTitle_:NEAR
        EXTRN   __WAdjust_:NEAR
        EXTRN   __WStat_:NEAR
        EXTRN   _WZoom_:NEAR
        EXTRN   __WControl_:NEAR
        EXTRN   _WOpen_:NEAR
        EXTRN   _GlobalToLocal_:NEAR
        EXTRN   __WPort_:NEAR
        EXTRN   _FindWindow_:NEAR
        EXTRN   _InKey_:NEAR
        EXTRN   _MousePos_:NEAR
        EXTRN   _DefaultProcess_:NEAR
        EXTRN   _GetNextEvent_:NEAR
        EXTRN   _DeActivateIdle_:NEAR
        EXTRN   _ActivateIdle_:NEAR
        EXTRN   _DeActivateHandler_:NEAR
        EXTRN   _ActivateHandler_:NEAR
        EXTRN   _MemoSize_:NEAR
        EXTRN   _FindMemo_:NEAR
        EXTRN   _AllocMemo_:NEAR
        EXTRN   _MemoChan_:NEAR
        EXTRN   _DBUnlock_:NEAR
        EXTRN   _DBLock_:NEAR
        EXTRN   _DBReplace_:NEAR
        EXTRN   _DBUnwind_:NEAR
        EXTRN   _DBSeek_:NEAR
        EXTRN   _DBSkip_:NEAR
        EXTRN   _DBRewind_:NEAR
        EXTRN   _DBAppend_:NEAR
        EXTRN   _DBWrite_:NEAR
        EXTRN   _DBRead_:NEAR
        EXTRN   _DBStatus_:NEAR
        EXTRN   _DBRecCount_:NEAR
        EXTRN   _DBRecNo_:NEAR
        EXTRN   _FCopy_:NEAR
        EXTRN   _FSeek_:NEAR
        EXTRN   __FIO_:NEAR
        EXTRN   __FStat_:NEAR
        EXTRN   _FCHSize_:NEAR
        EXTRN   __FFlush_:NEAR
        EXTRN   __FOpen_:NEAR
        EXTRN   _Alen_:NEAR
        EXTRN   _Load_:NEAR
        EXTRN   _Store_:NEAR
        EXTRN   _Release_:NEAR
        EXTRN   _NewVar_:NEAR
        EXTRN   _MemFill_:NEAR
        EXTRN   _MemCmp_:NEAR
        EXTRN   _MemMove_:NEAR
        EXTRN   _StrCmp_:NEAR
        EXTRN   _StrLen_:NEAR
        EXTRN   _StrCpy_:NEAR
        EXTRN   _StackAvail_:NEAR
        EXTRN   _MemAvail_:NEAR
        EXTRN   _HUnLock_:NEAR
        EXTRN   _HLock_:NEAR
        EXTRN   _SetHandSize_:NEAR
        EXTRN   _GetHandSize_:NEAR
        EXTRN   _HandToPtr_:NEAR
        EXTRN   _FreeHand_:NEAR
        EXTRN   _AllocHand_:NEAR
        EXTRN   _RetLogical_:NEAR
        EXTRN   _RetDateStr_:NEAR
        EXTRN   _RetFloat_:NEAR
        EXTRN   _RetInt_:NEAR
        EXTRN   _RetChar_:NEAR
        EXTRN   _RetVal_:NEAR
ELSE
        EXTRN   _ErrorInfo_:FAR
        EXTRN   _UserError_:FAR
        EXTRN   _Error_:FAR
        EXTRN   _Evaluate_:FAR
        EXTRN   _Execute_:FAR
        EXTRN   _OnSelection_:FAR
        EXTRN   _MenuInteract_:FAR
        EXTRN   _GetItemId_:FAR
        EXTRN   _SetItemCmdKey_:FAR
        EXTRN   _GetItemCmdKey_:FAR
        EXTRN   _SetItemText_:FAR
        EXTRN   _GetItemText_:FAR
        EXTRN   _SetItemSubMenu_:FAR
        EXTRN   _SetItemColor_:FAR
        EXTRN   _SetMenuColor_:FAR
        EXTRN   _SetMenuPoint_:FAR
        EXTRN   _DisposeItem_:FAR
        EXTRN   _NewItem_:FAR
        EXTRN   __MenuAction_:FAR
        EXTRN   _NewMenu_:FAR
        EXTRN   __MenuStat_:FAR
        EXTRN   _Dialog_:FAR
        EXTRN   _PutValue_:FAR
        EXTRN   _PutStr_:FAR
        EXTRN   _PutChr_:FAR
        EXTRN   _RefreshDisplay_:FAR
        EXTRN   _WPutStr_:FAR
        EXTRN   _WPutChr_:FAR
        EXTRN   _WSetAttr_:FAR
        EXTRN   _WAttr_:FAR
        EXTRN   _WGetCursor_:FAR
        EXTRN   _WScroll_:FAR
        EXTRN   __WSetTitle_:FAR
        EXTRN   __WAdjust_:FAR
        EXTRN   __WStat_:FAR
        EXTRN   _WZoom_:FAR
        EXTRN   __WControl_:FAR
        EXTRN   _WOpen_:FAR
        EXTRN   _GlobalToLocal_:FAR
        EXTRN   __WPort_:FAR
        EXTRN   _FindWindow_:FAR
        EXTRN   _InKey_:FAR
        EXTRN   _MousePos_:FAR
        EXTRN   _DefaultProcess_:FAR
        EXTRN   _GetNextEvent_:FAR
        EXTRN   _DeActivateIdle_:FAR
        EXTRN   _ActivateIdle_:FAR
        EXTRN   _DeActivateHandler_:FAR
        EXTRN   _ActivateHandler_:FAR
        EXTRN   _MemoSize_:FAR
        EXTRN   _FindMemo_:FAR
        EXTRN   _AllocMemo_:FAR
        EXTRN   _MemoChan_:FAR
        EXTRN   _DBUnlock_:FAR
        EXTRN   _DBLock_:FAR
        EXTRN   _DBReplace_:FAR
        EXTRN   _DBUnwind_:FAR
        EXTRN   _DBSeek_:FAR
        EXTRN   _DBSkip_:FAR
        EXTRN   _DBRewind_:FAR
        EXTRN   _DBAppend_:FAR
        EXTRN   _DBWrite_:FAR
        EXTRN   _DBRead_:FAR
        EXTRN   _DBStatus_:FAR
        EXTRN   _DBRecCount_:FAR
        EXTRN   _DBRecNo_:FAR
        EXTRN   _FCopy_:FAR
        EXTRN   _FSeek_:FAR
        EXTRN   __FIO_:FAR
        EXTRN   __FStat_:FAR
        EXTRN   _FCHSize_:FAR
        EXTRN   __FFlush_:FAR
        EXTRN   __FOpen_:FAR
        EXTRN   _Alen_:FAR
        EXTRN   _Load_:FAR
        EXTRN   _Store_:FAR
        EXTRN   _Release_:FAR
        EXTRN   _NewVar_:FAR
        EXTRN   _MemFill_:FAR
        EXTRN   _MemCmp_:FAR
        EXTRN   _MemMove_:FAR
        EXTRN   _StrCmp_:FAR
        EXTRN   _StrLen_:FAR
        EXTRN   _StrCpy_:FAR
        EXTRN   _StackAvail_:FAR
        EXTRN   _MemAvail_:FAR
        EXTRN   _HUnLock_:FAR
        EXTRN   _HLock_:FAR
        EXTRN   _SetHandSize_:FAR
        EXTRN   _GetHandSize_:FAR
        EXTRN   _HandToPtr_:FAR
        EXTRN   _FreeHand_:FAR
        EXTRN   _AllocHand_:FAR
        EXTRN   _RetLogical_:FAR
        EXTRN   _RetDateStr_:FAR
        EXTRN   _RetFloat_:FAR
        EXTRN   _RetInt_:FAR
        EXTRN   _RetChar_:FAR
        EXTRN   _RetVal_:FAR
ENDIF
;
;   These EQUates are to allow reference without "_" suffix appended
;   by WatCom.
;
_ErrorInfo          EQU _ErrorInfo_
_UserError          EQU _UserError_
_Error              EQU _Error_
_Evaluate           EQU _Evaluate_
_Execute            EQU _Execute_
_OnSelection        EQU _OnSelection_
_MenuInteract       EQU _MenuInteract_
_GetItemId          EQU _GetItemId_
_SetItemCmdKey      EQU _SetItemCmdKey_
_GetItemCmdKey      EQU _GetItemCmdKey_
_SetItemText        EQU _SetItemText_
_GetItemText        EQU _GetItemText_
_SetItemSubMenu     EQU _SetItemSubMenu_
_SetItemColor       EQU _SetItemColor_
_SetMenuColor       EQU _SetMenuColor_
_SetMenuPoint       EQU _SetMenuPoint_
_DisposeItem        EQU _DisposeItem_
_NewItem            EQU _NewItem_
_NewMenu            EQU _NewMenu_
_Dialog             EQU _Dialog_
_PutValue           EQU _PutValue_
_PutStr             EQU _PutStr_
_PutChr             EQU _PutChr_
_RefreshDisplay     EQU _RefreshDisplay_
_WPutStr            EQU _WPutStr_
_WPutChr            EQU _WPutChr_
_WSetAttr           EQU _WSetAttr_
_WAttr              EQU _WAttr_
_WGetCursor         EQU _WGetCursor_
_WScroll            EQU _WScroll_
_WZoom              EQU _WZoom_
_WOpen              EQU _WOpen_
_GlobalToLocal      EQU _GlobalToLocal_
_FindWindow         EQU _FindWindow_
_InKey              EQU _InKey_
_MousePos           EQU _MousePos_
_DefaultProcess     EQU _DefaultProcess_
_GetNextEvent       EQU _GetNextEvent_
_DeActivateIdle     EQU _DeActivateIdle_
_ActivateIdle       EQU _ActivateIdle_
_DeActivateHandler  EQU _DeActivateHandler_
_ActivateHandler    EQU _ActivateHandler_
_MemoSize           EQU _MemoSize_
_FindMemo           EQU _FindMemo_
_AllocMemo          EQU _AllocMemo_
_MemoChan           EQU _MemoChan_
_DBUnlock           EQU _DBUnlock_
_DBLock             EQU _DBLock_
_DBReplace          EQU _DBReplace_
_DBUnwind           EQU _DBUnwind_
_DBSeek             EQU _DBSeek_
_DBSkip             EQU _DBSkip_
_DBRewind           EQU _DBRewind_
_DBAppend           EQU _DBAppend_
_DBWrite            EQU _DBWrite_
_DBRead             EQU _DBRead_
_DBStatus           EQU _DBStatus_
_DBRecCount         EQU _DBRecCount_
_DBRecNo            EQU _DBRecNo_
_FCopy              EQU _FCopy_
_FSeek              EQU _FSeek_
_FCHSize            EQU _FCHSize_
_Alen               EQU _Alen_
_Load               EQU _Load_
_Store              EQU _Store_
_Release            EQU _Release_
_NewVar             EQU _NewVar_
_MemFill            EQU _MemFill_
_MemCmp             EQU _MemCmp_
_MemMove            EQU _MemMove_
_StrCmp             EQU _StrCmp_
_StrLen             EQU _StrLen_
_StrCpy             EQU _StrCpy_
_StackAvail         EQU _StackAvail_
_MemAvail           EQU _MemAvail_
_HUnLock            EQU _HUnLock_
_HLock              EQU _HLock_
_SetHandSize        EQU _SetHandSize_
_GetHandSize        EQU _GetHandSize_
_HandToPtr          EQU _HandToPtr_
_FreeHand           EQU _FreeHand_
_AllocHand          EQU _AllocHand_
_RetLogical         EQU _RetLogical_
_RetDateStr         EQU _RetDateStr_
_RetFloat           EQU _RetFloat_
_RetInt             EQU _RetInt_
_RetChar            EQU _RetChar_
_RetVal             EQU _RetVal_

sizeof_char         EQU 1
sizeof_short        EQU 2
sizeof_int          EQU 2
sizeof_long         EQU 4
sizeof_real         EQU 4
sizeof_double       EQU 8

sizeof_MHANDLE  = sizeof_int
sizeof_Ticks    = sizeof_long
sizeof_MENUID   = sizeof_long
sizeof_ITEMID   = sizeof_long

TRUE    EQU 1
FALSE   EQU 0
YES     EQU 1
NO      EQU 0

SCHEMEWIDTH     EQU 11

WCURSOR     EQU 1 SHL 1     ; Enable the cursor
ZOOM        EQU 1 SHL 2     ; Permit the window to be zoomed
ADJ         EQU 1 SHL 3     ; Allow Window Size to be Adjusted
CLOSE       EQU 1 SHL 4     ; Permit Closing of System Window
MOVE        EQU 1 SHL 5     ; Allow the window to be moved
HSCROLLBAR  EQU 1 SHL 6     ; Show Horizontal Scrollbars
VSCROLLBAR  EQU 1 SHL 7     ; Show Vertical Scrollbars
AUTOSCROLL  EQU 1 SHL 8     ; Window should Auto scroll
WEVENT      EQU 1 SHL 10    ; Participates in activate/deact events
SHADOW      EQU 1 SHL 11    ; Window will produce a shadow
WMODAL      EQU 1 SHL 12    ; Window is a modal window
WMINIMIZE   EQU 1 SHL 13    ; Window can be minimized
;
;   _FindWindow() return values.
;
inBorder        EQU  0  ; In the window border region
inHelp          EQU  1  ; In the Help region
inContent       EQU  2  ; In the content/text region
inDrag          EQU  3  ; In the Drag/Title bar region
inGrow          EQU  4  ; In the grow/resize region
inGoAway        EQU  5  ; In the goAway/close region
inZoom          EQU  6  ; In the zoom region
inVUpArrow      EQU  7  ; In the vertical up arrow region
inVDownArrow    EQU  8  ; In the vertical down arrow region
inVPageUp       EQU  9  ; In the vertical page up region
inVPageDown     EQU 10  ; In the vertical page down region
inVThumb        EQU 11  ; In the vertical thumb region
inHUpArrow      EQU 12  ; In the horizontal up arrow region
inHDownArrow    EQU 13  ; In the horizontal down arrow region
inHPageUp       EQU 14  ; In the horizontal page up region
inHPageDown     EQU 15  ; In the horizontal page down region
inHThumb        EQU 16  ; In the horizontal thumb region
inMenuBar       EQU 17  ; In the menu bar
;
;   EventRec.what values
;
nullEvent       EQU  0  ; Null
mouseDownEvent  EQU  1  ; Mouse down
keyDownEvent    EQU  2  ; Key down
activateEvent   EQU  3  ; Activate window
deactivateEvent EQU  4  ; Deactivate window
updateEvent     EQU  5  ; Redraw window
menuHitEvent    EQU  6  ; Menu Hit
menuUpdateEvent EQU  7  ; Menu Update required
closeEvent      EQU  8  ; Close window
hideEvent       EQU  9  ; Hide window
showEvent       EQU 10  ; Show window
hotkeyEvent     EQU 11  ; An ON KEY LABEL was pressed
sizeEvent       EQU 12  ; Size window event
zoomEvent       EQU 13  ; Zoom window event
;
;   EventRec.modifiers defines
;
charCodeMask    EQU 00fffH  ; Character code mask
shiftCodeMask   EQU 0f000H  ; Shift key mask

shiftKey        EQU 01000H  ; Either shift key    1 - down
ctrlKey         EQU 02000H  ; Control key         1 - down
altKey          EQU 04000H  ; Alternate key       1 - down
literalKey      EQU 08000H  ; This key is interpreted literally
;
;   EventRec.mbState code defines
;
leftButton      EQU 1 SHL 0     ; Left button status   1 - down
rightButton     EQU 1 SHL 1     ; Right button status  1 - down
centerButton    EQU 1 SHL 2     ; Center button status 1 - down
;
;   EventRec.mcState code defines
;
posChange       EQU 1 SHL 0     ; Position change        1 - change
leftPressed     EQU 1 SHL 1     ; Left button pressed    1 - pressed
leftReleased    EQU 1 SHL 2     ; Left button released   1 - released
rightPressed    EQU 1 SHL 3     ; Right button pressed   1 - pressed
rightReleased   EQU 1 SHL 4     ; Right button released  1 - released
centerPressed   EQU 1 SHL 5     ; Center button pressed  1 - pressed
centerReleased  EQU 1 SHL 6     ; Center button released 1 - released
;
;   Flag values for _InKey()
;
SHOWCURSOR      EQU 1 SHL 0
HIDECURSOR      EQU 1 SHL 1
MOUSEACTIVE     EQU 1 SHL 2
;
;   Flag values for the _ALen() function
;
AL_ELEMENTS     = 0
AL_SUBSCRIPT1   = AL_ELEMENTS + 1
AL_SUBSCRIPT2   = AL_SUBSCRIPT1 + 1

Point STRUC
    h   DW ?
    v   DW ?
Point ENDS

sizeof_Point    EQU (LENGTH Point)*(TYPE Point)

Rect STRUC
    top     DW ?
    left    DW ?
    bottom  DW ?
    right   DW ?
Rect ENDS
;
;   Menu structure type entry definitions used by _NewMenu()
;
MPOPUP  EQU 1       ; Menu is a POPUP type menu
MPAD    EQU 2       ; Menu is a PAD type menu
MBAR    EQU 3       ; Menu is a BAR type menu
;
;   These are the API identifiers for the System Menu Constants.
;
_LASTITEM   = -2
_FIRSTITEM  = _LASTITEM + 1

_SYSMENU    = _FIRSTITEM + 1
_SYSMSYSTEM = _SYSMENU + 1
_SYSMFILE   = _SYSMSYSTEM + 1
_SYSMEDIT   = _SYSMFILE + 1
_SYSMDATA   = _SYSMEDIT + 1
_SYSMRECORD = _SYSMDATA + 1
_SYSMPROG   = _SYSMRECORD + 1
_SYSMWINDOW = _SYSMPROG + 1

_SYSTEM         = _SYSMWINDOW + 1
_SYSTEMABOUT    = _SYSTEM + 1
_SYSTEMHELP     = _SYSTEMABOUT + 1
_SYSTEMMACRO    = _SYSTEMHELP + 1
_SYSTEMSEP100   = _SYSTEMMACRO + 1
_SYSTEMFILER    = _SYSTEMSEP100 + 1
_SYSTEMCALC     = _SYSTEMFILER + 1
_SYSTEMDIARY    = _SYSTEMCALC + 1
_SYSTEMSPECIAL  = _SYSTEMDIARY + 1
_SYSTEMASCII    = _SYSTEMSPECIAL + 1
_SYSTEMCAPTURE  = _SYSTEMASCII + 1
_SYSTEMPUZZLE   = _SYSTEMCAPTURE + 1

_FILE           = _SYSTEMPUZZLE + 1
_FILENEW        = _FILE + 1
_FILEOPEN       = _FILENEW + 1
_FILECLOSE      = _FILEOPEN + 1
_FILECLOSEALL   = _FILECLOSE + 1
_FILESEP100     = _FILECLOSEALL + 1
_FILESAVE       = _FILESEP100 + 1
_FILESAVEAS     = _FILESAVE + 1
_FILEREVERT     = _FILESAVEAS + 1
_FILESEP200     = _FILEREVERT + 1
_FILESETUP      = _FILESEP200 + 1
_FILEPRINT      = _FILESETUP + 1
_FILESEP300     = _FILEPRINT + 1
_FILEQUIT       = _FILESEP300 + 1

_EDIT           = _FILEQUIT + 1
_EDITUNDO       = _EDIT + 1
_EDITREDO       = _EDITUNDO + 1
_EDITSEP100     = _EDITREDO + 1
_EDITCUT        = _EDITSEP100 + 1
_EDITCOPY       = _EDITCUT + 1
_EDITPASTE      = _EDITCOPY + 1
_EDITCLEAR      = _EDITPASTE + 1
_EDITSEP200     = _EDITCLEAR + 1
_EDITSELECTALL  = _EDITSEP200 + 1
_EDITSEP300     = _EDITSELECTALL + 1
_EDITGOTO       = _EDITSEP300 + 1
_EDITFIND       = _EDITGOTO + 1
_EDITFINDAGAIN  = _EDITFIND + 1
_EDITREPLACE    = _EDITFINDAGAIN + 1
_EDITREPLACEALL = _EDITREPLACE + 1
_EDITSEP400     = _EDITREPLACEALL + 1
_EDITPREF       = _EDITSEP400 + 1

_DATABASE       = _EDITPREF + 1
_DATASETUP      = _DATABASE + 1
_DATABROWSE     = _DATASETUP + 1
_DATASEP100     = _DATABROWSE + 1
_DATAAPPEND     = _DATASEP100 + 1
_DATACOPY       = _DATAAPPEND + 1
_DATASORT       = _DATACOPY + 1
_DATATOTAL      = _DATASORT + 1
_DATASEP200     = _DATATOTAL + 1
_DATAAVERAGE    = _DATASEP200 + 1
_DATACOUNT      = _DATAAVERAGE + 1
_DATASUM        = _DATACOUNT + 1
_DATACALCULATE  = _DATASUM + 1
_DATAREPORT     = _DATACALCULATE + 1
_DATALABEL      = _DATAREPORT + 1
_DATASEP300     = _DATALABEL + 1
_DATAPACK       = _DATASEP300 + 1
_DATAREINDEX    = _DATAPACK + 1

_RECORD         = _DATAREINDEX + 1
_RECORDAPPEND   = _RECORD + 1
_RECORDCHANGE   = _RECORDAPPEND + 1
_RECORDSEP100   = _RECORDCHANGE + 1
_RECORDGOTO     = _RECORDSEP100 + 1
_RECORDLOCATE   = _RECORDGOTO + 1
_RECORDCONTINUE = _RECORDLOCATE + 1
_RECORDSEEK     = _RECORDCONTINUE + 1
_RECORDSEP200   = _RECORDSEEK + 1
_RECORDREPLACE  = _RECORDSEP200 + 1
_RECORDDELETE   = _RECORDREPLACE + 1
_RECORDRECALL   = _RECORDDELETE + 1

_PROG           = _RECORDRECALL + 1
_PROGDO         = _PROG + 1
_PROGSEP100     = _PROGDO + 1
_PROGCANCEL     = _PROGSEP100 + 1
_PROGRESUME     = _PROGCANCEL + 1
_PROGSEP200     = _PROGRESUME + 1
_PROGCOMPILE    = _PROGSEP200 + 1
_PROGGENERATE   = _PROGCOMPILE + 1
_PROGDOCUMENT   = _PROGGENERATE + 1
_PROGGRAPH      = _PROGDOCUMENT + 1

_WINDOW         = _PROGGRAPH + 1
_WINDOWHIDE     = _WINDOW + 1
_WINDOWHIDEALL  = _WINDOWHIDE + 1
_WINDOWSHOWALL  = _WINDOWHIDEALL + 1
_WINDOWCLEAR    = _WINDOWSHOWALL + 1
_WINDOWSEP100   = _WINDOWCLEAR + 1
_WINDOWMOVE     = _WINDOWSEP100 + 1
_WINDOWSIZE     = _WINDOWMOVE + 1
_WINDOWZOOM     = _WINDOWSIZE + 1
_WINDOWMINMAX   = _WINDOWZOOM + 1
_WINDOWROTATE   = _WINDOWMINMAX + 1
_WINDOWCOLOR    = _WINDOWROTATE + 1
_WINDOWSEP200   = _WINDOWCOLOR + 1
_WINDOWCOMMAND  = _WINDOWSEP200 + 1
_WINDOWDEBUG    = _WINDOWCOMMAND + 1
_WINDOWTRACE    = _WINDOWDEBUG + 1
_WINDOWVIEW     = _WINDOWTRACE + 1

_REPORT     = _WINDOWVIEW + 1
_LABEL      = _REPORT + 1
_BROWSE     = _LABEL + 1
_MACRO      = _BROWSE + 1
_DIARY      = _MACRO + 1
_DAFILER    = _DIARY + 1
_SCREEN     = _DAFILER + 1
_MBLDR      = _SCREEN + 1
_PROJECT    = _MBLDR + 1
_RQBE       = _PROJECT + 1
;
;   For consistency with C, include _BreakPoint
;
_BreakPoint MACRO
    int 3
ENDM
;
; Alternate values for parmCount to modify how FoxPro treats the function
;
INTERNAL        EQU -1      ; Not callable from FoxPro
CALLONLOAD      EQU -2      ; Call when library is loaded
CALLONUNLOAD    EQU -3      ; Call when library is unloaded
;
;   The FoxInfo structure contains the descriptions of the functions
;   contained in the library.
;
FoxInfo STRUC
    funcName    DD BYTE PTR ?   ; char FAR * - Function name (all caps)
    function    DD FAR  PTR ?   ; FPFI - Actual function address
    parmCount   DW ?            ; short  - # parms specified or a flag value
    parmTypes   DD BYTE PTR ?   ; char FAR * - Parameter list description
FoxInfo ENDS

FoxTable STRUC
    nextLibrary DD ?    ; struct _FoxTable FAR * - Linked list of libraries
    infoCount   DW ?    ; # of functions in this library
    infoPtr     DD ?    ; FoxInfo FAR * - Function list
FoxTable ENDS

;
;   An expression's value
;
Value STRUC
    ev_type     DB ?            ;char
    ev_padding  DB ?            ;char
    ev_width    DW ?            ;short
    ev_length   DW ?            ;unsigned short
    ev_long     DW 2 DUP(?)     ;long
    ev_real     DQ ?            ;double
    ev_handle   DW ?            ;MHANDLE
Value ENDS

sizeof_Value = 2*sizeof_char + 2*sizeof_short + sizeof_long + \
	sizeof_double + sizeof_int
;
;   A reference to a database or memory variable
;
Locator STRUC
    l_type      DB ?            ;
    l_where     DW ?            ; Database number or -1 for memory
    l_NTI       DW ?            ; Variable name table offset
    l_offset    DW ?            ; Index into database
    l_subs      DW ?            ; # subscripts specified 0 <= x <= 2
    l_sub1      DW ?            ; subscript integral values
    l_sub2      DW ?            ;
Locator ENDS

sizeof_Locator = sizeof_char + 6*sizeof_short
;
;   A parameter to a library function.
;
;Parameter UNION
;    Value
;    Locator               ; An 'R' in l_type means the Locator
;                          ; part of this union is in use.
;Parameter ENDS
;
sizeof_Parameter = sizeof_Value     ; max(sizeof_Value, sizeof_Locator)
;
;   A paramter list to a library function.
;
;ParamBlk STRUC
;    pCount      DW ?            ; Number of Parameters PASSED.
;	 p			 Parameter		 ; pCount Parameters.
;ParamBlk ENDS
;
;   Event record definitions.
;
EventRec STRUC
    what        DW ?                    ; Event code
    when        DB sizeof_Ticks DUP(?)  ; Ticks since startup
    where       DB TYPE Point DUP(?)    ; Mouse location
    message     DD ?                    ; Key/window
    misc        DD ?                    ; Event dependent misc info
    misc2       DD ?                    ; Event dependent misc info
    mbState     DB ?                    ; Mouse buttons state
    mcState     DB ?                    ; Mouse cond activate state
    modifiers   DW ?
EventRec ENDS
;
;   Flags for the _DBStatus function
;
DB_BOF          EQU 1       ; BOF()
DB_EOF          EQU 2       ; EOF()
DB_RLOCKED      EQU 4       ; Current record is RLOCKed
DB_FLOCKED      EQU 8       ; Database is FLOCKed
DB_EXCLUSIVE    EQU 16      ; Database is open EXCLUSIVEly
DB_READONLY     EQU 32      ; Database is READONLY
;
;   Flag values for _DBLock()
;
DBL_RECORD      EQU 0
DBL_FILE        EQU 1
;
;   Flag values for the _NewVar function
;
NV_PUBLIC       EQU 0
NV_PRIVATE      EQU 1
;
;   Mode flag values for the __FIO function
;
FIO_FGETS       EQU 0
FIO_FREAD       EQU 1
FIO_FPUTS       EQU 2
FIO_FWRITE      EQU 3
;
;   Mode flag values for the _FOpen function
;
FO_READONLY     EQU 0
FO_WRITEONLY    EQU 1
FO_READWRITE    EQU 2
;
;   Mode flag values for the _FCreate function
;
FC_NORMAL       EQU 0
FC_READONLY     EQU 1
FC_HIDDEN       EQU 2
FC_SYSTEM       EQU 4
FC_TEMPORARY    EQU 128
;
;   Mode flag values for the _FSeek function
;
FS_FROMBOF      EQU 0       ; From beginning of file
FS_RELATIVE     EQU 1       ; From current position
FS_FROMEOF      EQU 2       ; From end of file
;
;   Mode flag values for the __WStat function
;
WS_TOP          EQU 0
WS_BOTTOM       EQU 1
WS_LEFT         EQU 2
WS_RIGHT        EQU 3
WS_HEIGHT       EQU 4
WS_WIDTH        EQU 5
WS_TITLE        EQU 6
WS_SETPORT      EQU 7
WS_FOOTER       EQU 8
;
;   Mode flag values for the __WControl function
;
WC_CLEAR        EQU 0
WC_CLOSE        EQU 1
WC_HIDE         EQU 2
WC_SHOW         EQU 3
WC_SELECT       EQU 4
WC_SENDBEHIND   EQU 5
;
;   Mode flag values for the __WAdjust function
;
WA_MOVE         EQU 0
WA_SIZE         EQU 1
WA_POSCURSOR    EQU 2
;
;   Mode flag value for the __WPort function
;
WP_ONTOP        EQU 0
WP_OUTPUT       EQU 1
;
;   Mode flag value for the _WZoom function
;
WZ_MAXIMIZED    EQU 0
WZ_NORMAL       EQU 1
WZ_MINIMIZED    EQU 2
;
;   Border strings for typical window borders.
;
;WO_DOUBLEBOX    DB 0cdH, 0cdH, 0baH, 0baH, 0c9H, 0bbH, 0c8H, 0bcH, 0cdH, 0cdH, 0baH, 0baH, 0c9H, 0bbH, 0c8H, 0bcH
;WO_SINGLEBOX    DB 0c4H, 0c4H, 0b3H, 0b3H, 0daH, 0bfH, 0c0H, 0d9H, 0c4H, 0c4H, 0b3H, 0b3H, 0daH, 0bfH, 0c0H, 0d9H
;WO_PANELBORDER  DB 0dbH, 0dbH, 0dbH, 0dbH, 0dbH, 0dbH, 0dbH, 0dbH, 0dbH, 0dbH, 0dbH, 0dbH, 0dbH, 0dbH, 0dbH, 0dbH
;WO_SYSTEMBORDER DB 020H, 020H, 020H, 020H, 0feH, 0f0H, 020H, 0f9H, 020H, 020H, 020H, 020H, 020H, 020H, 020H, 020H
;
;   Border string offsets.
;
selectBorder        EQU 0
deselectBorder      EQU 8

topEdge             EQU 0
bottomEdge          EQU 1
leftEdge            EQU 2
rightEdge           EQU 3
topLeftCorner       EQU 4
topRightCorner      EQU 5
bottomLeftCorner    EQU 6
bottomRightCorner   EQU 7
maxBorderLen        EQU 17   ; Border string length (maximum)
;
;   Color scheme numbers for use by _WOpen and others
;
USER_SCHEME             = 0
USERMENU_SCHEME         = USER_SCHEME + 1
MBAR_SCHEME             = USERMENU_SCHEME + 1
POPUP_SCHEME            = MBAR_SCHEME + 1
DIALOG_SCHEME           = POPUP_SCHEME + 1
MODAL_POPUP_SCHEME      = DIALOG_SCHEME + 1
ALERT_SCHEME            = MODAL_POPUP_SCHEME + 1
WINDOW_SCHEME           = ALERT_SCHEME + 1
NONMODAL_POPUP_SCHEME   = WINDOW_SCHEME + 1
BROWSE_SCHEME           = NONMODAL_POPUP_SCHEME + 1
REPORT_SCHEME           = BROWSE_SCHEME + 1
ALERT_POPUP_SCHEME      = REPORT_SCHEME + 1
;
;   Color index numbers used by _WSetAttr() and _WAttr()
;
WA_PENCOLOR     = -1                ; CURRENT PEN COLOR

WA_NORMAL       = WA_PENCOLOR + 1   ; normal text
WA_ENHANCED     = WA_NORMAL + 1     ; enhanced text
WA_BORDER       = WA_ENHANCED + 1   ; window border
WA_FOREMOST     = WA_BORDER + 1     ; title when foremost
WA_TITLE        = WA_FOREMOST + 1   ; title otherwise
WA_SELECTED     = WA_TITLE + 1      ; selected text
WA_HOTKEY       = WA_SELECTED + 1   ; control hotkeys
WA_SHADOW       = WA_HOTKEY + 1     ; color of shadows that fall on this window.
WA_ENABLED      = WA_SHADOW + 1     ; enabled control
WA_DISABLED     = WA_ENABLED + 1    ; disabled control
WA_ISSHADOW     = WA_DISABLED + 1   ; window casts a shad

IS286   EQU 00000100b
IS386   EQU 00001000b

ImmPush MACRO n
    IF (@Cpu AND (IS286 OR IS386)) NE 0     ; if either 286 or 386
        push    n
    ELSE
        push    ax                      ; push immediate value on stack 
        mov     ax, n                   ; w/o using any additional registers
        push    bp
        mov     bp, sp
        xchg    ax, [bp + 2]
        pop     bp
    ENDIF
ENDM

_FOpen MACRO
    xor     cx, cx
    call    __FOpen_
ENDM

_FCreate MACRO
    mov     cx, 0001H
    call    __FOpen_
ENDM

_FClose MACRO
    mov     dx, 0001H
    call    __FFlush_
ENDM


_FEOF MACRO
    xor     dx, dx
    call    __FStat_
ENDM

_FError MACRO
    mov     dx, 0001H
    xor     ax, ax
    call    __FStat_
ENDM

_FFlush MACRO
    xor     dx, dx
    call    __FFlush_
ENDM

_FGets MACRO
    xor     cx, cx
    push    cx
    mov     cx, ds
    call    __FIO_
ENDM

_FPuts MACRO
    mov     dx, 0002H
    push    dx
    xor     dx, dx
    call    __FIO_
ENDM

_FRead MACRO
    mov     cx, 0001H
    push    cx
    mov     cx, ds
    call    __FIO_
ENDM

_FWrite MACRO
    mov     cx, 0003H
    push    cx
    mov     cx, ds
    call    __FIO_
ENDM

_WOnTop MACRO
    xor     ax, ax
    call    __WPort_
ENDM

_WClose MACRO
    mov     bx, 0001H
    call    __WControl_
ENDM

_WHide MACRO
    mov     bx,0002H
    call    __WControl_
ENDM

_WShow MACRO
    mov     bx, 0003H
    call    __WControl_
ENDM

_WSelect MACRO
    mov     bx, 0004H
    call    __WControl_
ENDM

_WSendBehind MACRO
    mov     bx, 0005H
    call    __WControl_
ENDM

_WGetPort MACRO
    mov     ax, 0001H
    call    __WPort_
ENDM

_WSetPort MACRO
    mov     bx, 0007H
    call    __WStat_
ENDM

_WMove MACRO
    ImmPush 0
    call    __WAdjust_
ENDM

_WSize MACRO
    ImmPush 1
    call    __WAdjust_
ENDM

_WTop MACRO
    xor     bx,bx
    call    __WStat_
ENDM

_WBottom MACRO
    mov     bx, 0001H
    call    __WStat_
ENDM

_WLeft MACRO
    mov     bx, 0002H
    call    __WStat_
ENDM

_WRight MACRO
    mov     bx, 0003H
    call    __WStat_
ENDM

_WHeight MACRO
    mov     bx,0004H
    call    __WStat_
ENDM

_WWidth MACRO
    mov     bx,0005H
    call    __WStat_
ENDM

_WTitle MACRO
    mov     bx,0006H
    call    __WStat_
ENDM

_WSetTitle MACRO
    ImmPush 1
    call    __WSetTitle_
ENDM        
_WFooter MACRO
    mov     bx, 0008H
    call    __WStat_
ENDM

_WSetFooter MACRO
    ImmPush 0
    call    __WSetTitle_
ENDM

_WClear MACRO
    xor     bx, bx
    call    __WControl_
ENDM

_WClearRect MACRO
    xor     ax, ax                  ; moving WHANDLE from stack into DX:AX
    xor     dx, dx                  ; and place 0, 0 in its place in stack
    push    bp
    mov     bp, sp
    xchg    ax, [bp + 10]
    xchg    dx, [bp + 12]
    pop     bp
    call    _WScroll_
ENDM

_WPosCursor MACRO
    ImmPush 2
    call    __WAdjust_
ENDM

_MenuId MACRO
    xor     bx, bx
    cwd
    call    __MenuStat_
ENDM

_GetNewMenuId MACRO
    mov     bx, 3
    xor     ax, ax
    xor     dx, dx
    call    __MenuStat_
ENDM

_GetNewItemId MACRO
    mov     bx, 1
    call    __MenuStat_
ENDM

_DisposeMenu MACRO
    mov     bx, 2
    call    __MenuAction_
ENDM

_ActivateMenu MACRO
    xor     bx, bx
    call    __MenuAction_
ENDM

_DeActivateMenu MACRO
    mov     bx, 1
    call    __MenuAction_
ENDM

_CountItems MACRO
    mov     bx, 2
    call    __MenuStat_
ENDM
