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