in the file: http_header.pl i changed this function below to be able to insert tags inside the html files which will output special html , database fields etc.
is this a bad idea ? is it dangerous or can i do this in this way
reply_file(Out, File, Header, _) :-
setup_call_cleanup(
open(File, read, In, [type(binary)]),
reply_file_line_by_line(0, In, Out, Header ),
close(In)).
process_line( Lx , Out ):-
sub_string( Lx, _P,_,_, "[jajaja]" ) , !,
write( Out, "prolog change prolog change " ), write( Out, "\n" ) .
process_line( Lx , Out ):- !,
write( Out, Lx ), write( Out, "\n" ) .
%----
reply_file_line_by_line( 0 , Sea , Out , Header ):- !,
send_reply_header(Out, Header),
reply_file_line_by_line( 1 , Sea , Out , Header ).
reply_file_line_by_line( Cou , Sea , Out , Header ):- not(at_end_of_stream(Sea)),
read_line_to_string( Sea, Lx ) , Lx \= end_of_file , ! ,
process_line( Lx , Out ),
% write( Out, Lx ), write( Out, "\n" ) ,
Cou2 is Cou + 1 ,
reply_file_line_by_line( Cou2 , Sea, Out, Header ).
reply_file_line_by_line( Cou , Sea, Out, Header):- not(at_end_of_stream(Sea)),!, reply_file_line_by_line( Cou, Sea, Out, Header ).
reply_file_line_by_line( _, _ , _ , _ ):- !.