home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional Developers Kit 1992 November / Disc01 / Disc01.mdf / prodtool / epm / e_macros / main.e < prev    next >
Encoding:
Text File  |  1992-03-05  |  3.4 KB  |  119 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.    'initconfig'                  -- Check if anything of interest is in OS2.INI
  29.  compile if DEBUG_MAIN
  30.    messageNwait('DEFMAIN: after INITCONFIG')
  31.  compile endif
  32.  compile if (HOST_SUPPORT='EMUL' | HOST_SUPPORT='E3EMUL') and not defined(my_SAVEPATH)
  33.    call check_savepath()
  34.  compile endif
  35. compile endif
  36.  
  37.    doscmdline                    -- Execute the doscmdline.
  38.  
  39. compile if DEBUG_MAIN
  40.    messageNwait('DEFMAIN: after DOSCMDLINE')
  41. compile endif
  42.  
  43.    getfileid newfileid
  44. compile if EVERSION < 5
  45.    if 'e'<>doscmdline then  /* Put doscmdline into coms stack if nontrivial.*/
  46.       getline line,comsfileid.last,comsfileid
  47.       if line<>doscmdline then  -- Don't duplicate last line
  48.          if comsfileid.last > 30 then deleteline 1,comsfileid endif  -- trim if too big
  49.          insertline doscmdline,comsfileid.last+1,comsfileid
  50.       endif
  51.    endif
  52. compile endif
  53.  
  54.    /* E automatically created an empty file when it started.              */
  55.    /* If user specified file(s) to edit, get rid of the empty file.       */
  56. do i=1 to 1
  57.    getfileid emptyfileid, UNNAMED_FILE_NAME
  58.    if emptyfileid='' then             -- User deleted it?
  59.       leave
  60.    endif
  61.    if emptyfileid.modify then         -- User changed it?
  62.       leave
  63.    endif
  64.    if newfileid=emptyfileid then      -- Check if others in ring.
  65. compile if EVERSION < 5
  66.       if messy then nextwindow else nextfile endif
  67.       getfileid newfileid
  68.       if messy then prevwindow else prevfile endif
  69. compile else
  70.       nextfile
  71.       getfileid newfileid
  72.       prevfile
  73. compile endif
  74.    endif
  75.    if newfileid<>emptyfileid then
  76.       activatefile emptyfileid
  77.       'xcom q'
  78. compile if EPM and MENU_LIMIT
  79.       call updateringmenu()
  80. compile endif
  81.       activatefile newfileid
  82.       call select_edit_keys()
  83.    endif
  84. end
  85.  
  86. compile if CURSOR_ON_COMMAND and not EPM
  87.    cursor_command
  88. compile endif
  89.  
  90. compile if EPM
  91.  compile if INCLUDE_MENU_SUPPORT
  92.    showmenu activemenu   /* show the default EPM menu           */
  93.   compile if DEBUG_MAIN
  94.    messageNwait('DEFMAIN: after SHOWMENU')
  95.   compile endif
  96.  compile endif
  97.    if should_showwindow then
  98.       call showwindow('ON')
  99.  compile if DEBUG_MAIN
  100.    messageNwait('DEFMAIN: after SHOWWINDOW')
  101.  compile endif
  102.    endif
  103. compile endif
  104.  
  105. compile if WANT_PROFILE
  106.  compile if WANT_PROFILE='SWITCH'
  107.    if REXX_PROFILE then
  108.  compile endif
  109.       profile = 'profile.erx'
  110.       findfile profile1, profile, EPATH
  111.       if rc then findfile profile1, profile, 'PATH'; endif
  112.       if not rc then 
  113.          'rx' profile1 arg(1)
  114.       endif
  115.  compile if WANT_PROFILE='SWITCH'
  116.    endif 
  117.  compile endif
  118. compile endif
  119.