#include <stdlib.h>#include <string.h>#include <ctype.h>#include <stdio.h>#include "machine.h"#include "wcommon.h"#include "Messages.h"#include "Warnings.h"#include "Errors.h"Include dependency graph for wmtex.c:

Go to the source code of this file.
Functions | |
| static int Sed | __PARAMS ((int, char *, FILE *, char *, char *, char *, char *, char *, char *)) |
| static void readOneLine | __PARAMS ((char *buff, int *stop, FILE *fd)) |
| static void FileNameChange | __PARAMS ((char *filein, char *fileout, char *, char *)) |
| char * | getSCIpath (void) |
| int | ScilabPsToTeX (char orientation, char *filein, char *fileout, double xs, double ys) |
| static void | FileNameChange (char *filein, char *fileout, char *name, char *suf) |
| static int | Sed (int flag, file, FILE *fileo, strin1, strout1, strin2, strout2, strin3, strout3) |
| static void | readOneLine (buff, int *stop, FILE *fd) |
Variables | |
| static char | entete [256] |
| static char | base [54] |
| static void FileNameChange __PARAMS | ( | (char *filein, char *fileout, char *, char *) | ) | [static] |
| static int Sed __PARAMS | ( | (int, char *, FILE *, char *, char *, char *, char *, char *, char *) | ) | [static] |
| static void FileNameChange | ( | char * | filein, | |
| char * | fileout, | |||
| char * | name, | |||
| char * | suf | |||
| ) | [static] |
Definition at line 173 of file wmtex.c.
Referenced by ScilabPsToTeX().
00175 { 00176 char *p = filein, *p1; 00177 p1 = strchr (p, '/'); 00178 while (p1 != 0) 00179 { 00180 p = p1 + 1; 00181 p1 = strchr (p, '/'); 00182 } 00183 p1 = strchr (p, '.'); 00184 if (p1 != 0) 00185 { 00186 *p1 = '\0'; 00187 sprintf (fileout, "%s.%s", filein, suf); 00188 sprintf (base, "%s", p); 00189 *p1 = '.'; 00190 } 00191 else 00192 { 00193 sprintf (fileout, "%s.%s", filein, suf); 00194 sprintf (base, "%s", p); 00195 } 00196 /* 00197 sciprint("[%s]=>[%s]\n",filein,fileout); 00198 sciprint("real base %s\n",base); 00199 */ 00200 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* getSCIpath | ( | void | ) |
get SCI path
Definition at line 19 of file setgetSCIpath.c.
References MALLOC, NULL, and SCIPATH.
00020 { 00021 char *pathtoreturn=NULL; 00022 pathtoreturn=(char*)MALLOC(sizeof(char)*(strlen(SCIPATH)+1)); 00023 sprintf(pathtoreturn,"%s",SCIPATH); 00024 return pathtoreturn; 00025 }
| static void readOneLine | ( | buff | , | |
| int * | stop, | |||
| FILE * | fd | |||
| ) | [static] |
| int ScilabPsToTeX | ( | char | orientation, | |
| char * | filein, | |||
| char * | fileout, | |||
| double | xs, | |||
| double | ys | |||
| ) |
Definition at line 28 of file wmtex.c.
References env, FileNameChange(), getSCIpath(), MSG_ERROR49, MSG_ERROR50, MSG_ERROR51, MSG_SCIMSG46, MSG_SCIMSG47, MSG_SCIMSG48, MSG_SCIMSG49, MSG_SCIMSG50, MSG_SCIMSG51, MSG_SCIMSG52, NULL, rep, sciprint(), and Sed().
00029 { 00030 double wide, high, widecm, highcm, hscale, vscale; 00031 int flag = 0, rep; 00032 FILE *fo; 00033 char *env; 00034 env = getSCIpath(); 00035 if (env == NULL) 00036 { 00037 sciprint (MSG_ERROR49); 00038 return (1); 00039 } 00040 00044 sprintf (entete, "%s/tools/printer/NperiPos.ps", env); 00045 00046 FileNameChange (filein, fileout, base, "eps"); 00047 if (strcmp (fileout, filein) == 0) 00048 { 00049 flag = 1; 00050 strcat (fileout, ".temp"); 00051 } 00052 00053 if ((fo = fopen (fileout, "w")) == 0) 00054 { 00055 sciprint (MSG_ERROR50, fileout); 00056 return 1; 00057 } 00058 00059 fprintf (fo, "%%!PS-Adobe-2.0 EPSF-2.0\n"); 00060 if (orientation == 'p') 00061 fprintf (fo, "%%%%BoundingBox: 0 0 300 212\n"); 00062 else 00063 fprintf (fo, "%%%%BoundingBox: 0 0 212 300\n"); 00064 00065 Sed (0, entete, fo, "%!PS-ADOBE", "%%", (char *) 0, (char *) 0, (char *) 0, (char *) 0); 00066 00067 if (orientation == 'p') 00068 rep = Sed (1, filein, fo, (char *) 0, (char *) 0, (char *) 0, (char *) 0, 00069 (char *) 0, (char *) 0); 00070 else 00071 rep = Sed (1, filein, fo, "[0.5 10 div 0 0 0.5 10 div neg 0 2120 10 div] concat", 00072 "90 rotate 0 600 neg translate [0.5 10 div 0 0 0.5 10 div neg 0 3000 5 div] concat", 00073 (char *) 0, (char *) 0, (char *) 0, (char *) 0); 00074 fclose (fo); 00075 00076 if (rep >= 1) 00077 { 00078 if (rep == 1) 00079 sciprint (MSG_ERROR51); 00080 remove (fileout); 00081 return 0; 00082 } 00083 00084 if (flag == 1) 00085 { 00087 fo = fopen (filein, "w"); 00088 Sed (0, fileout, fo, (char *) 0, (char *) 0, (char *) 0, (char *) 0, (char *) 0, (char *) 0); 00089 fclose (fo); 00090 } 00091 else 00092 { 00093 remove (filein); 00094 } 00095 00098 if (orientation == 'p') 00099 { 00100 wide = 300 * xs; 00101 high = 212 * ys; 00102 } 00103 else 00104 { 00105 wide = 212 * xs; 00106 high = 300 * ys; 00107 } 00108 widecm = wide * 2.835; 00109 highcm = high * 2.835; 00110 hscale = xs * 100; 00111 vscale = ys * 100; 00112 00113 FileNameChange (filein, fileout, base, "tex"); 00114 if ((fo = fopen (fileout, "w")) == 0) 00115 { 00116 sciprint (MSG_ERROR51, fileout); 00117 return 1; 00118 } 00119 #ifndef DOC 00120 00121 fprintf (fo, "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); 00122 fprintf (fo, MSG_SCIMSG46); 00123 fprintf (fo, MSG_SCIMSG47); 00124 fprintf (fo, MSG_SCIMSG48); 00125 fprintf (fo, MSG_SCIMSG49); 00126 fprintf (fo, MSG_SCIMSG50); 00127 fprintf (fo, MSG_SCIMSG51); 00128 fprintf (fo, "%% \n"); 00129 fprintf (fo, "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); 00130 00131 fprintf (fo, " \n"); 00132 00133 00134 fprintf (fo, " \\long\\def\\Checksifdef#1#2#3{%%\n"); 00135 fprintf (fo, "\\expandafter\\ifx\\csname #1\\endcsname\\relax#2\\else#3\\fi}\n"); 00136 fprintf (fo, "\\Checksifdef{Figdir}{\\gdef\\Figdir{}}{}\n"); 00137 fprintf (fo, "\\def\\dessin#1#2{\n"); 00138 #endif 00139 fprintf (fo, "\\begin{figure}[hbtp]\n"); 00140 fprintf (fo, "\\begin{center}\n"); 00141 fprintf (fo, MSG_SCIMSG52); 00142 fprintf (fo, "%%\\setlength{\\unitlength}{1mm}\n"); 00143 fprintf (fo, "%%\\fbox{\\begin{picture}(%.2f,%.2f)\n", widecm, highcm); 00144 fprintf (fo, "\\fbox{\\begin{picture}(%.2f,%.2f)\n", wide, high); 00145 FileNameChange (filein, fileout, base, "eps"); 00146 #ifdef EPSFIG 00147 fprintf (fo, "\\epsfig{file=\\Figdir %s.eps,width=%.2fpt,height=%.2fpt}\n", 00148 base, wide.high); 00149 #else 00150 fprintf (fo, "%% if you want to use epsfig uncomment the following line \n"); 00151 fprintf (fo, "%% and comment the special line \n"); 00152 fprintf (fo, "%%\\epsfig{file=\\Figdir %s.eps,width=%.2fpt,height=%.2fpt}\n", 00153 base, wide, high); 00154 fprintf (fo, "\\special{psfile=\\Figdir %s.eps hscale=%.2f vscale=%.2f}\n", 00155 base, hscale, vscale); 00156 #endif 00157 fprintf (fo, "\\end{picture}}\n"); 00158 fprintf (fo, "\\end{center}\n"); 00159 #ifndef DOC 00160 fprintf (fo, "\\caption{\\label{#2}#1}\n"); 00161 fprintf (fo, "\\end{figure}}\n"); 00162 #endif 00163 fclose (fo); 00164 return (0); 00165 }
Here is the call graph for this function:

| static int Sed | ( | int | flag, | |
| file | , | |||
| FILE * | fileo, | |||
| strin1 | , | |||
| strout1 | , | |||
| strin2 | , | |||
| strout2 | , | |||
| strin3 | , | |||
| strout3 | ||||
| ) | [static] |
Definition at line 208 of file wmtex.c.
References fd, MSG_ERROR52, readOneLine(), and sciprint().
00213 { 00214 FILE *fd; 00215 fd = fopen (file, "r"); 00216 if (fd != 0) 00217 { 00218 int stop = 0; 00219 while (stop != 1) 00220 { 00221 char buff[512]; 00222 readOneLine (buff, &stop, fd); 00223 if (flag == 1) 00224 { 00225 if (strncmp (buff, "%!PS-Adobe-2.0 EPSF-2.0", 00226 strlen ("%!PS-Adobe-2.0 EPSF-2.0")) == 0) 00227 { 00228 fclose (fd); 00229 return (1); 00230 } 00231 } 00232 if (strin1 != (char *) 0 && strncmp (buff, strin1, strlen (strin1)) == 0) 00233 fprintf (fileo, "%s\n", strout1); 00234 else 00235 { 00236 if (strin2 != (char *) 0 && strncmp (buff, strin2, strlen (strin2)) == 0) 00237 fprintf (fileo, "%s\n", strout2); 00238 else 00239 { 00240 if (strin3 != (char *) 0 && strncmp (buff, strin3, strlen (strin3)) == 0) 00241 fprintf (fileo, "%s\n", strout3); 00242 else 00243 fprintf (fileo, "%s", buff); 00244 } 00245 } 00246 } 00247 fclose (fd); 00248 } 00249 else 00250 { 00251 sciprint (MSG_ERROR52, file); 00252 return (2); 00253 } 00254 return (0); 00255 }
Here is the call graph for this function:

char base[54] [static] |
Definition at line 26 of file wmtex.c.
Referenced by Allocate(), my_basename(), putentries(), putpower(), Reallocate(), set_character_class(), and xls_basename().
1.5.1