Xcall.c File Reference

#include <string.h>
#include <stdio.h>
#include "math_graphics.h"
#include "periX11.h"
#include "periPos.h"
#include "periFig.h"
#include "periGif.h"
#include "Xcall1.h"
#include "sciprint.h"
#include "DestroyObjects.h"

Include dependency graph for Xcall.c:

Go to the source code of this file.

Data Structures

struct  funreplace

Defines

#define const
#define MIN_WORD_LENGTH   4
#define MAX_WORD_LENGTH   9
#define MIN_HASH_VALUE   9
#define MAX_HASH_VALUE   86

Typedefs

typedef void(*) func ()
typedef void( function )()

Functions

static void C2F() vide (char *v1, integer *v2, integer *v3, integer *v4, integer *v5, integer *v6, integer *v7, double *dv1, double *dv2, double *dv3, double *dv4)
funreplacexcall_in_word_set (register const char *str, register unsigned int len)
static void C2F() all (char x0[], char x1[], integer *x2, integer *x3, integer *x4, integer *x5, integer *x6, integer *x7, double *dx1, double *dx2, double *dx3, double *dx4, integer lx0, integer lx1)
static unsigned int hash (register const char *str, register unsigned int len)
void C2F() SetDriver (char *x0, integer *v2, integer *v3, integer *v4, integer *v5, integer *v6, integer *v7, double *dv1, double *dv2, double *dv3, double *dv4)
void GetDriver1 (char *str, integer *v2, integer *v3, integer *v4, integer *v5, integer *v6, integer *v7, double *dv1, double *dv2, double *dv3, double *dv4)
char GetDriver ()
int GetDriverId ()
int C2F() dr (char x0[], char x1[], integer *x2, integer *x3, integer *x4, integer *x5, integer *x6, integer *x7, double *dx1, double *dx2, double *dx3, double *dx4, integer lx0, integer lx1)
int GetScreenDPI (int *ixres, int *iyres)
int GetDPIFromDriver (int DPI[2])

Variables

int WindowsPrintScreen = 0
int Printer_XRes = 0
int Printer_YRes = 0
static char DriverName [] = "Rec"
static int DriverId = 0


Define Documentation

#define const

Definition at line 64 of file Xcall.c.

#define MAX_HASH_VALUE   86

Definition at line 107 of file Xcall.c.

#define MAX_WORD_LENGTH   9

Definition at line 105 of file Xcall.c.

#define MIN_HASH_VALUE   9

Definition at line 106 of file Xcall.c.

#define MIN_WORD_LENGTH   4

Definition at line 104 of file Xcall.c.

Referenced by in_word_set(), and xcall_in_word_set().


Typedef Documentation

typedef void(*) func()

Definition at line 99 of file Xcall.c.

typedef void( function)()

Definition at line 100 of file Xcall.c.


Function Documentation

static void C2F() all ( char  x0[],
char  x1[],
integer x2,
integer x3,
integer x4,
integer x5,
integer x6,
integer x7,
double *  dx1,
double *  dx2,
double *  dx3,
double *  dx4,
integer  lx0,
integer  lx1 
) [static]

Referenced by dr(), and vide().

Here is the caller graph for this function:

int C2F() dr ( char  x0[],
char  x1[],
integer x2,
integer x3,
integer x4,
integer x5,
integer x6,
integer x7,
double *  dx1,
double *  dx2,
double *  dx3,
double *  dx4,
integer  lx0,
integer  lx1 
)

Definition at line 332 of file Xcall.c.

References all(), C2F, ReleaseWinHdc(), and SetWinhdc().

00334 { 
00335 #ifdef _MSC_VER
00336   if ( DriverId == 0 && DriverName[0] != 'I' ) 
00337     {
00338       SetWinhdc();
00339       C2F(all)(x0,x1,x2,x3,x4,x5,x6,x7,dx1,dx2,dx3,dx4,lx0,lx1);
00340       ReleaseWinHdc();
00341     }
00342   else 
00343     {
00344       C2F(all)(x0,x1,x2,x3,x4,x5,x6,x7,dx1,dx2,dx3,dx4,lx0,lx1);
00345     }
00346 #else
00347       C2F(all)(x0,x1,x2,x3,x4,x5,x6,x7,dx1,dx2,dx3,dx4,lx0,lx1);
00348 #endif
00349   return 0;
00350 }

