home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / wps / editor / epmtools / epmmac / main.e < prev    next >
Encoding:
Text File  |  1993-04-07  |  3.8 KB  |  134 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 EPM
  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 endif
  35.  
  36. compile if (EPM and (HOST_SUPPORT='EMUL' | HOST_SUPPORT='E3EMUL') and not defined(my_SAVEPATH)) or DELAY_SAVEPATH_CHECK
  37.    call check_savepath()
  38. compile endif
  39.  
  40. compile if SUPPORT_USER_EXITS
  41.    if isadefproc('defmain_exit') then
  42.       call defmain_exit(doscmdline)
  43.    endif
  44. compile endif
  45.  
  46.    doscmdline                    -- Execute the doscmdline.
  47.  
  48. compile if DEBUG_MAIN
  49.    messageNwait('DEFMAIN: after DOSCMDLINE')
  50. compile endif
  51.  
  52.    getfileid newfileid
  53. compile if EVERSION < 5
  54.    if 'e'<>doscmdline then  /* Put doscmdline into coms stack if nontrivial.*/
  55.       getline line,comsfileid.last,comsfileid
  56.       if line<>doscmdline then  -- Don't duplicate last line
  57.          if comsfileid.last > 30 then deleteline 1,comsfileid endif  -- trim if too big
  58.          insertline doscmdline,comsfileid.last+1,comsfileid
  59.       endif
  60.    endif
  61. compile endif
  62.  
  63.    /* E automatically created an empty file when it started.              */
  64.    /* If user specified file(s) to edit, get rid of the empty file.       */
  65. do i=1 to 1
  66.    getfileid emptyfileid, UNNAMED_FILE_NAME
  67.    if emptyfileid='' then             -- User deleted it?
  68.       leave
  69.    endif
  70.    if emptyfileid.modify then         -- User changed it?
  71.       leave
  72.    endif
  73.    if newfileid=emptyfileid then      -- Check if others in ring.
  74. compile if EVERSION < 5
  75.       if messy then nextwindow else nextfile endif
  76.       getfileid newfileid
  77.       if messy then prevwindow else prevfile endif
  78. compile else
  79.       nextfile
  80.       getfileid newfileid
  81.       prevfile
  82. compile endif
  83.    endif
  84.    if newfileid<>emptyfileid then
  85.       activatefile emptyfileid
  86.       'xcom q'
  87. compile if EPM and MENU_LIMIT
  88.       call updateringmenu()
  89. compile endif
  90.       activatefile newfileid
  91.       call select_edit_keys()
  92.    endif
  93. end
  94.  
  95. compile if CURSOR_ON_COMMAND and not EPM
  96.    cursor_command
  97. compile endif
  98.  
  99. compile if EPM
  100.  compile if INCLUDE_MENU_SUPPORT
  101.    showmenu activemenu   /* show the default EPM menu           */
  102.   compile if SUPPORT_USERS_GUIDE
  103.    'postme cascade_menu 620'
  104.   compile endif
  105.   compile if SUPPORT_TECHREF
  106.    'postme cascade_menu 630'
  107.   compile endif
  108.   compile if DEBUG_MAIN
  109.    messageNwait('DEFMAIN: after SHOWMENU')
  110.   compile endif
  111.  compile endif
  112.    if should_showwindow then
  113.       call showwindow('ON')
  114.  compile if DEBUG_MAIN
  115.    messageNwait('DEFMAIN: after SHOWWINDOW')
  116.  compile endif
  117.    endif
  118. compile endif
  119.  
  120. compile if WANT_PROFILE
  121.  compile if WANT_PROFILE='SWITCH'
  122.    if REXX_PROFILE then
  123.  compile endif
  124.       profile = 'profile.erx'
  125.       findfile profile1, profile, EPATH
  126.       if rc then findfile profile1, profile, 'PATH'; endif
  127.       if not rc then
  128.          'rx' profile1 arg(1)
  129.       endif
  130.  compile if WANT_PROFILE='SWITCH'
  131.    endif
  132.  compile endif
  133. compile endif
  134.