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

  1. define DEBUG_MAIN = 0
  2.  
  3. defmain    /* defmain should be used to parse the command line arguments */
  4. compile if WANT_PROFILE='SWITCH'
  5.    universal REXX_PROFILE
  6. compile endif
  7. compile if EVERSION < 5
  8.    universal comsfileid, messy
  9. compile else
  10.    universal activemenu, should_showwindow
  11.    should_showwindow = 1  -- Lets cmdline commands inhibit the SHOWWINDOW.
  12. compile endif
  13.  
  14.    doscmdline = 'e 'arg(1) /* Can do special processing of DOS command line.*/
  15.  
  16.    unnamed_name=UNNAMED_FILE_NAME  -- Define the name once to save a few bytes.
  17.    .filename = unnamed_name      -- Ver. 3.11:  Don't rely on fileid.
  18.  
  19. compile if DEBUG_MAIN
  20.    messageNwait('DEFMAIN: arg(1)="'arg(1)'"')
  21. compile endif
  22.  
  23. compile if EVERSION < 5
  24.    if messy then .windowoverlap=1; endif    -- messy-desk style?
  25. compile endif
  26.  
  27. compile if EVERSION > '5.15'
  28.  compile if WANT_APPLICATION_INI_FILE
  29.    'initconfig'                  -- Check if anything of interest is in OS2.INI
  30.   compile if DEBUG_MAIN
  31.    messageNwait('DEFMAIN: after INITCONFIG')
  32.   compile endif
  33.  compile endif
  34.  compile if (HOST_SUPPORT='EMUL' | HOST_SUPPORT='E3EMUL') and not defined(my_SAVEPATH)
  35.    call check_savepath()
  36.  compile endif
  37. compile endif
  38.  
  39.    doscmdline                    -- Execute the doscmdline.
  40.  
  41. compile if DEBUG_MAIN
  42.    messageNwait('DEFMAIN: after DOSCMDLINE')
  43. compile endif
  44.  
  45.    getfileid newfileid
  46. compile if EVERSION < 5
  47.    if 'e'<>doscmdline then  /* Put doscmdline into coms stack if nontrivial.*/
  48.       getline line,comsfileid.last,comsfileid
  49.       if line<>doscmdline then  -- Don't duplicate last line
  50.          if comsfileid.last > 30 then deleteline 1,comsfileid endif  -- trim if too big
  51.          insertline doscmdline,comsfileid.last+1,comsfileid
  52.       endif
  53.    endif
  54. compile endif
  55.  
  56.    /* E automatically created an empty file when it started.              */
  57.    /* If user specified file(s) to edit, get rid of the empty file.       */
  58. do i=1 to 1
  59.    getfileid emptyfileid, UNNAMED_FILE_NAME
  60.    if emptyfileid='' then             -- User deleted it?
  61.       leave
  62.    endif
  63.    if emptyfileid.modify then         -- User changed it?
  64.       leave
  65.    endif
  66.    if newfileid=emptyfileid then      -- Check if others in ring.
  67. compile if EVERSION < 5
  68.       if messy then nextwindow else nextfile endif
  69.       getfileid newfileid
  70.       if messy then prevwindow else prevfile endif
  71. compile else
  72.       nextfile
  73.       getfileid newfileid
  74.       prevfile
  75. compile endif
  76.    endif
  77.    if newfileid<>emptyfileid then
  78.       activatefile emptyfileid
  79.       'xcom q'
  80. compile if EPM and MENU_LIMIT
  81.       call updateringmenu()
  82. compile endif
  83.       activatefile newfileid
  84.       call select_edit_keys()
  85.    endif
  86. end
  87.  
  88. compile if CURSOR_ON_COMMAND and not EPM
  89.    cursor_command
  90. compile endif
  91.  
  92. compile if EPM
  93.  compile if INCLUDE_MENU_SUPPORT
  94.    showmenu activemenu   /* show the default EPM menu           */
  95.   compile if DEBUG_MAIN
  96.    messageNwait('DEFMAIN: after SHOWMENU')
  97.   compile endif
  98.  compile endif
  99.    if should_showwindow then
  100.       call showwindow('ON')
  101.  compile if DEBUG_MAIN
  102.    messageNwait('DEFMAIN: after SHOWWINDOW')
  103.  compile endif
  104.    endif
  105. compile endif
  106.  
  107. compile if WANT_PROFILE
  108.  compile if WANT_PROFILE='SWITCH'
  109.    if REXX_PROFILE then
  110.  compile endif
  111.       profile = 'profile.erx'
  112.       findfile profile1, profile, EPATH
  113.       if rc then findfile profile1, profile, 'PATH'; endif
  114.       if not rc then
  115.          'rx' profile1 arg(1)
  116.       endif
  117.  compile if WANT_PROFILE='SWITCH'
  118.    endif
  119.  compile endif
  120. compile endif
  121.