Here is the call graph for this function:

int GetDPIFromDriver ( int  DPI[2]  ) 

we draw marks in pixel Returns the DPI depending on the used driver

Definition at line 372 of file Xcall.c.

References GetDriverId(), GetScreenDPI(), int, Printer_XRes, Printer_YRes, and WindowsPrintScreen.

00373 {
00374   int driver = GetDriverId(); /* return the first letter of the driver name (see XCall.c) */
00375   int succeed = 0;
00376   int ixres, iyres;
00377 
00378   switch(driver)
00379   {
00380   case 0: 
00381     if(WindowsPrintScreen == 1)
00382     {
00383       ixres = Printer_XRes;
00384       iyres = Printer_YRes;
00385       succeed = 1;
00386     }
00387     else
00388     {
00389       succeed = GetScreenDPI(&ixres,&iyres);
00390       if(succeed == -1){
00391         ixres = (int)72.; /* default value*/
00392         iyres = (int)72.; /* default value*/
00393       }
00394     }
00395     break;
00396   case 1: /* Pos */
00397     /*       printf("DRIVERS POS enabled -- -- -- --\n"); */
00398     /* when using Pos driver, the output file is 6000x4240 pixels */
00399     /* computed DPI: height : 6000/(30cm/2.54) = 508 ; width: 4240/(21.20/2.54) = 508 */
00400     ixres = (int)(524.*1.5);
00401     iyres = (int)(524.*1.5);
00402     break;
00403   case 2: /* Fig. */
00404     /*       printf("DRIVERS FIG enabled -- -- -- --\n"); */
00405     /* when using Pos driver, the output file is 6000x4240 pixels */
00406     /* computed DPI: height : 9600/(8inches) = 1200 ; width: 6784/(5.7inches) = 1190 */
00407     ixres = (int)1200.;
00408     iyres = (int)1190.;
00409     break;
00410   case 3: /* Gif & PPM driver */ /* NOT SURE: may be 72. avery time... */
00411   default:
00412     succeed = GetScreenDPI(&ixres,&iyres);
00413     if(succeed == -1){
00414       ixres = (int)72.; /* default value*/      
00415       iyres = (int)72.; /* default value*/
00416     }
00417     break;
00418   }
00419 
00420   DPI[0] = ixres;
00421   DPI[1] = iyres;
00422 
00423   return 0;
00424 }

Here is the call graph for this function:

char GetDriver ( void   ) 

Definition at line 323 of file Xcall.c.

00323 {return(DriverName[0]);}

void GetDriver1 ( char *  str,
integer v2,
integer v3,
integer v4,
integer v5,
integer v6,
integer v7,
double *  dv1,
double *  dv2,
double *  dv3,
double *  dv4 
)

Definition at line 317 of file Xcall.c.

Referenced by GetDriverName(), GSciString(), scig_2dzoom(), scig_3drot(), scig_driverX11(), scig_erase(), scig_expose(), scig_replay(), scig_replay_hdc(), scig_resize(), scig_toPs(), scig_unzoom(), and xcall_in_word_set().

00319 {
00320   strcpy(str,DriverName);
00321 }

Here is the caller graph for this function:

int GetDriverId ( void   ) 

Definition at line 325 of file Xcall.c.

Referenced by CheckPixelStatus(), drawFigureEntity(), GetDPIFromDriver(), GraySquare(), GraySquare1(), MaybeSetWinhdc(), ReleaseWinHdc(), sciDrawObj(), scig_toPs(), and sciIsExistingFigure().

00325 { return DriverId;}

Here is the caller graph for this function:

int GetScreenDPI ( int ixres,
int iyres 
)

