Package: grx
Version: 2.4.6p4
Author: Guillem Jover <guillem@hadrons.org>
Status: not-sent
Description:
 Fixed indentation.
 Port to non-DOS systems.
 Added a Linux makefile
 Updated tex version to 2.4.6.
 Transalted source code from Spanish to English.

diff -Naur grx-2.4.6p4/doc/tex/ex2tex.c grx-2.4.6p4-patched/doc/tex/ex2tex.c
--- grx-2.4.6p4/doc/tex/ex2tex.c	2001-04-25 22:37:06.000000000 +0200
+++ grx-2.4.6p4-patched/doc/tex/ex2tex.c	2003-06-02 21:19:42.000000000 +0200
@@ -22,152 +22,164 @@
 #include <string.h>
 #include <glob.h>
 
-char *separa = "@c -----------------------------------------------------------------------------";
+#if !defined(__MSDOS__)
+#include <ctype.h>
+
+char *strlwr(char *str)
+{
+  char *s;
+
+  for (s = str; *s; s++)
+    *s = tolower(*s);
+
+  return str;
+}
+#endif
+
+char *separator = "@c -----------------------------------------------------------------------------";
 FILE *fp;
 char **ap;
 int nhd;
 
-struct seccion
+struct section
 {
- char *Node, *Prev, *Up;
+  char *Node, *Prev, *Up;
 } s;
 
-void insertaCadena(char *linea, int x, char *cadena)
+void InsertString(char *line, int x, char *str)
 {
- int ll = strlen(linea), lc = strlen(cadena);
+  int ll = strlen(line), lc = strlen(str);
 
- if( x > ll )
- {
-	memset(linea + ll, ' ', x);
-	memcpy(linea + x - 1, cadena, lc);
-	linea[lc + x - 1] = '\0';
- }
- else
- {
-	char *tmp = calloc(strlen(linea + x) + 1, 1);
-	strcpy(tmp, linea + x - 1);
-	strcpy(linea + x - 1, cadena);
-	strcpy(linea + x - 1 + lc, tmp);
-	free(tmp);
+  if( x > ll )
+  {
+    memset(line + ll, ' ', x);
+    memcpy(line + x - 1, str, lc);
+    line[lc + x - 1] = '\0';
+  }
+  else
+  {
+    char *tmp = calloc(strlen(line + x) + 1, 1);
+    strcpy(tmp, line + x - 1);
+    strcpy(line + x - 1, str);
+    strcpy(line + x - 1 + lc, tmp);
+    free(tmp);
  }
-
 }
 
-void InsertaCaracter(char *linea, char carAinsertar, char carAubicar)
+void InsertCharacter(char *line, char charToInsert, char charToPlace)
 {
-   char *aqui = strchr(linea, carAubicar);
+  char *here = strchr(line, charToPlace);
 
-   while (aqui)
-   {
-		char tmp[180];
-		strcpy(tmp, aqui);
-		*aqui = carAinsertar;
-		strcpy(aqui + 1, tmp);
-      aqui = strchr(aqui + 2, carAubicar);
-   }
+  while (here)
+  {
+    char tmp[180];
+    strcpy(tmp, here);
+    *here = charToInsert;
+    strcpy(here + 1, tmp);
+    here = strchr(here + 2, charToPlace);
+  }
 }
 
-void DescargaArchivo(FILE *p, char *na)
+void DownloadFile(FILE *p, char *na)
 {
   int i;
-  char linea[180];
+  char line[180];
   FILE *ae = fopen(na, "r");
 
   fputs("@example\n", p);
 
   do
   {
-	  fgets(linea, 179, ae);
-	
-	  if(feof(ae)) break;
-                              /* Procesamiento de la l¡nea le¡da */
-
-	  InsertaCaracter(linea, '@', '@');    /*  @@  */
-	  InsertaCaracter(linea, '@', '{');    /*  @{  */
-	  InsertaCaracter(linea, '@', '}');    /*  @}  */
-
-     for(i = 0; i < nhd; i++) /* Colocar las referencias a los include */
-     {
-	     char *arch =strstr(linea, ap[i]);
+    fgets(line, 179, ae);
 
-        if(strcmp(na, ap[i]) == 0) continue; /* no tocar el propio include */
+    if(feof(ae)) break;
 
-	     if( arch )       /* šest  referido el archivo include? */
-        {
-           char *coment = strchr(arch, '/');
-	        char cadena[40];
+    /* Processing the line read */
+    InsertCharacter(line, '@', '@');    /*  @@  */
+    InsertCharacter(line, '@', '{');    /*  @{  */
+    InsertCharacter(line, '@', '}');    /*  @}  */
 
-           if(coment)     /* si hay cometario, incr£stalo dentro de l */
-           {
-             coment = strchr(coment, '*');
-             if(coment)
-             {
-		           strcpy(cadena, "@pxref{");
-			        strcat(cadena, ap[i]);
-			        strcat(cadena, "} ");
-			  	  	  insertaCadena(coment, 3, cadena);
-		           break;
-             }
-           }                  /* No hay comentario, hay que colocarlo */
-           strcpy(cadena, "/* @pxref{");
-	        strcat(cadena, ap[i]);
-	        strcat(cadena, "} */\n");
-	        linea[strlen(linea) - 1] = ' ';  /* quitamos el \n */
-	  	  	  insertaCadena(linea, strlen(linea) + 2, cadena);
-           break;
-        }
-     }
-	  fputs(linea, p);
-  }
-  while(1);
+    for(i = 0; i < nhd; i++) /* Put references into the include */
+    {
+      char *arch =strstr(line, ap[i]);
+
+      if(strcmp(na, ap[i]) == 0) continue; /* don't touch the include itself */
+
+      if( arch )       /* it's about the include file? */
+      {
+        char *comment = strchr(arch, '/');
+        char str[40];
+
+        if(comment)     /* if there is a comment, embbed inside it */
+        {
+          comment = strchr(comment, '*');
+          if(comment)
+          {
+            strcpy(str, "@pxref{");
+            strcat(str, ap[i]);
+            strcat(str, "} ");
+            InsertString(comment, 3, str);
+            break;
+          }
+        }               /* there is no comment, have to put it */
+        strcpy(str, "/* @pxref{");
+        strcat(str, ap[i]);
+        strcat(str, "} */\n");
+        line[strlen(line) - 1] = ' ';  /* remove the \n */
+        InsertString(line, strlen(line) + 2, str);
+        break;
+      }
+    }
+    fputs(line, p);
+  } while(1);
 
   fputs("@end example\n", p);
   fclose(ae);
 }
 
