home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / DATABASE / MED300.ZIP / MEMOEDIT.CLA < prev    next >
Text File  |  1994-02-22  |  12KB  |  213 lines

  1.  
  2. !▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
  3. !█                                                                       █
  4. !█ MEMOEDIT.CLA                                                          █
  5. !█ Memo and ASCII file editor for Clarion 3.0                            █
  6. !█                                                                       █
  7. !█ Revision  : 1                                                         █
  8. !█                                                                       █
  9. !█ Copyright : Bobcat Systems (c) 1994                                   █
  10. !█ Author    : Robert J. Pupazzoni, Bobcat Systems                       █
  11. !█                                                                       █
  12. !█ Compiler  : Clarion Database Developer 3.0, Batch 3006                █
  13. !█                                                                       █
  14. !█ REVISION HISTORY                                                      █
  15. !█   1 Created                                                           █
  16. !█                                                                       █
  17. !▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  18.  
  19. MEMOEDIT      PROGRAM
  20.  
  21. !─────────────────────────────────────────────────────────────────────────
  22. !                            E Q U A T E S
  23. !─────────────────────────────────────────────────────────────────────────
  24.               INCLUDE('KEYCODES.EQU')            ! Keycodes
  25.               INCLUDE('MEMOEDIT.EQU' )           ! Editor equates
  26.  
  27. !─────────────────────────────────────────────────────────────────────────
  28. !                       P R O G R A M   M A P
  29. !─────────────────────────────────────────────────────────────────────────
  30.   MAP
  31.     MODULE('MEBLOCK')                            ! Block operations:
  32.       ME_NormBlock()                             !   Normalize block
  33.       ME_MarkOn()                                !   Turn block marking on
  34.       ME_MarkOff()                               !   Turn block marking off
  35.       ME_Copy2Clip()                             !   Copy block to clipboard
  36.       ME_Cut2Clip()                              !   Cut block to clipboard
  37.       ME_PasteClip()                             !   Paste clipboard
  38.     .
  39.     MODULE('MECORE')                             ! Core editing operations:
  40.       ME_GetChar( USHORT ),BYTE                  !   Get character from buffer
  41.       ME_PutChar( USHORT, BYTE )                 !   Put character to buffer
  42.       ME_GetBlock( *STRING, USHORT, USHORT )     !   Get block from buffer
  43.       ME_InsTxt( USHORT, USHORT, STRING )        !   Insert text into buffer
  44.       ME_DelTxt( USHORT, USHORT )                !   Delete text from buffer
  45.     .
  46.     MODULE('MEDELETE')                           ! Deletion operations:
  47.       ME_DelChar()                               !   Delete character
  48.       ME_DelEOL()                                !   Delete to end-of line
  49.       ME_DelLine()                               !   Delete entire line
  50.     .
  51.     MODULE('MEDONE')                             ! Clean-up and termination:
  52.       ME_Done()                                  !   Free mem / restore context
  53.     .
  54.     MODULE('MEEDIT')                             ! Main edit loop:
  55.       ME_BufrFull(), BYTE                        !   Check for buffer full
  56.       ME_Edit()                                  !   Edit current document
  57.     .
  58.     MODULE('MEFILE')                             ! File operations:
  59.       ME_PickFile( STRING ),STRING               !   File/directory picklist
  60.       ME_PasteFile()                             !   Paste file
  61.       ME_Copy2File()                             !   Copy marked block to file
  62.       ME_EditFile( STRING, <USHORT> )            !   Edit file
  63.     .
  64.     MODULE('MEINIT')                             ! Initialization:
  65.       ME_InitMemo( *STRING[] )                   !   Allocate and init context
  66.     .
  67.     MODULE('MELINTBL')                           ! Line table access:
  68.       ME_AdjLines( USHORT, USHORT )              !   Adjust line pointers
  69.       ME_LineIndex( USHORT ),USHORT              !   Find line index
  70.       ME_LineStart( USHORT ),USHORT              !   Find line start
  71.       ME_LineEnd( USHORT ),USHORT                !   Find line end
  72.     .
  73.     MODULE('MEPACK')                             ! Memo packing/unpacking:
  74.       ME_Pack( *STRING[], <BYTE> )               !  Pack memo
  75.       ME_Unpack( *STRING[], USHORT )             !  Unpack memo
  76.     .
  77.     MODULE('MEREFORM')                           ! Reformatting:
  78.       ME_LineBreak( USHORT, USHORT ),USHORT      !   Calculate line break
  79.       ME_ReformDoc()                             !   Reformat document
  80.       ME_ReformPar( USHORT )                     !   Reformat paragraph
  81.     .
  82.     MODULE('MESCRDEF')                           ! Screen defaults:
  83.       ME_ScrnDefs( BYTE, BYTE, BYTE, BYTE )      !   Set screen defaults
  84.     .
  85.     MODULE('MESCREEN')                           ! Screen access:
  86.       ME_SetPage()                               !   Invalidate display page
  87.       ME_ShowPage()                              !   Refresh display
  88.       ME_CurPos()                                !   Position cursor
  89.       ME_CurSize( BYTE )                         !   Set cursor size
  90.     .
  91.     MODULE('MEUTIL')                             ! Miscellanous:
  92.       IsAlerted( SHORT ),BYTE                    !   See if key is ALERTed
  93.       UnAlert( SHORT, SHORT )                    !   UnALERT a key
  94.       ME_Max( LONG, LONG ),LONG                  !   Larger of 2 integers
  95.       ME_Min( LONG, LONG ),LONG                  !   Smaller of 2 integers
  96.       ME_Entry( STRING ),STRING                  !   String input dialog
  97.       ME_Confirm( STRING, <BYTE> ),BYTE          !   Confirmation dialog
  98.     .
  99.     MODULE('MEWORD')                             ! Word movement:
  100.       ME_WordLeft( SHORT  ),SHORT                !   Move to previous word
  101.       ME_WordRight( SHORT ),SHORT                !   Move to next word
  102.     .
  103.     MODULE('CLMEM')                              ! C memory library:
  104.       CFree( ULONG ),                    |       !
  105.         NAME('CFree')                            !
  106.       CMalloc( USHORT ), ULONG,          |       !
  107.         NAME('CMalloc')                          !
  108.       CMemMove( ULONG, ULONG,  USHORT ), |       !
  109.         NAME('CMemMove')                         !
  110.       CMemSet( ULONG, USHORT, USHORT ),  |       !
  111.         NAME('CMemSet')                          !
  112.       CMemWSet( ULONG, USHORT, USHORT ), |       !
  113.         NAME('CMemWSet')                         !
  114.     .
  115.     MODULE('RTL')                                ! Runtime library:
  116.       DeAlert( USHORT, USHORT ),         |       !   (See API Toolkit docs)
  117.         NAME('Cla$de_alert')                     !
  118.       FindAlert( SHORT ),                |       !
  119.         NAME('Cla$find_alert')                   !
  120.       FindFirst( *CSTRING, *GROUP, SHORT ),SHORT, |
  121.         RAW,NAME('_findfirst')                   !
  122.       FindNext( *GROUP ),SHORT,          |       !
  123.         RAW,NAME('_findnext')                    !
  124.       Int86x( SHORT, *GROUP, *GROUP, *GROUP ), SHORT, |
  125.         RAW,NAME('_int86x')                      !
  126.       QShow( *STRING, USHORT, USHORT, USHORT, BYTE, USHORT ), |
  127.         RAW,NAME('Cla$qshow')                    !
  128.     .
  129.   .
  130.  
  131. ! ─────────────────────────────────────────────────────────────────────────
  132. !                            S C R E E N S
  133. ! ─────────────────────────────────────────────────────────────────────────
  134. wStatus          SCREEN(1,80),PRE(MES),AT(25,1),COLOR(112)
  135. ssStatus           ROW(1,3)    STRING(76),COLOR(112)
  136.                  .
  137.  
  138. ! ─────────────────────────────────────────────────────────────────────────
  139. !                   G L O B A L   V A R I A B L E S
  140. ! ─────────────────────────────────────────────────────────────────────────
  141. gUserDefs    GROUP,PRE(MEU)                      !User-defined defaults:
  142. sHelpID        STRING(8)                         !  Help screen ID
  143. sFilePath      STRING(80)                        !  Path to prepend for OPEN()
  144. bbSizeToFit    BYTE(1)                           !  Size memo to fit on screen?
  145. bbShowStatus   BYTE(1)                           !  Show status line?
  146. ubStatusRow    BYTE(25)                          !  Status line display row
  147. bbAlrtBfrCmd   BYTE(0)                           !  Check ALERTs before cmnds?
  148. bbAlrtBfrMac   BYTE(1)                           !  Check ALERTs before macros?
  149. ubAscImpFmt    BYTE(eImpRefNone)                 !  Default ASCII import format
  150. ubAscExpFmt    BYTE(eExpKillCode)                !  Default ASCII export format
  151. isFlSaveKey    SHORT(CtrlEnter)                  !  File edit 'Save' key
  152. isFlCancKey    SHORT(EscKey)                     !  File edit 'Cancel' key
  153.              .
  154.  
  155. gGlobals     GROUP,PRE(MEG)                      !Internal global variables:
  156. sFileName      STRING(80)                        !  File NAME() variable
  157. isKeyBuffer    SHORT(0)                          !  Look ahead keystroke buffer
  158. ubCursRow      BYTE                              !  Current cursor row
  159. ubCursCol      BYTE                              !  Current cursor column
  160.              .
  161.  
  162. ! ─────────────────────────────────────────────────────────────────────────
  163. !                     M E M O R Y   T A B L E S
  164. ! ─────────────────────────────────────────────────────────────────────────
  165. qClipboard   QUEUE,PRE(MEB)                      !Clipboard for block
  166.                STRING(255)                       !operations
  167.              .
  168.  
  169. qDocument    QUEUE,PRE(MED)            !Table of document structures:
  170. ubWndRowOfs    BYTE                    !  Edit window row offset
  171. ubWndColOfs    BYTE                    !  Edit window column offset
  172. ubWndRows      BYTE                    !  Edit window rows
  173. ubWndCols      BYTE                    !  Edit window columns
  174.  
  175. usLineWidth    USHORT                  !  Line width
  176.  
  177. ubTextColor    BYTE                    !  Normal text color
  178. ubSymColor     BYTE                    !  Format code color
  179. ubBlockColor   BYTE                    !  Block marking color
  180.  
  181. bbInsertMode   BYTE                    !  Insert/overwrite flag
  182. bbShowCodes    BYTE                    !  Display format codes flag
  183.  
  184. bbBlockShow    BYTE                    !  Marked block display flag
  185. bbBlockMark    BYTE                    !  Block marking mode flag
  186. isBlockBegin   SHORT                   !  Start of marked text block
  187. isBlockEnd     SHORT                   !  End of marked text block
  188.  
  189. bbAllocFlag    BYTE                    !  Buffer allocation flag (*RESERVED*)
  190. ulEditBuffer   ULONG                   !  Pointer to edit buffer (*RESERVED*)
  191. usCharacters   USHORT                  !  Current # of chars document
  192. usMaxChars     USHORT                  !  Max. chars allowed in buffer
  193. bbHasChanged   BYTE                    !  Edit buffer changed flag
  194.  
  195. usPageTop      USHORT                  !  Line at current top-of-page
  196. usLineNdx      USHORT                  !  Current line index
  197.  
  198. isSkew         SHORT                   !  Horizontal skew increment
  199.  
  200. usPosition     USHORT                  !  Current point position
  201. usLineStart    USHORT                  !  Current line start offset
  202. usLineEnd      USHORT                  !  Current line end offset
  203.              .
  204.  
  205. qLine         QUEUE,PRE(QLN)           !Line table:
  206. usLineStart     SHORT                  !  Line start position
  207. bbRedisplay     SHORT                  !  Redisplay flag
  208.               .
  209.  
  210.   CODE
  211.  
  212.  
  213.