Definition at line 1124 of file x_util.c.

References DisplayInit(), and int.

Referenced by GetDPIFromDriver().

01125 {
01126   double xres, yres;
01127   
01128   Display *dpy;
01129   Widget toplevel;
01130   DisplayInit("",&dpy,&toplevel);
01131   
01132   /*
01133    * there are 2.54 centimeters to an inch; so there are 25.4 millimeters.
01134    *
01135    *     dpi = N pixels / (M millimeters / (25.4 millimeters / 1 inch))
01136    *         = N pixels / (M inch / 25.4)
01137    *         = N * 25.4 pixels / M inch
01138    */
01139   
01140   xres = ((((double) DisplayWidth(dpy,DefaultScreen(dpy))) * 25.4) / 
01141           ((double) DisplayWidthMM(dpy,DefaultScreen(dpy))));
01142   yres = ((((double) DisplayHeight(dpy,DefaultScreen(dpy))) * 25.4) / 
01143           ((double) DisplayHeightMM(dpy,DefaultScreen(dpy))));
01144   
01145   *ixres = (int) (xres + 0.5);
01146   *iyres = (int) (yres + 0.5);
01147   
01148   return 0;
01149 }

Here is the call graph for this function:

Here is the caller graph for this function:

static unsigned int hash ( register const char *  str,
register unsigned int  len 
) [static]

Definition at line 118 of file Xcall.c.

00119 {
00120   static const unsigned char asso_values[] =
00121     {
00122       87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00123       87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00124       87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00125       87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00126       87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00127       60, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00128       87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00129       87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00130       87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00131       87, 87, 87, 87, 87, 87, 87,  5, 87,  0, /* 99 */
00132       15,  5, 45, 15, 25,  0, 87, 45, 25, 15,
00133       20,  0, 10, 87,  0,  0,  5, 20, 87, 55,
00134       25, 10, 87, 87, 87, 87, 87, 87, 87, 87,
00135       87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00136       87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00137       87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00138       87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00139       87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00140       87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00141       87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00142       87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00143       87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00144       87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00145       87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00146       87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
00147       87, 87, 87, 87, 87, 87
00148     };
00149   
00150   return len + asso_values[(unsigned char)str[3]] + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[1]] + asso_values[(unsigned char)str[len - 1]];
00151 }

void C2F() SetDriver ( char *  x0,
integer v2,
integer v3,
integer v4,
integer v5,
integer v6,
integer v7,
double *  dv1,
double *  dv2,
double *  dv3,
double *  dv4 
)

Definition at line 269 of file Xcall.c.

References sciprint().

00271 {
00272   switch (x0[0])
00273     {
00274     case 'I':
00276       strcpy(DriverName,"Int"); /* internal : for Win32 */
00277       DriverId = 0;
00278       break;
00279     case 'G':
00280       if (x0[1] == 'I') {
00281           strcpy(DriverName,"GIF");
00282           DriverId = 3;
00283           break;
00284       }
00285     case 'X':
00286     case 'W':
00287       strcpy(DriverName,"X11");
00288       DriverId = 0;
00289       break;
00290     case 'P'  :
00291       if (x0[1] == 'P') {
00292         strcpy(DriverName,"PPM");
00293         DriverId = 3;
00294         break;
00295       }
00296       else {
00297         strcpy(DriverName,"Pos");
00298         DriverId = 1;
00299       }
00300       break;
00301     case 'F'  :
00302       strcpy(DriverName,"Fig");
00303       DriverId = 2;
00304       break;
00305     case 'R'  :
00306       strcpy(DriverName,"Rec");
00307       DriverId = 0;
00308       break;
00309     default:
00310       sciprint("\n Wrong driver name I'll use X11");
00311       strcpy(DriverName,"X11");
00312       DriverId = 0;
00313       break;
00314     }
00315 }

Here is the call graph for this function:

static void C2F() vide ( char *  v1,
integer v2,
integer v3,
integer v4,
integer v5,
integer v6,
integer v7,
double *  dv1,
double *  dv2,
double *  dv3,
double *  dv4 
) [static]

