home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / pmcstex.zip / install / pm4EPM.e < prev    next >
Text File  |  2000-04-02  |  19KB  |  551 lines

  1. /* 
  2.   pm4epm.e
  3.   Routines by PM (Petr Mikulik) for EPM --- pm_command family: commands 
  4.   with expansion dependent on the currently edited file or its master.
  5.  
  6.   This file belongs to the "pmCSTeX for EPM" package, see 
  7.     http://www.sci.muni.cz/~mikulik/os2/pmCSTeX.html
  8.   or pmcstex.zip on hobbes, leo and CTAN archives.
  9.  
  10.   Copyright  1996  Petr Mikulik
  11.   -----------------------------
  12.   License: free-latex     distributed under the same terms as LaTeX
  13.   This program can be redistributed and/or modified under the terms
  14.   of the LaTeX Project Public License Distributed from CTAN
  15.   archives in directory macros/latex/base/lppl.txt; either
  16.   version 1 of the License, or any later version.
  17.  
  18.   License meaning in short: use and distribution permitted, like any 
  19.   freeware. Package must be distributed together with the source code. 
  20.   Reuse of the source code or any part of it is allowed. Any changes or
  21.   enhancement to this package must involve a change of name unless these
  22.   changes are accepted by the author. You are welcome to submit your 
  23.   bugfixes, updates or new features.
  24.     Because the program is licensed free of charge, there is no warranty 
  25.   for any of its component. You are responsible for any software, hardware, 
  26.   human or nature disaster resulting from installing and using of this 
  27.   package.
  28.  
  29.  
  30.   Author's address:
  31.   -----------------
  32.   Petr Mikulík
  33.   Department of Solid State Physics 
  34.     and Laboratory of Thin Films and Nanostructures
  35.   Faculty of Science
  36.   Kotlarska 2 (Kotl\'a\v rsk\'a 2)
  37.   Masaryk University
  38.   Brno
  39.   Czech Republic
  40.  
  41.   mikulik@physics.muni.cz
  42.   http://www.sci.muni.cz/~mikulik/
  43.  
  44.  
  45.   History:
  46.   --------
  47.   Support &%latex format syntax: 2.4.2000
  48.   Update for MakeIndex options: 13.4.1997
  49.   Update for master file to be
  50.   firstly searched in the 
  51.   directory of the working file:
  52.                  4.1.1997, 15.1.1997, 11.2.1997
  53.   Update for emtex options:    17.5.1996
  54.   Update for dvips options:    15.5.1996
  55.   Original version:        20.2.1996
  56.  */
  57.  
  58.  
  59. /* 
  60. USAGE: I use this macro file for actions on the EPM toolbar, and in the package 
  61. CSTeX that implements menu for many (La)TeX related commands.
  62.  
  63. INSTALLATION: 
  64.   1. cite this file (pm4epm) in the  actions.lst  file
  65.   2. write  'link pm4epm'  into your Profile.erx
  66.  
  67. COMMANDS DEFINED HERE:
  68.  pm_expand        - expands the string and then executes it
  69.  pm_command_os2     - expands the string and runs it as os2 program
  70.  pm_command_os2fs    - expands the string and runs full-screen os2 program
  71.  pm_command_cmd      - expands the string and runs it through cmd
  72.  pm_command_pm      - expands the string and runs it (only START)
  73.  pm_command_dos     - expands the string and runs it as dos program
  74.  pm_command_dosfs    - expands the string and runs full-screen dos program
  75.  etc. 
  76.  
  77. The expansion depends on the edited file (currently active file in the editor). 
  78.  
  79. SYNTAX of pm_expand WITH EXAMPLE: work file is e:\tmp\a.tex => 
  80.  
  81. Syntax      Internal Variable    Explanation            Example
  82. %w      EFname        work file name          a
  83. %.w      EFext             work file extension        tex
  84. %W      EFwholename        full name without extension    e:\tmp\a
  85. %.W      EF            full name            e:\tmp\a.tex
  86.  
  87. Note: pm_expansion('%.W') equals .filename
  88.  
  89. The same holds for the Master file specified by the MASTER: key (see below):
  90. %m     %.m   %M   %.M
  91.  
  92. Both types written in the Unix format (i.e. backslahes replaced by slashes): 
  93. %x %.x %X %.X    for the work file      e.g.  %.X = e:/tmp/a.tex
  94. %n %.n %N %.N    for the master file
  95.  
  96. %h MFdrive        drive of the master file (e:)
  97. %d MainDirectory    directory of the master file (\tmp)
  98. %D XMainDirectory    directory in the Unix format (/home/petr/tex)
  99.  
  100. Key specifications: 
  101. The work file can have some of the following keyword written on its first line. 
  102. They are expanded as well according to this rules:
  103.  
  104. Syntax     Internal Variable    Introducing key word    If key not specified
  105. %master     MF          Master:           MF := EF
  106. %format     TheFormat       Format:           envir. var. TEXFORMATDEFAULT 
  107.                              of "latex"
  108. %etc       TheEtc        Etc:            empty string
  109. %orient   TheOrient        Orientation:        empty string
  110. %choice   TheChoice        Choice:          empty string
  111.  
  112. Synonym to the 'Format: myformat' is '%&myformat' starting the command line; 
  113. this allows to accept cweb/unix (?) style of format determination.
  114.  
  115. The following are expanded as verbatims, e.i. from the first char occuring after 
  116. the key to the next same char:
  117. %opts                Opts:            empty string
  118. %viewopts            ViewOpts:        empty string
  119. %optsdvips            dvips:            empty string
  120. %optsemtex            EmtexOpt:        empty string
  121. %optsmakeindex        makeindex:        empty string
  122.  
  123. The syntax $(Name) expands environmental variable Name
  124.  
  125.  
  126. *** Example 1 ***
  127. We edit file E:\TEXT\FERDA.TEX having the first line
  128. % Master: SEKORA.TEX  Format: latex209  Choice: none
  129.  
  130. Then commands are expanded:
  131. "copy %.W %W.old"        => "copy E:\TEXT\FERDA.TEX E:\TEXT\FERDA.old"
  132. "type %w%.w"            => "type FERDA.TEX"
  133. "%format.cmd %.N"        => "latex209.cmd E:/TEXT/SEKORA.TEX"
  134. "echo %choice *%etc*"       => "echo none **"
  135.  
  136. *** Example 2 ***
  137. We edit file E:\TEXT\BROUK.TEX having the first line
  138. % ViewOpts: +/tr1 /m1440+ Etc: does not exist Opts: =any other=
  139. "start cmd /c cykl %.W %format.cmd %N" =>
  140.    "start cmd /c cykl E:\TEXT\BROUK.TEX latex.cmd E:/TEXT/BROUK"
  141. "start /fs dviscr %viewopts %M.dvi" =>
  142.   "start /fs dviscr /tr1 /m1440 e:\text\brouk.dvi"
  143.  
  144. */
  145.  
  146. include 'stdconst.e'
  147.  
  148.  
  149. /************************ CONSTANTS *********************************/
  150.  
  151. const
  152.  
  153.  PM_STARTos2   = 'start /C /WIN '
  154.  PM_STARTos2fs = 'start /C /FS '
  155.  PM_STARTcmd   = 'start /C /WIN cmd /c '
  156.  PM_STARTpm    = 'start '
  157.  PM_STARTdos   = 'start /C /WIN /DOS command.com /c '
  158.  PM_STARTdosfs = 'start /C /FS /DOS command.com /c '
  159.  
  160. /* Message strings */
  161.  
  162.  pm_expand_inf = "Expand command with: Work file: %w (name) %.w (ext) %W (path\name) %.W (full name); Main drive:\dir %d; 'MASTER:' file: %m %.m %M %.M; 'FORMAT:' %format 'ORIENTATION:' %orient; 'ETC:' %etc; 'CHOICE:' %choice; Verbatims: 'EMTEXOPT:' %optsemtex; 'DVIPS:' %optsdvips; 'VIEWOPTS:' %viewopts; 'OPTS:' %opts"
  163.  pm_command_os2_inf = "Expand command line (as pm_expand) and execute OS/2 exe program"
  164.  pm_command_os2fs_inf = "Expand command line (as pm_expand) and execute full-screen OS/2 exe program"
  165.  pm_command_cmd_inf = "Expand command line (as pm_expand) and execute .cmd file"
  166.  pm_command_pm_inf = "Expand command line (as pm_expand) and execute Prezentation Manager program"
  167.  pm_command_dos_inf = "Expand command line (as pm_expand) and execute dos exe program"
  168.  pm_command_dosfs_inf = "Expand command line (as pm_expand) and execute dos exe program (full screen)"
  169.  
  170.  
  171. /* The following command adds the action commands to the list */
  172.  
  173. DEFINIT
  174.   universal pm4epm_MasterNotFound
  175.  
  176. DEFC pm4epm_actionlist
  177. universal ActionsList_FileID
  178.  
  179.  insertline 'pm_expand'pm_expand_inf'pm4epm',ActionsList_FileID.last+1,ActionsList_FileID
  180.  insertline 'pm_command_cmd'pm_command_cmd_inf'pm4epm',ActionsList_FileID.last+1,ActionsList_FileID
  181.  insertline 'pm_command_os2'pm_command_os2_inf'pm4epm',ActionsList_FileID.last+1,ActionsList_FileID
  182.  insertline 'pm_command_os2fs'pm_command_os2fs_inf'pm4epm',ActionsList_FileID.last+1,ActionsList_FileID
  183.  insertline 'pm_command_pm'pm_command_pm_inf'pm4epm',ActionsList_FileID.last+1,ActionsList_FileID
  184.  insertline 'pm_command_dos'pm_command_dos_inf'pm4epm',ActionsList_FileID.last+1,ActionsList_FileID
  185.  insertline 'pm_command_dosfs'pm_command_dosfs_inf'pm4epm',ActionsList_FileID.last+1,ActionsList_FileID
  186.  
  187.  
  188.  
  189. /*************************** ROUTINES ******************************/
  190.  
  191. DEFPROC PM_GetNextWord ( WhichWord, line, uline )
  192. -- routine returns the next word after the keyword  WhichWord  or  WhichWord:
  193. i = wordpos(WhichWord,uline)
  194. if i=0 then i = wordpos(WhichWord':',uline) endif
  195. if i=words(uline) then i=0; TheWord='' endif
  196. if i<>0 then TheWord=word(line,i+1)
  197.          else TheWord='' 
  198.          endif
  199. return TheWord
  200.  
  201.  
  202. DEFPROC PM_GetNextWordOptions ( WhichWord, line, uline )
  203. -- routine scans for WhichWord. The first char of the next word as taken as the 
  204. -- key char. Then line is copied to TheOpts until the next key char appears. 
  205. -- This is similar to \verb*TheOpts...* in LaTeX
  206. i = wordpos(WhichWord,uline)
  207. if i=0 then i = wordpos(WhichWord':',uline) endif
  208. if i=words(uline) then i=0; TheOpts='' endif
  209. if i<>0 
  210.   then TheOpts=subword(line,i+1,words(line)-i)
  211.     KeyChar=substr(TheOpts,1,1); TheOpts=delstr(TheOpts,1,1)
  212.     i=pos(KeyChar,TheOpts)
  213.     if (i<>0) then TheOpts=substr(TheOpts,1,i-1) endif
  214.   else TheOpts=''
  215.   endif
  216. return TheOpts
  217.  
  218.  
  219. DEFPROC PM_SubstKeys ( TheCommand, TheKey, ByWhat )
  220. -- routine substitutes TheKey strings by ByWhat strings in TheCommand
  221. i = pos(TheKey,TheCommand)
  222. do while (i<>0)
  223.    l = length(TheKey)
  224.    TheCommand = substr(TheCommand,1,i-1)ByWhat''substr(TheCommand,i+l,length(TheCommand)-i-l+1)
  225.    i = pos(TheKey,TheCommand)
  226.    end
  227. return TheCommand
  228.  
  229.  
  230. DEFPROC PM_SubstEnvironment ( TheCommand )
  231. -- routine substitutes the environmental variables (like $(PATH)) within TheCommand
  232. i = pos('$(',TheCommand)
  233. do while (i<>0)
  234.    e = substr(TheCommand,i+2,length(TheCommand)-i-2)
  235.    TheCommand = substr(TheCommand,1,i-1)
  236.    i = pos(')',e)
  237.    if i>0 
  238.      then TheCommand=TheCommand''get_env(substr(e,1,i-1))''substr(e,i+1,length(e)-i-1)
  239.      else TheCommand=TheCommand''get_env(substr(e,1,length(e)))
  240.    endif
  241.    i = pos('$(',TheCommand)
  242.    end
  243. return TheCommand
  244.  
  245.  
  246. DEFPROC save_the_ring() =
  247. n = filesinring()
  248. for i = 1 to n
  249.   if .modify then call savefile(.filename); endif
  250.   nextfile
  251.   endfor
  252. return
  253.  
  254. DEFPROC InfoBox( title, text) = --Information box 
  255. call WinMessageBox( title, text, MB_OK + MB_MOVEABLE + MB_INFORMATION )
  256. return
  257.  
  258. /* ErrorBox */
  259. DEFPROC ErrorBox( title, text) =
  260. Beep(440, 133)
  261. call WinMessageBox( title, text, MB_OK + MB_MOVEABLE + MB_ERROR )
  262. return
  263.  
  264. /* Debug box */
  265. DEFPROC DebugBox( text ) =
  266. call WinMessageBox( 'Debugging', text, MB_OK + MB_MOVEABLE + MB_NOICON )
  267. return
  268.  
  269. /* Split file name into parts. Taken from ZWepmTeX.e by Z. Wagner */
  270. DEFPROC split_file_name(var drive, var path, var base, var ext, filespec) =
  271. fn = strip(filespec)
  272. if substr(fn, 2, 1) = ':' then
  273.   drive = substr(fn, 1, 2)
  274.   fn = substr(fn, 3)
  275. else drive = ''
  276. endif
  277. dotpos = lastpos('.', fn)
  278. bspos = lastpos('\', fn)
  279. if dotpos <= bspos then dotpos = length(fn) + 1; endif
  280. path = substr(fn, 1, bspos)
  281. base = substr(fn, bspos+1, dotpos-bspos-1)
  282. ext = substr(fn, dotpos)
  283. return
  284.  
  285. /**************************** DEFINE pm_command **********************/
  286.  
  287. DEFPROC pm_expansion ( TheCommand )
  288.   universal pm4epm_MasterNotFound;
  289.  
  290. /* Read the first line of the current file in order to find Main file */
  291. EF = .filename; MF = ''; 
  292. TheFormat=''; TheEtc=''; TheOrient=''; TheChoice=''; 
  293. TheOpts=''; TheViewOpts=''; TheDvips=''; TheEmtexOpt=''; TheMakeindex=''
  294. pm4epm_MasterNotFound=0 -- clear toggle
  295.  
  296. /*** Analysis of the first line of the current file ***/
  297.  
  298. /* search Master or Master: ; result goes to MF */
  299.  
  300. getline line, 1
  301. uline = translate(line)  -- uppercase
  302. --  parse value uline with . 'MASTER' ':' MF .    -- this would not be case sensitive
  303.  
  304. -- oh... REXX has MFdrive = filespec("Drive",MF), but E not ! 
  305. call split_file_name(EFdrive, EFdir, EFname, EFext, EF)
  306.  
  307. MF=PM_GetNextWord('MASTER',line,uline)
  308. if MF=''
  309.   then MF=.filename; MFisEF=1
  310.   else 
  311.     MFisEF=0; MF = translate(MF,'\','/') -- convert from the unix format
  312.   endif
  313.  
  314. -- the following deals with the case when user specifies only file name
  315. -- It works with absolute path, but not with relative paths having ..\
  316. MFwholename='' -- MFwholename is now used temporarily
  317. if pos('\',MF)=0 then
  318.   if already_in_ring(MF,n) then  -- suggestion by kroni@bite.shnet.org, 16.5.1996
  319.       MF=n.filename
  320.     else
  321.       i=pos(':',MF); if i>0 then MF=substr(MF,i+1,length(MF)-i); endif
  322.       MFwholename=EFdrive''EFdir''MF
  323.       if exist(MFwholename)
  324.     then -- look firstly for the master at the working file's directory
  325.       MF=MFwholename
  326.     else -- no drive letter if specified MF=directory()'\'MF; 
  327.       MF=directory()'\'MF
  328.     endif
  329.     endif
  330.   endif
  331.  
  332. if not exist(MF) then 
  333.     -- beep(444,222); sayerror 'Master file 'MF' not found!'
  334.     if ( (MFwholename='') or (translate(MFwholename)=translate(MF)) )
  335.       then ErrorBox('Error','Master file 'MF' not found!')
  336.       else ErrorBox('Error','Master file 'MFwholename' nor 'MF' not found!')
  337.       endif
  338.     pm4epm_MasterNotFound=1;
  339. --        return 
  340.     endif
  341.  
  342. /* fill MF-compliant variables */
  343.  
  344. -- oh... REXX has MFdrive = filespec("Drive",MF), but E not ! 
  345. call split_file_name(MFdrive, MFdir, MFname, MFext, MF)
  346. -- call split_file_name(EFdrive, EFdir, EFname, EFext, EF) -- up to 4.1.1997
  347.  
  348. if (MFisEF==0) then -- files are different
  349.         if (MFdrive='') then MFdrive=EFdrive endif
  350.         if (MFdir='') then MFdir=EFdir endif
  351.         endif
  352.  
  353. MFdir = delstr(MFdir, length(MFdir)) -- del last backslash
  354. MainDirectory = MFdrive''MFDir
  355. MFext = delstr(MFext, 1,1) -- del .
  356. MFwholename = MainDirectory'\'MFname
  357.  
  358. EFext = delstr(EFext,1,1) -- del .
  359. if (MFisEF=1)
  360.     then  EFdrive=MFdrive; EFdir=MFdir
  361.         else  EFdir = delstr(EFdir, length(EFdir)) -- del last backslash
  362.     endif
  363. EFwholename = EFdrive''EFdir'\'EFname
  364.  
  365. /* Now master file MF and edit file EF are fully qualified. 
  366.     We should read the first line of the master file to get the information 
  367.     about Format, Orientation, Etc, Opts
  368. */
  369.  
  370. if (MFisEF=0) then -- read  line, uline  from Master
  371. if pfile_exists(MF) 
  372.     then  /* if Master file is in the ring */
  373.         getfileid working_fid
  374.         getfileid master_fid,MF
  375.         activatefile master_fid
  376.         getline line, 1
  377.         activatefile working_fid
  378.     else
  379.         'edit /d' MF
  380.         getfileid master_fid
  381.         getline line, 1
  382.         'quit'
  383.     endif
  384. uline = translate(line)
  385. endif
  386.  
  387. /*  Now parse   line   (note: uline is line in uppercase)  */
  388.  
  389. w=word(uline,1); -- support for &%latex syntax of format (2.4.2000)
  390. if substr(w,1,2)='%&' then TheFormat = substr(w,3,length(w)-2); endif
  391. if TheFormat='' then TheFormat=PM_GetNextWord('FORMAT',line,uline) endif
  392. if TheFormat='' then TheFormat=get_env('TEXFORMATDEFAULT') endif
  393. if TheFormat='' then TheFormat='latex' endif
  394.  
  395. TheOrient=PM_GetNextWord('ORIENTATION',line,uline)
  396.  
  397. TheEtc=PM_GetNextWord('ETC',line,uline)
  398.  
  399. TheChoice=PM_GetNextWord('CHOICE',line,uline)
  400.  
  401. -- TheOpts=PM_GetNextWord('OPTS',line,uline)
  402. TheOpts = PM_GetNextWordOptions('OPTS',line,uline)
  403. TheViewOpts = PM_GetNextWordOptions('VIEWOPTS',line,uline)
  404. TheDvips = PM_GetNextWordOptions('DVIPS',line,uline)
  405. TheMakeindex = PM_GetNextWordOptions('MAKEINDEX',line,uline)
  406. TheEmtexOpt = PM_GetNextWordOptions('EMTEXOPT',line,uline)
  407.  
  408. /* Finally perform the substitution on TheCommand
  409. Not for those who want to expand this list: long commands (%opt) must precede 
  410.     the short ones (%o) ! 
  411. */
  412.  
  413. /* strings cannot be empty nor spaces since they will be chained */
  414.  
  415. if EFname='' then EFname=\250 endif
  416. if EFext='' then EFext=\250 endif
  417. if MFname='' then MFname=\250 endif
  418. if MFext='' then MFext=\250 endif
  419. if MainDirectory='' then MainDirectory=\250 endif
  420. if TheFormat='' then TheFormat=\250 endif
  421. if TheOrient='' then TheOrient=\250 endif
  422. if TheEtc='' then TheEtc=\250 endif
  423. if TheChoice='' then TheChoice=\250 endif
  424.  
  425. XMF = translate(MF,'/','\') -- convert to unix format
  426. XMFwholename = translate(MFwholename,'/','\')
  427. XEF = translate(EF,'/','\') 
  428. XEFwholename = translate(EFwholename,'/','\')
  429. XMainDirectory = translate(MainDirectory,'/','\')
  430.  
  431. Shorts = '%% ' -- hide %% sequence
  432. Longs = '!$PETR$! '
  433. Shorts = Shorts'%w %W %.w %.W '
  434. Longs  = Longs''EFname' 'EFwholename' 'EFext' 'EF ' '
  435. Shorts = Shorts'%m %M %.m %.M '
  436. Longs = Longs''MFname' 'MFwholename' 'MFext' 'MF' '
  437. Shorts = Shorts'%x %X %.x %.X '
  438. Longs  = Longs''EFname' 'XEFwholename' 'EFext' 'XEF ' '
  439. Shorts = Shorts'%n %N %.n %.N '
  440. Longs = Longs''MFname' 'XMFwholename' 'MFext' 'XMF' '
  441. Shorts = Shorts'%h %d %D '
  442. Longs = Longs''MFdrive' 'MainDirectory' 'XMainDirectory' '
  443. Shorts = Shorts'%choice %format %etc %orient '
  444. Longs = Longs''TheChoice' 'TheFormat' 'TheEtc' 'TheOrient' '
  445.  
  446. TheCommand=translate(TheCommand,'',\250) -- del those 250
  447.  
  448. /* replace single words */
  449.  
  450. do i = 1 to words(Shorts)
  451.   sh = word(Shorts, i)
  452.   p = pos(sh,TheCommand)
  453.   do while (p<>0)
  454.      l = length(sh)
  455.      TheCommand = substr(TheCommand,1,p-1)word(Longs,i)substr(TheCommand,p+l,length(TheCommand)-p-l+1)
  456.      p = pos(sh,TheCommand)
  457.      end
  458. end
  459.  
  460. /* replace single words by long words (verbatims) */
  461. TheCommand=PM_SubstKeys(TheCommand,'%optsemtex',TheEmtexOpt)
  462. TheCommand=PM_SubstKeys(TheCommand,'%optsdvips',TheDvips)
  463. TheCommand=PM_SubstKeys(TheCommand,'%optsmakeindex',TheMakeindex)
  464. TheCommand=PM_SubstKeys(TheCommand,'%opts',TheOpts)
  465. TheCommand=PM_SubstKeys(TheCommand,'%viewopts',TheViewOpts)
  466. TheCommand=PM_SubstKeys(TheCommand,'!$PETR$!','%%') -- restore %%
  467. TheCommand=PM_SubstEnvironment(TheCommand)
  468.  
  469. /*
  470. sayerror "RESULT="TheCommand
  471. WinMessageBox( 'PM for himself', 'Continue...', MB_OK + MB_MOVEABLE + MB_ERROR)
  472. better: DebugBox('RESULT='TheCommand)
  473. */
  474.  
  475. RETURN TheCommand
  476.  
  477.  
  478.  
  479. /**************************** DEFINE pm_command_cmd **********************/
  480.  
  481. DEFPROC pm_command_start ( action, HowStart, TheCommand, TheInfo )
  482.  
  483. if action = 'S' then    
  484.      /* button launched => replace %xxx sequences and run TheCommand */
  485.     if TheCommand='' then 
  486.         ErrorBox('Please define your action in the icon/edit/customization/parameters')
  487.         return
  488.         endif 
  489.     TheCommand=pm_expansion(TheCommand)
  490. -- how to detect if all is OK?
  491.     save_the_ring()
  492.     HowStart''TheCommand
  493.     return
  494.  
  495. /* this is obsolete now
  496. if (word(TheCommand,1)='-') 
  497.   then TheCommand=subword(TheCommand,2,words(TheCommand)-1)
  498.     sayerror 'STARTing 'TheCommand
  499.     'START 'TheCommand
  500.   elseif (word(TheCommand,1)='--') then
  501.     TheCommand=subword(TheCommand,2,words(TheCommand)-1)
  502. sayerror 'STARTing 'TheCommand
  503.     TheCommand
  504.   else  sayerror PMOS2cmd '"'TheCommand'"'
  505.     PMOS2cmd '"'TheCommand'"'
  506.   endif
  507. */
  508.  
  509. /**** HELP ACTION ****/
  510. elseif action ='H' then sayerror 'Here can be help window or sth like that'
  511. /**** INFO ACTION (button held on the icon) ****/
  512. elseif action ='I' then sayerror TheInfo
  513. else ErrorBox("Error", 'The action 'action' is not implemented')
  514. endif
  515. return
  516.  
  517. /**************** END OF pm_command_start *************************/
  518.  
  519.  
  520. DEFC pm_expand
  521. parse arg action TheCommand
  522. pm_command_start(action,'',TheCommand,pm_expand_inf)
  523.  
  524. DEFC pm_command_os2
  525. parse arg action TheCommand
  526. pm_command_start(action,PM_STARTos2,TheCommand,pm_command_os2_inf)
  527.  
  528. DEFC pm_command_os2fs
  529. parse arg action TheCommand
  530. pm_command_start(action,PM_STARTos2fs,TheCommand,pm_command_os2fs_inf)
  531.  
  532. DEFC pm_command_cmd
  533. parse arg action TheCommand
  534. -- InfoBox('DEFC','action='action'   TheCommand='TheCommand)
  535. pm_command_start(action,PM_STARTcmd,TheCommand,pm_command_cmd_inf)
  536.  
  537. DEFC pm_command_pm
  538. parse arg action TheCommand
  539. pm_command_start(action,PM_STARTpm,TheCommand,pm_command_pm_inf)
  540.  
  541. DEFC pm_command_dos
  542. parse arg action TheCommand
  543. pm_command_start(action,PM_STARTdos,TheCommand,pm_command_dos_inf)
  544.  
  545. DEFC pm_command_dosfs
  546. parse arg action TheCommand
  547. pm_command_start(action,PM_STARTdosfs,TheCommand,pm_command_dosfs_inf)
  548.  
  549. /* end of pm4EPM */
  550.  
  551.