home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / e / epmmac2.zip / GET.E < prev    next >
Text File  |  1992-12-18  |  3KB  |  124 lines

  1. ;  For linking version, GET can be an external module.
  2.  
  3. compile if not defined(SMALL)  -- If SMALL not defined, then being separately
  4.  define INCLUDING_FILE = 'GET.E'
  5. const
  6.    tryinclude 'MYCNF.E'        -- the user's configuration customizations.
  7.  
  8.  compile if not defined(SITE_CONFIG)
  9.     const SITE_CONFIG = 'SITECNF.E'
  10.  compile endif
  11.  compile if SITE_CONFIG
  12.     tryinclude SITE_CONFIG
  13.  compile endif
  14.  
  15. const
  16.  compile if EVERSION >= 5
  17.   compile if not defined(WANT_BOOKMARKS)
  18.    WANT_BOOKMARKS = 'LINK'
  19.   compile endif
  20.  compile else
  21.    WANT_BOOKMARKS = 0
  22.  compile endif
  23.  compile if not defined(NLS_LANGUAGE)
  24.    NLS_LANGUAGE = 'ENGLISH'
  25.  compile endif
  26. include NLS_LANGUAGE'.e'
  27. compile endif
  28.  
  29. defmain     -- External modules always start execution at DEFMAIN.
  30.    'get' arg(1)
  31.  
  32. defc get=
  33.    universal default_edit_options
  34.    get_file = strip(arg(1))
  35.    if get_file='' then sayerror NO_FILENAME__MSG 'GET'; stop endif
  36.    if pos(argsep,get_file) then
  37.       sayerror INVALID_OPTION__MSG
  38.       stop
  39.    endif
  40.    call parse_filename(get_file,.filename)
  41.    getfileid fileid
  42.    s_last=.last
  43. compile if EVERSION < 5
  44.    'e /q /h /d' default_edit_options get_file
  45. compile else
  46.    display -1
  47.    'e /q /d' get_file
  48. compile endif
  49.    editrc=rc
  50.    getfileid gfileid
  51.    if editrc=sayerror('New file') | not .last then
  52.       'q'
  53. compile if EVERSION > 5
  54.       display 1
  55. compile endif
  56.       if editrc= -2 | not .last then  -- -2 = sayerror('New file') then
  57.          sayerror FILE_NOT_FOUND__MSG':  'get_file
  58.       else
  59.          sayerror FILE_NOT_FOUND__MSG':  'get_file
  60.       endif
  61.       stop
  62.    endif
  63.    if editrc & editrc<>-278 then  -- -278  sayerror('Lines truncated') then
  64. compile if EVERSION > 5
  65.       display 1
  66. compile endif
  67.       sayerror editrc
  68.       stop
  69.    endif
  70.    call psave_mark(save_mark)
  71. compile if WANT_BOOKMARKS
  72.    if not .levelofattributesupport then
  73.       'loadattributes'
  74.    endif
  75. compile endif
  76. compile if EVERSION > 5
  77.    get_file_attrib = .levelofattributesupport
  78. compile endif
  79.    top
  80.    mark_line
  81.    bottom
  82.    mark_line
  83.    activatefile fileid
  84.    rc=0
  85.    copy_mark
  86.    copy_rc=rc           -- Test for memory too full for copy_mark.
  87.    activatefile gfileid
  88.    'q'
  89.    parse value save_mark with s_firstline s_lastline s_firstcol s_lastcol s_mkfileid s_mt
  90.    if fileid=s_mkfileid then           -- May have to move the mark.
  91.       diff=fileid.last-s_last          -- (Adjustment for difference in size)
  92.       if fileid.line<s_firstline then s_firstline=s_firstline+diff; endif
  93.       if fileid.line<s_lastline then s_lastline=s_lastline+diff; endif
  94.    endif
  95.    call prestore_mark(s_firstline s_lastline s_firstcol s_lastcol s_mkfileid s_mt)
  96.    activatefile fileid
  97. compile if EVERSION > 5
  98.    if get_file_attrib // 2 then
  99.       call attribute_on(1)  -- Colors flag
  100.    endif
  101.  compile if EVERSION >= 5.50  -- GPI has font support
  102.    if get_file_attrib % 4 - 2 * (get_file_attrib % 8) then
  103.       call attribute_on(4)  -- Mixed fonts flag
  104.    endif
  105.  compile endif
  106.    if get_file_attrib % 8 - 2 * (get_file_attrib % 16) then
  107.       call attribute_on(8)  -- "Save attributes" flag
  108.    endif
  109.    display 1
  110. compile endif
  111.    if copy_rc then
  112.       sayerror NOT_2_COPIES__MSG get_file
  113. compile if EVERSION < 5
  114.    else
  115.       call message(1)
  116. compile endif
  117.    endif
  118. compile if EVERSION < 5
  119.    call select_edit_keys()
  120. compile else
  121. ;  refresh
  122. ;  call repaint_window()
  123. compile endif
  124.