******************************************************************************* * * Include file to declare names for GTI function key numbers. * * Module %M% Version %I% Date %H% * * (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved * This is unpublished proprietary source code of Ardent Software Inc. * The copyright notice above does not evidence any actual or intended * publication of such source code. * ******************************************************************************* * * Maintenence log - insert most recent change descriptions at top * * Date.... GTAR# WHO Description......................................... * 10/14/98 23801 SAP Change copyrights. * 11/04/97 21681 GMH Adjustments * 10/16/97 21681 GMH Correct phase III * 08/18/97 21321 GMH Correct phase II * 08/12/97 21321 GMH Correct initializations * 07/17/97 21134 LPC Ported from PI/Open * ******************************************************************************* * FUNCTION KEY NUMBERS: EQUATE FK$FIN TO 1 ; * Finish EQUATE FK$HELP TO 2 ; * Help EQUATE FK$BSP TO 3 ; * Backspace EQUATE FK$LEFT TO 4 ; * Left arrow EQUATE FK$RIGHT TO 5 ; * Right arrow EQUATE FK$UP TO 6 ; * Up arrow EQUATE FK$DOWN TO 7 ; * Down arrow EQUATE FK$LSCR TO 8 ; * Left screen EQUATE FK$RSCR TO 9 ; * Right screen EQUATE FK$USCR TO 10 ; * Up screen, Previous page EQUATE FK$DSCR TO 11 ; * Down screen, Next page EQUATE FK$BEGEND TO 12 ; * Toggle begin/end line,or Begin line EQUATE FK$TOPBOT TO 13 ; * Top/Bottom, or End line EQUATE FK$NEXTWD TO 14 ; * Next word EQUATE FK$PREVWD TO 15 ; * Previous word EQUATE FK$TAB TO 16 ; * Tab EQUATE FK$BTAB TO 17 ; * Backtab EQUATE FK$CTAB TO 18 ; * Column tab EQUATE FK$INSCH TO 19 ; * Insert character (space) EQUATE FK$INSLIN TO 20 ; * Insert line EQUATE FK$INSTXT TO 21 ; * Insert text, Toggle ins/over mode EQUATE FK$INSDOC TO 22 ; * Insert document EQUATE FK$DELCH TO 23 ; * Delete character EQUATE FK$DELLIN TO 24 ; * Delete line EQUATE FK$DELTXT TO 25 ; * Delete text EQUATE FK$SRCHNX TO 26 ; * Search next EQUATE FK$SEARCH TO 27 ; * Search EQUATE FK$REPLACE TO 28 ; * Replace EQUATE FK$MOVE TO 29 ; * Move text EQUATE FK$COPY TO 30 ; * Copy text EQUATE FK$SAVE TO 31 ; * Save text EQUATE FK$FMT TO 32 ; * Call format line EQUATE FK$CONFMT TO 33 ; * Confirm format line EQUATE FK$CONFMTNW TO 34 ; * Confirm format line, no wrap EQUATE FK$OOPS TO 35 ; * Oops EQUATE FK$GOTO TO 36 ; * Goto EQUATE FK$CALC TO 37 ; * Recalculate EQUATE FK$INDENT TO 38 ; * Indent (set left margin) EQUATE FK$MARK TO 39 ; * Mark EQUATE FK$ATT TO 40 ; * Set attribute EQUATE FK$CENTER TO 41 ; * Center EQUATE FK$HYPH TO 42 ; * Hyphenate EQUATE FK$REPAGE TO 43 ; * Repaginate EQUATE FK$ABBREV TO 44 ; * Abbreviation EQUATE FK$SPELL TO 45 ; * Check spelling EQUATE FK$FORM TO 46 ; * Enter formula EQUATE FK$HOME TO 47 ; * Home the cursor EQUATE FK$CMD TO 48 ; * Enter command EQUATE FK$EDIT TO 49 ; * Edit EQUATE FK$CANCEL TO 50 ; * Abort/Cancel EQUATE FK$CLEOL TO 51 ; * Clear to end of line EQUATE FK$SCRWID TO 52 ; * Toggle between 80 and 132 mode EQUATE FK$PERF TO 53 ; * Invoke DSS PERFORM emulator EQUATE FK$INCLUDE TO 54 ; * DSS Include scratchpad data EQUATE FK$EXPORT TO 55 ; * DSS Export scratchpad data EQUATE FK$TWIDDLE TO 56 ; * Twiddle character pair EQUATE FK$DELWD TO 57 ; * Delete word EQUATE FK$SRCHPREV TO 58 ; * Search previous EQUATE FK$LANGUAGE TO 59 ; * Language EQUATE FK$REFRESH TO 60 ; * Refresh EQUATE FK$UPPER TO 61 ; * Uppercase EQUATE FK$LOWER TO 62 ; * Lowercase EQUATE FK$CAPIT TO 63 ; * Capitalize EQUATE FK$REPEAT TO 64 ; * Repeat EQUATE FK$STAMP TO 65 ; * Stamp EQUATE FK$SPOOL TO 66 ; * Spool record EQUATE FK$GET TO 67 ; * Get record EQUATE FK$WRITE TO 68 ; * Write record EQUATE FK$EXECUTE TO 69 ; * Execute macro EQUATE FK$NUMBER TO 70 ; * Toggle line numbering EQUATE FK$DTAB TO 71 ; * Clear tabs EQUATE FK$STOP TO 72 ; * Stop (current activity) EQUATE FK$EXCHANGE TO 73 ; * Exchange mark and cursor EQUATE FK$BOTTOM TO 74 ; * Move bottom EQUATE FK$CASE TO 75 ; * Toggle case sensitivity EQUATE FK$LISTB TO 76 ; * List (buffers) EQUATE FK$LISTD TO 77 ; * List (deletions) EQUATE FK$LISTA TO 78 ; * List (selects) EQUATE FK$LISTC TO 79 ; * List (commands) EQUATE FK$DISPLAY TO 80 ; * Display (current select list) EQUATE FK$BLOCK TO 81 ; * Block (replace) EQUATE FK$PREFIX TO 82 ; * Prefix EQUATE FK$MAX TO 82 ; * Max number of fields * ADDITIVE VALUES FOR !EDIT.INPUT PARAMETER 1 (KEYS): EQUATE IK$NON TO 0 ; * No keys specified EQUATE IK$OCR TO 1 ; * Output EQUATE IK$ATM TO 2 ; * Terminate edit when string = maxlen EQUATE IK$TCR TO 4 ; * Toggle cursor (visible on entry, invisible on exit) EQUATE IK$DIS TO 8 ; * Reserved EQUATE IK$HDX TO 16 ; * Put terminal into half duplex EQUATE IK$INS TO 32 ; * Start in insert mode EQUATE IK$BEG TO 64 ; * Separate begin/end line functions EQUATE IK$NEK TO 128 ; * Ignore OS erase & kill characters (PI/open only) * Declarations for KEYEDIT functionality EQUATE KE$FUNC TO 1 ; * FUNC key EQUATE KE$LEFT TO 2 ; * Left Arrow EQUATE KE$RETN TO 3 ; * Return EQUATE KE$BKSP TO 4 ; * Back Space EQUATE KE$ESCP TO 5 ; * Escape EQUATE KE$RGHT TO 6 ; * Right Arrow EQUATE KE$INCH TO 7 ; * Insert Character EQUATE KE$DECH TO 8 ; * Delete Character EQUATE KE$INON TO 9 ; * Insert mode ON EQUATE KE$INOF TO 10 ; * Insert mode OFF EQUATE KE$CEOL TO 11 ; * Clear to End of Line EQUATE KE$DELN TO 12 ; * Clear Line EQUATE KE$TOGL TO 13 ; * Toggle Insert Mode * END-CODE COMMON /gtidata/ gti.inited * Uncomment the following $DEFINE line to allow the inclusion * of print statements for debugging purposes. *$DEFINE KEYDBG; DIM POWER(4) POWER(1) = 1 POWER(2) = 256 POWER(3) = 65536 POWER(4) = 16777216 IF gti.inited = 0 THEN gti.inited = 1 * * Setup up definitions used by !GET.KEY * The key sequences below are the only recognized * keys from terminfo. * * Step 1: Get terminfo data for terminal gti.terminfo$ = TERMINFO(0) gti.term.name = SYSTEM(7) * Set up KEYEDIT.EXIT $IFDEF KEYDBG print "KEYEDIT.EXIT" $ENDIF gti.ke.exit = gti.terminfo$<207> IF gti.ke.exit THEN gti.string = gti.ke.exit ELSE gti.string = "10;13" gti.code = KE$RETN GOSUB GTI.SSCAN $IFDEF KEYDBG print "1KEYEDIT(":gti.code:", ":seq(gti.string):")" $ENDIF * Set up KEYEDIT.FUNCTION $IFDEF KEYDBG print "KEYEDIT.FUNCTION" $ENDIF gti.string = gti.terminfo$<205> gti.code = KE$FUNC IF gti.string # '' THEN GOSUB GTI.SSCAN $IFDEF KEYDBG print "2KEYEDIT(":gti.code:", ":seq(gti.string):")" $ENDIF END * Set up KEYEDIT.ESCAPE $IFDEF KEYDBG print "KEYEDIT.ESCAPE" $ENDIF gti.string = gti.terminfo$<206> gti.code = KE$ESCP IF gti.string # '' THEN GOSUB GTI.SSCAN $IFDEF KEYDBG print "3KEYEDIT(":gti.code:", ":seq(gti.string):")" $ENDIF END * Set up KEYEDIT.BACKSPACE $IFDEF KEYDBG print "KEYEDIT.BACKSPACE" $ENDIF gti.string = gti.terminfo$<208> gti.code = KE$BKSP gti.group = "EDIT" IF gti.string # '' THEN GOSUB GTI.SSCAN $IFDEF KEYDBG print "4KEYEDIT(":gti.code:", ":seq(gti.string):")" $ENDIF END ELSE * If not defined, set up KEY.BACKSPACE gti.string = gti.terminfo$<144> IF gti.string # '' THEN GOSUB GTI.KEYPARSE END * Set up KEYEDIT.MOVE.BACKWARD $IFDEF KEYDBG print "KEYEDIT.MOVE.BACKWARD" $ENDIF gti.string = gti.terminfo$<209> gti.code = KE$LEFT gti.group = "EDIT" IF gti.string # '' THEN GOSUB GTI.SSCAN $IFDEF KEYDBG print "5KEYEDIT(":gti.code:", ":seq(gti.string):")" $ENDIF END ELSE * If not defined, set up KEY.MOVE.CURSOR.LEFT gti.string = gti.terminfo$<146> IF gti.string # '' THEN GOSUB GTI.KEYPARSE END * Set up KEYEDIT.MOVE.FORWARD $IFDEF KEYDBG print "KEYEDIT.MOVE.FORWARD" $ENDIF gti.string = gti.terminfo$<210> gti.code = KE$RGHT gti.group = "EDIT" IF gti.string # '' THEN GOSUB GTI.SSCAN $IFDEF KEYDBG print "6KEYEDIT(":gti.code:", ":seq(gti.string):")" $ENDIF END ELSE * If not defined, set up KEY.MOVE.CURSOR.RIGHT gti.string = gti.terminfo$<145> IF gti.string # '' THEN GOSUB GTI.KEYPARSE END * Set up KEYEDIT.INSERT.CHARACTER $IFDEF KEYDBG print "KEYEDIT.INSERT.CHARACTER" $ENDIF gti.string = gti.terminfo$<211> gti.code = KE$INCH gti.group = "EDIT" IF gti.string # '' THEN GOSUB GTI.SSCAN $IFDEF KEYDBG print "7KEYEDIT(":gti.code:", ":seq(gti.string):")" $ENDIF END ELSE * If not defined, set up KEY.INSERT.CHARACTER gti.string = gti.terminfo$<151> IF gti.string # '' THEN GOSUB GTI.KEYPARSE END * Set up KEYEDIT.INSERT.MODE.TOGGLE $IFDEF KEYDBG print "KEYEDIT.MODE.TOGGLE" $ENDIF gti.string = gti.terminfo$<214> gti.code = KE$TOGL gti.group = "EDIT" IF gti.string # '' THEN GOSUB GTI.SSCAN $IFDEF KEYDBG print "8KEYEDIT(":gti.code:", ":seq(gti.string):")" $ENDIF END ELSE * If not defined, set up KEY.INSERT.MODE.TOGGLE gti.string = gti.terminfo$<154> IF gti.string # '' THEN GOSUB GTI.KEYPARSE END * Set up KEYEDIT.DELETE.CHARACTER $IFDEF KEYDBG print "KEYEDIT.DELETE.CHARACTER" $ENDIF gti.string = gti.terminfo$<215> gti.code = KE$DECH gti.group = "EDIT" IF gti.string # '' THEN GOSUB GTI.SSCAN $IFDEF KEYDBG print "9KEYEDIT(":gti.code:", ":seq(gti.string):")" $ENDIF END ELSE * If not defined, set up KEY.DELETE.CHARACTER gti.string = gti.terminfo$<155> IF gti.string # '' THEN GOSUB GTI.KEYPARSE END * Set up KEYEDIT.ERASE.FIELD $IFDEF KEYDBG print "KEYEDIT.ERASE.FIELD" $ENDIF gti.string = gti.terminfo$<217> gti.code = KE$CEOL gti.group = "EDIT" IF gti.string # '' THEN GOSUB GTI.SSCAN $IFDEF KEYDBG print "10KEYEDIT(":gti.code:", ":seq(gti.string):")" $ENDIF END ELSE * If not defined, set up KEY.ERASE.SCREEN gti.string = gti.terminfo$<158> IF gti.string # '' THEN GOSUB GTI.KEYPARSE END * Set up KEYEDIT.ERASE.END.OF.FIELD $IFDEF KEYDBG print "KEYEDIT.ERASE.END.OF.FIELD" $ENDIF gti.string = gti.terminfo$<216> gti.code = KE$DELN gti.group = "EDIT" IF gti.string # '' THEN GOSUB GTI.SSCAN $IFDEF KEYDBG print "11KEYEDIT(":gti.code:", ":seq(gti.string):")" $ENDIF END ELSE * If not defined, set up KEY.ERASE.END.OF.LINE gti.string = gti.terminfo$<159> IF gti.string # '' THEN GOSUB GTI.KEYPARSE END * * The following key sequences are recognized sequences * within the terminfo entry, but unsupported. These * sequences will generate a beep. This is done by setting * the gti.code to a negative value, which will be parsed * by the keyset() function. * $IFDEF KEYDBG print "Unsupported keys...." $ENDIF * Set up KEY.MOVE.CURSOR.UP $IFDEF KEYDBG print "KEY.MOVE.CURSOR.UP" $ENDIF gti.code = FK$UP * -1 gti.group = "EXIT" gti.string = gti.terminfo$<148> IF gti.string # '' THEN GOSUB GTI.KEYPARSE $IFDEF KEYDBG print "12KEYEXIT(":gti.code:", ":seq(gti.string):")" $ENDIF END * Set up KEY.MOVE.CURSOR.DOWN $IFDEF KEYDBG print "KEY.MOVE.CURSOR.DOWN" $ENDIF gti.code = FK$DOWN * -1 gti.group = "EXIT" gti.string = gti.terminfo$<147> IF gti.string # '' THEN GOSUB GTI.KEYPARSE $IFDEF KEYDBG print "13KEYEXIT(":gti.code:", ":seq(gti.string):")" $ENDIF END * Set up KEY.PREVIOUS.PAGE $IFDEF KEYDBG print "KEY.PREVIOUS.PAGE" $ENDIF gti.code = FK$USCR * -1 gti.group = "EXIT" gti.string = gti.terminfo$<166> IF gti.string # '' THEN GOSUB GTI.KEYPARSE $IFDEF KEYDBG print "14KEYEXIT(":gti.code:", ":seq(gti.string):")" $ENDIF END * Set up KEY.NEXT.PAGE $IFDEF KEYDBG print "KEY.NEXT.PAGE" $ENDIF gti.code = FK$DSCR * -1 gti.group = "EXIT" gti.string = gti.terminfo$<165> IF gti.string # '' THEN GOSUB GTI.KEYPARSE $IFDEF KEYDBG print "15KEYEXIT(":gti.code:", ":seq(gti.string):")" $ENDIF END * Set up KEY.HELP $IFDEF KEYDBG print "KEY.HELP" $ENDIF gti.code = FK$HELP * -1 gti.group = "EXIT" gti.string = gti.terminfo$<492> IF gti.string # '' THEN GOSUB GTI.KEYPARSE $IFDEF KEYDBG print "16KEYEXIT(":gti.code:", ":seq(gti.string):")" $ENDIF END * Set up KEY.REFRESH $IFDEF KEYDBG print "KEY.REFRESH" $ENDIF gti.string = gti.terminfo$<502> IF gti.string # '' THEN GOSUB GTI.KEYPARSE $IFDEF KEYDBG print "17KEYEXIT(":gti.code:", ":seq(gti.string):")" $ENDIF END * Set up KEY.UNDO $IFDEF KEYDBG print "KEY.UNDO" $ENDIF gti.string = gti.terminfo$<508> IF gti.string # '' THEN GOSUB GTI.KEYPARSE $IFDEF KEYDBG print "18KEYEXIT(":gti.code:", ":seq(gti.string):")" $ENDIF END gti.terminfo$ = "" * Step 2: Check to see if there is a definition file OPEN "CUSTOM.GTI.DEFS" TO gti.def.file THEN * Step 3: Check to see if there is definition record * corresponding to our term type * * The definition record contains character sequences * which define the specific keys. Each field in the * definition record corresponds to the function listed * at the top of this include file; FK$FIN is field 1, * FK$HELP is field 2, etc, terminating with FK$PREFIX * at field 82. * * For any defined field, a comma separated list of ASCII * values, representing the characters of the key sequence, * is given. For instance, if the HELP key generates a key * sequence of [H, the PK$HELP (field 2) entry in the * definition record would be 27,91,72.. * READ gti.defs FROM gti.def.file,gti.term.name ELSE gti.defs = "" $IFDEF KEYDBG print "From CUSTOM.GTI.DEFS entry ":squote(gti.term.name) $ENDIF * Initialize string gti.groups = "" gti.codes = "" for xx = 1 to FK$MAX gti.codes = xx * -1; gti.groups = "" next xx * Setup Modes gti.groups = "EDIT" gti.groups = "EDIT" gti.groups = "EDIT" gti.groups = "EDIT" gti.groups = "EDIT" gti.groups = "EDIT" gti.groups = "EDIT" gti.groups = "EDIT" gti.groups = "EDIT" * Setup Modes gti.codes = KE$RETN gti.codes = KE$BKSP gti.codes = KE$LEFT gti.codes = KE$RGHT gti.codes = KE$INCH gti.codes = KE$TOGL gti.codes = KE$DECH gti.codes = KE$DELN gti.codes = KE$CEOL LOOP gti.string = REMOVE(gti.defs,gti.x) gti.group = REMOVE(gti.groups,gti.x) gti.code = REMOVE(gti.codes,gti.x) IF gti.string # "" THEN GOSUB GTI.DECODE WHILE gti.x # 0 DO REPEAT CLOSE gti.def.file gti.defs = "" gti.groups = "" gti.codes = "" END END GOTO GTI.INC.END GTI.DECODE: gti.len = LEN(gti.string) gti.ptr = 1 gti.plen = 0 gti.dc = "" LOOP WHILE gti.ptr+gti.plen <= gti.len DO IF gti.string[gti.ptr+gti.plen,1] = ',' THEN gti.dc = gti.dc:CHAR(gti.string[gti.ptr,gti.plen]+0) gti.ptr = gti.ptr + gti.plen + 1 gti.plen = 0 END ELSE gti.plen = gti.plen + 1 END REPEAT IF gti.plen > 0 THEN gti.dc = gti.dc:CHAR(gti.string[gti.ptr,gti.plen]+0) END gti.string = gti.dc GTI.KEYPARSE: dim gti.key(5) gti.len = LEN(gti.string) IF gti.len = 0 OR gti.len > 5 THEN RETURN gti.key(1) = MOD(SEQ(gti.string[1,1]),128) IF gti.len > 1 THEN gti.key(2) = MOD(SEQ(gti.string[2,1]),128) IF gti.len > 2 THEN gti.key(3) = MOD(SEQ(gti.string[3,1]),128) lmax = 2 IF gti.len > 3 THEN gti.key(4) = MOD(SEQ(gti.string[4,1]),128) lmax = 3 END IF gti.len > 4 THEN gti.key(5) = MOD(SEQ(gti.string[5,1]),128) lmax = 4 END * For multiple character sequences, we are packing * up to 4 bytes into the int in REVERSE order to * elimate setting the high bit. gti.edmode = KE$FUNC gti.key(2) = (gti.key(2)+160) * POWER(1) i = 2 loop while i <= lmax do gti.key(2) = gti.key(2) + (gti.key(i+1) * POWER(i)) i += 1 repeat END ELSE gti.edmode = KE$ESCP gti.key(2) = gti.key(2) + 32 END IF gti.group = "EDIT" THEN KEYEDIT (gti.edmode, gti.key(1)) $IFDEF KEYDBG print "A-KEYEDIT (":gti.edmode:", ":gti.key(1):")" $ENDIF KEYEDIT (gti.code, gti.key(2)) $IFDEF KEYDBG print "B-KEYEDIT (":gti.code:", ":gti.key(2):")" $ENDIF END ELSE KEYEDIT (gti.edmode, gti.key(1)) $IFDEF KEYDBG print "C-KEYEDIT (":gti.edmode:", ":gti.key(1):")" $ENDIF KEYEXIT (gti.code, gti.key(2)) $IFDEF KEYDBG print "D-KEYEXIT (":gti.code:", ":gti.key(2):")" $ENDIF END END ELSE IF gti.key(1) < 32 THEN IF gti.group = "EDIT" THEN KEYEDIT (gti.code, gti.key(1)) $IFDEF KEYDBG print "A-KEYEDIT (":gti.code:", ":gti.key(1):")" $ENDIF END ELSE KEYEXIT (gti.code, gti.key(1)) $IFDEF KEYDBG print "B-KEYEXIT (":gti.code:", ":gti.key(1):")" $ENDIF END END END $IFDEF KEYDBG print print "Press any key....": INPUT WAIT $ENDIF RETURN GTI.SSCAN: gti.len = LEN(gti.string) gti.ptr = 1 gti.plen = 0 LOOP WHILE gti.ptr+gti.plen <= gti.len DO IF gti.string[gti.ptr+gti.plen,1] = ';' THEN KEYEDIT (gti.code,gti.string[gti.ptr,gti.plen]+0) gti.ptr = gti.ptr + gti.plen + 1 gti.plen = 0 END ELSE gti.plen = gti.plen + 1 END REPEAT IF gti.plen > 0 THEN KEYEDIT (gti.code,gti.string[gti.ptr,gti.plen]+0) END RETURN GTI.INC.END: * END of GTI include file