Definition at line 93 of file Xcall.c.

References all(), C2F, len, str, and xcall_in_word_set().

Referenced by xcall_in_word_set().

00094                                                                                        {}

Here is the call graph for this function:

Here is the caller graph for this function:

struct funreplace * xcall_in_word_set ( register const char *  str,
register unsigned int  len 
)

Definition at line 156 of file Xcall.c.

References boundingbox(), boundingboxGif(), boundingboxPos(), boundingboxXfig(), C2F, CleanPlots(), cleararea(), clearareaGif(), clearareaPos(), clearareaXfig(), clearwindow(), clearwindowGif(), clearwindowPos(), clearwindowXfig(), displaynumbers(), displaynumbersGif(), displaynumbersPos(), displaynumbersXfig(), displaystring(), displaystringGif(), displaystringPos(), displaystringXfig(), drawarc(), drawarcGif(), drawarcPos(), drawarcs(), drawarcsGif(), drawarcsPos(), drawarcsXfig(), drawarcXfig(), drawarrows(), drawarrowsGif(), drawarrowsPos(), drawarrowsXfig(), drawaxis(), drawaxisGif(), drawaxisPos(), drawaxisXfig(), drawClippedPolyline(), drawClippedPolylineXfig(), drawpolyline(), drawpolylineGif(), drawpolylinePos(), drawpolylines(), drawpolylinesGif(), drawpolylinesPos(), drawpolylinesXfig(), drawpolylineXfig(), drawpolymark(), drawpolymarkGif(), drawpolymarkPos(), drawpolymarkXfig(), drawrectangle(), drawrectangleGif(), drawrectanglePos(), drawrectangles(), drawrectanglesGif(), drawrectanglesPos(), drawrectanglesXfig(), drawrectangleXfig(), drawsegments(), drawsegmentsGif(), drawsegmentsPos(), drawsegmentsXfig(), fillarc(), fillarcGif(), fillarcPos(), fillarcs(), fillarcsGif(), fillarcsPos(), fillarcsXfig(), fillarcXfig(), fillpolyline(), fillpolylineGif(), fillpolylinePos(), fillpolylines(), fillpolylinesGif(), fillpolylinesPos(), fillpolylinesXfig(), fillpolylineXfig(), fillrectangle(), fillrectangleGif(), fillrectanglePos(), fillrectangleXfig(), GetDriver1(), getFontMaxSize(), getFontMaxSizeGif(), getFontMaxSizePos(), getFontMaxSizeXfig(), hash(), initgraphic(), initgraphicfromscreenGif(), initgraphicfromscreenPos(), initgraphicfromscreenXfig(), initgraphicGif(), initgraphicPos(), initgraphicXfig(), loadfamily(), loadfamilyGif(), loadfamilyPos(), loadfamilyXfig(), MIN_WORD_LENGTH, MissileGCget(), MissileGCset(), funreplace::name, queryfamily(), queryfamilyGif(), queryfamilyPos(), queryfamilyXfig(), s, scilabgcgetGif(), scilabgcgetPos(), scilabgcgetXfig(), scilabgcsetGif(), scilabgcsetPos(), scilabgcsetXfig(), SetDriver(), setpopupname(), vide(), xclick(), xclick_any(), xclick_anyGif(), xclick_anyPos(), xclick_anyXfig(), xclickGif(), xclickPos(), xclickXfig(), xend(), xendGif(), xendPos(), xendXfig(), xgetmouse(), xgetmouseGif(), xgetmousePos(), xgetmouseXfig(), xinfo(), xselgraphic(), xselgraphicGif(), xselgraphicPos(), and xselgraphicXfig().

Referenced by vide().

