Share directory - advice is needed



Great! Thank you very much.

Steve Haflich wrote:

>    From: "Vadim V. Zhytnikov" <vvzhy at mail>
>
>    Share reorganization is on the way but what about converting
>    Maxima Lisp code in /src to lower case? Are we going to
>    do this now? Or later file by file?
>
> This would be a worthy task.  Anyone who wants to undertake it is
> welcome to use a little tool I wrote long ago, appended below.  It is
> a Unix filter that translates mixed-case Common Lisp code into uniform
> lower case.  It should build and run on any Unix or Linux, although I
> haven't been maintaining the code in about a decade.
>
> ========== downcase.l
> %{
> /* downcase -- A Common Lisp case unifier.
>  * smh          -[Fri Feb 16 09:41:44 1990 by smh]-
>  *
>  * Copyright 1990 Steven M. Haflich
>  * Permission is hereby granted for anyone to use this code for any purpose
>  * whatever at his own risk, proivided this copyright is preserved in all
>  * copies of this program.  No warrantee is stated, assumed, or implied.
>  *
>  * This quick hack is a filter for Common Lisp source code to allow
>  * code with inconsistent mixedcase to be compiled and run in a
>  * case-sensitive-lower Allegro CL image.
>  * It takes standard CL with mixed case and downcases all the code, leaving
>  * comments and strings alone.  Any symbol that has backslash or vertical-bar
>  * escapes is also left alone.  This probably doesn't cope with all standard
>  * lisp syntax, so send bugs to smh@franz.com and I'll try to fix them.
>  * But what do you want from a program that's nearly all punctuation?
>  * (God created Unix regular expression syntax only so we finite-state
>  * automata could have something to try to understand.)
>  *
>  * This does handle standard syntax strings, comments, #| ... |#, symbols
>  * with multiple escape chars, and single escape chars everywhere it should.
>  * It does not handle nested #| ... |# constructs.
>  *
>  * After running a case-insensitive Common Lisp source file through this
>  * filter, here are the things for which you typically still need to search.
>  * (The quoted strings are literals for which you might search.)
>  *   Calls to "-package" functions with upper-case string args.
>  *   Calls to "(intern" and "(find-symbol" with string args built
>  * typicaly using calls to format nil.  In addition, it might be useful to
>  * search for "(format ()" and "(format nil".
>  *
>  * To build:
>  *   lex downcase.l; cc -O -o downcase lex.yy.c -ll
>  */
>
> #include <ctype.h>
> #define P       { printf("%s",yytext); }
>
> %}
> A       [-A-Za-z0-9./\$%\^&\*\?\!\@\[\]\~\=\+\_\<\>\,]
>
> %%
>
> \#\|([^|]|(\|[^#])|\n)*\|\#     { P }
> {A}+                            { char *s;
>                                   for ( s=yytext; *s; s++)
>                                       if (isupper(*s))
>                                           *s = tolower(*s);
>                                   P }
> \\(.|\n)                        { P }
> ;.*\n                           { P }
> \|([^\\|]|(\\(.|\n)))*\|        { char *s;
>                                   for ( s=yytext; *s; s++)
>                                       if (isupper(*s)) {
>                                          fprintf(stderr,
>                         "Warning: multi-escaped symbol has uppercase: %s\n",
>                                                 yytext);
>                                          break;
>                                          }
>                                   P }
> \"([^\\"]|(\\(.|\n)))*\"        { P }
>
> %%
>
> #define YYLMAX (50000)          /* handle large #| ... |# */
>
> main(ac,av)
>  char **av;
> {
>     if (ac>2) usage(av[0]);
>     if (ac==2) {
>         if (freopen(av[1],"r",stdin)==NULL) {
>             fprintf(stderr,"%s: can't open %s\n", av[0], av[1]);
>             exit(1);
>         }
>     }
>     yylex();
> }
>
> usage(s)
>     char *s;
> {
>     fprintf(stderr, "Usage: %s [input file]\n", s);
> }
>
> ==========

--

[ Vadim V. Zhytnikov  <vvzhy@mail.ru>  <vvzhy@td.lpi.ac.ru> ]