Below there is a typical cgi function that joins a Javascript and Html file.
As you can see I need several strtran to substitute runtime data and
the number of strtrans can be high in more complex examples.

My guess is that calling several strtran C functions is still faster
than using a prg that parse the string and does the substitutions.

What I'm looking for is a single C function that replace all the
expressions between $%...%$ ( it could be everything else XML
complaint like ${...} )
with the value and return the string sth like cContent := evaluate( cContent ).

Is there any other way to achieve the goal?

best regards,
Lorenzo


#xcommand APPENDFILE <f> TO <v> => #pragma __streaminclude <f>|<v>+=%s

FUNCTION_DYNAMIC_MAIN()

   local cContent := ""
   local cUsrNam := HB_USERNAME()

   ...

   cContent += "<link rel=\"stylesheet\" type=\"text/css\"
href=\"http://$%cHost%$/desktop.css?$%cTime%$\"; />"
   cContent += "<script type=\"text/javascript\">"

   appendfile "desktop.js" to cContent

   cContent += "</script>"
   cContent += "</head>"

   appendfile "desktop.html" to cContent

   ...

   cContent = strtran( cContent, '$%cUsrNam%$', cUsrNam )

   ...

   cContent = strtran( cContent, "$%cTime%$", HB_TTOS( HB_DATETIME() ) )

   ...
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to