> >       TCL_OBJ_CMD( "encrypt", Rivet_EncryptCmd );
> >       TCL_OBJ_CMD( "decrypt", Rivet_DecryptCmd );
> >       TCL_OBJ_CMD( "crypt", Rivet_CryptCmd );
> 
> I would encourage you to take a look at the WebSh implementation of
> this, just for kicks.  If you don't have the code already, the CVS is
> the same except for 'tcl-websh' instead of 'tcl-rivet'.  They have a
> lot of commands and code built in, and where possible, I would like to
> share.

    I'll take a look at 'em.

> >    * Rivet_HexToDigit --
> >    * Rivet_UnescapeStringCmd --
> >    * Rivet_EscapeStringCmd --
> 
> What do these have that the relevant Apache functions don't?
> ap_os_escape_path and ap_unescape_url, to wit.

    The difference is that librivet will not have to link to Apache for
any of its functions.  It can be compiled and loaded as a Tcl library
without ever having to have Apache.

> >    * Rivet_EscapeSgmlCharsCmd --
> 
> >     switch(c) {
> >         case '&':
> >             *newStringP++ = '&';
> >             *newStringP++ = 'a';
> >             *newStringP++ = 'm';
> >             *newStringP++ = 'p';
> >             *newStringP++ = ';';
> >             break;
> >         case '<':
> >             *newStringP++ = '&';
> >             *newStringP++ = 'l';
> >             *newStringP++ = 't';
> >             *newStringP++ = ';';
> >             break;
> >         case '>':
> >             *newStringP++ = '&';
> >             *newStringP++ = 'g';
> >             *newStringP++ = 't';
> >             *newStringP++ = ';';
> >             break;
> >         case '\'':
> >             *newStringP++ = '&';
> >             *newStringP++ = '#';
> >             *newStringP++ = '3';
> >             *newStringP++ = '9';
> >             *newStringP++ = ';';
> >             break;
> >         case '"':
> >             *newStringP++ = '&';
> >             *newStringP++ = 'q';
> >             *newStringP++ = 'u';
> >             *newStringP++ = 'o';
> >             *newStringP++ = 't';
> >             *newStringP++ = ';';
> >             break;
> 
> What is the purpose of these?  Just to escape things that might be
> HTML relevant, or...?

    Basically.  I never really understood it when it was in NWS, but
it comes in really handy when you're trying to show code examples on a
webpage.  You can just go:

puts [escape_sgml_chars "<? some code example ?>"

    And it won't actually put the code.  It'll put the text.

D

Reply via email to