home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: SysTools
/
SysTools.zip
/
spm2.zip
/
spmapp03.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-10-20
|
4KB
|
188 lines
/* */
if Pop() <> 0 then exit 9903
Drive = filespec('Drive',OUTFILE)
Path = filespec('Path', OUTFILE)
Name = filespec('Name', OUTFILE)
if Name = '' then Name = 'SPMCTRGP.H'
mapfile = Drive||Path||Name
say GetMsg(23,mapfile,INIFILE)
say GetMsg(8,'03')
x = Types()
'@del' mapfile
if stream(mapfile,'c','query exists') <> ''
then
do
say GetMsg(22,mapfile)
exit 20
end
IF STREAM(MAPFILE,'C','OPEN WRITE') <> 'READY:'
then
do
say GetMsg(10,mapfile)
exit 10
end
x = Retrieve('SPM','VERSION','Ver')
cpgd = s2d(substr(Ver,1,2))
str = translate(substr(Ver,27),' ',',')
spmvrm = word(str,1)
os2vrm = word(str,2)
x = PunchHeader()
x = Retrieve('SPM','ELEMENTS','PgdList')
x = Retrieve('SPM','NAMES','PgNames')
x = Retrieve('SPM','DESC','PgDesc')
do i = 1 to cpgd
Pgd = substr(PgdList,(i*8)-7,8)
Ord = s2d(substr(Pgd,1,2))
PName = szstr(PgNames,s2d(substr(Pgd,5,2))+2)
if substr(Pgd,1,2) = substr(Pgd,3,2)
then
do
Grp = '_'||Ord
x = Retrieve(Grp,'ELEMENTS','Sgd')
x = Retrieve(Grp,'NAMES','Names')
x = Retrieve(Grp,'TAGS','Tags')
x = Retrieve(Grp,'DESC','Descriptions')
x = PunchGroup()
end
else
do
x = PunchAlias()
end
end
x = PunchTrailer()
x = stream(mapfile,'c','close')
say ' '
say GetMsg(9,'03')
return 0
/* * * * * * * * * */
PunchHeader:
x = lineout(mapfile,' /* generate date/time '||date()||' '||time()||' */')
x = lineout(mapfile,' ')
x = lineout(mapfile,'#ifndef SPM_COUNTERS_DEFINED ')
x = lineout(mapfile,'#define SPM_COUNTERS_DEFINED ')
x = lineout(mapfile,' ')
x = SPMAPP05(mapfile)
x = lineout(mapfile,' ')
x = lineout(mapfile,' /* spm level' spmvrm', os2 level' os2vrm '*/')
return 0
/* * * * * * * * * */
PunchGroup:
PDesc = szstr(PgDesc,s2d(substr(Pgd,7,2))+2)
STag = szstr(Tags,2)
BName = PName
x = PutDot() /* say '.. Ordinal 'Ord '"'PName'" tag 'STag */
x = lineout(mapfile,' ')
x = lineout(mapfile,'#ifndef SPMOrdinal_'||STag)
x = lineout(mapfile,'#define SPMOrdinal_'||STag||' '||Ord)
x = lineout(mapfile,' typedef')
x = lineout(mapfile,' struct _'||STag||' { /* "'||PName||'" - "'||PDesc||'" */')
ctEL = s2d(substr(Sgd,9,2))
do j = 1 to ctEL
Sel = substr(Sgd,(j*8)+3,8)
fsType = s2d(substr(Sel,2,1))
Type = TypeFld.fsType
Name = szstr(Names,s2d(substr(Sel,3,2))+2)
Tag = szstr(Tags,s2d(substr(Sel,5,2))+2)
Desc = szstr(Descriptions,s2d(substr(Sel,7,2))+2)
x = lineout(mapfile,' '||Type||' '||Tag||'; /* "'||Name||'" - "'||Desc||'" */')
end
x = lineout(mapfile,'#ifdef SPMCtrGpExtension_'||STag)
x = lineout(mapfile,' SPMCtrGpExtension_'||STag)
x = lineout(mapfile,'#endif')
x = lineout(mapfile,' } '||STag||';')
x = lineout(mapfile,'#endif')
return 0
/* * * * * * * * * */
PunchAlias:
msg = 'Ordinal '||Ord||' "'||PName||'" is an alias for "'||BName||'"'
x = PutDot() /* say '..' msg */
x = lineout(mapfile,' /* '||msg||' */')
return 0
/* * * * * * * * * */
PunchTrailer:
x = lineout(mapfile,' ')
x = lineout(mapfile,'#endif /* end of SPM_COUNTERS_DEFINED */')
return 0
/* * * * * * * * * */
Types:
x = Retrieve('DCL','fieldtyp','Types')
Tc = s2d(substr(Types,1,2))
Td = substr(Types,3,Tc*4)
Tn = substr(Types,3+length(Td))
j = 4 * Tc
q = 0
do i = 1 to j by 4
TypeFld.q = szstr(Tn,s2d(substr(Td,i,2))+2)
q = q + 1
end
return 0
/* * * * * * * * * */
Retrieve:
parse arg _app,_key,_item
_data = SysIni(INIFILE,_app,_key)
if _data = 'ERROR:'
then
do
say GetMsg(14,_app,_key)
exit 14
end
else
do
interpret _item '= _data'
return 0
end