api_sup_errno
= 0, /* Supervisor error number */
api_sup_fcn_id
= 0, /* Supervisor function id (0x12) */
api_fcn_errno
= 0, /* Function error number */
api_fcn_fcn_id
= 0; /* Function ID (0x6b, etc.) */
* Issue an API request, with reg structures supplied by the caller.
* Only certain routines need this (supervisor services come to mind).
api_issue_regs(ah
, al
, bh
, bl
, cx
, dx
, parms
, length
, regs
, sregs
)
int ah
, al
, bh
, bl
, cx
, dx
;
char far
*ourseg
= parms
;
sregs
->es
= (int) FP_SEG(ourseg
);
regs
->x
.di
= (int) FP_OFF(ourseg
);
int86x(API_INTERRUPT_NUMBER
, regs
, regs
, sregs
);
#endif /* defined(MSDOS) */
api_exch_api(regs
, sregs
, parms
, length
);
#endif /* defined(unix) */
api_sup_errno
= regs
->h
.cl
;
* Issue an API request without requiring caller to supply
* registers. Most routines use this.
api_issue(ah
, al
, bh
, bl
, cx
, dx
, parms
, length
)
int length
; /* Length of parms */
return api_issue_regs(ah
, al
, bh
, bl
, cx
, dx
, parms
, length
, ®s
, &sregs
);
for (i
= 0; i
< sizeof parms
.gate_name
; i
++) {
parms
.gate_name
[i
] = *name
++;
parms
.gate_name
[i
] = ' ';
if (api_issue_regs(NAME_RESOLUTION
, 0, 0, 0, 0, 0, &parms
, sizeof parms
, ®s
, &sregs
)
* Block until the oia or ps is modified.
if (api_issue_regs(PS_OR_OIA_MODIFIED
, 0, 0, 0, 0, 0, 0, 0, ®s
, &sregs
)
#endif /* defined(unix) */
* Session Information Services
api_query_session_id(parms
)
QuerySessionIdParms
*parms
;
if (api_issue(0x09, QUERY_SESSION_ID
, 0x80, 0x20, 0,
gate_sessmgr
, (char *)parms
, sizeof *parms
) == -1) {
} else if (parms
->rc
== 0) {
api_fcn_errno
= parms
->rc
;
api_fcn_fcn_id
= parms
->function_id
;
api_query_session_parameters(parms
)
QuerySessionParametersParms
*parms
;
if (api_issue(0x09, QUERY_SESSION_PARAMETERS
, 0x80, 0x20, 0,
gate_sessmgr
, (char *)parms
, sizeof *parms
) == -1) {
} else if (parms
->rc
== 0) {
api_fcn_errno
= parms
->rc
;
api_fcn_fcn_id
= parms
->function_id
;
api_query_session_cursor(parms
)
QuerySessionCursorParms
*parms
;
if (api_issue(0x09, QUERY_SESSION_CURSOR
, 0x80, 0x20, 0xff,
gate_sessmgr
, (char *)parms
, sizeof *parms
) == -1) {
} else if (parms
->rc
== 0) {
api_fcn_errno
= parms
->rc
;
api_fcn_fcn_id
= parms
->function_id
;
api_connect_to_keyboard(parms
)
ConnectToKeyboardParms
*parms
;
if (api_issue(0x09, CONNECT_TO_KEYBOARD
, 0x80, 0x20, 0,
gate_keyboard
, (char *)parms
, sizeof *parms
) == -1) {
} else if (parms
->rc
== 0) {
api_fcn_errno
= parms
->rc
;
api_fcn_fcn_id
= parms
->function_id
;
api_disconnect_from_keyboard(parms
)
DisconnectFromKeyboardParms
*parms
;
if (api_issue(0x09, DISCONNECT_FROM_KEYBOARD
, 0x80, 0x20, 0,
gate_keyboard
, (char *)parms
, sizeof *parms
) == -1) {
} else if (parms
->rc
== 0) {
api_fcn_errno
= parms
->rc
;
api_fcn_fcn_id
= parms
->function_id
;
api_write_keystroke(parms
)
WriteKeystrokeParms
*parms
;
if (api_issue(0x09, WRITE_KEYSTROKE
, 0x80, 0x20, 0,
gate_keyboard
, (char *)parms
, sizeof *parms
) == -1) {
} else if (parms
->rc
== 0) {
api_fcn_errno
= parms
->rc
;
api_fcn_fcn_id
= parms
->function_id
;
DisableInputParms
*parms
;
if (api_issue(0x09, DISABLE_INPUT
, 0x80, 0x20, 0,
gate_keyboard
, (char *)parms
, sizeof *parms
) == -1) {
} else if (parms
->rc
== 0) {
api_fcn_errno
= parms
->rc
;
api_fcn_fcn_id
= parms
->function_id
;
if (api_issue(0x09, ENABLE_INPUT
, 0x80, 0x20, 0,
gate_keyboard
, (char *)parms
, sizeof *parms
) == -1) {
} else if (parms
->rc
== 0) {
api_fcn_errno
= parms
->rc
;
api_fcn_fcn_id
= parms
->function_id
;
if (api_issue(0x09, COPY_STRING
, 0x80, 0x20, 0xff,
gate_copy
, (char *)parms
, sizeof *parms
) == -1) {
} else if (parms
->rc
== 0) {
api_fcn_errno
= parms
->rc
;
api_fcn_fcn_id
= parms
->function_id
;
* Operator Information Area Services
api_read_oia_group(parms
)
ReadOiaGroupParms
*parms
;
if (api_issue(0x09, READ_OIA_GROUP
, 0x80, 0x20, 0xff,
gate_oiam
, (char *)parms
, sizeof *parms
) == -1) {
} else if (parms
->rc
== 0) {
api_fcn_errno
= parms
->rc
;
api_fcn_fcn_id
= parms
->function_id
;
* The "we are done" routine. This gets called last.
if (api_close_api() == -1) {
#endif /* defined(unix) */
* The initialization routine. Be sure to call this first.
regs
.h
.al
= API_INTERRUPT_NUMBER
;
intdosx(®s
, ®s
, &sregs
);
if ((regs
.x
.bx
== 0) && (sregs
.es
== 0)) {
return 0; /* Interrupt not being handled */
if (api_open_api(0) == -1) {
#endif /* defined(unix) */
gate_sessmgr
= api_name_resolve("SESSMGR");
gate_keyboard
= api_name_resolve("KEYBOARD");
gate_copy
= api_name_resolve("COPY");
gate_oiam
= api_name_resolve("OIAM");
if ((gate_sessmgr
== gate_keyboard
) ||
(gate_sessmgr
== gate_copy
) ||
(gate_sessmgr
== gate_oiam
) ||
(gate_keyboard
== gate_copy
) ||
(gate_keyboard
== gate_oiam
) ||
(gate_copy
== gate_oiam
)) {
return 0; /* Interrupt doesn't seem correct */