migrator.h File Reference

Header for graphics conversion. More...

#include <wordexp.h>

Include dependency graph for migrator.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

int migrate (char *, wordexp_t *)
 Transmigrates one graphical kind for another more para-W3C (id est, dvi -> png).
char cache (char *, wordexp_t *)
 Got cash? spare yourself the render time, baby.


Detailed Description

Header for graphics conversion.

Definition in file migrator.h.


Function Documentation

char cache char *  pcjob,
wordexp_t *  pw
 

Got cash? spare yourself the render time, baby.

Parameters:
pcjob veritand
pw receptacle of said verity or privation
Returns:
0, 1; cache.

Definition at line 61 of file migrator.c.

Referenced by math().

00062 {
00063   char cret = 0;
00064   const char *pcglobbase = "%s*png";
00065   const char *pcerr = "migrator.c cache()";
00066   char *pcglob;
00067 
00068   if ((pcglob = (char *) malloc(strlen(pcglobbase) + strlen(pcjob) + sizeof('\0'))) == NULL) {
00069     errno = ENOMEM;
00070     perror(pcerr);
00071     return cret;
00072   }
00073   sprintf(pcglob, pcglobbase, pcjob);
00074 
00075   if (wordexp(pcglob, pw, 0) == 0 && strcmp(*(pw->we_wordv), pcglob) != 0) {
00076     cret = 1;
00077   }
00078 
00079   free(pcglob);
00080   return cret;
00081 }

int migrate char *  pcjob,
wordexp_t *  pw
 

Transmigrates one graphical kind for another more para-W3C (id est, dvi -> png).

Parameters:
pcjob job name sans extension; migrand
pw globuland; to be filled of product
Returns:
state eserialerr

Definition at line 29 of file migrator.c.

References ALLOC, ERRDVIPNG, ERRDVIPNGOUTPUT, ERRDVIPNGWRITE, EVAL, and NONE.

Referenced by math().

00030 {
00031   int iret = ERROK;
00032   const char *pcbase = "dvipng -T tight -o %s%%d.png %s >&2";
00033   const char *pcerr = "migrator.c migrate()";
00034   const char *pcglobbase = "%s*png";
00035   char NONE(*pccommand), NONE(*pcglob), NONE(*pccache);
00036   FILE *pf;
00037 
00038   ALLOC(pccommand, strlen(pcbase) + strlen(pcjob) + strlen(pcjob));
00039   sprintf(pccommand, pcbase, pcjob, pcjob);
00040 
00041   EVAL((pf = popen(pccommand, "r")) == NULL, EIO, ERRDVIPNG);
00042   EVAL(pclose(pf) == -1, EINVAL, ERRDVIPNGWRITE);
00043 
00044   ALLOC(pcglob, strlen(pcglobbase) + strlen(pcjob));
00045   sprintf(pcglob, pcglobbase, pcjob);
00046 
00047   /* Test for results, neither that result is identical to the glob in file expansion's failure. */
00048   EVAL(wordexp(pcglob, pw, 0) != 0 || strcmp(*(pw->we_wordv), pcglob) == 0, EINVAL, ERRDVIPNGOUTPUT);
00049 
00050  cleanup:
00051   free(pccommand);
00052   free(pcglob);
00053   free(pccache);
00054   return iret;
00055 }  


Generated on Tue Dec 7 06:38:25 2004 for CSCI101:ProjectLatex by  doxygen 1.3.9.1