00157 {
00158   static const struct funreplace wordlist[] =
00159     {
00160       {""}, /* index 0 */
00161       {""}, 
00162       {""}, 
00163       {""}, 
00164       {""}, 
00165       {""}, 
00166       {""}, 
00167       {""}, 
00168       {""},
00169       {"xarc",    {C2F(drawarc),C2F(drawarcPos),C2F(drawarcXfig),C2F(drawarcGif)}},
00170       {"xarcs",    {C2F(drawarcs),C2F(drawarcsPos),C2F(drawarcsXfig),C2F(drawarcsGif)}}, /* 10 */
00171       {"xrects",    {C2F(drawrectangles),C2F(drawrectanglesPos),C2F(drawrectanglesXfig),C2F(drawrectanglesGif)}},
00172       {""}, 
00173       {""}, 
00174       {""},
00175       {"xrect",    {C2F(drawrectangle),C2F(drawrectanglePos),C2F(drawrectangleXfig),C2F(drawrectangleGif)}},
00176       {"xsetdr",    {C2F(SetDriver),C2F(SetDriver),C2F(SetDriver),C2F(SetDriver)}},
00177       {""}, 
00178       {""},
00179       {"xset",    {C2F(MissileGCset),C2F(scilabgcsetPos),C2F(scilabgcsetXfig),C2F(scilabgcsetGif)}},
00180       {"xarea",    {C2F(fillpolyline),C2F(fillpolylinePos),C2F(fillpolylineXfig),C2F(fillpolylineGif)}}, /* 20 */
00181       {"xstart",    {CleanPlots,CleanPlots,CleanPlots,CleanPlots}},
00182       {""}, 
00183       {""},
00184       {""},
00185       {"xsegs",    {C2F(drawsegments),C2F(drawsegmentsPos),C2F(drawsegmentsXfig),C2F(drawsegmentsGif)}},
00186       {"xmarks",    {C2F(drawpolymark),C2F(drawpolymarkPos),C2F(drawpolymarkXfig),C2F(drawpolymarkGif)}},
00187       {"xstring",    {C2F(displaystring),C2F(displaystringPos),C2F(displaystringXfig),C2F(displaystringGif)}},
00188       {""},
00189       {""},
00190       {"xinit",    {C2F(initgraphic),C2F(initgraphicPos),C2F(initgraphicXfig),C2F(initgraphicGif)}}, /* 30 */
00191       {"xgetdr",    {GetDriver1,GetDriver1,GetDriver1,GetDriver1}},
00192       {""},
00193       {""},
00194       {"xget",    {C2F(MissileGCget),C2F(scilabgcgetPos),C2F(scilabgcgetXfig),C2F(scilabgcgetGif)}},
00195       {"xaxis",    {C2F(drawaxis),C2F(drawaxisPos),C2F(drawaxisXfig),C2F(drawaxisGif)}},
00196       {"xclear",    {C2F(clearwindow),C2F(clearwindowPos),C2F(clearwindowXfig),C2F(clearwindowGif)}},
00197       {""},
00198       {"xstringl",    {C2F(boundingbox),C2F(boundingboxPos),C2F(boundingboxXfig),C2F(boundingboxGif),}},
00199       {"xgetmouse",    {C2F(xgetmouse),C2F(xgetmousePos),C2F(xgetmouseXfig),C2F(xgetmouseGif)}},
00200       {"xclea",    {C2F(cleararea),C2F(clearareaPos),C2F(clearareaXfig),C2F(clearareaGif)}}, /* 40 */
00201       {"xpolys",    {C2F(drawpolylines),C2F(drawpolylinesPos),C2F(drawpolylinesXfig),C2F(drawpolylinesGif)}},
00202       {"xselect",    {C2F(xselgraphic),C2F(xselgraphicPos),C2F(xselgraphicXfig),C2F(xselgraphicGif)}},
00203       {""},
00204       {"xclickany",    {C2F(xclick_any),C2F(xclick_anyPos),C2F(xclick_anyXfig),C2F(xclick_anyGif)}},
00205       {""},
00206       {""},
00207       {""}, 
00208       {""},
00209       {""},
00210       {"xname",    {C2F(setpopupname),C2F(vide),C2F(vide),C2F(vide)}}, /* 50 */
00211       {"xlines",    {C2F(drawClippedPolyline),C2F(drawpolylinePos),C2F(drawClippedPolylineXfig),C2F(drawpolylineGif)}},
00212       {"xliness",    {C2F(fillpolylines),C2F(fillpolylinesPos),C2F(fillpolylinesXfig),C2F(fillpolylinesGif)}},
00213       {"xuclines",    {C2F(drawpolyline),C2F(drawpolylinePos),C2F(drawpolylineXfig),C2F(drawpolylineGif)}}, 
00214       {""},
00215       {"xfarc",    {C2F(fillarc),C2F(fillarcPos),C2F(fillarcXfig),C2F(fillarcGif)}},
00216       {"xfarcs",    {C2F(fillarcs),C2F(fillarcsPos),C2F(fillarcsXfig),C2F(fillarcsGif)}},
00217       {""}, 
00218       {""},
00219       {"xend",    {C2F(xend),C2F(xendPos),C2F(xendXfig),C2F(xendGif)}},
00220       {""}, /* 60 */
00221       {"xfrect",    {C2F(fillrectangle),C2F(fillrectanglePos),C2F(fillrectangleXfig),C2F(fillrectangleGif)}},
00222       {""}, 
00223       {""}, 
00224       {""}, 
00225       {""},
00226       {"xarrow",    {C2F(drawarrows),C2F(drawarrowsPos),C2F(drawarrowsXfig),C2F(drawarrowsGif)}},
00227       {""}, 
00228       {""}, 
00229       {""},
00230       {"xinfo",    {C2F(xinfo),C2F(vide),C2F(vide),C2F(vide)}}, /* 70 */
00231       {"xgfont",    {C2F(queryfamily),C2F(queryfamilyPos),C2F(queryfamilyXfig),C2F(queryfamilyGif)}},
00232       {""}, 
00233       {"xfontmxs", {C2F(getFontMaxSize),C2F(getFontMaxSizePos),C2F(getFontMaxSizeXfig),C2F(getFontMaxSizeGif)}},
00234       {"xnum",    {C2F(displaynumbers),C2F(displaynumbersPos),C2F(displaynumbersXfig),C2F(displaynumbersGif)}},
00235       {""},
00236       {"xclick",    {C2F(xclick),C2F(xclickPos),C2F(xclickXfig),C2F(xclickGif)}},
00237       {""}, 
00238       {""}, 
00239       {""},
00240       {""}, /* 80 */
00241       {"xlfont",    {C2F(loadfamily),C2F(loadfamilyPos),C2F(loadfamilyXfig),C2F(loadfamilyGif)}},
00242       {""}, 
00243       {""}, 
00244       {""}, 
00245       {""},
00246       {"xinit2",    {C2F(initgraphic),C2F(initgraphicfromscreenPos),C2F(initgraphicfromscreenXfig),C2F(initgraphicfromscreenGif)}} /* 86 */
00247     };
00248 
00249   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
00250     {
00251       register int key = hash (str, len);
00252 
00253       if (key <= MAX_HASH_VALUE && key >= 0)
00254         {
00255           register const char *s = wordlist[key].name;
00256 
00257           if (*str == *s && !strcmp (str + 1, s + 1))
00258             return &wordlist[key];
00259         }
00260     }
00261   return 0;
00262 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

int DriverId = 0 [static]

Definition at line 267 of file Xcall.c.

char DriverName[] = "Rec" [static]

Definition at line 266 of file Xcall.c.

Referenced by xendgraphicGif().

int Printer_XRes = 0

Definition at line 68 of file Xcall.c.

Referenced by CopyPrint(), and GetDPIFromDriver().

int Printer_YRes = 0

Definition at line 69 of file Xcall.c.

Referenced by CopyPrint(), and GetDPIFromDriver().

int WindowsPrintScreen = 0

Definition at line 67 of file Xcall.c.

Referenced by CopyPrint(), and GetDPIFromDriver().


Generated on Sun Mar 4 15:55:26 2007 for Scilab [trunk] by  doxygen 1.5.1