REM >E-Library REM REM Created by asmtobasic (c) 2002 Zap Developers REM REM Defines the variables needed for writing Zap extension modes. REM Call the procedure define_zap_variables to set variables up. REM The procedure defines REM f_* The file block variables (see E-File) REM w_* The window block variables (see E-Windows) REM c_* The cursor block variables (see E-Cursors) REM e_* The entry point variables (see E-Entry) REM r_* The redraw block variables (see Redraw) REM Zap_* The zap routines (see E-ZapCalls) REM DEF PROCdefine_zap_variables LOCAL pass%, P%, O%, L%, code% DIM code% 2048 L% = code% + 2048 FOR pass% = %1100 TO %1110 STEP 2 P% = 0 : O% = code% [ OPT pass% .f_ptr EQUD 4 ; pointer to file buffer / -1 .f_bufl EQUD 4 ; length of file buffer .f_len EQUD 4 ; length of file .f_name EQUD 4 ; pointer to filename .f_load EQUD 4 ; load address of file .f_exec EQUD 4 ; exec address of file .f_flags EQUD 4 ; file flags .f_uptr EQUD 4 ; pointer to undo buffer .f_ubufl EQUD 4 ; length of undo buffer .f_ulen EQUD 4 ; length of data in undo buffer .f_undo EQUD 4 ; offset of main undo pointer .f_undop EQUD 4 ; offset of undo block sub-pointer .f_blklen EQUD 4 ; total length of file block + undo .f_splito EQUD 4 ; offset in file of start of split .f_splite EQUD 4 ; offset in buf of end of split .f_splits EQUD 4 ; size of split=splite-splito .f_mptr EQUD 4 ; pointer to marker buffer .f_mbufl EQUD 4 ; length of marker buffer .f_mlen EQUD 4 ; length of data in marker buffer .f_mark EQUD 4 ; current offset in marker buffer .f_docom EQUD 4 ; current command being 'done'. .f_source EQUD 4 ; word for use of f_cmode mode .f_dolen EQUD 4 ; length of insertion/deletion .f_dodata EQUD 4 ; data to be inserted/replace with. .f_altered EQUD 4 ; first altered offset in file /-1 .f_shiftable EQUD 4 ; first shiftable offset in file /-1 .f_change EQUD 4 ; signed change of shiftable offset .f_depth EQUD 4 ; multiple operation depth / 0 .f_links EQUD 4 ; v links to other files .f_cmode EQUD 4 ; mode which 'owns' file / -1 .f_attr EQUD 4 ; file attributes .f_chklen EQUD 4 ; initial length .f_chksum EQUD 4 ; initial checksum .f_oflags EQUD 4 ; old flags (used by startop/stopop) .f_proposed_name EQUD 4 ; proposed file name .f_tag EQUD 4 ; tag number for this file .f_end_mark EQUD 4 ; end of list marker ]:NEXT FOR pass% = %1100 TO %1110 STEP 2 P% = 0 : O% = code% [ OPT pass% .w_handle EQUD 4 ; window handle / -1 if deleted .w_minx EQUD 4 ; min scn x .w_miny EQUD 4 ; min scn y .w_maxx EQUD 4 ; max scn x .w_maxy EQUD 4 ; max scn y .w_scrollx EQUD 4 ; x scroll .w_scrolly EQUD 4 ; y scroll .w_infront EQUD 4 ; window handle of window in front .w_windowflags EQUD 4 ; wimp window flags .w_file EQUD 4 ; offset of file showing .w_format EQUD 4 ; display format .w_width EQUD 4 ; width of work area in chars .w_height EQUD 4 ; height of work area in chars .w_txt EQUD 4 ; pointer to cached text buffer .w_txth EQUD 4 ; height of cached txt buf in lines .w_txtw EQUD 4 ; char width of cached line (mult 8) .w_txtn EQUD 4 ; number of lines cached .w_coff EQUD 4 ; off in text of first cached line .w_cline EQUD 4 ; line number of first cached line .w_clogl EQUD 4 ; log line num of first cached line .w_tab EQUD 4 ; coltab width .w_tabc EQUD 4 ; actual tab character code (x4) .w_cr EQUD 4 ; code of return/line feed .w_flags EQUD 4 ; (my) window flags .w_title EQUD 4 ; pointer to window title buffer .w_bpl EQUD 4 ; bytes per line / width of text .w_margin EQUD 4 ; width of margin (inc line nos) .w_rl EQUD 4 ; height in lines of each character .w_rw EQUD 4 ; width in pixels of each character .w_rh EQUD 4 ; text height in pixels (no spacing) .w_addr EQUD 4 ; address of first byte in display .w_stline EQUD 4 ; line number of first line in disp .w_titlelen EQUD 4 ; title length (excluding 0) .w_titbuf EQUD 4 ; address of title showing buffer .w_titlen EQUD 4 ; length of title showing string .w_mwidth EQUD 4 ; user required margin width .w_tabchar EQUD 4 ; user required tab char code (x4) .w_linesp EQUD 4 ; user required line spacing .w_savedo EQUD 4 ; fixed off / fixed line off before .w_savedl EQUD 4 ; pixs from top / phy line of off .w_savedc EQUD 4 ; change in phy line for shiftable .w_savedh EQUD 4 ; w_height at multiop start .w_savedlc EQUD 4 ; phy line of fixed for one op .w_wrapwidth EQUD 4 ; wordwrap width .w_togminx EQUD 4 ; toggle size min x .w_togminy EQUD 4 ; toggle size min y .w_togmaxx EQUD 4 ; toggle size max x .w_togmaxy EQUD 4 ; toggle size max y .w_txtlen EQUD 4 ; size of cache line inc col masks .w_palette EQUD 4 ; current palette data .w_pwind EQUD 4 ; point (=this!) window offset .w_pline EQUD 4 ; point row (y coord) .w_pcol EQUD 4 ; point column (x coord) .w_poff EQUD 4 ; point offset .w_ploff EQUD 4 ; point line offset .w_pwidth EQUD 4 ; point width .w_saveds EQUD 4 ; start of area to redraw offset .w_modedata EQUD 4 ; zap handled mode data block .w_basemap EQUD 1 ; base keymap number .w_currentmap EQUD 1 ; current keymap number .w_helpmap EQUD 1 ; previous keymap number (for HELPKEY) .w_defaultmap EQUD 1 ; default keymap number .w_font EQUD 4 ; font block pointer .w_savedscy EQUD 4 ; saved scrolly (s_txt_stat) ; (was RW 12) .w_info EQUD 4 ; w_info (was RW13) .w_res14 EQUD 4 ; font cache offset / -1 if none .w_res15 EQUD 4 ; font offset (of 1bpp form) .w_tag EQUD 4 ; tag number for this window (was RW16) .w_mode0 EQUD 4 ; mode 0 word .w_mode1 EQUD 4 ; mode 1 word .w_mode2 EQUD 4 .w_mode3 EQUD 4 .w_mode4 EQUD 4 .w_mode5 EQUD 4 .w_mode6 EQUD 4 .w_mode7 EQUD 4 .w_mode8 EQUD 4 .w_mode9 EQUD 4 .w_mode10 EQUD 4 .w_mode11 EQUD 4 .w_mode12 EQUD 4 .w_mode13 EQUD 4 .w_mode14 EQUD 4 .w_mode15 EQUD 4 .w_mode16 EQUD 4 .w_mode17 EQUD 4 .w_mode18 EQUD 4 .w_mode19 EQUD 4 .w_mode20 EQUD 4 .w_mode21 EQUD 4 .w_mode22 EQUD 4 .w_mode23 EQUD 4 .w_mode24 EQUD 4 .w_mode25 EQUD 4 .w_mode26 EQUD 4 .w_mode27 EQUD 4 .w_mode28 EQUD 4 .w_mode29 EQUD 4 .w_mode30 EQUD 4 .w_mode31 EQUD 4 .w_end_mark EQUD 4 ; end of list marker ]:NEXT FOR pass% = %1100 TO %1110 STEP 2 P% = 0 : O% = code% [ OPT pass% .c_wind EQUD 4 ; offset of window with this caret .c_line EQUD 4 ; line of caret in work area .c_col EQUD 4 ; column of caret in work area .c_off EQUD 4 ; offset of caret in text .c_loff EQUD 4 ; start of line offset .c_width EQUD 4 ; width of cursor in chars .c_owind EQUD 4 ; old window / -1 if none .c_oline EQUD 4 ; old plotted line .c_ocol EQUD 4 ; old plotted col .c_owidth EQUD 4 ; old width / offset for selected regions .c_charoff EQUD 4 ; offset within character .cusr_blk EQUD 4 ; length of a cursor block ]:NEXT FOR pass% = %1100 TO %1110 STEP 2 P% = 0 : O% = code% [ OPT pass% .e_module EQUD 4 ; table offset from module start .e_title EQUD 4 ; title offset (max 10) .e_author EQUD 4 ; author offset .e_basemode EQUD 4 ; mode to call for 0 offsets .e_mode EQUD 4 ; mode you would like to be .e_init EQUD 4 ; startup code .e_menu EQUD 4 ; extension menu .e_len EQUD 4 ; length of this table .e_postload EQUD 4 ; called after being loaded/created .e_presave EQUD 4 ; called before being saved .e_loading EQUD 4 ; file being loaded/created .e_start EQUD 4 ; window entering this mode .e_end EQUD 4 ; window leaving this mode .e_width EQUD 4 ; find work area width .e_linecol EQUD 4 ; column offset to file offset .e_lineoff EQUD 4 ; file offset to column offset .e_clnlog EQUD 4 ; log to file off .e_clnphy EQUD 4 ; phy to file off .e_clnoff EQUD 4 ; file off to phy/log .e_nextline EQUD 4 ; find next line which can be shifted down .e_minus EQUD 4 ; perform cursor left .e_plus EQUD 4 ; perform cursor right .e_sminus EQUD 4 ; perform shift left .e_splus EQUD 4 ; perform shift right .e_cminus EQUD 4 ; perform ctrl minus .e_cplus EQUD 4 ; perform ctrl plus .e_redrawline EQUD 4 ; redraw a line of the display .e_redrawlnum EQUD 4 ; find logical line number .e_char EQUD 4 ; insert characters as if typed .e_delete EQUD 4 ; delete characters from text .e_tab EQUD 4 ; tab key pressed .e_return EQUD 4 ; return key pressed .e_renumber EQUD 4 ; please renumber .e_saveandrun EQUD 4 ; save file and run/compile .e_linestart EQUD 4 ; find start of line .e_lineend EQUD 4 ; find end of line .e_linenext EQUD 4 ; find actual end of line .e_lineprev EQUD 4 ; find actual start of line .e_copy EQUD 4 ; copy key data .e_joinline EQUD 4 ; join this line with the next .e_splitline EQUD 4 ; split this line at the cursor .e_aligncaret EQUD 4 ; put caret in sensible posn before command .e_command EQUD 4 ; someone wants to alter the text .e_compile EQUD 4 ; compile / run and don't exit .e_formattext EQUD 4 ; format the text from this point .e_run EQUD 4 ; run the program being edited .e_runandquit EQUD 4 ; as above but then quits .e_basic EQUD 4 ; drops into basic (or language) .e_search EQUD 4 ; called before a search .e_replace EQUD 4 ; replace a string .e_selection EQUD 4 ; start/end a selection .e_click EQUD 4 ; double/treble click etc .e_message EQUD 4 ; unrecognised wimp messages .e_setwidth EQUD 4 ; changing window width .e_listfns EQUD 4 ; provide list of functions .e_prevline EQUD 4 ; find start of update region .e_openwindow EQUD 4 ; window changing size or moving .e_interrogate EQUD 4 ; Information request from Zap .e_returnword EQUD 4 ; return bounds of word at cursor .e_help EQUD 4 ; return possible help keywords .e_stripspaces EQUD 4 ; space-stripping help requests ]:NEXT FOR pass% = %1100 TO %1110 STEP 2 P% = 0 : O% = code% [ OPT pass% .Zap_AddMode EQUD 4 ; add new mode to zap .Zap_Claim EQUD 4 ; claim heap block .Zap_Ensure EQUD 4 ; ensure heap block .Zap_Free EQUD 4 ; free heap block .Zap_MoveBytes EQUD 4 ; move data .Zap_SplitBuffer EQUD 4 ; split text buffer at given point .Zap_NewTxtStatus EQUD 4 ; refresh screen after file changed .Zap_SaveTxtStatus EQUD 4 ; save info before file changed .Zap_Command EQUD 4 ; execute insert/delete command .Zap_NewWinStatus EQUD 4 ; recreate window after change .Zap_SaveWinStatus EQUD 4 ; save window status before change .Zap_ReplaceArea EQUD 4 ; replace one string by another .Zap_PlotCaret EQUD 4 ; plot caret at given position .Zap_ReflectCaret EQUD 4 ; plot caret at posn only using c_off .Zap_SetCaret EQUD 4 ; draw caret .Zap_ClearCaret EQUD 4 ; draw old caret position (remove caret) .Zap_DoCommand EQUD 4 ; perform the command .Zap_ShowCursor EQUD 4 ; make sure given cursor is visible .Zap_ReadVar EQUD 4 ; read a zap variable .Zap_WriteVar EQUD 4 ; write a zap variable .Zap_SaveFile EQUD 4 ; save a file to disc .Zap_FillWords EQUD 4 ; fill a given area of memory .Zap_UpdateLns EQUD 4 ; update line numbers column .Zap_EachWindow EQUD 4 ; call sub for each window on file .Zap_UpdateCaret EQUD 4 ; updates caret posn from offset .Zap_GetWindState EQUD 4 ; update R8 block with wind posn .Zap_StartOp EQUD 4 ; start multiop .Zap_StopOp EQUD 4 ; stop multiop .Zap_CallMode EQUD 4 ; call a mode entry point using R8 .Zap_CallGivenMode EQUD 4 ; call mode in R10 .Zap_ReadMode EQUD 4 ; read info on a mode .Zap_FindFile EQUD 4 ; find window on a given file name .Zap_FindWindow EQUD 4 ; find window on a loaded file .Zap_ConvWindOff EQUD 4 ; convert window off to blk ptr .Zap_ConvFileOff EQUD 4 ; convert file off to blk ptr .Zap_GetWindOff EQUD 4 ; convert window blk ptr to off .Zap_GetFileOff EQUD 4 ; convert file blk ptr to off .Zap_GotoOffset EQUD 4 ; move cursor to given posn + mark .Zap_JumptoOffset EQUD 4 ; move cursor to given posn nomark .Zap_FindOffset EQUD 4 ; find file offset from x,y coord .Zap_NewFileTitle EQUD 4 ; update titlebars on a file .Zap_InsertString EQUD 4 ; insert string into file .Zap_CreateFile EQUD 4 ; create an empty file .Zap_NewLinkEntry EQUD 4 ; add an entry to the links table .Zap_DefaultClick EQUD 4 ; default mouse click handling .Zap_PutCaret EQUD 4 ; put new caret in file .Zap_DiscardFile EQUD 4 ; kill file .Zap_DeleteFile EQUD 4 ; propmt then kill .Zap_DiscardWindow EQUD 4 ; kill window .Zap_DeleteWindow EQUD 4 ; prompt then kill window .Zap_BuildMenu EQUD 4 ; create a variable length menu .Zap_ClearSel EQUD 4 ; clear selected area .Zap_CreateFileBlk EQUD 4 ; create a new file block in R9 .Zap_CreateWindBlk EQUD 4 ; create a new window block in R8 .Zap_GetSel EQUD 4 ; get info on selected region .Zap_InsertMark EQUD 4 ; insert marker at given offset .Zap_InstallFile EQUD 4 ; load a file into Zap .Zap_NewMode EQUD 4 ; change mode of a file .Zap_NewTitle EQUD 4 ; update the title of a window .Zap_CallBaseMode EQUD 4 ; call base mode entry point .Zap_NewView EQUD 4 ; open a new window on a file .Zap_ReadSel EQUD 4 ; read the selected region .Zap_Replace EQUD 4 ; perform a search and replace .Zap_Search EQUD 4 ; perform a file search .Zap_Select EQUD 4 ; select a region .Zap_AlterSel EQUD 4 ; alter selected region .Zap_OffLineCol EQUD 4 ; convert file offset to X,Y .Zap_AddCommands EQUD 4 ; add a command table .Zap_MiniWrite EQUD 4 ; insert chars in minibuffer .Zap_MiniPrompt EQUD 4 ; set/change the minibuffer prompt .Zap_MiniUpdate EQUD 4 ; update minibuffer on screen .Zap_AddYankRegion EQUD 4 ; add a region to kill ring .Zap_FindCommand EQUD 4 ; convert command name to address .Zap_ProcessCommand EQUD 4 ; call a Zap command .Zap_FindKeyEntry EQUD 4 ; read a keymap entry .Zap_FindLeafName EQUD 4 ; find leaf part of a filename .Zap_NewFileName EQUD 4 ; change the name of a file .Zap_CheckFileName EQUD 4 ; see if file contains a path .Zap_GetCurrDir EQUD 4 ; find the current directory name .Zap_MiniWriteC EQUD 4 ; write a character to minibuffer .Zap_MiniClear EQUD 4 ; clear minibuffer .Zap_MiniStart EQUD 4 ; start up a new minibuffer .Zap_MiniEval EQUD 4 ; turn string into number .Zap_CommandString EQUD 4 ; execute a string command .Zap_ProcessKeys EQUD 4 ; process a list of keys .Zap_ProcessAKey EQUD 4 ; process a single key as if typed .Zap_OpenWindow EQUD 4 ; open a Zap window .Zap_RestoreModeWord EQUD 4 ; restore mode options on e_start .Zap_SaveModeWord EQUD 4 ; save mode options on e_end .Zap_GetModeWord EQUD 4 ; read the mode word .Zap_PutModeWord EQUD 4 ; write the mode word .Zap_BaseMode EQUD 4 ; call the base mode .Zap_ReadWord EQUD 4 ; read a word from the file buffer .Zap_ReplaceWord EQUD 4 ; replace a word in the file buffer .Zap_ModeColour EQUD 4 ; Read colour definitions .Zap_FindInput EQUD 4 ; Find input position .Zap_ClipCache EQUD 4 ; Move the cache reference point. .Zap_ModeData EQUD 4 ; Read/write Zap data mode words. .Zap_WhichMode EQUD 4 ; Which mode to load a file into. .Zap_ModeNumber EQUD 4 ; Convert mode name to number. .Zap_SendDataSave EQUD 4 ; Initiate data transfer protocol. .Zap_Warning EQUD 4 ; Show warning message. .Zap_AllWindow EQUD 4 ; Examine each window in turn. .Zap_ReadMenu EQUD 4 ; Create text menu to data. .Zap_LoadMenu EQUD 4 ; Load a text menu file. .Zap_OpenMenu EQUD 4 ; Open a menu on the screen. .Zap_CallBack EQUD 4 ; Call back at given time. .Zap_DragBox EQUD 4 ; Perform your own drag box. .Zap_SendMessage EQUD 4 ; Send a message via Zap. .Zap_Reply EQUD 4 ; Reply to a message via Zap. .Zap_Extend EQUD 4 ; Extend a heap block. .Zap_ModeColourNum EQUD 4 ; Change size of palette. .Zap_CreateThrowback EQUD 4 ; Create a throwback file. .Zap_Throwback EQUD 4 ; Insert a throwback line. .Zap_TestModeName EQUD 4 ; Find if a mode is loaded. .Zap_UpdateArea EQUD 4 ; Force window redraw .Zap_UpdateWindow EQUD 4 ; Force window redraw .Zap_UpdateWholeWindow EQUD 4 ; Force window redraw .Zap_AllFiles EQUD 4 ; Force window redraw .Zap_ReadValidateCommand EQUD 4 ; String -> command block .Zap_ProcessKeyCommand EQUD 4 ; Execute a given command block .Zap_ReturnWord EQUD 4 ; Return delimited word at cursor .Zap_DoReplaceArea EQUD 4 ; Calls Zap_ReplaceArea with R8=0 .Zap_LogicalLine EQUD 4 ; Calls base mode's e_clnlog .Zap_PhysicalLine EQUD 4 ; Calls base mode's e_clnphy .Zap_OffsetLine EQUD 4 ; Calls base mode's e_clnoff .Zap_NextLine EQUD 4 ; Calls base mode's e_nextline .Zap_EvaluateExpression EQUD 4 ; Calls base mode's e_nextline .Zap_ClaimMessage EQUD 4 ; Claim/forward the next message .Zap_TestChanged EQUD 4 ; Tests to see if file modified .Zap_MarkChanged EQUD 4 ; Marks the file changed/unchanged .Zap_CalculateChecksum EQUD 4 ; Calculates the file's chksum .Zap_LookupToken EQUD 4 ; Looks up token in Zap's messages file .Zap_LookupTokenGS EQUD 4 ; ...with GS translation (OS_GStrans) .Zap_LookupError EQUD 4 ; ...for error generation .Zap_LookupTokenR0 EQUD 4 ; LookupToken with R2=R3=0 .Zap_ExpandMenu EQUD 4 ; Expands a tokenised menu .Zap_MiniWriteToken EQUD 4 ; insert chars in minibuffer (ditto) .Zap_MiniPromptToken EQUD 4 ; set/change the minibuffer prompt (ditto) .Zap_TestIfCloneBase EQUD 4 ; is given mode clone base of current mode? .Zap_ReadVariable EQUD 4 ; read a user configuration variable .Zap_BuildMenuWithHelp EQUD 4 ; build a Zap menu structure with help data .Zap_CharDelDispatch EQUD 4 ; do a column of changes if in a selection .Zap_SelectHistoryBuffer EQUD 4 ; choose/create a history buffer ]:NEXT FOR pass% = %1100 TO %1110 STEP 2 P% = 0 : O% = code% [ OPT pass% .r_flags EQUD 4 ; Redraw flags .r_minx EQUD 4 ; min x in pixs inc .r_miny EQUD 4 ; min y in pixs inc (from top) .r_maxx EQUD 4 ; max x in pixs exc .r_maxy EQUD 4 ; max y in pixs exc (from top) .r_screen EQUD 4 ; address of the screen .r_bpl EQUD 4 ; bytes per raster line .r_bpp EQUD 4 ; log base 2 of bpp .r_charw EQUD 4 ; width of a character in pixs .r_charh EQUD 4 ; height of a character in pixs .r_caddr EQUD 4 ; cache address / font name .r_cbpl EQUD 4 ; bytes per cached line .r_cbpc EQUD 4 ; bytes per cached character .r_linesp EQUD 4 ; line spacing in pixels .r_data EQUD 4 ; address of data to print .r_scrollx EQUD 4 ; x scroll offset in pixs .r_scrolly EQUD 4 ; y scroll offset in pixs .r_palette EQUD 4 ; address of palette data .r_for EQUD 4 ; start forground colour .r_bac EQUD 4 ; start background colour .r_workarea EQUD 4 ; address of work area .r_magx EQUD 4 ; log 2 of num of x os per pixel .r_magy EQUD 4 ; log 2 of num of y os per pixel .r_xsize EQUD 4 ; screen width in pixels .r_ysize EQUD 4 ; screen height in pixels .r_mode EQUD 4 ; screen mode ; the rest of this block is optional (depending on r_flags .r_length EQUD 4 ; total length of redraw block .r_lmargin EQUD 4 ; left margin (pixels) .r_tmargin EQUD 4 ; top margin (pixels) .r_end EQUD 4 ; end of longest possible redraw block ]:NEXT ENDPROC REM