% Remember to use the lgrind style

\File{pipe.c},{15:49},{Nov 25 1998}
\L{\LB{\C{}\1\*_pipeObj}}
\L{\LB{_\*___Reads_an_OpenMath_object_from_\<inDev\>_and_copy_it_to_\<outDev\>.}}
\L{\LB{_\*___Syntax_is_checked_to_detect_poorly_structured_obhects.}}
\L{\LB{_\*___It_is_able_to_dup_an_incomplete_object.}}
\L{\LB{_\*___(ie:_that_lacks_the_bounding_\<OMOBJ\>_\<\1OMOBJ\>}}
\L{\LB{_\*_inDev:_source_device}}
\L{\LB{_\*_outDev:_destibation_device}}
\L{\LB{_\*_return:_0_or_some_error_status}}
\L{\LB{_\*\1\CE{}}}
\L{\LB{\K{static}_\V{OMstatus}}}
\L{\LB{\Proc{pipeObj}\V{pipeObj}(\V{OMdev}_\V{inDev},_\V{OMdev}_\V{outDev})}}
\L{\LB{\{}}
\L{\LB{__\V{OMtokenType}_\V{ttype};}}
\L{\LB{__\V{OMstatus}_\V{status};}}
\L{\LB{__\K{char}_\*\V{buf};}}
\L{\LB{__\V{OMUCS2}_\*\V{wcbuf};}}
\L{\LB{__\K{double}_\V{d};}}
\L{\LB{__\K{int}_\V{i},_\V{l},_\V{sign};}}
\L{\LB{__\V{OMbigIntType}_\V{format};}}
\L{\LB{}}
\L{\LB{__\C{}\1\*_pipes\1skips_comments_(if_any)_\*\1\CE{}}}
\L{\LB{__\V{pipeComments}(\V{inDev},_\V{outDev});}}
\L{\LB{}}
\L{\LB{__\C{}\1\*_checks_for_end_of_parse_\*\1\CE{}}}
\L{\LB{__\K{if}_(\V{status}_=_\V{OMgetType}(\V{inDev},_\&\V{ttype}))_\{}}
\L{\LB{____\K{if}_(\V{status}_==_\V{OMnoMoreToken})}}
\L{\LB{______\K{return}_\V{status};}\Tab{32}{\C{}\1\*_OK_that_may_be_a_normal_exit_condition_\*\1\CE{}}}
\L{\LB{____\V{checkStatus}(\V{status});}\Tab{32}{\C{}\1\*_there_is_something_realy_wrong_\*\1\CE{}}}
\L{\LB{__\}}}
\L{\LB{}}
\L{\LB{__\C{}\1\*_pipes_the_token_depending_on_its_type_\*\1\CE{}}}
\L{\LB{__\K{switch}_(\V{ttype})_\{}}
\L{\LB{__\K{case}_\V{OMtokenInt32}:}}
\L{\LB{____\V{checkStatus}(\V{OMgetInt32}(\V{inDev},_\&\V{i}));}}
\L{\LB{____\V{checkStatus}(\V{OMputInt32}(\V{outDev},_\V{i}));}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{case}_\V{OMtokenFloat64}:}}
\L{\LB{____\V{checkStatus}(\V{OMgetFloat64}(\V{inDev},_\&\V{d}));}}
\L{\LB{____\V{checkStatus}(\V{OMputFloat64}(\V{outDev},_\&\V{d}));}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{case}_\V{OMtokenByteArray}:}}
\L{\LB{____\V{checkStatus}(\V{OMgetByteArray}(\V{inDev},_\&\V{buf},_\&\V{l}));}}
\L{\LB{____\V{checkStatus}(\V{OMputByteArray}(\V{outDev},_\V{buf},_\V{l}));}}
\L{\LB{____\V{free}(\V{buf});}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{case}_\V{OMtokenBigInt}:}}
\L{\LB{____\V{checkStatus}(\V{OMgetBigInt}(\V{inDev},_\&\V{buf},_\&\V{l},_\&\V{sign},_\&\V{format}));}}
\L{\LB{____\V{checkStatus}(\V{OMputBigInt}(\V{outDev},_\V{buf},_\V{l},_\V{sign},_\V{format}));}}
\L{\LB{____\V{free}(\V{buf});}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{case}_\V{OMtokenSymbol}:}}
\L{\LB{____\V{checkStatus}(\V{pipeSymb}(\V{inDev},_\V{outDev}));}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{case}_\V{OMtokenVar}:}}
\L{\LB{____\V{checkStatus}(\V{pipeVar}(\V{inDev},_\V{outDev}));}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{case}_\V{OMtokenString}:}}
\L{\LB{____\C{}\1\*_some_application_may_assume_that_they_only_use_}}
\L{\LB{_____\*_plain_8bits_strings.\,.\,._(this_is_probably_not_a_}}
\L{\LB{_____\*_good_idea_but_it_may_be_ok_if_speed_considerations}}
\L{\LB{_____\*_are_in_balance)}}
\L{\LB{_____\*_tpipe_is_suposed_to_work_on_all_inputs_thus_it}}
\L{\LB{_____\*_must_deal_with_wide_char_strings_(16bits_chars)}}
\L{\LB{_____\*\1\CE{}}}
\L{\LB{____\V{checkStatus}(\V{OMgetWCString}(\V{inDev},_\&\V{wcbuf}));}}
\L{\LB{____\V{checkStatus}(\V{OMputWCString}(\V{outDev},_\V{wcbuf}));}}
\L{\LB{____\V{free}(\V{wcbuf});}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{case}_\V{OMtokenApp}:}}
\L{\LB{____\V{checkStatus}(\V{pipeApp}(\V{inDev},_\V{outDev}));}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{case}_\V{OMtokenEndApp}:}}
\L{\LB{____\V{fatalError}(\N{1},_\S{}\3syntax_error:_\<\1OMA\>_found_out_of_\<OMA\>_scope.\3\SE{});}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{case}_\V{OMtokenAttr}:}}
\L{\LB{____\V{checkStatus}(\V{pipeAttr}(\V{inDev},_\V{outDev}));}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{case}_\V{OMtokenEndAttr}:}}
\L{\LB{____\V{fatalError}(\N{1},_\S{}\3syntax_error:_\<\1OMATTR\>_found_out_of_\<OMATTR\>_scope.\3\SE{});}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{case}_\V{OMtokenAtp}:}}
\L{\LB{____\V{fatalError}(\N{1},_\S{}\3syntax_error:_\<OMATP\>_found_out_of_\<OMATTR\>_scope.\3\SE{});}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{case}_\V{OMtokenEndAtp}:}}
\L{\LB{____\V{fatalError}(\N{1},_\S{}\3syntax_error:_\<\1OMATP\>_found_out_of_\<OMATTR\>_scope.\3\SE{});}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{case}_\V{OMtokenBind}:}}
\L{\LB{____\V{checkStatus}(\V{pipeBind}(\V{inDev},_\V{outDev}));}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{case}_\V{OMtokenEndBind}:}}
\L{\LB{____\V{fatalError}(\N{1},_\S{}\3syntax_error:_\<\1OMBIND\>_found_out_of_\<OMBIND\>_scope.\3\SE{});}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{case}_\V{OMtokenBVar}:}}
\L{\LB{____\V{fatalError}(\N{1},_\S{}\3syntax_error:_\<OMBVAR\>_found_out_of_\<OMBIND\>_scope.\3\SE{});}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{case}_\V{OMtokenEndBVar}:}}
\L{\LB{____\V{fatalError}(\N{1},_\S{}\3syntax_error:_\<\1OMBVAR\>_found_out_of_\<OMBIND\>_scope.\3\SE{});}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{case}_\V{OMtokenError}:}}
\L{\LB{____\V{pipeError}(\V{inDev},_\V{outDev});}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{case}_\V{OMtokenEndError}:}}
\L{\LB{____\V{fatalError}(\N{1},_\S{}\3syntax_error:_\<\1OME\>_found_out_of_\<OME\>_scope.\3\SE{});}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{case}_\V{OMtokenObject}:}}
\L{\LB{____\C{}\1\*_this_object_is_explicitly_enclosed_in_\<OMOBJ\>_.\,.\,._\<\1OMOBJ\>_\*\1\CE{}}}
\L{\LB{____\V{checkStatus}(\V{OMgetObject}(\V{inDev}));}}
\L{\LB{____\V{checkStatus}(\V{OMputObject}(\V{outDev}));}}
\L{\LB{____\C{}\1\*_parse_embeded_elements_\*\1\CE{}}}
\L{\LB{____\V{checkStatus}(\V{pipeObj}(\V{inDev},_\V{outDev}));}}
\L{\LB{____\C{}\1\*_end_object_tag_\*\1\CE{}}}
\L{\LB{____\V{checkStatus}(\V{OMgetEndObject}(\V{inDev}));}}
\L{\LB{____\V{checkStatus}(\V{OMputEndObject}(\V{outDev}));}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{case}_\V{OMtokenEndObject}:}}
\L{\LB{____\V{fprintf}(\V{stderr},_\S{}\3warning:_empty_\<OMOBJ\>\<\1OMOBJ\>!\2n\3\SE{});}}
\L{\LB{____\K{break};}}
\L{\LB{__\K{default}:\{}}
\L{\LB{______\K{char}_\V{tmp}[\N{1024}];}}
\L{\LB{______\V{sprintf}(\V{tmp},_\S{}\3Not_yet_implemented_or_unknown_token_type_(\%d).\2n\3\SE{},_\V{ttype});}}
\L{\LB{______\V{fatalError}(\N{1},_\V{tmp});}}
\L{\LB{____\}}}
\L{\LB{__\}}}
\L{\LB{}}
\L{\LB{__\C{}\1\*_pipes\1skips_comments_(if_any)_\*\1\CE{}}}
\L{\LB{__\V{pipeComments}(\V{inDev},_\V{outDev});}}
\L{\LB{}}
\L{\LB{__\K{return}_\V{OMsuccess};}}
\L{\LB{\}}}
\L{\LB{}}
