$!----------------------------------------------------------------------------- $! STYLE_WASDOC.COM $! $! turn WASDOC.CSS into a C header file $! (just too easy to text-process on [Open]VMS! :-) $! $! 25-MAR-2019 MGD initial $!----------------------------------------------------------------------------- $! $ h_file_name = "[]css.h" $ css_file_name = "[.doc]wasdoc.css" $ if f$search(h_file_name) .nes. "" then delete/nolog/noconfirm 'h_file_name';* $! $ on error then goto controlY $ on controly then goto controlY $! $ if f$trnlnm("HFILE","LNM$PROCESS") .nes. "" then close hfile $ if f$trnlnm("CSSFILE","LNM$PROCESS") .nes. "" then close cssfile $ open /read cssfile 'css_file_name $ open /write hfile 'h_file_name $! $ write hfile "/* generated from ''css_file_name' by HTML_STYLE.COM */" $ write hfile "/* DO NOT EDIT this file - edit ''css_file_name' " + - "and @HTML_STYLE.COM */" $ write hfile "" $ write hfile "#ifndef STYLE_DEFAULT" $ write hfile "#define STYLE_DEFAULT ""\" $! $ read_loop: $ read /end=end_read_loop cssfile line $ length = f$length(line) $ if f$locate("\",line) .le. length $ then $! (escape backslashes) $ line2 = "" $ escape_loop: $ length = f$length(line) $ pos = f$locate("\",line) $ if pos .ge. length then goto end_escape_loop $ line2 = line2 + f$extract(0,pos,line) + "\\" $ line = f$extract(pos+1,999,line) $ if line .nes. "" then goto escape_loop $ end_escape_loop: $ line = line2 + line $ line2 = "" $ length = f$length(line) $ endif $ if f$locate("""",line) .le. length $ then $! (escape double quotes) $ line2 = "" $ escape_loop: $ length = f$length(line) $ pos = f$locate("""",line) $ if pos .ge. length then goto end_escape_loop $ line2 = line2 + f$extract(0,pos,line) + "\""" $ line = f$extract(pos+1,999,line) $ if line .nes. "" then goto escape_loop $ end_escape_loop: $ line = line2 + line $ line2 = "" $ length = f$length(line) $ endif $ if f$locate("'",line) .le. length $ then $! (escape single quotes) $ line2 = "" $ escape_loop: $ length = f$length(line) $ pos = f$locate("'",line) $ if pos .ge. length then goto end_escape_loop $ line2 = line2 + f$extract(0,pos,line) + "\'" $ line = f$extract(pos+1,999,line) $ if line .nes. "" then goto escape_loop $ end_escape_loop: $ line = line2 + line $ line2 = "" $ length = f$length(line) $ endif $ write hfile line + "\n\" $ goto read_loop $ end_read_loop: $! $ write hfile """" $ write hfile "#endif" $ write hfile "" $ write hfile "/* end */" $! $ close hfile $ close cssfile $! $ purge /nolog 'h_file_name $! $ exit $! $ controlY: $ if f$trnlnm("HFILE","LNM$PROCESS") .nes. "" then close hfile $ if f$trnlnm("CSSFILE","LNM$PROCESS") .nes. "" then close cssfile $ exit 44 $! $!-----------------------------------------------------------------------------