/*
* A HTML Pretty Printer for ProtoGen protocol definitions
*
* Copyright (c) 1994, 1995, 1996 Gunther Schadow. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
:- module(mkc_html, [html_title/1,html_headline/4,pp_msg/1,html_th/1,
html_td/1]).
:- style_check(+string).
:- ensure_loaded(supp-format).
:- ensure_loaded(pl-tools).
mkc :-
main_package(PM),
assertz(PM:functional_area('',0,'NO CHAPTER')),
( messages; true ),
( segments; true ),
( composites; true ),
( codes; true ),
retract(PM:functional_area('',0,'NO CHAPTER')).
html_title(T) :-
html_header,
main_package(P),
uppercase(P,UP),
format("
~>"), pp_msg(DefL), format("~<~n~n") ); format("
~>"), pp_msg(DefL), format("~<~n~n") ) )), format("~n") )) ); true ) )), html_footer, format(""), told. pp_msg([]). pp_msg([H|T]) :- pp_msg1(H), pp_msg(T). pp_msg1(rep(opt(X))) :- atom(X), uppercase(X, UX), format("~n{ [ ~w ] }", [X, UX]). pp_msg1(opt(rep(X))) :- atom(X), uppercase(X, UX), format("~n[ { ~w } ]", [X, UX]). pp_msg1(rep(X)) :- atom(X), uppercase(X, UX), format("~n{ ~w }", [X, UX]). pp_msg1(opt(X)) :- atom(X), uppercase(X, UX), format("~n[ ~w ]", [X, UX]). pp_msg1(rep(opt(grp(X)))) :- atom(X), uppercase(X, UX), format("~n{ [ ~w ] }", [X, UX]). pp_msg1(opt(rep(grp(X)))) :- atom(X), uppercase(X, UX), format("~n[ { ~w } ]", [X, UX]). pp_msg1(rep(grp(X))) :- atom(X), uppercase(X, UX), format("~n{ ~w }", [X, UX]). pp_msg1(opt(grp(X))) :- atom(X), uppercase(X, UX), format("~n[ ~w ]", [X, UX]). pp_msg1(X) :- X =.. [rep|A], format("~n{~>"), pp_msg(A), format("~<~n}"). pp_msg1(X) :- X =.. [opt|A], format("~n[~>"), pp_msg(A), format("~<~n]"). pp_msg1(X) :- X =.. [any|A], format("~nANY"), anyof(A). pp_msg1(X) :- atom(X), uppercase(X, UX), format("~n~w", [X, UX]). anyof([]). anyof(X) :- format(" OF"), anyof1(X). anyof1([X]) :- uppercase(X, UX), format(" ~w", [X, UX]). anyof1([X, Y]) :- uppercase(X, UX), uppercase(Y, UY), format(" ~w", [X, UX]), format(" AND ~w", [Y, UY]). anyof1([X|R]) :- uppercase(X, UX), format(" ~w,", [X, UX]), anyof1(R). html_th(L) :- format("