-void FinSeccion(char *Up, char *Next)
+void EndSection(char *Up, char *Next)
 {
   fprintf(fp,"@node  %s, %s, %s, %s\n", s.Node, Next, s.Prev, Up);
   fprintf(fp, "%s  %s\n", "@unnumberedsec ", s.Node);
-  DescargaArchivo(fp, s.Node);
-  fprintf(fp, "%s\n", separa);
+  DownloadFile(fp, s.Node);
+  fprintf(fp, "%s\n", separator);
 }
 
-void DescargaArchivos(glob_t *r)
+void DownloadFiles(glob_t *r)
 {
   int i;
 
   fprintf(fp, "@end menu\n");
-  fprintf(fp, "%s\n", separa);
+  fprintf(fp, "%s\n", separator);
 
-  if(r->gl_pathc == 1)          /*  šUn solo archivo en el directorio?  */
+  if(r->gl_pathc == 1)          /* Only one file in the directory? */
   {
-      s.Node = r->gl_pathv[0];
-      if(s.Prev != NULL) free(s.Prev);
-      s.Prev= strdup(s.Up);
-      return;
+    s.Node = r->gl_pathv[0];
+    if(s.Prev != NULL) free(s.Prev);
+    s.Prev= strdup(s.Up);
+    return;
   }
 
   fprintf(fp, "@node  %s, %s, %s, %s\n", r->gl_pathv[0], r->gl_pathv[1],
                                                             s.Up, s.Up);
   fprintf(fp, "%s  %s\n", "@unnumberedsec ", r->gl_pathv[0]);
-  DescargaArchivo(fp, r->gl_pathv[0]);
-  fprintf(fp,"%s\n",separa);
+  DownloadFile(fp, r->gl_pathv[0]);
+  fprintf(fp,"%s\n", separator);
 
   for(i = 1; i < r->gl_pathc - 1 ; i++)
   {
-     fprintf(fp,"@node  %s, %s, %s, %s\n", r->gl_pathv[i], r->gl_pathv[i + 1],
+    fprintf(fp,"@node  %s, %s, %s, %s\n", r->gl_pathv[i], r->gl_pathv[i + 1],
                                                     r->gl_pathv[i - 1], s.Up);
-     fprintf(fp, "%s  %s\n", "@unnumberedsec ", r->gl_pathv[i]);
-     DescargaArchivo(fp, r->gl_pathv[i]);
-     fprintf(fp,"%s\n",separa);
+    fprintf(fp, "%s  %s\n", "@unnumberedsec ", r->gl_pathv[i]);
+    DownloadFile(fp, r->gl_pathv[i]);
+    fprintf(fp,"%s\n", separator);
   }
 
   s.Node = r->gl_pathv[i];
   s.Prev = r->gl_pathv[i - 1];
 }
 
-void IniSeccion(FILE *p, char *Node, char *Next, char *Prev, char *Up)
+void IniSection(FILE *p, char *Node, char *Next, char *Prev, char *Up)
 {
   fprintf(p,"@node %s, %s, %s, %s\n", Node, Next, Prev, Up);
   fprintf(p,"@unnumberedsec %s\n@menu\n", Node);
@@ -176,7 +188,7 @@
   s.Up = strdup(Node);
 }
 
-void FormaIndice(glob_t *r)
+void GenIndex(glob_t *r)
 {
   int i;
 
@@ -192,62 +204,65 @@
   p0 = fopen("grx2_0.tex", "r");
   p = fopen("grx2_2.tex", "w");
 
-  do         /* Copiamos grx2_0.tex a grx2_2.tex  */
+  do         /* Copy grx2_0.tex to grx2_2.tex  */
   {
-		char linea[180];
-		fgets(linea, 179, p0);
-		fputs(linea, p);
+    char linea[180];
+    fgets(linea, 179, p0);
+    fputs(linea, p);
   } while( !feof(p0) );
   fclose(p0);
 
   chdir("..");
   chdir("..");
-  chdir("test");   /* Leemos los nombres de los archivos que nos interesan */
+  chdir("test");   /* Read the file names we are interested in */
   glob("*.c", 0 , 0, &r);
-  nhd = r.gl_pathc; /* # de archivos *.c (variable global) */
+  nhd = r.gl_pathc; /* num of *.c files (global variable) */
   glob("*.h", GLOB_APPEND , 0, &r);
   glob("*.dat", GLOB_APPEND, 0, &r);
 
   if(r.gl_pathc == 0)
   {
-	  chdir("..");
-	  chdir("doc/tex");
-	  fclose(p);
-     puts("Directorio sin los archivos requeridos. Programa abortado.");
-     exit(1);
+    chdir("..");
+    chdir("doc/tex");
+    fclose(p);
+    puts("Required files not found in the directory. Program aborted.");
+    return 1;
   }
 
-  ap = &r.gl_pathv[nhd];    /* inicio de los *.h y *.dat (variable global) */
-  nhd = r.gl_pathc - nhd;   /* # de archivos *.h y *.dat en \test */
+  ap = &r.gl_pathv[nhd];    /* Start of *.h and *.dat (global variable) */
+  nhd = r.gl_pathc - nhd;   /* num of *.h and *.dat files in dir test */
 
   /*                Node               Next                  Prev           Up */
-  IniSeccion(p, "Test examples", strlwr(r.gl_pathv[0]), "BGI interface",
+  IniSection(p, "Test examples", strlwr(r.gl_pathv[0]), "BGI interface",
                                                       "A User Manual For GRX2");
-  FormaIndice(&r);        /* Utilizando los nombre de los archivos  */
-  DescargaArchivos(&r);
-  FinSeccion("Test examples", "Includes");/* Fin de Text examples sigue Includes */
+  GenIndex(&r);        /* Using the file names */
+  DownloadFiles(&r);
+  EndSection("Test examples", "Includes");
+  /* End of Text examples, next Includes */
 
-  chdir("..");            /* Ahora leemos los includes de GRX20 */
+  /* Now we read GRX20 includes */
+  chdir("..");
   chdir("include");
   glob("grx*.h", 0, 0, &rh);
 
   if(rh.gl_pathc == 0)
   {
-	  chdir("..");
-	  chdir("doc/tex");
-	  fclose(p);
-     globfree(&r);
-     puts("Directorio sin los archivos requeridos. Programa abortado.");
-     exit(1);
+    chdir("..");
+    chdir("doc/tex");
+    fclose(p);
+    globfree(&r);
+    puts("Required files not found in the directory. Program aborted.");
+    return 1;
   }
 
   nhd = 0;
   /*               Node               Next                  Prev           Up */
-  IniSeccion(p, "Includes", strlwr(rh.gl_pathv[0]), r.gl_pathv[r.gl_pathc - 1],
+  IniSection(p, "Includes", strlwr(rh.gl_pathv[0]), r.gl_pathv[r.gl_pathc - 1],
                                                     "A User Manual For GRX2");
-  FormaIndice(&rh);
-  DescargaArchivos(&rh);
-  FinSeccion("Includes", ""); /* Fin de Includes y adi¢s */
+  GenIndex(&rh);
+  DownloadFiles(&rh);
+  EndSection("Includes", "");
+  /* End of Includes and bye */
 
   chdir("..");
   chdir("doc/tex");
diff -Naur grx-2.4.6p4/doc/tex/grx2.tex grx-2.4.6p4-patched/doc/tex/grx2.tex
--- grx-2.4.6p4/doc/tex/grx2.tex	2002-06-17 21:50:16.000000000 +0200
+++ grx-2.4.6p4-patched/doc/tex/grx2.tex	2003-06-02 20:47:30.000000000 +0200
@@ -1,6 +1,6 @@
 \input texinfo   @c -*-texinfo-*-
 @c %**start of header
-@setfilename grx245um.inf
+@setfilename grx246um.inf
 @settitle GRX2 User's Manual
 @c %**end of header
 
diff -Naur grx-2.4.6p4/doc/tex/makefile.lnx grx-2.4.6p4-patched/doc/tex/makefile.lnx
--- grx-2.4.6p4/doc/tex/makefile.lnx	1970-01-01 01:00:00.000000000 +0100
+++ grx-2.4.6p4-patched/doc/tex/makefile.lnx	2003-06-02 21:17:20.000000000 +0200
@@ -0,0 +1,11 @@
+CFALSG=-Wall -O3
+
+build: ex2tex
+	./ex2tex
+	makeinfo --no-split grx2.tex
+	mv *.inf ..
+
+clean:
+	rm -f grx2_2.tex
+	rm -f ex2tex
+
