$title Generates HTM Model Library Files (GAMSHTM,SEQ=215)
$onText
Generates HTM model library files.
GAMS Development Corporation, Modeling Tool Box.
Generates all .htm related files for a set of models
found in gamsmod.inc. Uses unpublished and
unsupported PUT_Utilities features.
The file gamsmod.inc is the master file for all other
derived files.
Files generated:
seqindx.htm
subindx.htm
modlist.tex
alfindx.htm
*.htm for all model and include files
All files $included, read and written have to be in the same
directory. This program can be execute from another location
by using the GAMS parameter U1, for example:
>gams gamshtm.215 U1=c:\oldd\alex\gams\gamslib\ver008\test\
Keywords: GAMS language features, GAMS model library, generating htm files
$offText
$setglobal gamslib '%gams.u1%'
File
htm 'HTML file handle' / htm.htm /
seqindx 'HTML sequence index' / '%gamslib%seqindx.htm' /
subindx 'HTML subject index' / '%gamslib%subindx.htm' /
alfindx 'HTML alpha index' / '%gamslib%alfindx.htm' /
modlist 'TeX subject index' / '%gamslib%modlist.tex' /;
Scalar first;
$offListing
$include "%gamslib%gamsmod.inc"
$onListing
*
* model htm files
*
put htm;
htm.pw = 4096;
htm.lcase = 1;
loop(sm(s,m),
put_utilities 'ren'/ '%gamslib%' m.tl:0 '.htm';
put '
' m.tl:0 '.gms'
/ ''
/ ''m.tl:0 '.gms : ' m.te(m) '
';
put / '
';
put_utilities 'htm'/ '%gamslib%' m.tl:0 '.' s.tl:0;
put / '
';
if(big(s), put 'Large '; else put 'Small ';);
put 'Model of Type';
put$(sum(ts(t,s),1)>1) 's';
put ':';
htm.lcase = 2;
loop(tss(t,s), put ' ' t.tl;);
htm.lcase = 1;
loop(ts(t,s)$(not tss(t,s)), put ' ' t.tl;);
first = 1;
loop(incmap(inc,s),
if(first,
put ' Includes:'; first = 0;);
put$(not bininc(inc)) ' ' inc.tl:0 '';
put$bininc(inc) ' ' inc.tl:0 '';
);
put '
'
/ ''
/ '';
* Either we do the < > replacement or we use plaintext
* / ''
* / ''
* / ''
);
*
* include htm files
*
loop(inc$(not bininc(inc)),
put_utilities 'ren'/ '%gamslib%' inc.tl:0 '.htm';
put ' ' inc.tl:0 ''
/ ''
/ ''inc.tl:0 ' : ' inc.te(inc) '
'
/ '
Used by:';
loop((incmap(inc,s),sm(s,m)),
put ' ' m.tl:0 '.gms';);
put / '
'
/ ''
/ ''
/ '
'
/ ''
/ '';
);
*
* seqindx
*
seqindx.lcase = 1;
put seqindx
' GAMS Model Library Chronological Index'
/ ''
/'Model Library Chronological Index
'
/'This is a listing of the model library in order of'
/'submission date. The newest ones are at the top.'
/''
/'There is also an author index,'
/'a subject index,'
/'and an alphabetical index.'
/'
'
/ '
'
/ ''
/ ' No | '
/ ' Model | '
/ ' Description | '
/ ' Type | '
/ '
';
loop((srev(ss,s),sm(s,m))$(not deprecated(s)),
put / ''
/ ' ',s.tl:0,' | '
/ ' ', m.tl:0, ' | '
/ ' ',m.te(m):0,' | '
/ ' ';
seqindx.lcase = 2;
loop(tss(t,s), put t.tl:0;);
put ' | '
/ '
';
seqindx.lcase = 1;
);
put / '
'
/ ''
/ '';
*
* subindx
*
subindx.lcase = 1;
put subindx
' GAMS Model Library Subject Index'
/ ''
/'Model Library Subject Index
'
/'The following subject areas are covered:'
/''
/''
/''
/'There is also an alphabetical index'
/'an author index,'
/'and a chronological index.';
loop(a,
put /'
'
/''
/''
/' Model'
/' | Description'
/' | Type'
/' |
';
loop((m,as(a,s),sm(s,m))$(not deprecated(s)),
put / ''
/ ' ', m.tl:0, ' | '
/ ' ',m.te(m):0,' | '
/ ' ';
subindx.lcase = 2;
loop(tss(t,s), put t.tl:0;);
put ' | '
/ '
';
subindx.lcase = 1;
);
put / '
';
);
put / ''
/ '';
*
* modlist
*
modlist.lcase = 1;
put modlist
'% Model library listed by application area' /
loop(a,
put /
/'\subsubsection*{' a.te(a):0 '}' /
/'\begin{modellist}'
/'\Mname{\normalfont\textbf{Name}}'
'\Mdesc{\textbf{Description}}'
'\Mtype{\textbf{Type}}'
'\Mnumber{\textbf{No.}}'
loop((m,as(a,s),sm(s,m))$(not deprecated(s)),
put / '\Mname{\textbf{' m.tl:0 '}}'
'\Mdesc{' m.te(m):0 '}';
modlist.lcase = 2;
loop(tss(t,s), put '\Mtype{' t.tl:0 '}';);
put '\Mnumber{' s.tl:0 '}' /;
modlist.lcase = 1;
);
put / '\end{modellist}';
);
*
* alfindx
*
alfindx.lcase = 1;
put alfindx
' GAMS Model Library Alphabetical Index'
/ ''
/'Model Library Alphabetical Index
'
/'This is an alphabetical listing of the models available'
/'in the on-line model library.'
/'There is also an author index,'
/'a subject index, and'
/'a chronological index.'
/'Shortcuts: ';
alfindx.lcase = 2;
loop(letters, put alfindx ' ' letters.tl:0 '' /;);
alfindx.lcase = 1;
put alfindx
/'
'
/''
/' | '
/' Model | '
/' Description | '
/' Type | '
/ '
';
loop(m,
if(letters(m),
alfindx.lcase = 2;
put /''
/' | '
/'', m.tl:0, ' | '
/'
';
alfindx.lcase = 1;
else
if(not sum(sm(deprecated(s),m),1),
put / ''
* |
/ ' | '
/ ' ', m.tl:0, ' | '
/ ' ', m.te(m):0, ' | '
/ ' ';
alfindx.lcase = 2;
loop(sm(s,m),
loop(tss(t,s), put t.tl:0;);
put ' | '
/ '
';
alfindx.lcase = 1;
);
);
);
);
put / '
'
/ ''
/ '';
$exit