slxfig-pre0.2.0-138/0002755000175000000620000000000014551442151012647 5ustar johnstaffslxfig-pre0.2.0-138/src/0002755000175000000620000000000014551442151013436 5ustar johnstaffslxfig-pre0.2.0-138/src/config.hin0000644000175000000620000000042411325613443015401 0ustar johnstaff/* -*- c -*- */ /* Define this if have stdlib.h */ #undef HAVE_STDLIB_H /* Define this if you have unistd.h */ #undef HAVE_UNISTD_H /* Set these to the appropriate values */ #undef SIZEOF_SHORT #undef SIZEOF_INT #undef SIZEOF_LONG #undef SIZEOF_FLOAT #undef SIZEOF_DOUBLE slxfig-pre0.2.0-138/src/gcontour.sl0000644000175000000620000000475711357313335015653 0ustar johnstaffimport ("gcontour"); private define do_gcontour_callback (xvals, yvals, zlevel, s) { return (@s.fun)(xvals, yvals, zlevel, __push_list (s.args)); } %!%+ %\function{gcontour} %\synopsis{} %\usage{gcontour(img, levels, &callback_fun [, callback_args...]);} %\description % \exmp{img} is a 2d-array of numbers, \exmp{levels} is an array of contour-levels, % and \exmp{callback_fun} is a callback function that will be called as %#v+ % callback_fun(x, y, iz [, callback_args...]); %#v- % for each contour line at the level \exmp{levels[iz]} % with the image coordinates \exmp{x} and \exmp{y}. %\seealso{gcontour_compute} %!%- define gcontour () { variable nargs = _NARGS; variable args = NULL; if (nargs > 3) { args = __pop_list (nargs - 3); nargs = 3; } if (nargs != 3) usage ("gcontour (2d-array, 1d-levels, &callback-fun [, callback-args...])"); variable img, zvals, fun; (img, zvals, fun) = (); if (args == NULL) return _gcontour (img, zvals, fun); return _gcontour (img, zvals, &do_gcontour_callback, struct { fun=fun, args=args }); } private define gcontour_compute_callback (xvals, yvals, zlevel, contours) { variable s = contours[zlevel]; list_append (s.x_list, xvals); list_append (s.y_list, yvals); } %!%+ %\function{gcontour_compute} %\usage{Struct_Type[] gcontour_compute(img, levels)} %\description % This function takes a 2d array of numbers (\exmp{img}) and an array of % array of N contour-levels (\exmp{levels}) and returns the % corresponding contours in the form of an array of N structures. % Each structure contains the contour lines for the corresponding level % via the fields \exmp{x_list} and \exmp{y_list}. % As the names indicate, the values of these fields are lists. Each % element of the x_list contains the image x coordinate of the % contour. Similarly each element of the y_list field is an array of % image y coordinates. %\seealso{gcontour} %!%- define gcontour_compute () { if (_NARGS != 2) usage ("contour_list = %s (2d-array, 1d-levels)", _function_name); variable img, zvals; (img, zvals) = (); variable nz = length (zvals); variable contours = Struct_Type[nz]; _for (0, nz-1, 1) { variable i = (); contours[i] = struct { x_list = {}, y_list = {} }; } _gcontour (img, zvals, &gcontour_compute_callback, contours); return contours; } $1 = path_concat (path_concat (path_dirname (__FILE__), "help"), "gcontour.hlp"); if (NULL != stat_file ($1)) add_doc_file ($1); slxfig-pre0.2.0-138/src/gcontour-module.c0000644000175000000620000005252514146404547016743 0ustar johnstaff/* Copyright (C) 2005, 2006, 2007 John E. Davis This file is part of SLxfig. SLxfig is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. SLxfig is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "config.h" #include #include #include #include #include SLANG_MODULE(gcontour); #include "version.h" #define IS_NAN(x) isnan(x) typedef struct { int flag; int zlevel; float *xpts; float *ypts; unsigned int npts; unsigned int nmalloced; SLang_Name_Type *nt; SLang_Any_Type *client_data; } Contour_Type; static void free_contour_type (Contour_Type *ct) { if (ct == NULL) return; if (ct->xpts != NULL) SLfree ((char *) ct->xpts); if (ct->ypts != NULL) SLfree ((char *) ct->ypts); SLfree ((char *) ct); } static Contour_Type *alloc_contour_type (SLang_Name_Type *nt, SLang_Any_Type *cd) { unsigned int num; Contour_Type *ct = (Contour_Type *)SLcalloc (1, sizeof (Contour_Type)); if (ct == NULL) return NULL; num = 2048; if ((NULL == (ct->xpts = (float *)SLmalloc (num * sizeof (float)))) || (NULL == (ct->ypts = (float *)SLmalloc (num * sizeof (float))))) { free_contour_type (ct); return NULL; } ct->nmalloced = num; ct->npts = 0; ct->flag = 0; ct->nt = nt; ct->client_data = cd; return ct; } #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #define MAX(a,b) (((a) > (b)) ? (a) : (b)) #define ISIGN(a,b) (((b) < 0) ? (-a) : (a)) /* FILL THE FIRST N BITS OF BITMAP WITH ZEROES. */ static void fill0 (unsigned char *bitmap, unsigned int n) { unsigned int i; unsigned char ch; unsigned char mask; i = n / 8; memset ((char *) bitmap, 0, i); n = n % 8; if (n == 0) return; ch = bitmap[i]; mask = 1; for (i = 0; i < n; i++) { ch &= ~mask; mask = mask << 1; } bitmap[i] = ch; } /* PUT A ONE IN THE NTH BIT OF BITMAP */ static void mark1 (unsigned char *bitmap, unsigned int n) { unsigned int i = n/8; n = n % 8; bitmap[i] |= (1 << n); } /* IGET=0 IF THE NTH BIT OF BITMAP IS ZERO, ELSE IGET IS ONE. */ static int iget (unsigned char *bitmap, unsigned int n) { unsigned int i = n/8; n = n % 8; return bitmap[i] & (1 << n); } /* C C THIS SUBROUTINE DRAWS A CONTOUR THROUGH EQUAL VALUES OF AN ARRAY. C C ***** FORMAL ARGUMENTS *********************************** C C Z IS THE ARRAY FOR WHICH CONTOURS ARE TO BE DRAWN. THE ELEMENTS C OF Z ARE ASSUMED TO LIE UPON THE NODES OF A TOPOLOGICALLY C RECTANGULAR COORDINATE SYSTEM - E.G. CARTESIAN, POLAR (EXCEPT C THE ORIGIN), ETC. C C NRZ IS THE NUMBER OF ROWS DECLARED FOR Z IN THE CALLING PROGRAM. C C NX IS THE LIMIT FOR THE FIRST SUBSCRIPT OF Z. C C NY IS THE LIMIT FOR THE SECOND SUBSCRIPT OF Z. C C CV ARE THE VALUES OF THE CONTOURS TO BE DRAWN. C C NCV IS THE NUMBER OF CONTOUR VALUES IN CV. C C ZMAX IS THE MAXIMUM VALUE OF Z FOR CONSIDERATION. A VALUE OF C Z(I,J) GREATER THAN ZMAX IS A SIGNAL THAT THAT POINT AND THE C GRID LINE SEGMENTS RADIATING FROM THAT POINT TO IT'S NEIGHBORS C ARE TO BE EXCLUDED FROM CONTOURING. C C BITMAP IS A WORK AREA LARGE ENOUGH TO HOLD 2*NX*NY*NCV BITS. IT C IS ACCESSED BY LOW-LEVEL ROUTINES, WHICH ARE DESCRIBED BELOW. C LET J BE THE NUMBER OF USEFUL BITS IN EACH WORD OF BITMAP, C AS DETERMINED BY THE USER MACHINE AND IMPLEMENTATION OF C THE BITMAP MANIPULATION SUBPROGRAMS DESCRIBED BELOW. THEN C THE NUMBER OF WORDS REQUIRED FOR THE BITMAP IS THE FLOOR OF C (2*NX*NY*NCV+J-1)/J. C C DRAW IS A USER-PROVIDED SUBROUTINE USED TO DRAW CONTOURS. C THE CALLING SEQUENCE FOR DRAW IS: C C CALL DRAW (X,Y,IFLAG) C LET NX = INTEGER PART OF X, FX = FRACTIONAL PART OF X. C THEN X SHOULD BE INTERPRETED SUCH THAT INCREASES IN NX C CORRESPOND TO INCREASES IN THE FIRST SUBSCRIPT OF Z, AND C FX IS THE FRACTIONAL DISTANCE FROM THE ABSCISSA CORRESPONDING C TO NX TO THE ABSCISSA CORRESPONDING TO NX+1, C AND Y SHOULD BE INTERPRETED SIMILARLY FOR THE SECOND C SUBSCRIPT OF Z. C THE LOW-ORDER DIGIT OF IFLAG WILL HAVE ONE OF THE VALUES: C 1 - CONTINUE A CONTOUR, C 2 - START A CONTOUR AT A BOUNDARY, C 3 - START A CONTOUR NOT AT A BOUNDARY, C 4 - FINISH A CONTOUR AT A BOUNDARY, C 5 - FINISH A CLOSED CONTOUR (NOT AT A BOUNDARY). C NOTE THAT REQUESTS 1, 4 AND 5 ARE FOR PEN-DOWN C MOVES, AND THAT REQUESTS 2 AND 3 ARE FOR PEN-UP C MOVES. C 6 - SET X AND Y TO THE APPROXIMATE 'PEN' POSITION, USING C THE NOTATION DISCUSSED ABOVE. THIS CALL MAY BE C IGNORED, THE RESULT BEING THAT THE 'PEN' POSITION C IS TAKEN TO CORRESPOND TO Z(1,1). C IFLAG/10 IS THE CONTOUR NUMBER. C C ***** EXTERNAL SUBPROGRAMS ******************************* C C DRAW IS THE USER-SUPPLIED LINE DRAWING SUBPROGRAM DESCRIBED ABOVE. C DRAW MAY BE SENSITIVE TO THE HOST COMPUTER AND TO THE PLOT DEVICE. C FILL0 IS USED TO FILL A BITMAP WITH ZEROES. CALL FILL0 (BITMAP,N) C FILLS THE FIRST N BITS OF BITMAP WITH ZEROES. C MARK1 IS USED TO PLACE A 1 IN A SPECIFIC BIT OF THE BITMAP. C CALL MARK1 (BITMAP,N) PUTS A 1 IN THE NTH BIT OF THE BITMAP. C IGET IS USED TO DETERMINE THE SETTING OF A PARTICULAR BIT IN THE C BITMAP. I=IGET(BITMAP,N) SETS I TO ZERO IF THE NTH BIT OF THE C BITMAP IS ZERO, AND SETS I TO ONE IF THE NTH BIT IS ONE. C FILL0, MARK1 AND IGET ARE MACHINE SENSITIVE. C C ****************************************************************** C */ static int gcontr (VOID_STAR z, unsigned int nx, unsigned int ny, double (*to_double_fun)(VOID_STAR, unsigned int), double *cv, unsigned int ncv, double zmax, unsigned char *bitmap, int (*draw)(double, double, int, Contour_Type *), Contour_Type *ct) { int l1[4]; int l2[4]; int ij[2]; /* C L1 AND L2 CONTAIN LIMITS USED DURING THE SPIRAL SEARCH FOR THE C BEGINNING OF A CONTOUR. C IJ STORES SUBCRIPTS USED DURING THE SPIRAL SEARCH. */ int i1[2]; int i2[2]; int i3[6]; /* C C I1, I2 AND I3 ARE USED FOR SUBSCRIPT COMPUTATIONS DURING THE C EXAMINATION OF LINES FROM Z(I,J) TO IT'S NEIGHBORS. C */ double xint[4]; /* C C XINT IS USED TO MARK INTERSECTIONS OF THE CONTOUR UNDER C CONSIDERATION WITH THE EDGES OF THE CELL BEING EXAMINED. C */ double xy[2]; /* C C XY IS USED TO COMPUTE COORDINATES FOR THE DRAW SUBROUTINE. C */ double zz; int icur, jcur; /* 1 based */ int ibkey; int jump = 0; double cval, z1, z2; int l, iedge, icv; /* 0-based index */ int idir, nxidir; int k; /* 0-based indices */ int ix; int ii, jj; /* 1-based */ int iflag; #define I ij[0] #define J ij[1] #define X xy[0] #define Y xy[1] l1[0] = nx; l1[1] = ny; l1[2] = -1; l1[3] = -1; i1[0] = 1; i1[1] = 0; i2[0] = 1; i2[1] = -1; i3[0] = 1; i3[1] = 0; i3[2] = 0; i3[3] = 1; i3[4] = 1; i3[5] = 0; /* C C SET THE CURRENT PEN POSITION. THE DEFAULT POSITION CORRESPONDS C TO Z(1,1). C */ X = 1.0; Y = 1.0; if (-1 == (*draw) (X-1, Y-1, 6, ct)) return -1; icur = 1; jcur = 1; fill0 (bitmap, 2*nx*ny*ncv); /* C C SEARCH ALONG A RECTANGULAR SPIRAL PATH FOR A LINE SEGMENT HAVING C THE FOLLOWING PROPERTIES: C 1. THE END POINTS ARE NOT EXCLUDED, C 2. NO MARK HAS BEEN RECORDED FOR THE SEGMENT, C 3. THE VALUES OF Z AT THE ENDS OF THE SEGMENT ARE SUCH THAT C ONE Z IS LESS THAN THE CURRENT CONTOUR VALUE, AND THE C OTHER IS GREATER THAN OR EQUAL TO THE CURRENT CONTOUR C VALUE. C C SEARCH ALL BOUNDARIES FIRST, THEN SEARCH INTERIOR LINE SEGMENTS. C NOTE THAT THE INTERIOR LINE SEGMENTS NEAR EXCLUDED POINTS MAY BE C BOUNDARIES. C */ ibkey = 0; while (1) /* label 10 */ { I = icur; J = jcur; label_20: l2[0] = I; l2[1] = J; l2[2] = -I; l2[3] = -J; /* C DIRECTION ZERO IS +I, 1 IS +J, 2 IS -I, 3 IS -J. */ idir = 0; label_30: nxidir = idir + 1; k = idir; /* FORTRAN: k = nxidir; */ if (nxidir > 3) nxidir = 0; label_40: I = abs(I); J = abs(J); /* #define Z(i,j) ((*to_double_fun)(z, (i)*(ny) + (j))) */ #define Z(i,j) ((*to_double_fun)(z, (i) + ((nx)*(j)))) zz = Z(I-1,J-1); if ((zz > zmax) || IS_NAN(zz)) goto label_140; /* label_50 */ for (l = 0; l < 2; l++) { /* C L=1 MEANS HORIZONTAL LINE, L=2 MEANS VERTICAL LINE. */ if (ij[l] >= l1[l]) continue; ii = I + i1[l]; jj = J + i1[1-l]; zz = Z(ii-1,jj-1); if ((zz > zmax) || IS_NAN(zz)) continue; jump = 100; /* C THE NEXT 15 STATEMENTS (OR SO) DETECT BOUNDARIES. */ label_60: ix = 1; if (ij[1-l] != 1) { ii = I - i1[1-l]; jj = J - i1[l]; if (Z(ii-1,jj-1) <= zmax) { ii = I + i2[l]; jj = J + i2[1-l]; if (Z(ii-1,jj-1) < zmax) ix = 0; } if (ij[1-l] >= l1[1-l]) goto label_90; } ii = I + i1[1-l]; jj = J + i1[l]; if (Z(ii-1, jj-1) <= zmax) { if (Z(I,J) < zmax) { if (jump == 100) goto label_100; goto label_280; } } label_90: ix += 2; if (jump != 100) goto label_280; label_100: if ((ix != 3) && (ix + ibkey != 0)) { /* C NOW DETERMINE WHETHER THE LINE SEGMENT IS CROSSED BY THE CONTOUR. */ unsigned int offset; ii = I + i1[l]; jj = J + i1[1-l]; z1 = Z(I-1,J-1); z2 = Z(ii-1, jj-1); offset = ncv*(2*(ny*(I-1) + (J-1)) + l); for (icv = 0; icv < (int)ncv; icv++) { if (0 == iget (bitmap, offset)) { if ((cv[icv] > MIN(z1, z2)) && (cv[icv] <= MAX(z1,z2))) goto label_190; /* uses icv */ mark1 (bitmap, offset); } offset++; } } } label_140: l = idir % 2; ij[l] = ISIGN(ij[l],l1[k]); /* C */ /* C LINES FROM Z(I,J) TO Z(I+1,J) AND Z(I,J+1) ARE NOT SATISFACTORY. */ /* C CONTINUE THE SPIRAL. */ /* C */ while (1) /* label_150 */ { if (ij[l] < l1[k]) { ij[l]++; if (ij[l] <= l2[k]) goto label_40; l2[k] = ij[l]; idir = nxidir; goto label_30; } if (idir == nxidir) break; nxidir++; ij[l] = l1[k]; k = nxidir-1; l = 1 - l; ij[l] = l2[k]; if (nxidir > 3) nxidir = 0; } if (ibkey != 0) return 0; /* ??? */ ibkey = 1; } /* goto label_10 */ /* C */ /* C AN ACCEPTABLE LINE SEGMENT HAS BEEN FOUND. */ /* C FOLLOW THE CONTOUR UNTIL IT EITHER HITS A BOUNDARY OR CLOSES. */ /* C */ label_190: iedge = l; cval = cv[icv]; if (ix != 1) iedge += 2; iflag = 2 + ibkey; xint[iedge] = (cval-z1)/(z2-z1); while (1) /* label_200 */ { unsigned int offset; int ni; int ks; /* 0 based */ xy[l] = ij[l] + xint[iedge]; xy[1-l] = ij[1-l]; offset = ncv*(2*(ny*(I-1) + (J-1)) + l)+icv; mark1 (bitmap, offset); if (-1 == (*draw)(X-1,Y-1,iflag + 10*icv, ct)) return -1; if (iflag >= 4) { icur = I; jcur = J; goto label_20; } /* C */ /* C CONTINUE A CONTOUR. THE EDGES ARE NUMBERED CLOCKWISE WITH */ /* C THE BOTTOM EDGE BEING EDGE NUMBER ONE. */ /* C */ ni = 1; if (iedge >= 2) { I = I - i3[iedge]; J = J - i3[iedge+2]; } for (k = 0; k < 4; k++) { if (k == iedge) continue; ii = I + i3[k]; jj = J + i3[k+1]; z1 = Z(ii-1,jj-1); ii = I + i3[k+1]; jj = J + i3[k+2]; z2 = Z(ii-1,jj-1); if (cval <= MIN(z1,z2)) continue; if (cval > MAX(z1,z2)) continue; if ((k == 0) || (k == 3)) { zz = z1; z1 = z2; z2 = zz; } xint[k] = (cval-z1)/(z2-z1); ni++; ks = k; } if (ni != 2) { /* C */ /* C THE CONTOUR CROSSES ALL FOUR EDGES OF THE CELL BEING EXAMINED. */ /* C CHOOSE THE LINES TOP-TO-LEFT AND BOTTOM-TO-RIGHT IF THE */ /* C INTERPOLATION POINT ON THE TOP EDGE IS LESS THAN THE INTERPOLATION */ /* C POINT ON THE BOTTOM EDGE. OTHERWISE, CHOOSE THE OTHER PAIR. THIS */ /* C METHOD PRODUCES THE SAME RESULTS IF THE AXES ARE REVERSED. THE */ /* C CONTOUR MAY CLOSE AT ANY EDGE, BUT MUST NOT CROSS ITSELF INSIDE */ /* C ANY CELL. */ /* C */ ks = (5 - iedge)-2; if (xint[2] >= xint[0]) { ks = 1 - iedge; if (ks < 0) ks += 4; } } /* C */ /* C DETERMINE WHETHER THE CONTOUR WILL CLOSE OR RUN INTO A BOUNDARY */ /* C AT EDGE KS OF THE CURRENT CELL. */ /* C */ l = ks; iflag = 1; jump = 280; if (ks >= 2) { I = I + i3[ks]; J = J + i3[ks+2]; l = ks - 2; } offset = ncv*(2*(ny*(I-1) + (J-1)) + l)+icv; if (iget (bitmap, offset) == 0) goto label_60; iflag = 5; goto label_290; label_280: if (ix != 0) iflag = 4; label_290: iedge = ks + 2; if (iedge > 3) iedge -= 4; xint[iedge] = xint[ks]; } } /* C 1 - CONTINUE A CONTOUR, C 2 - START A CONTOUR AT A BOUNDARY, C 3 - START A CONTOUR NOT AT A BOUNDARY, C 4 - FINISH A CONTOUR AT A BOUNDARY, C 5 - FINISH A CLOSED CONTOUR (NOT AT A BOUNDARY). C NOTE THAT REQUESTS 1, 4 AND 5 ARE FOR PEN-DOWN C MOVES, AND THAT REQUESTS 2 AND 3 ARE FOR PEN-UP C MOVES. C 6 - SET X AND Y TO THE APPROXIMATE 'PEN' POSITION, USING C THE NOTATION DISCUSSED ABOVE. THIS CALL MAY BE C IGNORED, THE RESULT BEING THAT THE 'PEN' POSITION C IS TAKEN TO CORRESPOND TO Z(1,1). */ static SLang_Array_Type *make_float_array (float *x, unsigned int npts) { SLindex_Type inpts = (SLindex_Type) npts; SLang_Array_Type *at; if (NULL == (at = SLang_create_array (SLANG_FLOAT_TYPE, 0, NULL, &inpts, 1))) return NULL; memcpy ((char *) at->data, (char *)x, npts * sizeof (float)); return at; } static int push_contour (Contour_Type *ct) { SLang_Array_Type *at_x, *at_y; int ret = 0; if (NULL == (at_x = make_float_array (ct->xpts, ct->npts))) return -1; if (NULL == (at_y = make_float_array (ct->ypts, ct->npts))) { SLang_free_array (at_x); return -1; } if ((-1 == SLang_start_arg_list ()) || (-1 == SLang_push_array (at_x, 0)) || (-1 == SLang_push_array (at_y, 0)) || (-1 == SLang_push_int (ct->zlevel)) || ((ct->client_data != NULL) && (-1 == SLang_push_anytype (ct->client_data))) || (-1 == SLang_end_arg_list ()) || (-1 == SLexecute_function (ct->nt))) ret = -1; SLang_free_array (at_y); SLang_free_array (at_x); return ret; } static int resize_contour (Contour_Type *ct) { unsigned int new_num = ct->npts + 512; float *tmp; if (NULL == (tmp = (float *)SLrealloc ((char *)ct->xpts, new_num*sizeof(float)))) return -1; ct->xpts = tmp; if (NULL == (tmp = (float *)SLrealloc ((char *)ct->ypts, new_num*sizeof(float)))) return -1; ct->ypts = tmp; ct->nmalloced = new_num; return 0; } static int draw_callback (double x, double y, int flag, Contour_Type *ct) { int zlevel = flag / 10; flag = flag % 10; if (flag == 6) return 0; if (ct->npts + 1 >= ct->nmalloced) { if (-1 == resize_contour (ct)) return -1; } ct->xpts[ct->npts] = (float) x; ct->ypts[ct->npts] = (float) y; ct->npts++; switch (flag) { default: SLang_verror (SL_INTERNAL_ERROR, "Error in gcont module: Unexpected flag %d", flag); return -1; case 2: case 3: /* start */ ct->zlevel = zlevel; break; case 1: /* continuation */ break; case 5: /* finish closed */ ct->xpts[ct->npts] = ct->xpts[0]; ct->ypts[ct->npts] = ct->ypts[0]; ct->npts++; /* fall through */ case 4: /* finish at boundary */ if (-1 == push_contour (ct)) return -1; ct->npts = 0; break; } return 0; } static double char_to_double (VOID_STAR p, unsigned int offset) { return (double) *((char *)p + offset); } static double uchar_to_double (VOID_STAR p, unsigned int offset) { return (double) *((unsigned char *)p + offset); } static double int_to_double (VOID_STAR p, unsigned int offset) { return (double) *((int *)p + offset); } static double uint_to_double (VOID_STAR p, unsigned int offset) { return (double) *((unsigned int *)p + offset); } static double short_to_double (VOID_STAR p, unsigned int offset) { return (double) *((short *)p + offset); } static double ushort_to_double (VOID_STAR p, unsigned int offset) { return (double) *((unsigned short *)p + offset); } static double long_to_double (VOID_STAR p, unsigned int offset) { return (double) *((long *)p + offset); } static double ulong_to_double (VOID_STAR p, unsigned int offset) { return (double) *((unsigned long *)p + offset); } static double float_to_double (VOID_STAR p, unsigned int offset) { return (double) *((float *)p + offset); } static double double_to_double (VOID_STAR p, unsigned int offset) { return (double) *((double *)p + offset); } static void gcontr_intrin (void) { SLang_Name_Type *nt; SLang_Array_Type *image = NULL; SLang_Array_Type *zvals = NULL; unsigned int nx, ny, nz; double (*to_double_fun)(VOID_STAR, unsigned int); Contour_Type *ct; SLang_Any_Type *client_data = NULL; int nargs; nargs = SLang_Num_Function_Args; if (nargs == 4) { if (-1 == SLang_pop_anytype (&client_data)) return; nargs--; } if (nargs != 3) { SLang_verror (SL_USAGE_ERROR, "gcontour (image, zlevels, &callback [,clientdata])"); if (client_data != NULL) SLang_free_anytype (client_data); return; } if (NULL == (nt = SLang_pop_function ())) { if (client_data != NULL) SLang_free_anytype (client_data); return; } if (-1 == SLang_pop_array_of_type (&zvals, SLANG_DOUBLE_TYPE)) goto free_return; if (zvals->num_dims != 1) { SLang_verror (SL_INVALID_PARM, "Expecting a 1-d array of contour levels"); goto free_return; } nz = zvals->num_elements; if (-1 == SLang_pop_array (&image, 0)) goto free_return; if (image->num_dims != 2) { SLang_verror (SL_INVALID_PARM, "gcontr requires a 2-d image"); goto free_return; } ny = image->dims[0]; nx = image->dims[1]; if ((nx < 2) || (ny < 2)) { SLang_verror (SL_INVALID_PARM, "gcontr requires at least a 2x2 image"); goto free_return; } switch (image->data_type) { case SLANG_CHAR_TYPE: to_double_fun = char_to_double; break; case SLANG_UCHAR_TYPE: to_double_fun = uchar_to_double; break; case SLANG_SHORT_TYPE: to_double_fun = short_to_double; break; case SLANG_USHORT_TYPE: to_double_fun = ushort_to_double; break; case SLANG_INT_TYPE: to_double_fun = int_to_double; break; case SLANG_UINT_TYPE: to_double_fun = uint_to_double; break; case SLANG_LONG_TYPE: to_double_fun = long_to_double; break; case SLANG_ULONG_TYPE: to_double_fun = ulong_to_double; break; case SLANG_FLOAT_TYPE: to_double_fun = float_to_double; break; case SLANG_DOUBLE_TYPE: to_double_fun = double_to_double; break; default: SLang_verror (SL_NOT_IMPLEMENTED, "Unsupported image type"); goto free_return; } if (NULL != (ct = alloc_contour_type (nt, client_data))) { double zmax = 1e10; unsigned char *bitmap = (unsigned char *)SLmalloc ((1 + (2*nx*ny*nz)/8)); if (bitmap == NULL) { free_contour_type (ct); goto free_return; } (void) gcontr (image->data, nx, ny, to_double_fun, (double *)zvals->data, zvals->num_elements, zmax, bitmap, draw_callback, ct); SLfree ((char *) bitmap); free_contour_type (ct); } /* drop */ free_return: if (client_data != NULL) SLang_free_anytype (client_data); SLang_free_function (nt); SLang_free_array (image); SLang_free_array (zvals); } static SLang_Intrin_Fun_Type Module_Intrinsics [] = { MAKE_INTRINSIC_0("_gcontour", gcontr_intrin, SLANG_VOID_TYPE), SLANG_END_INTRIN_FUN_TABLE }; static SLang_Intrin_Var_Type Module_Variables [] = { MAKE_VARIABLE("_gcontour_module_version_string", &Module_Version_String, SLANG_STRING_TYPE, 1), SLANG_END_INTRIN_VAR_TABLE }; static SLang_IConstant_Type Module_IConstants [] = { MAKE_ICONSTANT("_gcontour_module_version", MODULE_VERSION_NUMBER), SLANG_END_ICONST_TABLE }; int init_gcontour_module_ns (char *ns_name) { SLang_NameSpace_Type *ns = SLns_create_namespace (ns_name); if (ns == NULL) return -1; if ((-1 == SLns_add_intrin_var_table (ns, Module_Variables, NULL)) || (-1 == SLns_add_intrin_fun_table (ns, Module_Intrinsics, NULL)) || (-1 == SLns_add_iconstant_table (ns, Module_IConstants, NULL))) return -1; return 0; } /* This function is optional */ void deinit_gcontour_module (void) { } slxfig-pre0.2.0-138/src/mkversion.sh0000755000175000000620000000034411325613443016011 0ustar johnstaff#version 1.0 # The initial echo is necessary because the solaris version of sed cannot # grok input without a trailing newline. echo `grep "^#define MODULE_[MP]" version.h | sed -e 's/[^0-9]*//' | tr '\012' .` | sed -e 's/.$//' slxfig-pre0.2.0-138/src/version.h0000644000175000000620000000057511325613443015301 0ustar johnstaff#define MODULE_MAJOR_VERSION 0 #define MODULE_MINOR_VERSION 1 #define MODULE_PATCH_LEVEL 0 #define MKSTR1(x) #x #define MKSTR(x) MKSTR1(x) static char *Module_Version_String = MKSTR(MODULE_MAJOR_VERSION) "." \ MKSTR(MODULE_MINOR_VERSION) "." MKSTR(MODULE_PATCH_LEVEL); #define MODULE_VERSION_NUMBER \ (MODULE_MAJOR_VERSION*10000+MODULE_MINOR_VERSION*100+MODULE_PATCH_LEVEL) slxfig-pre0.2.0-138/src/Makefile.in0000644000175000000620000001142214551442151015501 0ustar johnstaff# -*- sh -*- #--------------------------------------------------------------------------- # List of modules and associated .sl files to install #--------------------------------------------------------------------------- MODULES = gcontour-module.so SL_FILES = gcontour.sl xfig.sl vector.sl XFIG_SL_FILES = xfig/*.sl XFIG_DAT_FILES = xfig/w3ccolors.txt HLP_FILES = ../doc/help/slxfig.hlp ../doc/help/gcontour.hlp ../doc/help/vector.hlp MODULE_VERSION = `./mkversion.sh` #--------------------------------------------------------------------------- # Installation Directories #--------------------------------------------------------------------------- prefix = @prefix@ exec_prefix = @exec_prefix@ datarootdir = @datarootdir@ MODULE_INSTALL_DIR = @MODULE_INSTALL_DIR@ SL_FILES_INSTALL_DIR = @SL_FILES_INSTALL_DIR@ HLP_FILES_INSTALL_DIR = $(SL_FILES_INSTALL_DIR)/help #--------------------------------------------------------------------------- # C Compiler to create a shared library #--------------------------------------------------------------------------- CC = @CC@ CFLAGS = @CFLAGS@ LDFLAGS = @LDFLAGS@ CC_SHARED = @CC_SHARED@ #--------------------------------------------------------------------------- # Location of the S-Lang library and its include file #--------------------------------------------------------------------------- SLANG_INC = @SLANG_INC@ SLANG_LIB = @SLANG_LIB@ -lslang #--------------------------------------------------------------------------- # Additional Libraries required by the module #--------------------------------------------------------------------------- RPATH = @RPATH@ #--------------------------------------------------------------------------- # Misc Programs required for installation #--------------------------------------------------------------------------- INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ MKINSDIR = ../autoconf/mkinsdir.sh RM = rm -f LN = ln -s UPDATE_VERSION_SCRIPT = $(HOME)/bin/update_changes_version #--------------------------------------------------------------------------- # DESTDIR is designed to facilitate making packages. Normally it is empty #--------------------------------------------------------------------------- DESTDIR = DEST_MODULE_INSTALL_DIR = $(DESTDIR)$(MODULE_INSTALL_DIR) DEST_SL_FILES_INSTALL_DIR = $(DESTDIR)$(SL_FILES_INSTALL_DIR) DEST_HLP_FILES_INSTALL_DIR = $(DESTDIR)$(HLP_FILES_INSTALL_DIR) #--------------------------------------------------------------------------- LIBS = $(SLANG_LIB) $(RPATH) $(DL_LIB) -lm INCS = $(SLANG_INC) all: $(MODULES) xfig.sl #--------------------------------------------------------------------------- # Put Rules to create the modules here #--------------------------------------------------------------------------- gcontour-module.so: gcontour-module.c $(CC_SHARED) $(INCS) $(LDFLAGS) gcontour-module.c -o gcontour-module.so $(LIBS) xfig.sl: ../changes.txt if [ -x $(UPDATE_VERSION_SCRIPT) ]; then \ $(UPDATE_VERSION_SCRIPT) ../changes.txt xfig.sl; \ fi #--------------------------------------------------------------------------- # Regression tests #--------------------------------------------------------------------------- test: @for X in tests/test_*.sl; \ do \ slsh $$X '/tmp/slxfig-$$uid/$$ppid'; \ done #--------------------------------------------------------------------------- # Installation Rules #--------------------------------------------------------------------------- install_directories: $(MKINSDIR) $(DEST_MODULE_INSTALL_DIR) $(MKINSDIR) $(DEST_SL_FILES_INSTALL_DIR)/xfig $(MKINSDIR) $(DEST_HLP_FILES_INSTALL_DIR) install_modules: install_directories @for X in $(MODULES); \ do \ Y=$$X.$(MODULE_VERSION); \ YDEST=$(DEST_MODULE_INSTALL_DIR)/$$Y; \ echo $(INSTALL_DATA) $$X $$YDEST; \ $(INSTALL_DATA) $$X $$YDEST; \ if [ "$$?" != "0" ]; then \ exit 1; \ fi; \ $(RM) $(DEST_MODULE_INSTALL_DIR)/$$X; \ $(LN) $$Y $(DEST_MODULE_INSTALL_DIR)/$$X; \ done install_slfiles: install_directories @for X in $(SL_FILES); \ do \ echo $(INSTALL_DATA) $$X $(DEST_SL_FILES_INSTALL_DIR); \ $(INSTALL_DATA) $$X $(DEST_SL_FILES_INSTALL_DIR); \ if [ "$$?" != "0" ]; then \ exit 1; \ fi; \ done @for X in $(XFIG_SL_FILES) $(XFIG_DAT_FILES); \ do \ echo $(INSTALL_DATA) $$X $(DEST_SL_FILES_INSTALL_DIR)/xfig/; \ $(INSTALL_DATA) $$X $(DEST_SL_FILES_INSTALL_DIR)/xfig/; \ if [ "$$?" != "0" ]; then \ exit 1; \ fi; \ done install_hlpfiles: install_directories @for X in $(HLP_FILES); \ do \ echo $(INSTALL_DATA) $$X $(DEST_HLP_FILES_INSTALL_DIR); \ $(INSTALL_DATA) $$X $(DEST_HLP_FILES_INSTALL_DIR); \ if [ "$$?" != "0" ]; then \ exit 1; \ fi; \ done install: all install_directories install_modules install_slfiles install_hlpfiles clean: -/bin/rm -f $(MODULES) *~ \#* distclean: clean -/bin/rm -f config.h Makefile slxfig-pre0.2.0-138/src/xfig.sl0000644000175000000620000000140014551442151014724 0ustar johnstaff$1 = 0; $2 = 2; $3 = 0; variable _xfig_version = $1*10000 + $2*100 + $3; variable _xfig_version_string = "pre$1.$2.$3-138"$; ()=evalfile ("xfig/core"); ()=evalfile ("xfig/polyline"); ()=evalfile ("xfig/ellipse"); %()=evalfile ("xfig/text"); % obsolete-- replaced by latex.sl ()=evalfile ("xfig/png.sl"); ()=evalfile ("xfig/latex.sl"); ()=evalfile ("xfig/objects"); ()=evalfile ("xfig/clip.sl"); ()=evalfile ("xfig/plot.sl"); ()=evalfile ("xfig/multipage"); ()=evalfile ("xfig/timetics"); $1 = getenv ("HOME"); if ($1 != NULL) { $1 = path_concat ($1, ".slxfigrc"); if (NULL != stat_file ($1)) { () = evalfile ($1); } } $1 = path_concat (path_concat (path_dirname (__FILE__), "help"), "slxfig.hlp"); if (NULL != stat_file ($1)) add_doc_file ($1); slxfig-pre0.2.0-138/src/tests/0002755000175000000620000000000011653730343014603 5ustar johnstaffslxfig-pre0.2.0-138/src/tests/test_plot_ticlabels-confine.sl0000644000175000000620000000105611453303746022622 0ustar johnstaff() = evalfile (path_concat (path_dirname(__FILE__), "setup.sl")); define slsh_main () { variable x = xfig_plot_new (); variable base = path_basename_sans_extname (__FILE__); x.world (0, 10, 0, 100); x.plot ([0:10], dup^2); x.render (path_concat (OutDir, base+"_default.eps")); variable cx, cy; foreach cx ([0,1]) foreach cy ([0,1]) { x.title ("cx=$cx, cy=$cy"$); x.x1axis (; ticlabels_confine=cx); x.y1axis (; ticlabels_confine=cy); x.render (path_concat (OutDir, sprintf ("%s_%d%d.eps", base, cx, cy))); } } slxfig-pre0.2.0-138/src/tests/test_multiplot_align_ylabels.sl0000644000175000000620000000137711453303746023127 0ustar johnstaff() = evalfile (path_concat (path_dirname(__FILE__), "setup.sl")); define slsh_main () { variable N = 10000; variable i; _for i (-1, 3, 1) { variable a = xfig_plot_new(); a.world (0, 1, 1, 9); a.world2(0, 1, N+1, N+9); a.plot(0.5, 5, 1); a.ylabel ("A$_1$"); a.y2label("A$_2$"); variable b = xfig_plot_new(); b.world (0, 1, N+1, N+9); b.world2(0, 1, 1, 9); b.plot(0.5, N+5, 1); b.ylabel("B$_1$"); b.y2label("B$_2$"); variable q = i<0 ? struct { title="no align ylabels qualifier set" } : struct { align_ylabels=i }; variable mp = xfig_multiplot (a, b;; q); mp.render (path_concat (OutDir, "xfig_multiplot-align_ylabels=$i.eps"$)); } } slxfig-pre0.2.0-138/src/tests/test_textrotate.sl0000644000175000000620000000227511653730343020411 0ustar johnstaff() = evalfile (path_concat (path_dirname(__FILE__), "setup.sl")); define slsh_main () { variable method, angle, col, tone, fname, e, t; variable autoepsdir = xfig_get_autoeps_dir(); foreach method ([0, 2, 3, 4, 1]) { vmessage ("\ndvi2eps_method=%d", method); xfig_set_autoeps_dir ("$autoepsdir/$method"$); variable outdir = "$OutDir/$method"$; () = mkdir (outdir); variable failed=0, passed=0; foreach angle ([0, 30, 180/PI]) foreach col (["black", "blue", "green", "red"]) foreach tone (col=="black" ? [""] : ["4", ""]) { fname = sprintf ("rotate%.f-%s%s", angle, col, tone); vmessage (" trying %s...", fname); try (e) t = xfig_new_text (fname; dvi2eps_method=method, rotate=angle, color=col+tone); catch AnyError: { failed++; vmessage (" ERROR:%s:%s:%S", __argv[0], fname, e.message); continue; } t.render (path_concat (outdir, fname+".eps")); t.render (path_concat (outdir, fname+".png")); t.render (path_concat (outdir, fname+".pdf")); passed++; } if (failed) vmessage ("***%s: Failed: %d/%d", __argv[0], failed, failed+passed); vmessage ("Check output files in %s", outdir); } } slxfig-pre0.2.0-138/src/tests/test_plot_scale.sl0000644000175000000620000000151611435153535020330 0ustar johnstaff() = evalfile (path_concat (path_dirname(__FILE__), "setup.sl")); define slsh_main () { variable x = Struct_Type[2]; x[0] = xfig_plot_new(); x[0].plot([0,10],[10,0]); x[0].xlabel("the x-label"); x[0].ylabel("the y-label"); x[0].title("the title"); x[1] = xfig_plot_new(); x[1].plot([0,10],[10,0]); x[1].axis(; off); variable i, fmt=".png"; _for i (0, length(x)-1, 1) { variable file = "plot${i}_scaled0"$+fmt; vmessage("rendering %s", file); x[i].render(path_concat (OutDir, file)); file = "plot${i}_scaled1"$+fmt; vmessage("rendering %s after scaling", file); x[i].scale(0.5); x[i].render(path_concat(OutDir, file)); file = "plot${i}_scaled2"$+fmt; vmessage("rendering %s after further scaling", file); x[i].scale(.5*(1+sqrt(5)), sqrt(5)); x[i].render(path_concat (OutDir, file)); } } slxfig-pre0.2.0-138/src/tests/test_world1log_world2lin.sl0000644000175000000620000000060111653730343022103 0ustar johnstaff() = evalfile (path_concat (path_dirname(__FILE__), "setup.sl")); define slsh_main () { variable w = xfig_plot_new(); w.world1(0, 2, 1, 100; ylog); w.world2(0, 2, 0, 2; xticlabels=0); w.xlabel(`$x$`); w.ylabel(`$y=10^x$`); w.y2label(`$\log_{10}(y)$`); variable x = [0:2:#100]; w.plot(x, 10^x); w.render (path_concat (OutDir, "world1log_world2lin.eps")); } slxfig-pre0.2.0-138/src/tests/test_hplot-shaded.sl0000644000175000000620000000046611477400554020564 0ustar johnstaff() = evalfile (path_concat (path_dirname(__FILE__), "setup.sl")); define slsh_main () { variable xlo = [0,1,2,3,4,5,6,7,8,9]; variable y = [1,0,3,6,9,8,4,2,3,1]; variable p = xfig_plot_new(); p.world(0, 10, 0, 10); p.hplot(xlo, y; fill=5); p.render (path_concat (OutDir, "hplot-shaded.eps")); } slxfig-pre0.2.0-138/src/tests/setup.sl0000644000175000000620000000202411453303746016300 0ustar johnstaff#!/usr/bin/env slsh require ("rand"); if (__argc != 2) { () = fprintf (stderr, "Usage: slsh %s OUTPUTDIR\n", __argv[0]); () = fprintf (stderr, "\ OUTPUTDIR may contain:\n\ $uid expands to userid\n\ $pid expands to process-id\n\ $ppid expands to parent process-id\n\ $time expands to the integer Unix time\n\ $rnd expands to a random integer\n"); exit (1); } private variable RootDir; private define set_root_dir (dir) { variable uid = getuid (); variable time = _time (); variable rnd = rand (); variable pid = getpid (); variable ppid = getppid (); RootDir = _$(dir); } set_root_dir (__argv[1]); vmessage ("Running %s in %s", __argv[0], RootDir); variable TestDir = path_dirname (__FILE__); prepend_to_slang_load_path (path_concat (TestDir, "..")); require ("xfig"); xfig_set_verbose (-1); xfig_set_tmp_dir (path_concat (RootDir, "tmp")); xfig_set_autoeps_dir (path_concat(RootDir, "autoeps")); variable OutDir = path_concat (RootDir, "output"); () = mkdir (OutDir); slxfig-pre0.2.0-138/src/tests/test_ellipse.sl0000644000175000000620000000461411477400554017644 0ustar johnstaff() = evalfile (path_concat (path_dirname(__FILE__), "setup.sl")); define slsh_main () { variable xfig = xfig_create_file (path_concat (OutDir, "ellipse_rotate.eps")); variable theta; _for theta (0, 90, 15) { variable col = theta/15 - 1; variable e = xfig_new_ellipse (2+theta/15, 1; color=col); e.rotate (vector (0,0,1), theta/180.*PI); e.render (xfig); xfig_new_polyline(e.X.x[[0,1]], e.X.y[[0,1]]; color=col).render(xfig); } xfig_close_file (xfig); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% xfig = xfig_create_file (path_concat (OutDir, "ellipse_BoundingBox.eps")); variable a=5, b=2; theta = PI/3; e = xfig_new_ellipse (a, b); e.rotate (vector (0,0,1), theta); xfig_justify_object (e, vector (0,0,0), vector (0,0,0)); e.render (xfig); xfig_new_polyline(e.X.x[[0,1]], e.X.y[[0,1]]; line=0).render(xfig); xfig_new_polyline(e.X.x[[0,2]], e.X.y[[0,2]]; line=1).render(xfig); xfig_new_polyline([-.2,.2,0,0,0], [0,0,0,-.2,.2]).render(xfig); variable xmin, xmax, ymin, ymax; (xmin, xmax, ymin, ymax, ,) = e.get_bbox(); xfig_new_polyline([xmin,xmax,xmax,xmin], [ymin,ymin,ymax,ymax]; closed, line=2).render(xfig); xfig_close_file (xfig); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% xfig = xfig_create_file (path_concat (OutDir, "ellipse_scale.eps")); e.translate (vector (-e.X.x[0], -e.X.y[0], -e.X.z[0])); e.render (xfig); xfig_new_polyline(e.X.x[[0,1]], e.X.y[[0,1]]).render(xfig); xfig_new_polyline(e.X.x[[0,2]], e.X.y[[0,2]]).render(xfig); variable t = [0:2*PI:#1000]; xfig_new_polyline(cos(theta)*a*cos(t) - sin(theta)*b*sin(t), sin(theta)*a*cos(t) + cos(theta)*b*sin(t) ; line=1, color="red").render(xfig); variable sx=2, sy=.5; col = "blue4"; xfig_new_polyline(sx*e.X.x[[0,1]], sy*e.X.y[[0,1]]; line=1, color="red").render(xfig); xfig_new_polyline(sx*e.X.x[[0,2]], sy*e.X.y[[0,2]]; line=1, color="red").render(xfig); xfig_new_polyline(sx*(cos(theta)*a*cos(t) - sin(theta)*b*sin(t)), sy*(sin(theta)*a*cos(t) + cos(theta)*b*sin(t)) ; line=1, color="red").render(xfig); e.scale (sx, sy); e.set_pen_color (col); e.render (xfig); xfig_new_polyline(e.X.x[[0,1]], e.X.y[[0,1]]; color=col).render(xfig); xfig_new_polyline(e.X.x[[0,2]], e.X.y[[0,2]]; color=col).render(xfig); xfig_close_file (xfig); } slxfig-pre0.2.0-138/src/tests/test_plot_axis-labels.sl0000644000175000000620000000114411453303746021443 0ustar johnstaff() = evalfile (path_concat (path_dirname(__FILE__), "setup.sl")); define set_labels(x, text) { x.xlabel ("x1-label"+text); x.ylabel ("y1-label"+text); x.x2label ("x2-label"+text); x.y2label ("y2-label"+text); } define slsh_main () { variable x = xfig_plot_new(); set_labels(x, " before plotting"); x.render (path_concat (OutDir, "plot_axis-label_1.eps")); x.plot ([0:10], dup^2); set_labels(x, " after plotting"); x.render (path_concat (OutDir, "plot_axis-label_2.eps")); set_labels(x, ", again overwritten"); x.render (path_concat (OutDir, "plot_axis-label_3.eps")); } slxfig-pre0.2.0-138/src/vector.sl0000644000175000000620000003155211653730343015307 0ustar johnstaff% This routine implements some 3-vector operations. % Copyright (c) 2004-2008 John E. Davis % You may distribute this file under the terms the GNU General Public % License. See the file COPYING for more information. % % Version 0.2.0 #ifnexists sincos private define sincos(x) { return sin(x), cos(x); } #endif private define help (f) { #ifexists _xfig_check_help () = _xfig_check_help (0, f; help); #endif throw UsageError, "Illegal usage of $f"$; } %!%+ %\datatype{Vector_Type} %\synopsis{vector data type} %\description % The data type used by various vector functions % is defined as a structure with the fields %#v+ % x, y, z %#v- % A vector can be initialized, e.g., by %#v+ % v = vector(x, y ,z); %#v- % The following common operators can be used for vector arithmetics: % +/- : addition/subtraction of scalars or vectors % * : scaling of vectors or dot product of vectors % ^ : cross product of two vectors % !=/== : (in)equality of two vectors % sqr : scalar product of a vector with itself % abs : norm of a vector %\seealso{vector} %!%- if (0 == is_defined ("Vector_Type")) typedef struct { x,y,z } Vector_Type; %%%%%%%%%%%%%%%%%%%%%%%% define vector () %%%%%%%%%%%%%%%%%%%%%%%% %!%+ %\function{vector} %\synopsis{returns a vector object given by its cartesian or spherical coordinates} %\usage{Vector_Type vector(Double_Type x, y, z)} %\altusage{Vector_Type vector(Double_Type r, phi, theta; sph)} %\qualifiers %\qualifier{sph}{consider the given coordinates to be spherical (r, phi, theta)} %\description % The components of the vector are returned within the \dtype{Vector_Type} % and are accessible like a structure with the fields x, y, and z. % If the \var{sph} qualifier is given, the cartesian coordinates are % calculated as %#v+ % [x, y, z] = % r * [cos(phi)*sin(theta), sin(phi)*sin(theta), cos(theta)] %#v- %\seealso{Vector_Type} %!%- { variable x, y, z; ifnot (_NARGS) return help(_function_name()); (x,y,z) = (); variable v = @Vector_Type; if (__is_numeric (x) != 2) x = typecast (x, Double_Type); if (__is_numeric (y) != 2) y = typecast (y, Double_Type); if (__is_numeric (z) != 2) z = typecast (z, Double_Type); % spherical coordinates given if (qualifier_exists("sph")) { variable sinphi, cosphi, sintheta, costheta; (sinphi, cosphi) = sincos(y); (sintheta, costheta) = sincos(z); (x, y, z) = (x * cosphi * sintheta, x * sinphi * sintheta, x * costheta); } v.x = x; v.y = y; v.z = z; return v; } %%%%%%%%%%%%%%%%%%%%%%%% define dotprod () %%%%%%%%%%%%%%%%%%%%%%%% %!%+ %\function{dotprod} %\synopsis{calculates the dot product of the given vectors} %\usage{Double_Type dotprod(Vector_Type a, b)} %\qualifiers % none %\description % The dot product is calculated as %#v+ % a.x*b.x + a.y*b.y + a.z*b.z %#v- %\seealso{vector} %!%- { variable a, b; ifnot (_NARGS) return help(_function_name()); (a,b) = (); return a.x*b.x + a.y*b.y + a.z*b.z; } %%%%%%%%%%%%%%%%%%%%%%%% define crossprod () %%%%%%%%%%%%%%%%%%%%%%%% %!%+ %\function{crossprod} %\synopsis{calculates the cross product of the given vectors} %\usage{Vector_Type crossprod(a, b)} %\qualifiers % none %\description % The returned vector is calculated as %#v+ % x = a.y*b.z - b.y*a.z % y = a.z*b.x - b.z*a.x % z = a.x*b.y - b.x*a.y %#v- %\seealso{vector} %!%- { ifnot (_NARGS) return help(_function_name()); variable a, b; (a,b) = (); variable ax=a.x,ay=a.y,az=a.z,bx=b.x,by=b.y,bz=b.z; return vector (ay*bz-by*az, az*bx-bz*ax, ax*by-bx*ay); } %%%%%%%%%%%%%%%%%%%%%%%% define vector_sqr () %%%%%%%%%%%%%%%%%%%%%%%% %!%+ %\function{vector_sqr} %\synopsis{returns the scalar product of the given vector with itself} %\usage{Double_Type vector_sqr(Vector_Type v)} %\qualifiers % none %\description % The scalar product of the given vector is returned using %#v+ % dotprod(v, v) %#v- %\seealso{dotprod, vector} %!%- { ifnot (_NARGS) return help(_function_name()); variable v = (); return dotprod (v,v); } %%%%%%%%%%%%%%%%%%%%%%%% define vector_norm () %%%%%%%%%%%%%%%%%%%%%%%% %!%+ %\function{vector_norm} %\synopsis{returns the norm of the given vector} %\usage{Double_Type vector_norm(Vector_Type v)} %\qualifiers % none %\description % The norm of the given vector is calculated as %#v+ % sqrt(v.x^2 + v.y^2 + v.z^2) %#v- %\seealso{vector_sqr, vector} %!%- { ifnot (_NARGS) return help (_function_name()); variable v = (); return hypot (v.x, v.y, v.z); } %%%%%%%%%%%%%%%%%%%%%%%% define normalize_vector () %%%%%%%%%%%%%%%%%%%%%%%% %!%+ %\function{normalize_vector} %\synopsis{normalizes the given vector} %\usage{normalize_vector(Vector_Type v);} %\qualifiers % none %\description % The given vector is normalized such that %#v+ % vector_norm(v) = 1 %#v- %\seealso{vector_norm, vector} %!%- { ifnot (_NARGS) return help (_function_name()); variable v = (); variable len = hypot (v.x, v.y, v.z); v.x /= len; v.y /= len; v.z /= len; } %%%%%%%%%%%%%%%%%%%%%%%% define unit_vector () %%%%%%%%%%%%%%%%%%%%%%%% %!%+ %\function{unit_vector} %\synopsis{normalizes the given vector} %\usage{Vector_Type unit_vector(Vector_Type v)} %\qualifiers % none %\description % The given vector is normalized such that %#v+ % vector_norm(v) = 1 %#v- %\seealso{normalize_vector} %!%- { ifnot (_NARGS) return help (_function_name()); variable v = (); v = @v; % ok if normalize_vector creates new fields normalize_vector (v); return v; } %%%%%%%%%%%%%%%%%%%%%%%% define vector_sum () %%%%%%%%%%%%%%%%%%%%%%%% %!%+ %\function{vector_sum} %\synopsis{calculates the sum of two vectors} %\usage{Vector_Type vector_sum(Vector_Type a, b)} %\qualifiers % none %\description % The components of the two given vectors are % added and the resulting vector is returned. % Instead of calling this function, operator % arithmetic can be used as well: %#v+ % a + b %#v- %\seealso{vector_diff, vector} %!%- { ifnot (_NARGS) return help (_function_name()); variable a, b; (a,b) = (); variable c = @Vector_Type; c.x = a.x+b.x; c.y = a.y+b.y; c.z = a.z+b.z; return c; } %%%%%%%%%%%%%%%%%%%%%%%% define vector_a_plus_bt () %%%%%%%%%%%%%%%%%%%%%%%% %!%+ %\function{vector_a_plus_bt} %\synopsis{calculates the time dependent sum of two vectors} %\usage{Vector_Type vector_a_plus_bt(Vector_Type a, b, Double_Type t)} %\qualifiers % none %\description % The components of the second vector are scaled % by t and added to the first vector: %#v+ % a + t*b %#v- % This can be done by pure operator arithmetic as % well as using other functions like %#v+ % vector_sum(a, vector_mul(t, b)) %#v- %\seealso{vector_sum, vector_mul, vector} %!%- { ifnot (_NARGS) return help (_function_name()); variable a, b, t; (a, b, t) = (); return vector(a.x + t * b.x, a.y + t * b.y, a.z + t * b.z); } %%%%%%%%%%%%%%%%%%%%%%%% define vector_diff () %%%%%%%%%%%%%%%%%%%%%%%% %!%+ %\function{vector_diff} %\synopsis{calculates the difference of two vectors} %\usage{Vector_Type vector_diff(Vector_Type a, b)} %\qualifiers % none %\description % The components of the two given vectors are % subtracted and the resulting vector is returned. % Instead of calling this function, operator % arithmetic can be used as well: %#v+ % a - b %#v- %\seealso{vector_sum, vector} %!%- { ifnot (_NARGS) return help (_function_name()); variable a, b; (a,b) = (); return vector(a.x-b.x, a.y-b.y, a.z-b.z); } %%%%%%%%%%%%%%%%%%%%%%%% define vector_mul () %%%%%%%%%%%%%%%%%%%%%%%% %!%+ %\function{vector_mul} %\synopsis{the given vector is scaled by a scalar} %\usage{Vector_Type vector_mul(Double_Type a, Vector_Type v)} %\qualifiers % none %\description % The components of the given vector are scaled % by a scalar and the resulting vector is returned. % Instead of calling this function, operator % arithmetic can be used as well: %#v+ % a*v %#v- %\seealso{vector} %!%- { ifnot (_NARGS) return help (_function_name()); variable a, v; (a, v) = (); return vector(a*v.x, a*v.y, a*v.z); } % shortcut for vector_mul(a, v) private define vector_times_scalar (v, a) { return vector_mul (a, v); } % logical comparison of the components of two vectors private define vector_eqs (a, b) { return (a.x == b.x) and (a.y == b.y) and (a.z == b.z); } % logical comparison of the components of two vectors private define vector_neqs (a, b) { return not vector_eqs (a, b); } %%%%%%%%%%%%%%%%%%%%%%%% define vector_change_basis () %%%%%%%%%%%%%%%%%%%%%%%% %!%+ %\function{vector_change_basis} %\synopsis{applies a basis transformation to the given vector} %\usage{Vector_Type vector_change_basis(Vector_Type v, e1, e2, e3)} %\qualifiers % none %\description % The components of the given vector are transformed into % the new basis given by the unit vectors e1, e2 and e3: %#v+ % v.x*e1 + v.y*e2 + v.z*e3 %#v- %\seealso{unit_vector, vector} %!%- { ifnot (_NARGS) return help (_function_name()); variable v, e1, e2, e3; (v, e1, e2, e3) = (); return vector_sum (vector_mul (v.x, e1), vector_sum (vector_mul(v.y, e2), vector_mul(v.z, e3))); } %%%%%%%%%%%%%%%%%%%%%%%% define vector_rotate () %%%%%%%%%%%%%%%%%%%%%%%% %!%+ %\function{vector_rotate} %\synopsis{rotates the given vector around another vector} %\usage{Vector_Type vector_rotate(Vector_Type v, n, Double_Type theta)} %\qualifiers % none %\description % The vector v is rotated around the given vector n % by the angle theta: %#v+ % cos(theta)*v % + dotprod(v,n)*(1-cos(theta))*n % + sin(theta)*crossprod(n,v) %#v- %\seealso{dotprod, crossprod, vector} %!%- { ifnot (_NARGS) return help (_function_name()); variable p, n, theta; (p,n,theta) = (); variable pn = dotprod (p, n); variable s, c; (s, c) = sincos (theta); return vector_sum (vector_mul (c,p), vector_sum (vector_mul (pn*(1.0-c),n), vector_mul (s, crossprod(n,p)))); } %%%%%%%%%%%%%%%%%%%%%%%% define vector_get_transformation () %%%%%%%%%%%%%%%%%%%%%%%% %!%+ %\function{vector_get_transformation} %\synopsis{finds a rotation axis and angle that will produce the given basis} %\usage{(Vector_Type, Double_Type) vector_get_transformation(Vector_Type x1_hat, y1_hat);} %\qualifiers % none %\description % The orthonormal basis, given by the unit vectors % x1_hat, y1_hat and x1_hat cross y1_hat = z1_hat, % can be produced by a transformation of the % standard orthonormal basis %#v+ % (1,0,0), (0,1,0), (0,0,1) %#v- % by rotation around an axis and angle, which are % returned by this function. %\seealso{vector_rotate, vector_change_basis, unit_vector, vector} %!%- { ifnot (_NARGS) return help(_function_name()); variable x1_hat, x2_hat; (x1_hat, x2_hat) = (); variable x3_hat = crossprod (x1_hat, x2_hat); variable a1, a2, a3; variable b1, b2, b3; variable c1, c2, c3; a1 = x1_hat.x; % m11 a2 = x2_hat.y; % m22 a3 = x3_hat.z; % m33 b1 = x2_hat.z; % m23 b2 = x3_hat.x; % m31 b3 = x1_hat.y; % m12 c1 = x3_hat.y; % m32 c2 = x1_hat.z; % m13 c3 = x2_hat.x; % m21 % Matrix is: % % [a1 b3 c2] % [c3 a2 b1] % [b2 c1 a3] % variable cos_theta = 0.5*(a1+a2+a3-1.0); variable sin_theta = sqrt (1.0 - cos_theta*cos_theta); if (sin_theta < 1e-12) return vector (0, 0, 1), 0.0; variable den = 2.0*sin_theta; return vector ((b1-c1)/den, (b2-c2)/den, (b3-c3)/den), asin(sin_theta); } %%%%%%%%%%%%%%%%%%%%%%%% define vector_chs () %%%%%%%%%%%%%%%%%%%%%%%% %!%+ %\function{vector_chs} %\synopsis{inverts the given vector} %\usage{Vector_Type vector_chs(Vector_Type v)} %\qualifiers % none %\description % The components of the given vector are % inverted such that %#v+ % v + vector_chs(v) = (0, 0, 0) %#v- %\seealso{vector_sum, vector} %!%- { ifnot (_NARGS) return help(_function_name()); variable a = (); variable v = @Vector_Type; v.x = -a.x; v.y = -a.y; v.z = -a.z; return v; } #ifexists __add_unary % Operator overloading __add_unary ("sqr", Double_Type, &vector_sqr, Vector_Type); __add_unary ("abs", Double_Type, &vector_norm, Vector_Type); __add_unary ("-", Vector_Type, &vector_chs, Vector_Type); __add_binary ("+", Vector_Type, &vector_sum, Vector_Type, Vector_Type); __add_binary ("-", Vector_Type, &vector_diff, Vector_Type, Vector_Type); __add_binary ("*", Double_Type, &dotprod, Vector_Type, Vector_Type); %__add_binary ("*", Vector_Type, &vector_mul, Array_Type, Vector_Type); __add_binary ("*", Vector_Type, &vector_mul, Any_Type, Vector_Type); __add_binary ("*", Vector_Type, &vector_times_scalar, Vector_Type, Any_Type); __add_binary ("^", Vector_Type, &crossprod, Vector_Type, Vector_Type); __add_binary ("==", Char_Type, &vector_eqs, Vector_Type, Vector_Type); __add_binary ("!=", Char_Type, &vector_neqs, Vector_Type, Vector_Type); #endif $1 = path_concat (path_concat (path_dirname (__FILE__), "help"), "vector.hlp"); if (NULL != stat_file ($1)) add_doc_file ($1); slxfig-pre0.2.0-138/src/xfig/0002755000175000000620000000000014540004350014364 5ustar johnstaffslxfig-pre0.2.0-138/src/xfig/clip.sl0000644000175000000620000002144211435153535015666 0ustar johnstaff% clipping routines private define intersect (x0, dx, y0, dy, a, da, b, db) { variable s = Double_Type[length(x0)], t = @s; variable den = dx*db - dy*da; variable i = where (den == 0); s[i] = -1; t[i] = -1; i = where (den != 0); variable alpha = a-x0; variable beta = b-y0; den = den[i]; s[i] = (dy*alpha-dx*beta)[i]/den; t[i] = (db*alpha-da*beta)[i]/den; return s, t; } private define project_to_boundary (x0, x1, xmin, xmax, delta_is_zero) { variable i = where (isinf(x0) and (delta_is_zero)); ifnot (length (i)) return; variable j = where ((x0[i] < xmin) and (x1[i] > xmin)); x0[i[j]] = xmin; j = where ((x0[i] > xmax) and (x1[i] < xmax)); x0[i[j]] = xmax; } % Here the line segment is represented by (x0,y0) -> (x1,y1). These % coordinates can be infinite. Since we are interested in where these % segments intersect within the box defined by (xmin,xmax,ymin,ymax), % project the line segment to the box. private define project_infinite_values (x0, x1, y0, y1, xmin, xmax, ymin, ymax) { variable delta_is_zero = abs((y1-y0) < 1e-6*(ymax-ymin)); project_to_boundary (x0, x1, xmin, xmax, delta_is_zero); project_to_boundary (x1, x0, xmin, xmax, delta_is_zero); delta_is_zero = abs((x1-x0) < 1e-6*(xmax-xmin)); project_to_boundary (y0, y1, ymin, ymax, delta_is_zero); project_to_boundary (y1, y0, ymin, ymax, delta_is_zero); } %!%+ %\function{xfig_clip_polyline2d} %\synopsis{Clip a list of 2d line segments} %\usage{list = xfig_clip_polyline2d (x[], y[], xmin, xmax, ymin, ymax)} %\description % This function clips a polyline composed individual line segments that run from % (x_i,y_i) to (x_{i+1},y_{i+1}) at the boundaries of the window defined by the % \exmp{xmin}, \exmp{xmax}, \exmp{ymin}, and \exmp{ymax} parameters. The result % is returned as an xfig polyline object. %\notes % This function should be used if the order of the line segments does not matter. % Otherwise, the \sfun{xfig_clip_polygon2d} function should be used. %\seealso{xfig_clip_polygon2d, xfig_new_polyline_list} %!%- define xfig_clip_polyline2d (x, y, xmin, xmax, ymin, ymax) { variable is_outside; is_outside = ((x < xmin) or (x > xmax) or (y < ymin) or (y > ymax)); if (length (where(is_outside)) == 0) return xfig_new_polyline (vector(x,y,0*x)); variable list = xfig_new_polyline_list (); % Suppose is_outside looks like: % 00001000110000111 % Separate the line segments into those that lie in the region and those % that are outside. variable len = length (x); if (len < 2) return list; variable bad = where (is_outside); variable i, j, i0; i0 = 0; variable line; foreach (bad) { i = (); if (i - i0 >= 2) { j = [i0:i-1]; list.insert (vector (x[j],y[j],0.0*j)); } i0 = i + 1; } % This segment was not picked up by the above loop if (is_outside[len-1] == 0) { if (i0 != len-1) { j = [i0:len-1]; list.insert (vector(x[j],y[j],0.0*j)); } } % Now deal with the segments that involve outside points i = [0:len-2]; variable x0 = x[i], y0 = y[i]; variable is_outside0 = is_outside[i]; i = [1:len-1]; variable x1 = x[i], y1 = y[i]; variable is_outside1 = is_outside[i]; % Suppose is_outside looks like: % is_outside: 00001000110000111 % Then: % is_outside0: 0000100011000011 % is_outside1: 0001000110000111 % The segments that we want to deal with are: % 0001100111000111 bad = where (is_outside0 or is_outside1); x0 = x0[bad]; x1 = x1[bad]; y0 = y0[bad]; y1 = y1[bad]; is_outside0 = is_outside0[bad]; is_outside1 = is_outside1[bad]; project_infinite_values (x0, x1, y0, y1, xmin, xmax, ymin, ymax); #iffalse % swap 0 <--> 1 such that 0 represents the inside point i = where (0 == is_outside1); (x0[i], x1[i]) = (x1[i], x0[i]); (y0[i], y1[i]) = (y1[i], y0[i]); (is_outside0[i], is_outside1[i]) = (is_outside1[i], is_outside0[i]); #endif variable dx = x1 - x0; variable dy = y1 - y0; variable a = [xmin, xmax, xmax, xmin]; variable b = [ymin, ymin, ymax, ymax]; variable da = [xmax-xmin, 0, xmin-xmax, 0]; variable db = [0, ymax-ymin, 0, ymin-ymax]; variable s = Array_Type[4], t = Array_Type[4], is_intersect = Array_Type[4]; variable ss, tt; _for (0, 3, 1) { i = (); (ss, tt) = intersect (x0, dx, y0, dy, a[i], da[i], b[i], db[i]); is_intersect[i] = ((ss>=0)and (ss<=1)and (tt>=0)and(tt<=1)); s[i] = ss; t[i] = tt; } _for (0, length(x0)-1, 1) { i = (); variable min_t = 2, max_t = -1; if (is_outside0[i] == 0) min_t = 0; if (is_outside1[i] == 0) max_t = 1; if ((is_outside0[i] == 0) and (is_outside1[i] == 0)) vmessage ("NO"); variable num_intersects = 0; _for (0, 3, 1) { j = (); if (is_intersect[j][i] == 0) continue; tt = t[j][i]; if (tt < min_t) min_t = tt; if (tt > max_t) max_t = tt; num_intersects++; } if ((min_t < 0) or (min_t > 1) or (max_t < 0) or (max_t > 1)) continue; variable x0_i = x0[i]; variable y0_i = y0[i]; variable dx_i = dx[i]; variable dy_i = dy[i]; variable x1_i = x0_i + dx_i*max_t; variable y1_i = y0_i + dy_i*max_t; x0_i += dx_i*min_t; y0_i += dy_i*min_t; if (x0_i > xmax) x0_i = xmax; if (x0_i < xmin) x0_i = xmin; if (y0_i > ymax) y0_i = ymax; if (y0_i < ymin) y0_i = ymin; if (x1_i > xmax) x1_i = xmax; if (x1_i < xmin) x1_i = xmin; if (y1_i > ymax) y1_i = ymax; if (y1_i < ymin) y1_i = ymin; if (length (where ((x0_i < xmin-0.001) or (x0_i > xmax+0.001) or (x1_i < xmin-0.001) or (x1_i > xmax+0.001) or (y0_i < ymin-0.001) or (y0_i > ymax+0.001) or (y1_i < ymin-0.001) or (y1_i > ymax+0.001)))) { vmessage ("Uh oh--- line not clipped: min_t = %g, max_t=%g, is_outside0=%d, is_outside1=%d, num_intersects=%d", min_t, max_t, is_outside0[i], is_outside1[i], num_intersects); message ("box from ($xmin,$ymin)->($xmax,$ymax)"$); message ("($x0_i,$y0_i)->($x1_i,$y1_i)"$); vmessage ("Orig coords: %g,%g -> %g,%g",x0[i],y0[i],x1[i],y1[i]); } list.insert (vector ([x0_i, x1_i], [y0_i, y1_i], [0,0])); } return list; } % This algorithm is based uses the Sutherland-Hodgman method private define intersect_x (x0, y0, x1, y1, x) { variable d0 = x - x0; variable d1 = x1 - x; variable den = d0+d1; if (den == 0) return (x, y0); return x, (d0*y1 + d1*y0)/den; } private define intersect_y (x0, y0, x1, y1, y) { variable d0 = y - y0; variable d1 = y1 - y; variable den = d0+d1; if (den == 0) return (x0, y); return (d0*x1 + d1*x0)/den, y; } private define clip_1 (x, y, is_outside, intersect, a) { variable fx, fy, sx, sy, xi, yi, xx, yy; variable n = length (x); if (n == 0) return x, y; variable new_x = {}; variable new_y = {}; variable last_outside = is_outside[0]; fx = x[0]; fy = y[0]; sx = fx, sy = fy; _for (0, n-1, 1) { variable i = (); variable io = is_outside[i]; if (io == last_outside) { sx = x[i]; sy = y[i]; } else { last_outside = io; xi = x[i]; yi = y[i]; (xx, yy) = (@intersect) (sx, sy, xi, yi, a); list_append (new_x, xx); list_append (new_y, yy); sx = xi; sy = yi; } if (last_outside == 0) { list_append (new_x, sx); list_append (new_y, sy); } } if (length (new_x) and (last_outside != is_outside[0])) { (xx, yy) = (@intersect) (sx, sy, fx, fy, a); list_append (new_x, xx); list_append (new_y, yy); } return new_x, new_y; } #ifnexists list_to_array private define list_to_array (x) { variable i, n = length (x); variable xx = Double_Type[n]; _for i (0, n-1, 1) { xx[i] = x[i]; } return xx; } #endif define _xfig_clip_polygon2d (x, y, xmin, xmax, ymin, ymax) { variable is_outside = (x < xmin); !if (any (is_outside or (x > xmax) or (y < ymin) or (y > ymax))) return (x, y); (x, y) = clip_1 (x, y, is_outside, &intersect_x, xmin); ifnot (length(y)) { return Double_Type[0], Double_Type[0]; } y = list_to_array (y); is_outside = (y < ymin); (x, y) = clip_1 (x, y, is_outside, &intersect_y, ymin); ifnot (length(x)) { return Double_Type[0], Double_Type[0]; } x = list_to_array (x); is_outside = (x > xmax); (x, y) = clip_1 (x, y, is_outside, &intersect_x, xmax); ifnot (length(y)) { return Double_Type[0], Double_Type[0]; } y = list_to_array (y); is_outside = (y > ymax); (x, y) = clip_1 (x, y, is_outside, &intersect_y, ymax); ifnot (length(x)) { return Double_Type[0], Double_Type[0]; } x = list_to_array (x); y = list_to_array (y); return x, y; } define xfig_clip_polygon2d (x, y, xmin, xmax, ymin, ymax) { (x, y) = _xfig_clip_polygon2d (x, y, xmin, xmax, ymin, ymax); return xfig_new_polyline (vector(x,y,0*x)); } slxfig-pre0.2.0-138/src/xfig/timetics.sl0000644000175000000620000002322114540004350016543 0ustar johnstaff% -*- mode: slang; mode: fold -*- % Functions to make time tic labels. private variable CDays_In_Month = int(cumsum([0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31])); private variable CDays_In_Month_Ly = int(cumsum([0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31])); private define update_yday (tm) { variable y = 1900+tm.tm_year, c; if (((y mod 4) == 0) && ((y mod 100) || ((y mod 400) == 0))) c = CDays_In_Month_Ly; else c = CDays_In_Month; tm.tm_yday = int (c[tm.tm_mon]) + (tm.tm_mday - 1); } private define localtime_to_tm (t) { return localtime (t); } private define tm_to_localtime (tm) { return mktime (tm); } private define utc_to_tm (t) { return gmtime (t); } private define tm_to_utc (tm) { return timegm (tm); } % values: [sec, min, hour, mday, mon, year] (level 5==>year) private define tm_decend (level_sets, level, values, tinfo); private define tm_decend (level_sets, level, values, tinfo) { variable set, val, tm, tics; tics = tinfo.tics; if (level == 6) { tm = gmtime(0); tm.tm_year = values[5]-1900; tm.tm_mon = values[4]; tm.tm_mday = values[3]; tm.tm_hour = values[2]; tm.tm_min = values[1]; tm.tm_sec = values[0]; tm.tm_isdst = -1; update_yday (tm); variable t = (@tinfo.tm_to_time)(tm); if (tinfo.t0 <= t <= tinfo.t1) { variable i = where (tics == t); if (length(i) == 0) { tinfo.tics = [tics, t]; tinfo.counts = [tinfo.counts, 1]; } else tinfo.counts[i] += 1; } return; } variable maxtics = tinfo.maxtics; variable last_set = NULL; foreach set (level_sets[level]) { foreach val (set) { values[level] = val; tm_decend (level_sets, level + 1, values, tinfo); } last_set = set; if (length (tinfo.tics) > maxtics) % go down one additional level for minor tics break; } % Replace the level_sets at this level with either the last (most % fine grained), or % with the one that produced a sufficient number of tics. This way % when we recurse back to this level, we use the preferred set. level_sets[level] = {last_set}; } private define prune_level_sets (level_sets, level, x0, x1) { variable level_set = level_sets[level]; variable i, n = length(level_set); _for i (0, n-1, 1) { variable set = level_set[i]; level_set[i] = set[where(x0 <= set <= x1)]; } variable a = level_set[0]; variable ns = {a}; _for i (1, n-1, 1) { variable b = level_set[i]; ifnot (_eqs(a, b)) { list_append (ns, b); a = b; } } level_sets[level] = ns; } private define prune_labels (dlabs, tlabs) { variable endstr; % xx:xx:xx % 12345678 if (all (tlabs == "00:00:00")) { tlabs = NULL; % don't display times % dlabs: yyyy-mm-dd % 1234567890 % Map YYYY-MM-01 to YYYY-MM endstr = array_map (String_Type, &substr, dlabs, 9, 2); ifnot (all (endstr == "01")) return dlabs, tlabs; dlabs = array_map (String_Type, &substr, dlabs, 1, 7); % Map YYYY-01 to YYYY endstr = array_map (String_Type, &substr, dlabs, 6, 2); ifnot (all (endstr == "01")) return dlabs, tlabs; dlabs = array_map (String_Type, &substr, dlabs, 1, 4); return dlabs, tlabs; } endstr = array_map (String_Type, &substr, tlabs, 7, 2); if (all (endstr == "00")) { tlabs = array_map (String_Type, &substr, tlabs, 1, 5); } variable last = ""; _for (0, length(dlabs)-1, 1) { variable i = (); if (dlabs[i] == last) dlabs[i] = ""; else last = dlabs[i]; } return dlabs, tlabs; } %!%+ %\function{xfig_timetics} %\usage{xfig_timetics(tmin, tmax [;qualifiers])} %\description % This function may be used to construct nice tic-labels for the time % interval specified by the tmin and tmax variables. By default, % these values represent the number of seconds since the POSIX epoch % 1970-01-01T00:00:00Z. The format of the tic-labels may be controlled % by qualifiers. % % This function returns a structure with the following fields: %#v+ % tmin The value of the tmin parameter % tmax The value of the tmax parameter % major An array of major tic positions % minor An array of minor tic positions % ticlabels An array of ticlabels correponding to the major tic positions %#v- % The field names of this structure were chosen to correspond to the % qualifiers accepted by the plot axis methods. %\qualifiers % \qualifier{localtime}{Construct tic labels using localtime} % \qualifier{timetotm=&func}{Use func to convert a time value to a tm structure} % \qualifier{tmtotime=&func}{Use func to convert a tm structure to a time value} % \qualifier{nodates[=0|1]}{Turn on or off date (YYYY-MM-DD) labels} % \qualifier{dateformat=VAL}{strftime format for date labels (default: \exmp{"%Y-%m-%d"}} % \qualifier{timeformat=VAL}{strftime format for time labels (default:\exmp{"%H:%M:%S"}} % % The default is to format the time as UTC using the \ifun{gmtime} and % \ifun{timegm} functions. If the \exmp{localtime} qualifier is % given, the \ifun{localtime} and \ifun{mktime} functions will be used. % The \exmp{timetotm} and \exmp{tmtotime} qualifiers may be used to % specify the functions to be used convert to and from tm structures. % The default (no qualifiers) corresponds to using % \exmp{timetotm=&gmtime} and \exmp{tmtotime=timegm}. %\example %#v+ % tmax = _time(); % Current time % tmin = tmax - 100*86400; % 100 days prior % tinfo = xfig_timetics (tmin, tmax; localtime, maxtics=6); % t = [tmin:tmax:#1024]; % y = sin(2*PI/(5*86400)*(t-tmin)); % 5 day period % w = xfig_plot_new(); % w.plot (t, y; color="blue"); % w.x1axis (;;tinfo); % w.render ("/tmp/example.pdf"); %#v- % Note that the structure returned by the \sfun{xfig_timetics} was % passed as a structure of qualifiers to the \sfun{x1axis} method. %!%- define xfig_timetics (tmin, tmax) { variable time_to_tm_func = qualifier ("timetotm"), tm_to_time_func = qualifier ("tmtotime"), maxtics = qualifier("maxtics", 4), date_format = qualifier ("dateformat"), time_format = qualifier ("timeformat"), nodates = 0; if ((time_format == NULL) || (time_format == "")) time_format = "%H:%M:%S"; if ((date_format == NULL) || (date_format == "")) date_format = "%Y-%m-%d"; if (qualifier_exists ("nodates")) { nodates = qualifier ("nodates"); if (nodates == NULL) nodates = 1; } if (qualifier_exists ("localtime")) { time_to_tm_func = &localtime_to_tm; tm_to_time_func = &tm_to_localtime; } if ((time_to_tm_func == NULL) || (tm_to_time_func == NULL)) { time_to_tm_func = &utc_to_tm; tm_to_time_func = &tm_to_utc; } if (tmax < tmin) { return struct { tmin = tmin, tmax = tmax, ticpos = Long_Type[0], ticlabels = String_Type[0], }; } variable level_sets = { {[0], [0,30], [0:59:15], [0:59:5], [0:59]},% secs {[0], [0,30], [0:59:15], [0:59:5], [0:59]},% mins {[0], [0,12], [0:23:6], [0:23:3], [0:23]}, % hours {[1], [1,15], [1,8,15,22], [1,4,8,11,15,18,22,25,28], [1:31]}, % days {[0], [0,6], [0,3,6,9], [0:11]}, % months {[1920:2030:20], [1910:2030:10], [1905:2035:5], [1902:2038:1]}%, [1970:2030:1]}, % years }; tmin = typecast (tmin, Long_Type); tmax = typecast (tmax, Long_Type); variable tm0 = (@time_to_tm_func)(tmin); variable tm1 = (@time_to_tm_func)(tmax); % Try to prune the level_sets prune_level_sets (level_sets, 5, 1900+tm0.tm_year, 1900+tm1.tm_year); if (tm0.tm_year == tm1.tm_year) { prune_level_sets(level_sets, 4, tm0.tm_mon, tm1.tm_mon); if (tm0.tm_mon == tm1.tm_mon) { prune_level_sets(level_sets, 3, tm0.tm_mday, tm1.tm_mday); if (tm0.tm_mday == tm1.tm_mday) { prune_level_sets(level_sets, 2, tm0.tm_hour, tm1.tm_hour); if (tm0.tm_hour == tm1.tm_hour) { if (tm0.tm_min == tm1.tm_min) { prune_level_sets(level_sets, 0, tm0.tm_sec, tm1.tm_sec); } } } } } variable tinfo = struct { tics = Long_Type[0], t0 = tmin, t1 = tmax, counts = Int_Type[0], maxtics = maxtics, time_to_tm = time_to_tm_func, tm_to_time = tm_to_time_func, }; tm_decend (level_sets, 0, Int_Type[6], tinfo); variable major = tinfo.tics, counts = tinfo.counts; variable i, n = length(major); i = array_sort(major); major = major[i]; counts = counts[i]; variable max_count = max(counts), minor = Double_Type[0]; while (length(major) > maxtics) { variable min_count = min (counts); if (min_count == max_count) break; variable j = where (counts == min_count, &i); minor = major[j]; major = major[i]; %dlabs = dlabs[i]; %tlabs = tlabs[i]; counts = counts[i]; } n = length(major); variable tlabs = String_Type[n], dlabs = String_Type[n]; variable last_dlab = NULL; _for i (0, n-1, 1) { variable t = major[i]; variable tm = (@time_to_tm_func)(t); % major[i] = typecast(t, Long_Type); tlabs[i] = strftime(time_format, tm); variable dlabs_i = strftime(date_format, tm); %if (last_dlab == dlabs_i) dlabs_i = ""; %else last_dlab = dlabs_i; dlabs[i] = dlabs_i; } (dlabs, tlabs) = prune_labels (dlabs, tlabs); if (tlabs != NULL) { if (nodates) dlabs = tlabs; else { dlabs = "\\begin{center}" + tlabs + "\\\\" + dlabs + "\\end{center}"; } } tinfo = struct { tmin = tmin, tmax = tmax, major = major, ticlabels = dlabs, minor = minor, maxtics = maxtics, }; return tinfo; } #stop %--------------------------------------------------------------------------- define slsh_main () { variable t0, t1; t0 = atof(__argv[1]); t1 = atof(__argv[2]); variable s = xfig_timetics (t0, t1;localtime, maxtics=4); print (s.ticlabels); print (s); } slxfig-pre0.2.0-138/src/xfig/w3ccolors.txt0000644000175000000620000000532611761627347017072 0ustar johnstaff# The colors listed here are defined by W3C and are supported by most # browsers. The definitions of "green" and "pink" differ from the # Xfig values. 0xF0F8FF aliceblue 0xFAEBD7 antiquewhite 0x00FFFF aqua 0x7FFFD4 aquamarine 0xF0FFFF azure 0xF5F5DC beige 0xFFE4C4 bisque 0x000000 black 0xFFEBCD blanchedalmond 0x0000FF blue 0x8A2BE2 blueviolet 0xA52A2A brown 0xDEB887 burlywood 0x5F9EA0 cadetblue 0x7FFF00 chartreuse 0xD2691E chocolate 0xFF7F50 coral 0x6495ED cornflowerblue 0xFFF8DC cornsilk 0xDC143C crimson 0x00FFFF cyan 0x00008B darkblue 0x008B8B darkcyan 0xB8860B darkgoldenrod 0xA9A9A9 darkgray 0x006400 darkgreen 0xBDB76B darkkhaki 0x8B008B darkmagenta 0x556B2F darkolivegreen 0xFF8C00 darkorange 0x9932CC darkorchid 0x8B0000 darkred 0xE9967A darksalmon 0x8FBC8F darkseagreen 0x483D8B darkslateblue 0x2F4F4F darkslategray 0x00CED1 darkturquoise 0x9400D3 darkviolet 0xFF1493 deeppink 0x00BFFF deepskyblue 0x696969 dimgray 0x1E90FF dodgerblue 0xB22222 firebrick 0xFFFAF0 floralwhite 0x228B22 forestgreen 0xFF00FF fuchsia 0xDCDCDC gainsboro 0xF8F8FF ghostwhite 0xFFD700 gold 0xDAA520 goldenrod 0x808080 gray 0x008000 green 0xADFF2F greenyellow 0xF0FFF0 honeydew 0xFF69B4 hotpink 0xCD5C5C indianred 0x4B0082 indigo 0xFFFFF0 ivory 0xF0E68C khaki 0xE6E6FA lavender 0xFFF0F5 lavenderblush 0x7CFC00 lawngreen 0xFFFACD lemonchiffon 0xADD8E6 lightblue 0xF08080 lightcoral 0xE0FFFF lightcyan 0xFAFAD2 lightgoldenrodyellow 0x90EE90 lightgreen 0xD3D3D3 lightgrey 0xFFB6C1 lightpink 0xFFA07A lightsalmon 0x20B2AA lightseagreen 0x87CEFA lightskyblue 0x778899 lightslategray 0xB0C4DE lightsteelblue 0xFFFFE0 lightyellow 0x00FF00 lime 0x32CD32 limegreen 0xFAF0E6 linen 0xFF00FF magenta 0x800000 maroon 0x66CDAA mediumaquamarine 0x0000CD mediumblue 0xBA55D3 mediumorchid 0x9370DB mediumpurple 0x3CB371 mediumseagreen 0x7B68EE mediumslateblue 0x00FA9A mediumspringgreen 0x48D1CC mediumturquoise 0xC71585 mediumvioletred 0x191970 midnightblue 0xF5FFFA mintcream 0xFFE4E1 mistyrose 0xFFE4B5 moccasin 0xFFDEAD navajowhite 0x000080 navy 0xFDF5E6 oldlace 0x808000 olive 0x6B8E23 olivedrab 0xFFA500 orange 0xFF4500 orangered 0xDA70D6 orchid 0xEEE8AA palegoldenrod 0x98FB98 palegreen 0xDB7093 palevioletred 0xFFEFD5 papayawhip 0xFFDAB9 peachpuff 0xCD853F peru 0xFFC0CB pink 0xDDA0DD plum 0xB0E0E6 powderblue 0x800080 purple 0xFF0000 red 0xBC8F8F rosybrown 0x4169E1 royalblue 0x8B4513 saddlebrown 0xFA8072 salmon 0xFAA460 sandybrown 0x2E8B57 seagreen 0xFFF5EE seashell 0xA0522D sienna 0xC0C0C0 silver 0x87CEEB skyblue 0x6A5ACD slateblue 0x708090 slategray 0xFFFAFA snow 0x00FF7F springgreen 0x4682B4 steelblue 0xD2B48C tan 0x008080 teal 0xD8BFD8 thistle 0xFF6347 tomato 0x40E0D0 turquoise 0xEE82EE violet 0xF5DEB3 wheat 0xFFFFFF white 0xF5F5F5 whitesmoke 0xFFFF00 yellow 0x9ACD32 yellowgreen slxfig-pre0.2.0-138/src/xfig/core.sl0000644000175000000620000012772413745227527015712 0ustar johnstaffrequire ("vector"); require ("rand"); autoload ("readascii", "readascii"); private variable PIX_PER_INCH = 1200.0; % xfig units per inch private variable XFig_Origin_X = 10.795;% [cm] private variable XFig_Origin_Y = 13.97; % [cm] % XFig has a strange notion about what a cm is--- not 1200/2.54. private variable PIX_PER_CM = 450.0; private variable DISPLAY_PIX_PER_INCH = 80; private variable Scale_Factor; private variable Display_Pixel_Size; variable _XFig_Verbose = 0; define _xfig_check_help (nargs, fname) { ifnot (qualifier_exists ("help")) return 0; _pop_n (nargs); #ifexists help help (fname); #else variable txt = get_doc_string_from_file (fname); if (txt == NULL) vmessage ("No help found for %S\n", fname); else message (txt); #endif return 1; } private variable Focus = vector (0, 0, 0); private variable Eye = vector (0, 0, 1e6); private variable EF_Len, EF_x, EF_y, EF_z; private variable EFhat_x, EFhat_y, EFhat_z; private variable Eye_x, Eye_y, Eye_z; % components of Eye private variable Focal_Plane_Xhat, Focal_Plane_Yhat; private variable Eye_Roll = 0.0; private variable Eye_Dist, Eye_Theta, Eye_Phi; private define eye_focus_changed () { variable yhat = vector (0, 1, 0); variable zhat = vector (0, 0, 1); variable eyehat = vector (0, 0, 1); variable d2r = PI/180.0; eyehat = vector_rotate (eyehat, yhat, Eye_Theta*d2r); eyehat = vector_rotate (eyehat, zhat, Eye_Phi*d2r); eyehat = unit_vector (eyehat); % Mh: `eyehat' should already be a unit vector. % Let p be the unit vector from Focus to the Eye. A vector u % perpendicular to p is given by p.u = 0. Let w be a unit vector % that we want u to be aligned with as much as possible. Choose u % such that w.u is maximized. Then: % w.du = 0 % p.du = 0 % u.du = 0 (since u.u=1) % Thus: % wx*dx + wy*dy + wz*dz = 0 % px*dx + py*dy + pz*dz = 0 % ux*dx + uy*dy + uz*dz = 0 % ==> % wx*py*uz + wy*pz*ux + wz*px*uy = wz*py*ux + wx*pz*uy + wy*px*uz % (wx*py-wy*px)*uz + (wy*pz-wz*py)*ux + (wz*px-wx*pz)*uy % ==> (w cross p).u = 0 % Let v = (w cross p) ==> v.p = 0, v.u = 0 % ==> u = p cross v variable u, v, w; variable eps = 2.3e-16; if (abs(eyehat.z)>eps) w = vector (0, 1, 0); else if (abs(eyehat.y) > eps) w = vector (0, 0, 1); else w = vector (0, 0, 1); v = crossprod (w, eyehat); v = vector_rotate (v, eyehat, -Eye_Roll*d2r); v = unit_vector (v); u = crossprod (eyehat, v); variable ef = Eye_Dist*eyehat; Eye = Focus + ef; Eye_x = Eye.x; Eye_y = Eye.y; Eye_z = Eye.z; EF_Len = Eye_Dist; EF_x = ef.x; EF_y = ef.y; EF_z = ef.z; EFhat_x = eyehat.x; EFhat_y = eyehat.y; EFhat_z = eyehat.z; Focal_Plane_Yhat = u; Focal_Plane_Xhat = v; } define xfig_set_eye_roll (roll) %!%+ %\function{xfig_set_eye_roll} %\synopsis{Set the roll angle under which the projection of 3d space is seen} %\usage{xfig_get_eye_roll (Double_Type roll);} %\description % The \exmp{roll} angle is measured in degrees. %\seealso{xfig_get_eye_roll, xfig_set_eye, xfig_set_focus} %!%- { variable Eye_Roll = roll; eye_focus_changed (); } define xfig_get_eye_roll (roll) %!%+ %\function{xfig_get_eye_roll} %\synopsis{Obtain the roll angle under which the projection of 3d space is seen} %\usage{Double_Type xfig_get_eye_roll ()} %\description % The roll angle is measured in degrees. %\seealso{xfig_set_eye_roll, xfig_set_eye} %!%- { return Eye_Roll; } define xfig_set_eye () %!%+ %\function{xfig_set_eye} %\synopsis{Define the point from which the projection of 3d space is seen} %\usage{xfig_set_eye (Double_Type dist, theta, phi [, roll]);} %\description % \exmp{dist} - distance of the eye from the focus % \exmp{theta} - polar angle from the z-axis (in degrees) % \exmp{phi} - azimuthal angle in the x-y-plane (in degrees) % \exmp{roll} - roll angle (in degrees) %\seealso{xfig_get_eye, xfig_get_eye_roll, xfig_set_eye_roll, xfig_set_focus} %!%- { if (_NARGS == 4) Eye_Roll = (); (Eye_Dist, Eye_Theta, Eye_Phi) = (); eye_focus_changed (); } define xfig_get_eye () %!%+ %\function{xfig_get_eye} %\synopsis{Obtain the point from which the projection of 3d space is seen} %\usage{Vector_Type xfig_get_eye ()} %\seealso{xfig_set_eye} %!%- { return Eye; } define xfig_set_focus (X) %!%+ %\function{xfig_set_focus} %\synopsis{Define the focus point of the projection of 3d space} %\usage{xfig_set_focus (Vector_Type X);} %\seealso{xfig_get_focus, xfig_set_eye} %!%- { Focus = X; eye_focus_changed (); } define xfig_get_focus () %!%+ %\function{xfig_get_focus} %\synopsis{Obtain the focus point of the projection of 3d space} %\usage{Vector_Type xfig_get_focus ()} %\seealso{xfig_set_focus} %!%- { return Focus; } define xfig_convert_inches (x) { return int (PIX_PER_INCH * x + 0.5); } define xfig_convert_cm (x) { return int (PIX_PER_CM*x + 0.5); } define xfig_convert_units (x) { return nint (Scale_Factor * x + 0.5); } define xfig_use_inches () { Scale_Factor = PIX_PER_INCH; Display_Pixel_Size = 1.0/DISPLAY_PIX_PER_INCH; } define xfig_use_cm () { Scale_Factor = PIX_PER_CM; Display_Pixel_Size = 2.54/DISPLAY_PIX_PER_INCH; } % Scale from inches to user system define xfig_scale_from_inches (x) { return x*(PIX_PER_INCH/Scale_Factor); } define xfig_scale_to_inches (x) { return (x * Scale_Factor)/PIX_PER_INCH; } % Xfig scales the image pixels (e.g., png) to its pixel system using the factor % PIX_PER_INCH/DISPLAY_PIX_PER_INCH % when inches are used, and % (2.54*PIX_PER_CM)/DISPLAY_PIX_PER_INCH % when cm are used. % where DISPLAY_PIX_PER_INCH is 80. Note also that in Xfig, % PIX_PER_INCH/PIX_PER_CM is _not_ 2.54. The scale factor represents % the number of Xfig pixels per image-pixel. % The function below supplies the correct scaling for images that have no % predefined units. define xfig_get_display_pix_size () { return Display_Pixel_Size; } define xfig_set_origin (x, y) { XFig_Origin_X = x; XFig_Origin_Y = y; } define xfig_transform_vector (X, xhat, yhat, zhat, X0, scale) { X = vector_change_basis (X, xhat, yhat, zhat); return vector_sum (X0, vector_mul (scale, X)); } define xfig_project_to_xfig_plane (X) { % This function is expensive and gets called many times. So % here the calls will be inlined. % E + (X-E)t = X' % (X'-F).n = 0 ; N = E-F = EF, n = EFhat = Nhat % E-F + (X-E)t = X'-F % EF.EF + t(X-E).EF = 0 % t = -EF.EF/(X-E).EF % = -EF.nhat/(X-E).n % = -EF_len/(X-E).n % compute X'-F = (E-F)+(X-E)*t variable dx = X.x - Eye_x, dy = X.y - Eye_y, dz = X.z - Eye_z; variable t = -EF_Len/(EFhat_x*dx + EFhat_y*dy + EFhat_z*dz); X = vector (EF_x+dx*t, EF_y+dy*t, EF_z+dz*t); variable x = dotprod (X,Focal_Plane_Xhat); variable y = dotprod (X,Focal_Plane_Yhat); y = -y; x += XFig_Origin_X; y += XFig_Origin_Y; variable is_bad = where (t < 0); if (any(is_bad)) { if (typeof (x) != Array_Type) return _NaN, _NaN; x[is_bad] = _NaN; y[is_bad] = _NaN; } return (x, y); } private variable XFig_Header = struct { orientation = "Portrait", justification = "Center", units = "Metric", papersize = "Letter", magnification = 100, % percent multiple_page = "Single", transparant_color = -1, % default resolution_coord_system = [PIX_PER_INCH, 2], }; define xfig_vwrite () { variable args = __pop_list (_NARGS); () = fprintf (__push_list (args)); } define xfig_write (fp, x) { () = fputs (x, fp); } define xfig_write_header (fp, h) { if (h == NULL) h = @XFig_Header; xfig_write (fp, "#FIG 3.2\n"); xfig_vwrite (fp, "%s\n", h.orientation); xfig_vwrite (fp, "%s\n", h.justification); xfig_vwrite (fp, "%s\n", h.units); xfig_vwrite (fp, "%s\n", h.papersize); xfig_vwrite (fp, "%g\n", h.magnification); xfig_vwrite (fp, "%s\n", h.multiple_page); xfig_vwrite (fp, "%d\n", h.transparant_color); xfig_vwrite (fp, "%g %g\n", h.resolution_coord_system[0], h.resolution_coord_system[1]); } private variable Fig2dev_Formats = Assoc_Type[String_Type]; %!%+ %\function{xfig_set_output_driver} %\synopsis{Associate an output driver to a file extension} %\usage{xfig_set_output_driver (String_Type ext, String_Type cmd)} %\description % This may may be used to define the command that runs to created the specified % output format (dictated by the extension) from the corresponding .fig file. % The \exmp{ext} parameter specifies the filename extension and \exmp{cmd} is % the shell command that will be used to generate the file. % % The \exmp{cmd} may contain the following format descriptors that will be % replaced by the corresponding objects before being passed to the shell: %#v+ % %I Input .fig file % %O Output file % %B basename of the file % %P This will resolve to -z % %G This will resolve to -g %#v- % The \exmp{%P} specifier will only be expanded if the "papersize" % qualifier is given when rendering the output; otherwise it will be % ignored. % % The \exmp{%G} specifier will be expanded when the "background" % qualifier is given when rendering the output; otherwise it is % ignored. Not all output devices support setting a background color. %\example % The default driver for postscript output is given by: %#v+ % xfig_set_output_driver ("ps", "fig2dev -L ps -c %P %I %O"); %#v- % The \var{ps2ps} command may result in a smaller file size at a slight cost % of resolution. It may be used as follows: %#v+ % xfig_set_output_driver ("ps", "fig2dev -L ps -c %I %B-tmp.ps" % + ";ps2ps %B-tmp.ps %O; rm -f %B-tmp.ps"); %#v- %\seealso{xfig_set_paper_size} %!%- define xfig_set_output_driver (ext, cmd) { Fig2dev_Formats[ext] = cmd; } xfig_set_output_driver("eps", "fig2dev -L eps %I %O"); % paper size is not suppored for eps xfig_set_output_driver("ps", "fig2dev -L ps -c %P %I %O"); xfig_set_output_driver("pdf", "fig2dev -L pdf -c %P %G %I %O"); xfig_set_output_driver("png", "fig2dev -L png %G %I %O"); xfig_set_output_driver("gif", "fig2dev -L gif %G %I %O"); xfig_set_output_driver("jpg", "fig2dev -L jpeg %G %I %O"); xfig_set_output_driver("jpeg", "fig2dev -L jpeg %G %I %O"); xfig_set_output_driver("svg", "fig2dev -L svg %G %I %O"); % Colors private variable Color_Type = struct { name, id, rgb, xfigid }; private variable Color_Table = Assoc_Type[Struct_Type]; private variable Color_List = {}; private variable LAST_XFIG_COLOR_ID = 31; private variable Next_Color_Id; private variable Next_XFig_Color_Id = LAST_XFIG_COLOR_ID+1; private define new_color (name, rgb, xfigid, id) { variable s = @Color_Type; name = strlow (strtrans (name, " ", "")); s.name = name; s.rgb = rgb; s.xfigid = xfigid; s.id = id; Color_Table[name] = s; %if (id >= 0) list_append (Color_List, s); } private define add_color (name, rgb, xfigid) { new_color (name, rgb, xfigid, Next_Color_Id); Next_Color_Id++; } % These are the built-in xfig colors. % They are ordered for the purpose of plotting via a color index. Next_Color_Id = -2; add_color ("default", 0xFFFFFF, -1); add_color ("white", 0xFFFFFF, 7); add_color ("black", 0x000000, 0); add_color ("red", 0xFF0000, 4); add_color ("green4", 0x009000, 12); add_color ("blue", 0x0000FF, 1); add_color ("magenta", 0xFF00FF, 5); add_color ("cyan", 0x00FFFF, 3); add_color ("brown4", 0x803000, 24); add_color ("red4", 0x900000, 18); add_color ("green3", 0x00b000, 13); add_color ("blue4", 0x000090, 8); add_color ("magenta4", 0x900090, 21); add_color ("cyan4", 0x009090, 15); add_color ("brown3", 0xa04000, 25); add_color ("red3", 0xb00000, 19); add_color ("green", 0x00FF00, 2); add_color ("blue3", 0x0000d0, 10); add_color ("magenta3", 0xb000b0, 22); add_color ("cyan3", 0x00b0b0, 16); add_color ("brown2", 0xc06000, 26); add_color ("red2", 0xd00000, 20); add_color ("green2", 0x00d000, 14); add_color ("blue2", 0x0000b0, 9); add_color ("magenta2", 0xd000d0, 23); add_color ("cyan2", 0x00d0d0, 17); add_color ("gold", 0xffd700, 31); add_color ("pink4", 0xff8080, 27); add_color ("yellow", 0xFFFF00, 6); add_color ("blue1", 0x87ceff, 11); add_color ("pink3", 0xffa0a0, 28); add_color ("pink2", 0xffc0c0, 29); add_color ("pink", 0xffe0e0, 30); private define make_canonical_color_name (name) { return strlow (str_delete_chars (name)); } define xfig_new_color () %{{{ %!%+ %\function{xfig_new_color} %\synopsis{Add a new color definition} %\usage{xfig_new_color (name, RGB [,&id]} %\description % This function may be used to add a new color called \exmp{name} % with the specified RGB (24 bit integer) value. If the optional % third parameter is provided, it must be a reference to a variable % whose value upon return will be set to the integer index of the color. %\notes % Color names are converted to a canonical form by removing whitespace % from the name and converting it to lowercase. This means that % \exmp{"OffWhite"}, \exmp{"offwhite"}, and \exmp{"off White"} are all % equivalent. %\seealso{xfig_lookup_color_rgb, xfig_lookup_color} %!%- { variable name, rgb, id, idp = &id; if (_NARGS == 3) idp = (); (name, rgb) = (); if (rgb == NULL) return; name = make_canonical_color_name (name); if (assoc_key_exists (Color_Table, name)) { variable s = Color_Table[name]; if (rgb != s.rgb) { %vmessage ("%s 0x%X --> 0x%X", name, s.rgb, rgb); s.rgb = rgb; if (s.xfigid <= LAST_XFIG_COLOR_ID) s.xfigid = Next_XFig_Color_Id; } @idp = s.id; return; } new_color (name, rgb, Next_XFig_Color_Id, Next_Color_Id); @idp = Next_Color_Id; Next_Color_Id++; Next_XFig_Color_Id++; } %}}} private define to_rgb (r, g, b) { return (r << 16) | (g << 8) | b; } % some additional colors xfig_new_color ("orange", to_rgb(255,165,0)); xfig_new_color ("orange2",to_rgb(238,154,0)); xfig_new_color ("orange3",to_rgb(205,133,0)); xfig_new_color ("orange4",to_rgb(139,90,0)); xfig_new_color ("silver", 0xC0C0C0); % W3C xfig_new_color ("x11gray", 0xBEBEBE); % X11 xfig_new_color ("gray", 0x808080); % W3C private variable W3C_RGB_Data = NULL; private variable W3C_RGB_Txt_File = path_concat (path_dirname (__FILE__), "w3ccolors.txt"); private define load_w3c_colors () { if (W3C_RGB_Data != NULL) return 0; variable names, values; variable fp = fopen (W3C_RGB_Txt_File, "r"); if ((fp == NULL) || (readascii (fp, &values, &names; format="0x%X %s") <= 0)) return -1; () = fclose (fp); W3C_RGB_Data = Assoc_Type[Int_Type, -1]; _for (0, length (names)-1, 1) { variable i = (); variable name = make_canonical_color_name (names[i]); W3C_RGB_Data[name] = values[i]; } return 0; } %!%+ %\function{xfig_lookup_w3c_color (name)} %\synopsis{Lookup an RGB value for an W3C color name} %\usage{rgb = xfig_lookup_w3c_color (name)} %\description % This function may be used to lookup the RGB value for a specified % W3C color name. If the W3C rgb.txt file could not be loaded, or % the color name does not exist within he file, NULL will be returned. % % The primary purpose of this function is to provide a mechanism for % overriding Xfig color values with those defined by W3C. %\example % Xfig uses 0x00FF00 for green, whereas W3C defines 0x008000. Use the % W3C value: %#v+ % xfig_new_color ("green", xfig_lookup_w3c_color ("green")); %#v- %\seealso{xfig_new_color, xfig_list_colors, xfig_get_color_names} %!%- define xfig_lookup_w3c_color (color) { if (-1 == load_w3c_colors ()) return NULL; color = make_canonical_color_name (color); color = W3C_RGB_Data[color]; if (color == -1) return NULL; return color; } private define load_w3c_color (color) { variable rgb = xfig_lookup_w3c_color (color); if (rgb == NULL) return; xfig_new_color (color, rgb); } private define find_color (color) { if (typeof (color) == String_Type) { color = make_canonical_color_name (color); ifnot (assoc_key_exists (Color_Table, color)) { variable h = `[0-9A-Fa-f]` + dup; % two hex characters h = string_matches (color, `^#\(`+h+h+h+`\)$`); if (h != NULL && sscanf (h[1], "%x", &h)) xfig_new_color(color, h); } ifnot (assoc_key_exists (Color_Table, color)) { load_w3c_color (color); ifnot (assoc_key_exists (Color_Table, color)) return NULL; } return Color_Table[color]; } if (color > 0) return Color_List[2 + (color mod (length (Color_List)-2))]; if (color) return Color_List[0]; return Color_List[1]; } private define get_colors () { variable a = Assoc_Type[Int_Type]; variable name, rgb, s; if (0 == load_w3c_colors ()) { foreach name, rgb (W3C_RGB_Data) a[name] = rgb; } foreach s (Color_List) a[s.name] = s.rgb; return a; } define xfig_list_colors () { variable s, col = NULL; if(_NARGS==1) col = (); variable a = get_colors (), names = assoc_get_keys (a); names = names[array_sort (names)]; foreach (names) { variable name = (); if ((col==NULL) || string_match (name, col, 1)) vmessage("0x%06x - %s", a[name], name); } } %!%+ %\function{xfig_get_color_names} %\synopsis{Get a list color names} %\usage{Array_Type xfig_get_color_names ()} %\description % This function returns an array of strings giving the available color % names. This list includes the Xfig color names, user-defined % colors, and the W3C color names. %\seealso{xfig_new_color, xfig_list_colors, xfig_lookup_w3c_color} %!%- define xfig_get_color_names () { variable names = assoc_get_keys (get_colors ()); names = names[array_sort (names)]; return names; } define xfig_lookup_color (color) { variable s = find_color (color); if (s != NULL) return s.xfigid; () = fprintf (stderr, "color %S is unknown-- using default\n", color); return -1; } define xfig_lookup_color_rgb (color) { variable s = find_color (color); if (s == NULL) { () = fprintf (stderr, "color %S is unknown-- using black\n", color); return 0; } return s.rgb; } define xfig_get_color_info (color) { return find_color (color); } private define write_colors (fp) { foreach (assoc_get_values (Color_Table)) { variable s = (); if (s.xfigid < 32) continue; if (-1 == fprintf (fp, "0 %d #%06X\n", s.xfigid, s.rgb)) throw IOError, "Write to .fig file failed"; } } private define get_fig2dev_cmd (ext) { ext = ext[[1:]]; ifnot (assoc_key_exists (Fig2dev_Formats, ext)) { () = fprintf (stderr, "Unsupported device: %s\n", ext); return NULL; } variable fmt = Fig2dev_Formats[ext]; if (fmt == NULL) { vmessage ("*** Warning: %s format may not be supported by fig2dev", ext); return fmt; } return fmt; } define xfig_create_file (file) { variable dev = struct { fp, figfile, devfile, papersize, fig2dev_fmt }; variable cwd = getcwd (); file = path_concat (cwd, file); variable ext = path_extname (file); variable base = path_sans_extname (file); variable figfile = strcat (base, ".fig"); if (ext != ".fig") { dev.devfile = file; dev.fig2dev_fmt = get_fig2dev_cmd (ext); } dev.figfile = figfile; variable fp = fopen (figfile, "w"); if (fp == NULL) verror ("Unable to open %s\n", figfile); dev.fp = fp; dev.papersize = XFig_Header.papersize; xfig_write_header (fp, NULL); write_colors (fp); return dev; } define xfig_close_file (dev) { if (-1 == fclose (dev.fp)) throw WriteError, sprintf ("xfig_close_file failed: %S", errno_string (errno)); variable fmt = dev.fig2dev_fmt; if (fmt == NULL) return; variable papersize = ""; if (qualifier_exists("papersize")) { papersize = qualifier ("papersize"); if (papersize == NULL) papersize = dev.papersize; papersize = "-z $papersize"$; } variable background = qualifier ("background"); if (background != NULL) background = xfig_lookup_color_rgb (background); if (background != NULL) background = sprintf("-g '#%06x'", background); else background = ""; fmt = strreplace (fmt, "%P", papersize); fmt = strreplace (fmt, "%G", background); fmt = strreplace (fmt, "%I", dev.figfile); fmt = strreplace (fmt, "%O", dev.devfile); fmt = strreplace (fmt, "%B", path_sans_extname(dev.figfile)); if (qualifier ("verbose", _XFig_Verbose) >= 0) message("$ "+fmt); if (0 != system_intr (fmt)) { () = fprintf (stderr, "*** WARNING: %S exited with non-zero status\n", fmt); return; } ifnot (qualifier ("fig", 0)) { () = remove (dev.figfile); } } #iffalse define xfig_primative_set_attr (p, attr, val) { variable names = get_struct_field_names (p); if (0 == length (where (names == attr))) return; set_struct_field (p, attr, val); } #endif private define default_render_to_fp (object, fp) { } private define begin_render_as_compound (obj, fp) { variable x0, x1, y0, y1, z0, z1, x, y; (x0, x1, y0, y1, z0, z1) = obj.get_bbox (); (x, y) = xfig_project_to_xfig_plane (vector ([x0,x0,x0,x0,x1,x1,x1,x1], [y0,y0,y1,y1,y0,y0,y1,y1], [z0,z1,z0,z1,z0,z1,z0,z1])); x = xfig_convert_units (x); y = xfig_convert_units (y); xfig_write (fp, sprintf ("6 %d %d %d %d\n", min(x), min(y), max(x), max(y))); } private define end_render_as_compound (obj, fp) { xfig_write (fp, "-6\n"); } % Bitmapped values for flags parameter variable XFIG_RENDER_AS_COMPOUND = 1; private define default_render () %!%+ %\function{.render} %\synopsis{Render an xfig object to a file.} %\usage{.render(String_Type filename); %\altusage{.render(Struct_Type dev);} %} %\description % If the argument is a \exmp{filename} string, % the file is created through \sfun{xfig_create_file}, % and the \exmp{} is rendered. % \sfun{xfig_close_file} finally closes the file % and runs Xfig's \exmp{fig2dev} program on it. %\qualifiers %\qualifier{depth=intarray}{if specified, only objects of these depths are rendered} %\qualifier{verbose=intval}{if >=0, the fig2dev command is displayed} %\qualifier{fig=0|1}{if 0 (default), the .fig file will be removed, otherwise kept} %\qualifier{papersize[=VAL]}{Process the %P string in the output driver. If VAL is given, use it for the papersize} %\qualifier{background=color}{Process the %G string in the output driver with the specified color} %\seealso{xfig_set_verbose} %!%- { if (_xfig_check_help (_NARGS, ".render";; __qualifiers)) return; variable dev=(), obj=(); variable rac; variable do_close = 0; if (obj == NULL) return; if (typeof (dev) == String_Type) { do_close = 1; dev = xfig_create_file (dev); } variable fp = dev; if (typeof (dev) == Struct_Type) fp = dev.fp; rac = (obj.flags & XFIG_RENDER_AS_COMPOUND); if (rac) { rac = obj.count_objects (); if (rac) begin_render_as_compound (obj, fp); } obj.render_to_fp (fp;; __qualifiers); if (rac) end_render_as_compound (obj, fp); if (do_close) xfig_close_file (dev;; __qualifiers); } define xfig_justify_object () %{{{ %!%+ %\function{xfig_justify_object} %\synopsis{Justify an object at a specified position} %\usage{xfig_justify_object (XFig_Object obj, Vector_Type X [, Vector_Type dX]); %\altusage{xfig_justify_object (XFig_Object obj, XFig_Object o [, Vector_Type dX]);} %} %\description % This function moves the object to the specified position \exmp{X} (a vector) % and justifies it at that position according to the offsets specified by % the vector \exmp{dX}. The components of \exmp{dX} are normally in the % range -0.5 to 0.5 and represent offsets relative to the size of the object. % If the components of \exmp{dX} are 0, then the object will be centered at \exmp{X}. % % Alternatively, the second argument may be an XFig object \exmp{o} itself. % The position vector \exmp{X} is then determined from the position of \exmp{o} % and the justification vector \exmp{dX}: \exmp{obj} will be justified relative % to the outer boundary of \exmp{o}, unless the \exmp{inside} qualifier is set, % in which case it will be justified relative to the inner boundary. %\qualifiers %\qualifier{inside}{justify \exmp{obj} relative to the inner boundary of \exmp{o}} %\example % For \exmp{dX = vector (0,0,0)}: % the object \exmp{obj} will be justified concentrically with \exmp{o}. % % For \exmp{dX = vector (0,-0.5,0)} (i.e., \exmp{obj} will be horizontally % centered and vertically aligned at its lower baseline): \exmp{X} is % the horizontal center of the upper vertical baseline of \exmp{o} % such that \exmp{obj} will be placed on top of \exmp{o}. % % For \exmp{dX = vector (0,-0.5,0)}, together with the \exmp{inside} qualifier: % \exmp{X} is the horizontal center of the lower vertical baseline of \exmp{o} % such that \exmp{obj} will be coaligned with \exmp{o} at their lower baselines. %\seealso{.justify, .get_bbox, .translate} %!%- { variable obj, X, dX; switch (_NARGS) { case 2: (obj, X) = (); dX = vector (0, 0, 0); } { case 3: (obj, X, dX) = (); } { usage ("%s (obj, X [, dX]);", _function_name()); } variable x0, x1, y0, y1, z0, z1; if ( typeof (X) != Vector_Type && typeof (X) == Struct_Type && struct_field_exists (X, "get_bbox") ) { (x0, x1, y0, y1, z0, z1) = X.get_bbox (); if (qualifier_exists ("inside")) (x0, x1, y0, y1, z0, z1) = (x1, x0, y1, y0, z1, z0); X = vector (0.5*(x0+x1) - dX.x*(x1-x0), 0.5*(y0+y1) - dX.y*(y1-y0), 0.5*(z0+z1) - dX.z*(z1-z0)); } (x0, x1, y0, y1, z0, z1) = obj.get_bbox (); obj.translate (vector (X.x - 0.5*(x0+x1) - dX.x*(x1-x0), X.y - 0.5*(y0+y1) - dX.y*(y1-y0), X.z - 0.5*(z0+z1) - dX.z*(z1-z0))); } %}}} private define default_justify () %!%+ %\function{.justify} %\synopsis{Justify an object at a specified position} %\usage{.justify (Vector_Type X [, Vector_Type dX]); %\altusage{.justify (XFig_Object o [, Vector_Type dX]);} %} %\seealso{xfig_justify_object} %!%- { variable args = __pop_list(_NARGS); xfig_justify_object (__push_list (args);; __qualifiers); } private define default_method1 (obj, arg1); private define default_method2 (obj, arg1, arg2); private define default_method3 (obj, arg1, arg2, arg3); private define default_get_bbox (object) { verror ("*** Warning: %S has no get_bbox method", object); return (0.0, 0.0, 0.0, 0.0, 0.0, 0.0); } private define default_count_objects (object) { return 1; } private variable XFig_Object = struct { render_to_fp = &default_render_to_fp,% define this one rotate = &default_method2, translate = &default_method1, scale = &default_method3, get_bbox = &default_get_bbox, set_depth = &default_method1, set_pen_color = &default_method1, set_thickness = &default_method1, set_line_style = &default_method1, set_area_fill = &default_method1, set_fill_color = &default_method1, render = &default_render, % do not override justify = &default_justify, flags = 0, count_objects = &default_count_objects, % Private below }; define xfig_new_object () { variable args = __pop_args (_NARGS); variable root = @XFig_Object; return struct_combine (root, __push_args (args)); } define _xfig_get_scale_args (nargs) %!%+ %\function{.scale} %\synopsis{Scale an xfig object} %\usage{.scale (s); %\altusage{.scale (sx, sy[, sz]]);} %} %\description % If the \sfun{.scale} method is called with one argument \exmp{s}, % the object is scaled by \exmp{s} in all directions. % If two (three) arguments \exmp{sx}, \exmp{sy} (and \exmp{sz}) are given, % x, y (and z) coordinates are scaled differently. %!%- { if (nargs == 4) return; % leave them on the stack switch (nargs) { case 2:% sx given. Set sy=sz=sx dup(); dup(); return; } { case 3: return 1; % sx, sy given. Add sz = 1 } { case 1: return 1, 1, 1; } usage (".scale: Expecting 1, 2, or 3 scale parameters"); } define _xfig_verify_depth (depth) { if (0 <= depth <= 999) return depth; variable new_depth = (depth < 0) ? 0 : 999; () = fprintf (stderr, "*** Warning: Invalid depth %S. Using %S\n", depth, new_depth); return new_depth; } define _xfig_render_depth (obj) { variable depth = qualifier ("depth"); if (depth == NULL) return 1; depth = _xfig_verify_depth (depth); return any (obj.depth == depth); } private define translate_compound (c, dX) { foreach (c.list) { variable obj = (); obj.translate (dX); } } private define rotate_compound (c, axis, theta) { foreach (c.list) { variable obj = (); obj.rotate (axis, theta); } } private define count_objects_compound (c) { variable count = 0; foreach (c.list) { variable obj = (); count += obj.count_objects (); } return count; } private define scale_compound () { if (_xfig_check_help (_NARGS, ".scale";; __qualifiers)) return; variable c, sx, sy, sz, obj; (c, sx, sy, sz) = _xfig_get_scale_args (_NARGS); foreach obj (c.list) obj.scale (sx, sy, sz); } private define set_depth_compound (c, depth) { depth = _xfig_verify_depth (depth); foreach (c.list) { variable obj = (); obj.set_depth (depth); } } private define set_thickness_compound (c, thick) { foreach (c.list) { variable obj = (); obj.set_thickness (thick); } } private define set_line_style_compound (c, ls) { foreach (c.list) { variable obj = (); obj.set_line_style (ls); } } private define set_pen_color_compound (c, pc) { % Currently there is no way to distinguish the xfig integer color ids % from the logical color ids. So omit the color lookup here. %pc = xfig_lookup_color (pc); foreach (c.list) { variable obj = (); obj.set_pen_color (pc); } } private define set_area_fill_compound (c, x) { foreach (c.list) { variable obj = (); obj.set_area_fill (x); } } private define set_fill_color_compound (c, x) { %x = xfig_lookup_color (x); foreach (c.list) { variable obj = (); obj.set_fill_color (x); } } private define get_bbox_compound (c) { variable x0, x1, y0, y1, z0, z1; variable xmin = _Inf, ymin = _Inf, zmin = _Inf; variable xmax = -_Inf, ymax = -_Inf, zmax = -_Inf; foreach (c.list) { variable obj = (); (x0, x1, y0, y1, z0, z1) = obj.get_bbox (); xmin = _min(xmin, x0); xmax = _max(xmax, x1); ymin = _min(ymin, y0); ymax = _max(ymax, y1); zmin = _min(zmin, z0); zmax = _max(zmax, z1); } return xmin, xmax, ymin, ymax, zmin, zmax; } private define render_compound_to_fp (c, fp) { foreach (c.list) { variable obj = (); obj.render_to_fp (fp ;;__qualifiers()); } } private define compound_insert () %!%+ %\function{xfig_compound.insert} %\synopsis{Insert one or more xfig objects to a compound} %\usage{xfig_compound.insert( o[, ...]);} %\seealso{xfig_compound.append} %!%- { variable arg = __pop_list (_NARGS-1); variable list = ().list; foreach arg (arg) list_insert (list, arg); } private define compound_append () %!%+ %\function{xfig_compound.append} %\synopsis{Append one or more xfig objects to a compound} %\usage{xfig_compound.append( o[, ...]);} %\seealso{xfig_compound.insert} %!%- { variable arg = __pop_list (_NARGS-1); variable list = ().list; foreach arg (arg) list_append (list, arg); } define xfig_new_compound_list () { variable obj = xfig_new_object ("insert", "append", "list"); obj.render_to_fp = &render_compound_to_fp; obj.rotate = &rotate_compound; obj.translate = &translate_compound; obj.scale = &scale_compound; obj.set_depth = &set_depth_compound; obj.get_bbox = &get_bbox_compound; obj.set_thickness = &set_thickness_compound; obj.set_line_style = &set_line_style_compound; obj.set_pen_color = &set_pen_color_compound; obj.set_area_fill = &set_area_fill_compound; obj.set_fill_color = &set_fill_color_compound; obj.flags |= XFIG_RENDER_AS_COMPOUND; obj.insert = &compound_insert; obj.append = &compound_append; obj.count_objects = &count_objects_compound; obj.list = {}; return obj; } define xfig_new_compound () %!%+ %\function{xfig_new_compound} %\synopsis{Create an XFig compound list} %\usage{c = xfig_new_compound ([obj1, obj2, ...]);} %\description % An empty compound list is created with \sfun{xfig_new_compound_list}. % All arguments passed to the \sfun{xfig_new_compound} function % are inserted in the newly created list. %\seealso{xfig_new_vbox_compound, xfig_new_hbox_compound} %!%- { variable c = xfig_new_compound_list (); loop (_NARGS) { variable obj = (); if (obj != NULL) c.insert (obj); } return c; } define xfig_new_vbox_compound () %!%+ %\function{xfig_new_vbox_compound} %\synopsis{Create an XFig compound list of vertically aligned objects} %\usage{c = xfig_new_vbox_compound (obj1, obj2 [, ...] [, space]);} %\description % The objects \exmp{obj2}, ... are translated in negative y-direction % such that all of them align vertically according to their size. % If the last argument \exmp{space} is numeric, it indicates additional % vertical space that is inserted between each of the objects. %\qualifiers %\qualifier{just=val}{Justifiy the objects with respect to the first.} % If \exmp{val} is 0 then the objects will be centered. If val is % -1, the objects will be left justified. If val is +1, they will be % right justified. %\qualifier{center}{Center the objects with respect to the first} %\seealso{xfig_new_hbox_compound, xfig_new_compound} %!%- { variable objs = __pop_list (_NARGS); variable space = is_struct_type (objs[-1]) ? 0 : list_pop (objs, -1); variable ymin, xmin, xmax, obj, y0, y1, x0, x1; (xmin,xmax,ymin,,,) = objs[0].get_bbox (); variable t = qualifier ("just", qualifier_exists ("center") ? 0 : NULL); foreach obj (objs[[1:]]) { (x0,x1,y0,y1,,) = obj.get_bbox (); variable dy = ymin-y1-space; variable dx = 0; if (t != NULL) dx = 0.5*((xmin-x0)*(1-t)+(xmax-x1)*(1+t)); obj.translate (vector (dx, dy, 0)); ymin = y0 + dy; } return xfig_new_compound (__push_list (objs)); } define xfig_new_hbox_compound () %!%+ %\function{xfig_new_hbox_compound} %\synopsis{Create an XFig compound list of horizontally aligned objects} %\usage{c = xfig_new_hbox_compound (obj1, obj2 [, ...] [, space]);} %\description % The objects \exmp{obj2}, ... are translated in negative y-direction % such that all of them align horizontally according to their size. % If the last argument \exmp{space} is numeric, it indicates additional % horizontal space that is inserted between each of the objects. %\qualifiers %\qualifier{just=val}{Justifiy the objects with respect to the first.} % If \exmp{val} is 0 then the objects will be centered. If val is % 1, the objects will be aligned at the top. If val is -1, they will be % aligned at the bottom. %\qualifier{center}{Center the objects with respect to the first} %\seealso{xfig_new_vbox_compound, xfig_new_compound} %!%- { variable objs = __pop_list (_NARGS); variable xmax, ymin, ymax, obj, x0, x1, y0, y1; variable space = is_struct_type (objs[-1]) ? 0 : list_pop (objs, -1); (,xmax,ymin,ymax,,) = objs[0].get_bbox (); variable v0 = vector (xmax, 0, 0); variable t = qualifier ("just", qualifier_exists ("center") ? 0 : NULL); foreach obj (objs[[1:]]) { (x0,x1,y0,y1,,) = obj.get_bbox (); variable dx = xmax-x0+space, dy = 0; if (t != NULL) dy = 0.5*((ymin-y0)*(1-t)+(ymax-y1)*(1+t)); obj.translate (vector (dx, dy, 0)); xmax = x1 + dx; } return xfig_new_compound (__push_list (objs)); } #iffalse define xfig_object_set_attr (obj, attr, val) { (@obj.set_attr)(obj.object, attr, val); } define xfig_set_depth (p, val) { xfig_object_set_attr (p, "depth", val); } define xfig_set_line_style (p, val) { xfig_object_set_attr (p, "line_style", val); } define xfig_set_thickness (p, val) { xfig_object_set_attr (p, "thickness", val); } define xfig_set_pen_color (p, val) { if (typeof (val) == String_Type) val = xfig_lookup_color (val); xfig_object_set_attr (p, "pen_color", val); } define xfig_set_fill_color (p, val) { if (typeof (val) == String_Type) val = xfig_lookup_color (val); xfig_object_set_attr (p, "fill_color", val); } define xfig_set_pen_style (p, val) { xfig_object_set_attr (p, "pen_style", val); } define xfig_set_area_fill (p, val) { xfig_object_set_attr (p, "area_fill", val); } define xfig_set_style_val (p, val) { xfig_object_set_attr (p, "style_val", val); } define xfig_set_join_style (p, val) { xfig_object_set_attr (p, "join_style", val); } define xfig_set_cap_style (p, val) { xfig_object_set_attr (p, "cap_style", val); } define xfig_set_radius (p, val) { xfig_object_set_attr (p, "radius", val); } define xfig_set_font (p, val) { xfig_object_set_attr (p, "font", val); } define xfig_set_font_size (p, val) { xfig_object_set_attr (p, "font_size", val); } #endif %!%+ %\function{xfig_render_object} %\synopsis{Render an object to a device} %\usage{xfig_render_object (obj, device)} %\description % This function renders the specified object to a specified device. % If the device parameter is a string, then a device will be opened with % the specified name. %\seealso{xfig_create_file, xfig_close_file} %!%- define xfig_render_object (obj, fp) { if (obj == NULL) return; return obj.render (fp); } private variable Paper_Info = Assoc_Type[Struct_Type]; %\function{xfig_add_paper_size_info} %\synopsis{Add paper-size information} %\usage{xfig_add_paper_size_info (String_Type name, Double_Type width, Double_Type height)} %\description % This function may be used to add paper size information for a % specified paper size name. By default, the width and height % parameters are to be specified in inches. If the \em{cm} % qualifier is give, the width an height are assumed to be given with % cm units. %\qualifiers %\qualifier{cm}{The width and height parameters have cm units}. %\seealso{xfig_get_paper_size_info, xfig_set_paper_size} %!%- private define xfig_add_paper_size_info (name, width_inches, height_inches) { variable s = 1.0; if (qualifier_exists ("cm")) s = 1/2.54; Paper_Info[strlow(name)] = struct { name = name, width = width_inches * s, height = height_inches * s, }; } xfig_add_paper_size_info ("Letter", 8.5, 11.0); xfig_add_paper_size_info ("Legal", 8.5, 14.0); xfig_add_paper_size_info ("Ledger", 17.0, 11.0); xfig_add_paper_size_info ("Tabloid", 11.0, 17.0); xfig_add_paper_size_info ("A", 8.5, 11.0); xfig_add_paper_size_info ("B", 11.0, 17.0); xfig_add_paper_size_info ("C", 17.0, 22.0); xfig_add_paper_size_info ("D", 22.0, 34.0); xfig_add_paper_size_info ("E", 34.0, 44.0); xfig_add_paper_size_info ("A9", 3.7, 5.2; cm); xfig_add_paper_size_info ("A8", 5.2, 7.4; cm); xfig_add_paper_size_info ("A7", 7.4, 10.5; cm); xfig_add_paper_size_info ("A6", 10.5, 14.8; cm); xfig_add_paper_size_info ("A5", 14.8, 21.0; cm); xfig_add_paper_size_info ("A4", 21.0, 29.7; cm); xfig_add_paper_size_info ("A3", 29.7, 42.0; cm); xfig_add_paper_size_info ("A2", 42.0, 59.4; cm); xfig_add_paper_size_info ("A1", 59.4, 84.1; cm); xfig_add_paper_size_info ("A0", 84.1, 118.9; cm); xfig_add_paper_size_info ("B10", 3.2, 4.5; cm); xfig_add_paper_size_info ("B9", 4.5, 6.4; cm); xfig_add_paper_size_info ("B8", 6.4, 9.1; cm); xfig_add_paper_size_info ("B7", 9.1, 12.8; cm); xfig_add_paper_size_info ("B6", 12.8, 18.2; cm); xfig_add_paper_size_info ("B5", 18.2, 25.7; cm); xfig_add_paper_size_info ("B4", 25.7, 36.4; cm); xfig_add_paper_size_info ("B3", 36.4, 51.5; cm); xfig_add_paper_size_info ("B2", 51.5, 72.8; cm); xfig_add_paper_size_info ("B1", 72.8 , 103.0; cm); xfig_add_paper_size_info ("B0", 103.0 , 145.6; cm); %\function{xfig_get_paper_size_info} %\synopsis{Get information about a paper size} %\usage{xfig_get_paper_info ( [ paper ] } %\description % This function returns information about the currently selected % paper size, or optionally, a specified paper size. In particular, the % function returns a structure with the fields: %#v+ % name : the paper size name % width : the paper width in inches % height : the paper height in inches %#v- % Currently supported paper size names include: %#v+ % letter, legal, ledger, tabloid, % A, B, C, D, E, % A0, A1, A2, A3, A4, A5, A6, A7, A8, A9 % B0, B1, B2, B3, B4, B5, B6, B7, B8, B9, B10 %#v- %\seealso{xfig_add_paper_size_info, xfig_set_paper_size} %!%- define xfig_get_paper_size_info () { variable p = XFig_Header.papersize; if (_NARGS) p = (); p = strlow (p); ifnot (assoc_key_exists (Paper_Info, p)) { () = fprintf (stderr, "Unable to find paper info for '%s', assuming 'letter'\n", p); p = "letter"; } return Paper_Info[p]; } define xfig_set_paper_size (paper) { variable s = xfig_get_paper_size_info (paper); XFig_Header.papersize = s.name; } %!%+ %\function{xfig_set_verbose} %\synopsis{Control the level of chattiness} %\usage{xfig_set_verbose(Integer_Type level);} %\description % This function may be used to control the verbosity level of the % xfig functions that display informational messages. %\notes % It is not always possible to control the verbosity level of % external programs. For the LaTeX/eps interface, if the level is 0, % then only the running command will be displayed and any output will % be redirected to \file{/dev/null}. Otherwise if level > 0, then % the output will not be redirected. %!%- define xfig_set_verbose (n) { _XFig_Verbose = n; } private variable Temp_File_List = {}; define xfig_add_tmp_file (file) { ifnot (path_is_absolute (file)) { variable cwd = getcwd (); if (cwd == NULL) return; file = path_concat (cwd, file); } list_append (Temp_File_List, file); } define xfig_delete_tmp_files () { loop (length (Temp_File_List)) { variable file = list_pop (Temp_File_List); variable st = stat_file (file); if (st == NULL) continue; if (stat_is ("dir", st.st_mode)) () = rmdir (file); else () = remove (file); } } atexit (&xfig_delete_tmp_files); private variable Tmp_Dir = "/tmp"; define xfig_mkdir (); define xfig_mkdir (dir) { variable topdir = path_dirname (dir); if (topdir == dir) return; if (NULL == stat_file (topdir)) xfig_mkdir (topdir); if ((-1 == mkdir (dir, 0777)) && (errno != EEXIST)) throw OSError, sprintf ("Unable to mkdir(%s): %s", dir, errno_string()); } define xfig_set_tmp_dir (tmp) { xfig_mkdir (tmp); Tmp_Dir = tmp; } define xfig_get_tmp_dir () { return Tmp_Dir; } define xfig_make_tmp_file (base, ext) { if (path_is_absolute (base) == 0) base = path_concat (Tmp_Dir, base); xfig_mkdir (path_dirname (base)); if (ext == NULL) ext = ".tmp"; loop (1000) { variable file = sprintf ("%s%X%X%s", base, rand_int (1, 0xFFFF), rand_int(1, 0x7FFFF), ext); if (NULL == stat_file (file)) { if (qualifier_exists ("delete")) xfig_add_tmp_file (file); return file; } } throw IOError, "Unable to create a tmp file"; } private define ones() { !if (_NARGS) return 1; variable a = __pop_args (_NARGS); return 1 + Int_Type[__push_args (a)]; } define xfig_meshgrid () %{{{ %!%+ %\function{xfig_meshgrid} %\synopsis{Produce grid points for an image} %\usage{(xx,yy) = xfig_meshgrid (xx, yy)} %\description % This function takes two 1-d vectors representing the orthogonal % grids for a rectangular region in the (x,y) plane and returns two % 2-d arrays corresponding to the (x,y) coordinates of each % intersecting grid point. % % Suppose that one wants to evaluate a % function \exmp{f(x,y)} at each point defined by the two grid % vectors. Simply calling \exmp{f(x,y)} using the grid vectors would % lead to either a type-mismatch error or produce a 1-d result. The % correct way to do this is to use the \sfun{xfig_meshgrid} function: %#v+ % result = f(xfig_meshgrid(x,y)); %#v- %!%- { variable x,y; if (_NARGS != 2) usage ("(xx,yy)=xfig_meshgrid (x,y) ==> produces grid vectors for an image"); (x,y) = (); variable nx, ny, xx, yy, i; nx = length (x); ny = length (y); xx = x # ones(1,ny); yy = ones(nx) # transpose(y); return xx, yy; } %}}} % Use CM as the default system xfig_use_cm (); xfig_set_eye (1e6, 0, 0); xfig_set_eye_roll (0); xfig_set_paper_size ("Letter"); xfig_set_verbose (0); slxfig-pre0.2.0-138/src/xfig/png.sl0000644000175000000620000000432711532666762015537 0ustar johnstaffprivate variable Magic_Bytes = "\d137\d80\d78\d71\d13\d10\d26\d10"; private define read_exactly_n_bytes (fd, n) { variable buf; variable nbytes = read (fd, &buf, n); if (nbytes != n) verror ("Error reading png file"); return buf; } private define open_png (png) { variable fd = open (png, O_RDONLY); if (fd == NULL) verror ("Unable to open png file %S", png); variable magic = read_exactly_n_bytes (fd, strlen (Magic_Bytes)); if (magic != Magic_Bytes) verror ("%s is not a PNG file", png); return fd; } private define read_4byte_uint (fd) { variable buf = read_exactly_n_bytes (fd, 4); return unpack (">K", buf); } private define read_png_chunk (fd) { variable length, type, data, crc; length = read_4byte_uint (fd); type = read_exactly_n_bytes (fd, 4); %type = read_4byte_uint (fd); data = read_exactly_n_bytes (fd, length); crc = read_4byte_uint (fd); return length, type, data, crc; } % The IHDR chunk must appear FIRST. It contains: % Width: 4 bytes % Height: 4 bytes % Bit depth: 1 byte % Color type: 1 byte % Compression method: 1 byte % Filter method: 1 byte % Interlace method: 1 byte define xfig_new_png (file) %!%+ %\function{xfig_new_png} %\synopsis{Create an object that encapsulates a png image} %\usage{obj = xfig_new_png(String_Type filename);} %\qualifiers %\qualifier{depth}{XFig depth} %\qualifier{x0}{x-position}{0} %\qualifier{y0}{y-position}{0} %\qualifier{z0}{z-position}{0} %\qualifier{just=[jx,jy]}{justification}{[0,0]} %\description % \sfun{xfig_new_png} reads the image dimensions from the file header % and passes them to \sfun{xfig_new_pict}. See its documentation for % a detailed description of the qualifiers. %\seealso{xfig_new_pict} %!%- { variable fd = open_png (file); variable length, type, data, crc; (length, type, data, crc) = read_png_chunk (fd); if (type != "IHDR") verror ("Expecting an IHDR header in %s", file); variable width, height; (width, height) = unpack (">k>k", data); () = close (fd); width *= xfig_get_display_pix_size (); height *= xfig_get_display_pix_size (); return xfig_new_pict (file, width, height;; __qualifiers); } slxfig-pre0.2.0-138/src/xfig/objects.sl0000644000175000000620000001173411726620761016376 0ustar johnstaff% -*- mode: slang; mode: fold; -*- % Creates a rectangle with the LL corner at the origin define xfig_new_rectangle (dx, dy) { return xfig_new_polygon (vector([0,dx,dx,0,0], [0,0,dy,dy,0], [0,0,0,0,0])); } define xfig_new_grid (nx, ny, dx, dy) { variable lenx, leny; variable X; leny = ny * dy; lenx = nx * dx; variable border = xfig_new_rectangle (lenx, leny); variable list = xfig_new_polyline_list (); nx++; ny++; variable xs, ys, zs, x, y; x = 0; ys = [0,leny]; zs = [0,0]; loop (nx) { X = vector ([x,x], ys, zs); list.insert (X); x += dx; } xs = [0, lenx]; y = 0; loop (ny) { X = vector (xs, [y,y], zs); list.insert (X); y += dy; } %return list; return xfig_new_compound (border, list); } %}}} define xfig_new_block (dx, dy, dz) { variable block = xfig_new_polygon_list (); variable X, p, obj; variable zeros = [0,0,0,0,0]; % Bottom X = vector ([0, 0, dx, dx, 0], [0, dy, dy, 0, 0], zeros); block.insert (xfig_new_polygon(X)); % Top X = vector ([0, dx, dx, 0, 0], [0, 0, dy, dy, 0], [dz, dz, dz, dz, dz]); block.insert (xfig_new_polygon(X)); % Left X = vector ([0, dx, dx, 0, 0], zeros, [0, 0, dz, dz, 0]); block.insert (xfig_new_polygon(X)); % Front X = vector ([dx, dx, dx, dx, dx], [0, dy, dy, 0, 0], [0, 0, dz, dz, 0]); block.insert (xfig_new_polygon(X)); % Back X = vector (zeros, [0, 0, dy, dy, 0], [0, dz, dz, 0, 0]); block.insert (xfig_new_polygon(X)); % Right X = vector ([0, 0, dx, dx, 0], [dy, dy, dy, dy, dy], [0, dz, dz, 0, 0]); block.insert (xfig_new_polygon(X)); return block; } #ifnexists urand private variable Fast_Random = _time (); private define urand (n) { variable x = Double_Type[n]; _for (0, n-1, 1) { variable i = (); Fast_Random = Fast_Random * 69069U + 1013904243U; x[i] = Fast_Random/4294967296.0; } return x; } #endif define xfig_new_random_polyline (dx, dy, dz, max_points) { return xfig_new_ellipse (dx, dy); variable x, y, z; x = 2*(0.5-urand(max_points)); y = 2*(0.5-urand(max_points)); z = 2*(0.5-urand(max_points)); variable i = where (x*x + y*y + z*z < 1.0); return xfig_new_polyline (vector (dx*x[i], dy*y[i], dz*z[i])); } % Created photon will have head at the origin and tail at dX define xfig_new_photon (dX, amp, wavelength) { dX = vector_chs (dX); variable x, y, z, t; variable len = vector_norm (dX); variable npts_per_wavelength = qualifier ("npts", 16); z = [0:len:wavelength/(1.0*npts_per_wavelength)]; t = z*(2*PI/wavelength); % For the arrow to look ok, make the amp fall off near the end amp *= (1.0 - exp ((z-len)/(3*wavelength))); x = amp*cos (t); y = amp*sin (t); variable v = vector (x, y, z); variable n = crossprod(vector(0,0,1), dX); normalize_vector (n); variable cos_theta = dX.z/len; v = vector_rotate (v, n, acos (cos_theta)); variable photon = xfig_new_polyline (v); variable a = xfig_new_arrow_head (0.5*wavelength, wavelength, dX); dX = vector_chs (dX); photon.translate (dX); a.translate (dX*(wavelength/len)); return xfig_new_compound (photon, a); } % Neither of these functions work too well --- avoid them define xfig_new_labeled_arrow (dX, label) { variable height = 0.1, width = 0.05; variable p = xfig_new_polyline (vector([0,dX.x], [0,dX.y], [0,dX.z]) ;; __qualifiers); variable a = xfig_new_arrow_head (width, height, dX;; __qualifiers); a.translate ((1.0-height)*dX); if (label != NULL) { label = xfig_new_text (label ;;__qualifiers); variable dx, dy; (dx, dy) = label.get_pict_bbox (); label.translate (1.05*dX + vector (dX.x*dx, dy, 0)); } return xfig_new_compound (p, a, label); } define xfig_new_3d_axis (xlabel, ylabel, zlabel) { variable e1 = xfig_new_labeled_arrow (vector(1,0,0), xlabel;; __qualifiers); variable e2 = xfig_new_labeled_arrow (vector(0,1,0), ylabel;; __qualifiers); variable e3 = xfig_new_labeled_arrow (vector(0,0,1), zlabel;; __qualifiers); return xfig_new_compound (e1, e2, e3); } define xfig_new_hedgehog (radius, n) { variable h = xfig_new_polyline_list (); variable phis = 2*PI*urand (n); variable thetas = acos (2.0*urand (n)-1); variable xs = sin(thetas); variable ys = xs*sin(phis); xs *= cos(phis); variable zs = cos(thetas); _for (0, n-1, 1) { variable i = (); variable x = xs[i], y = ys[i], z = zs[i]; h.insert (vector ([-x,x], [-y,y], [-z,z])); } return h; } define xfig_new_polyline_with_arrow (X, width, height) { variable x = X.x, y = X.y, z = X.z; if (length (x) < 2) verror ("xfig_new_arrow: need at least 2 points"); variable line = xfig_new_polyline (X); X = vector (x[-1], y[-1], z[-1]); variable dX = vector_diff (X, vector (x[-2], y[-2], z[-2])); variable a = xfig_new_arrow_head (width, height, dX); normalize_vector (dX); %xfig_translate_object (a, X); a.translate (vector_diff (X, vector_mul (height, dX))); return xfig_new_compound (line, a); } slxfig-pre0.2.0-138/src/xfig/plot.sl0000644000175000000620000030523514146404547015726 0ustar johnstaff% -*- mode: slang; mode: fold; -*- require ("setfuns"); private variable DEFAULT_IMAGE_DEPTH = 89; private variable DEFAULT_TIC_DEPTH = DEFAULT_IMAGE_DEPTH-10; private variable DEFAULT_LINE_DEPTH = DEFAULT_TIC_DEPTH-10; private variable DEFAULT_POINT_DEPTH = DEFAULT_LINE_DEPTH-10; private variable DEFAULT_FRAME_DEPTH = DEFAULT_POINT_DEPTH-10; private variable ERRBAR_TERMINAL_SIZE = 0.1; % convert a scalar to an array of size n private define convert_to_array (s, n) %{{{ { variable type = typeof (s); if (type == Array_Type) return s; if (type == List_Type) return s; % list_to_array (s); variable a = type[n]; a[*] = s; return a; } %}}} define xfig_new_legend (labels, colors, linestyles, thicknesses, width) %{{{ %!%+ %\function{xfig_new_legend} %\synopsis{Create a plot legend object} %\usage{legend = xfig_new_legend (labels[], colors[], linestyles[], thicknesses[], width);} %\qualifiers %\qualifier{areafill=intval}{}{20} %\qualifier{fillcolor=strval}{}{"white"} %\qualifier{labelsize=strval}{}{"large"} %\description % The \sfun{xfig_new_legend} function creates a legend object suitable for adding % to a plot. The legend will consist of ... %!%- % FIXME: allow any object, not just a line... { variable num = length(labels); colors = convert_to_array (colors, num); linestyles = convert_to_array (linestyles, num); thicknesses = convert_to_array (thicknesses, num); variable legend = xfig_new_compound_list (); variable height = 0; variable x = width + 0.2; variable x0, x1, y0, y1; variable y = 0; _for (0, num-1, 1) { variable i = (); variable obj = xfig_new_text (labels[i]; size=qualifier("labelsize", "large")); xfig_justify_object (obj, vector (x,y,0), vector (-0.5, 0.5, 0)); legend.insert (obj); (,,y0,y1,,) = obj.get_bbox (); y = 0.5*(y0+y1); obj = xfig_new_polyline (vector([0,width], [y,y], [0,0])); obj.set_pen_color (colors[i]); obj.set_thickness (thicknesses[i]); obj.set_line_style (linestyles[i]); legend.insert (obj); y = y0 - 0.1 * (y1-y0); } (x0, x1, y0, y1,,) = legend.get_bbox (); variable border = (0.5 * (y1-y0))/num; legend.translate (vector (border-x0, border-y0, 0)); variable box = xfig_new_rectangle ((x1-x0)+2*border, (y1-y0)+2*border); box.set_area_fill (qualifier("areafill", 20)); box.set_fill_color (qualifier("fillcolor", "white")); legend.insert (box); return legend; } %}}} %{{{ Plot_Axis_Type, etc % A "Plot" consists of a plotting area surrounded by a box, with optional tic % marks and labels: % % X2 axis label % X2 tic labels % +-----+-----+-----+-----+-----+-----+ % y1 + + y2 % Y1-label tic + + tic Y2 label % labels + + labels % +-----+-----+-----+-----+-----+-----+ % X1 tic labels % X1 axis label % % % The X1 axis label is placed below the X axis by an amount depending upon the % size of the X1 tic labels. Similar considerations apply to the other axes. % The Y1/Y2 labels will be rotated 90 degrees % private variable Plot_Axis_Type = struct { X, dX, dY, % position of axis, direction, tic dir xmin = 0.1, xmax = 1.0, wcs_transform, islog = 0, % if non-zero, is a log axis. if < 0 format tics as non-log major_tics, minor_tics, maxtics, user_specified_major_tics, user_specified_minor_tics, user_specified_tic_labels, %tic_label_format, tic_labels, tic_labels_dX, % from tic tic_label_format, tic_label_strings, tic_labels_font_struct, % do not initialize font_struct here, but only in do_axis_method, % when user may have changed the default font_style tic_label_objects, tic_labels_tweak, % from tic tic_labels_just, % justification for tic labels and axis_label tic_labels_confine, % May tic label objects overhang the plot box? max_tic_h=0.0, max_tic_w=0.0, % max width and height of tic label bbox geom, % geometric parameters line, major_tic_marks, minor_tic_marks, minor_tic_len = 0.15, major_tic_len = 0.25, major_tic_color = "black", minor_tic_color = "black", major_tic_linestyle = 0, minor_tic_linestyle = 0, major_tic_thickness = 1, minor_tic_thickness = 1, axis_color = "black", axis_linestyle = 0, axis_thickness = 1, axis_label, draw_line=1, draw_major_tics=1, draw_minor_tics=1, draw_tic_labels=1, inited = 0, needs_setup = 1, axis_depth = DEFAULT_FRAME_DEPTH, tic_depth = DEFAULT_TIC_DEPTH, }; private variable XFig_Plot_Legend_Type = struct { X, width, names, objects }; private variable XFig_Plot_Data_Type = struct { X, plot_width, plot_height, % plot window, does not include labels x1axis, y1axis, x2axis, y2axis, % Plot_Axis_Type world1_inited = 0, world2_inited = 0, line_color, line_style, thickness, point_color, point_size, object_list, title_object, num_plots = 0, % methods line_depth, point_depth, axis_depth, image_depth, legend }; %}}} %{{{ Coordinate transforms: linear, log, etc private variable WCS_Transforms = Assoc_Type[]; private define setup_axis_wcs (axis, wcs_type) { if (0 == assoc_key_exists (WCS_Transforms, wcs_type)) { vmessage ("*** Warning: axis transform %s not supported. Using linear", wcs_type); wcs_type = "linear"; } axis.islog = (wcs_type == "log"); variable wcs = WCS_Transforms[wcs_type]; axis.wcs_transform = wcs; variable wcs_xmin = wcs.xmin; if (wcs_xmin == NULL) wcs_xmin = -_Inf; variable wcs_xmax = wcs.xmax; if (wcs_xmax == NULL) wcs_xmax = _Inf; variable x = axis.xmin; if (x == NULL) x = 0.1; if (0 == (wcs_xmin <= x < wcs_xmax)) x = wcs_xmin; axis.xmin = x; x = axis.xmax; if (x == NULL) x = 1.0; if (0 == (wcs_xmin < x <= wcs_xmax)) x = wcs_xmax; axis.xmax = x; } private define world_to_normalized (wcs, x, x0, x1) { variable cd = wcs.client_data; variable f = wcs.wcs_func; variable t0 = (@f)(double(x0), cd); variable t1 = (@f)(double(x1), cd); return ((@f)(double(x), cd) - t0)/(t1-t0); } private define normalized_to_world (wcs, t, x0, x1) { variable cd = wcs.client_data; variable f = wcs.wcs_func; variable t0 = (@f)(double(x0), cd); variable t1 = (@f)(double(x1), cd); variable x = t0 + t*(t1-t0); return (@wcs.wcs_invfunc)(t0 + t*(t1-t0), cd); } private define round_generic_tic (x, np) { % Try to choose tics that end in 0 or 5 variable y = x mod 10; x -= y; if (2.5 <= y <= 7.5) { @np = 5; return x + 5; } @np = 10; if (y < 2.5) return x; return x + 10; } private define generic_compute_tics (wcs, xmin, xmax, ntics) { % Increase the density a bit variable ntics1 = ntics * 2; ifnot (ntics1 mod 2) ntics1++; variable c = [0:1:#ntics1]; variable dc = 0.501*(c[1]-c[0]);%((0.5*ntics1)/ntics); variable tics = normalized_to_world (wcs, c, xmin, xmax); variable s = sign(tics); tics *= s; % x = a*10^b % log10(x) = log10(a) + b variable bad = where (tics <= 0); variable y = log10(tics); variable b = int(y); variable a = y - b; variable i = where (a < 0); a[i] += 1; b[i] -= 1; a[bad] = 0; b[bad] = 0; a = 10.0^a; tics = a * 10^b; variable n = length (tics); variable ok = Char_Type[n]; variable isnice = Char_Type[n]; variable loop_num = 0; loop (5) { loop_num++; _for i (0, n-1, 1) { if (ok[i]) continue; variable a_i = a[i]; variable b_i = 10^b[i]; variable c_i = c[i]; variable dc1, dc2, tic_1, tic_2, ia_1, ia_2; tic_1 = round_generic_tic (a_i, &ia_1) * b_i; if (xmin <= tic_1 <= xmax) { dc1 = abs(c_i-world_to_normalized (wcs, s[i]*tic_1, xmin, xmax)); if (dc1 < dc) { tics[i] = tic_1; ok[i] = loop_num; isnice[i] = ia_1; continue; } } ia_1 = int(a_i); ia_2 = nint(a_i); tic_1 = ia_1*b_i; tic_2 = ia_2*b_i; dc1 = abs(c_i-world_to_normalized (wcs, s[i]*tic_1, xmin, xmax)); dc2 = abs(c_i-world_to_normalized (wcs, s[i]*tic_2, xmin, xmax)); if (dc1 < dc2) { if (dc1 < dc) { if (ia_1 == 1) isnice[i] = 10; tics[i] = tic_1; ok[i] = loop_num; continue; } } else { if (dc2 < dc) { if (ia_2 == 1) isnice[i] = 10; tics[i] = tic_2; ok[i] = loop_num; continue; } } a[i] = a_i*10; b[i]--; } if (all(ok)) break; } tics = s*tics; variable t0 = tics[0]; variable j = 0; i = 1; while (i < n) { variable t1 = tics[i]; if (t1 == t0) { i++; continue; } j++; tics[j] = t1; ok[j] = ok[i]; isnice[j] = isnice[i]; t0 = t1; i++; } tics = tics[[0:j]]; ok = ok[[0:j]]; isnice = isnice[[0:j]]; n = length(tics); if (n <= 1) return NULL, NULL; i = where(xmin <= tics <= xmax); tics = tics[i]; ok = ok[i]; isnice = isnice[i]; t0 = tics[0]; t1 = tics[-1]; if (t0 < 0.0 < t1) tics[wherefirst (minabs(tics) == abs(tics))] = 0; if (length(tics) > ntics) { % Prune the tics to the desired number. c = world_to_normalized (wcs, tics, xmin, xmax); while (length(tics) > ntics) { dc = shift (c, 1) - c; dc[-1] = 10; i = wherefirst (dc == min(dc)); % We can eliminate tics[i] or tics[i+1]. % |---------|-----|---------| % dc[i-1] dc[i] dc[i+1] if ((ok[i] < ok[i+1]) || ((ok[i] == ok[i+1]) && ((isnice[i] > isnice[i+1]) || (i == 0) || (dc[i-1] > dc[i+1])))) i++; j = [[0:i-1],[i+1:length(tics)-1]]; tics = tics[j]; c = c[j]; ok = ok[j]; isnice = isnice[j]; } } return tics, NULL; } private define wcs_compute_major_minor_tics (wcs, xmin, xmax, maxtics) { variable f = wcs.compute_major_minor_tics; if (f == NULL) return NULL, NULL; if (f == &generic_compute_tics) return (@f)(wcs, xmin, xmax, maxtics); return (@f)(xmin, xmax, maxtics, wcs.client_data); } define xfig_plot_add_transform (name, wcs_func, wcs_invfunc, client_data) %!%+ %\function{xfig_plot_add_transform} %\usage{xfig_plot_add_transform (String_Type name, Ref_Type &wcs_func, &wcs_invfunc, Any_Type client_data);} %\qualifiers %\qualifier{xmin}{}{-inf} %\qualifier{xmax}{}{+inf} %\qualifier{ticfun}{}{&generic_compute_tics} %\description % \exmp{wcs_func} (\exmp{wcs_invfunc}) is a function % of two arguments: the world (plot) coordinate and some client data. % It has to return the correspondig plot (world) coordinate. % % The qualifier \exmp{ticfun} may reference a function % that takes 4 arguments: xmin, xmax, maxtics, and client_data. % It is supposed to return two arrays of major and minor tic marks. %!%- { variable s = struct { wcs_func = wcs_func, wcs_invfunc = wcs_invfunc, client_data = client_data, xmin = qualifier ("xmin", -_Inf), xmax = qualifier ("xmax", _Inf), compute_major_minor_tics = qualifier("ticfun"), }; if ((s.compute_major_minor_tics == NULL) && (name != "log") && (name != "linear")) s.compute_major_minor_tics = &generic_compute_tics; WCS_Transforms[name] = s; } private define linear_wcs_func (x, cd) { return x; } xfig_plot_add_transform ("linear", &linear_wcs_func, &linear_wcs_func, NULL); private define check_xmin_xmax_for_log (xmin, xmax) { variable tweaked = 0; if (xmax <= 0.0) { xmax = 1.0; tweaked++; } if (xmin <= 0.0) { tweaked++; xmin = 0.1*xmax; } if (xmin == 0.0) { xmax = 1.0; xmin = 0.1; } if (tweaked) () = fprintf (stderr, "*** Warning: Invalid world coordinates for log axis\n"); return xmin, xmax; } private define log_wcs_func (x, cd) { return log10 (x); } private define log_wcs_invfunc (x, cd) { return 10.0^x; } xfig_plot_add_transform ("log", &log_wcs_func, &log_wcs_invfunc, NULL; xmin = DOUBLE_MIN); private define sqrt_wcs_func (x, cd) { return sqrt (x); } private define sqrt_wcs_invfunc (x, cd) { return x*x; } xfig_plot_add_transform ("sqrt", &sqrt_wcs_func, &sqrt_wcs_invfunc, NULL; xmin = 0); private define cdf_tan_wcs_func (x, theta0) { return 0.5 * (1.0 + tan((2.0*x-1.0)*theta0)/tan(theta0)); % (1 + tan((2x-1)*t0)/tan(t0)/2; % 2*x-1 = tan((2x-1)*t0)/tan(t0) } private define cdf_tan_wcs_invfunc (x, theta0) { return 0.5*(1.0 + atan((2.0*x-1.0)*tan(theta0))/theta0); } private define cdf_compute_tics (xmin, xmax, maxtics, cd) { variable major = [0, 0.01, 0.05, 0.1, 0.2, 0.5, 0.8, 0.9, 0.95, 0.99, 1.0]; variable minor = [[0:0.1:0.01], [0.1:0.9:0.1], [0.9:1.0:0.01]]; if (length (where (xmin <= major <= xmax)) < 2) return NULL, NULL; return major, minor; } xfig_plot_add_transform ("cdf", &cdf_tan_wcs_func, &cdf_tan_wcs_invfunc, PI/2-0.15 ;ticfun=&cdf_compute_tics, xmin = 0, xmax = 1); % x >= 1: y = 2 - 1/x^n ==> y >= 1 % x < 1: y = x^n ==> y < 1 private define resid_wcs_func (x, n) { variable s = sign(x); x = s*x; variable y = Double_Type[length(x)]; variable i, j; i = where (x >= 1, &j); y[i] = 2.0 - 1.0/(x[i]^n); y[j] = x[j]^n; if (typeof (x) != Array_Type) y = y[0]; return y*s; } private define resid_wcs_invfunc (y, n) { variable x = Double_Type[length(y)]; variable i, j; variable s = sign(y); y = s*y; i = where (y >= 1.0, &j); x[i] = (1.0/(2.0 - y[i]))^(1.0/n); x[j] = y[j]^(1.0/n); if (typeof (y) != Array_Type) x = x[0]; return x*s; } xfig_plot_add_transform ("resid", &resid_wcs_func, &resid_wcs_invfunc, 2.0); %}}} private define compute_major_tics (xmin, xmax, maxtics, tic_intervals) %{{{ { variable diff = xmax - xmin; variable multiplier = 1.0; variable factor = 10.0; variable last_diff; variable max_diff = tic_intervals[-1]*maxtics; while (diff <= max_diff) { multiplier *= factor; last_diff = diff; diff *= factor; if (last_diff == diff) return [xmin,xmax], 0; } while (diff > max_diff) { multiplier *= 1.0/factor; last_diff = diff; diff *= 1.0/factor; if (last_diff == diff) return [xmin,xmax], 0; } variable tic_interval; variable nth_chosen = 0; foreach (tic_intervals) { tic_interval = (); if (diff/tic_interval <= maxtics) break; nth_chosen++; } tic_interval /= multiplier; variable nmin = xmin / tic_interval; if (abs(nmin) > 0x7FFFFFFF) return [xmin,xmax], 0; nmin = int(nmin); if (xmin < 0) nmin--; variable nmax = xmax/tic_interval; if (abs(nmin) > 0x7FFFFFFE) return [xmin,xmax], 0; nmax = int(nmax); if (xmax > 0) nmax++; tic_intervals = [nmin:nmax]*tic_interval; return tic_intervals, nth_chosen; } %}}} private define get_major_tics (xmin, xmax, islog, maxtics) %{{{ { variable tic_intervals = [1.0,2.0,5.0]; % 1, 1.2,1.4,1.6,1.8, 2 % 2, 3.0, 4 % 5, 6.0,7.0,8.0,9.0, 10, ... variable num_minor = [4, 1, 4]; variable ti, n; if (islog) { xmin = log10(xmin); xmax = log10(xmax); if (xmin < 0) xmin -= 1.0; xmin = int(xmin); if (xmax > 0) xmax += 1.0; xmax = int(xmax); num_minor = [0:5]; tic_intervals = num_minor+1.0; if ((xmax - xmin + 1) <= maxtics) { num_minor = 0; tic_intervals = [1.0]; } } (ti, n) = compute_major_tics (xmin, xmax, maxtics, tic_intervals); if (islog) { % For a log axis, only integer valued major tics are meaningful ti = ti[where (feqs (ti, int(ti)))]; } return ti, num_minor[n]; } %}}} private define make_tic_objects (axis, tics, X, xmin, xmax, dX, dY, ticlen) %{{{ { xmin = double(xmin); xmax = double(xmax); variable den = (xmax - xmin); variable list = xfig_new_polyline_list (); variable f = axis.wcs_transform.wcs_func; variable cd = axis.wcs_transform.client_data; variable t0 = (@f)(xmin, cd); variable t1 = (@f)(xmax, cd); variable dt = t1 - t0; dY = vector_mul (ticlen, dY); variable Xmax = vector_sum (X, dX); _for (0, length(tics)-1, 1) { variable i = (); variable x = ((@f)(double(tics[i]), cd) - t0)/dt; variable X0 = vector_sum (X, vector_mul(x, dX)); variable X1 = vector_sum (X0, dY); list.insert (vector ([X0.x, X1.x], [X0.y, X1.y], [X0.z, X1.z])); } return list; } %}}} private define make_tic_marks (axis) %{{{ { if (axis == NULL) return; variable X = axis.X, dX = axis.dX, dY = axis.dY; variable xmin = axis.xmin; variable xmax = axis.xmax; variable islog = axis.islog; if (axis.draw_line) axis.line = xfig_new_polyline (X.x+[0,dX.x], X.y+[0,dX.y], X.z+[0,dX.z] ; color=axis.axis_color, line=axis.axis_linestyle, width=axis.axis_thickness, depth=axis.axis_depth ); axis.minor_tic_marks = NULL; axis.major_tic_marks = NULL; variable ticlen; variable major_tics, minor_tics, tics; major_tics = axis.major_tics; minor_tics = axis.minor_tics; if ((major_tics != NULL) && axis.draw_major_tics) { tics = make_tic_objects (axis, major_tics, X, xmin, xmax, dX, dY, axis.major_tic_len); tics.set_pen_color (axis.major_tic_color); tics.set_line_style (axis.major_tic_linestyle); tics.set_thickness (axis.major_tic_thickness); tics.set_depth (axis.tic_depth); axis.major_tic_marks = tics; } if ((minor_tics != NULL) && (axis.draw_minor_tics)) { % prune the minor tics so that the major ones are not overwritten if (major_tics != NULL) minor_tics = minor_tics[complement(minor_tics, major_tics)]; tics = make_tic_objects (axis, minor_tics, X, xmin, xmax, dX, dY, axis.minor_tic_len); tics.set_pen_color (axis.minor_tic_color); tics.set_line_style (axis.minor_tic_linestyle); tics.set_thickness (axis.minor_tic_thickness); tics.set_depth (axis.tic_depth); axis.minor_tic_marks = tics; } } %}}} private define format_labels_using_scientific_notation (tics) %{{{ { variable log10_tics = log10 (abs(tics)); % x = a*10^b ==> log10(x) = log10(a) + b; % = log10(10a) + (b-1) variable b = int (log10_tics); variable a = log10_tics - b; variable j = where (a < 0.0); a[j] += 1; b[j] -= 1; if (max(b)-min(b) == 1) { j = where (b == max(b)); a[j] += 1; b[j] -= 1; } % This logic is flawed variable mant, mant_factor = 1.0, s = where(tics<0); loop (8) { mant = nint(10^a); mant[s] *= -1; if (all(shift(mant,1)-mant)) break; mant_factor *= 0.1; a += 1; } mant = nint(10^a); mant *= mant_factor; if (any(mant < 1)) { mant *= 10; b--; } mant[s] *= -1; j = where (mant >= 10); if (length(j)*2 >= length(mant)) { mant *= 0.1; b += 1; } return array_map (String_Type, &sprintf, `$\text{%g}{\times}\text{10}^\text{%d}$`, mant, b); } %}}} private define construct_tic_label_strings (axis, tics); %{{{ private define construct_tic_label_strings (axis, tics) { if (axis.user_specified_tic_labels != NULL) { if (_typeof(axis.user_specified_tic_labels) == String_Type) return axis.user_specified_tic_labels; tics = axis.user_specified_tic_labels; } variable format = axis.tic_label_format; variable fixed_format = (format != NULL); variable i, j, alt_fmt = NULL; variable tic_labels; variable a, b; if (axis.islog > 0) { if (format == NULL) { format = `$\text{10}^\text{%g}$`; alt_fmt = "%.5g"; } variable log10_tics = log10 (tics); variable frac, whole; variable is_frac = fneqs (log10_tics, nint(log10_tics)); frac = where (is_frac, &whole); tic_labels = String_Type[length(tics)]; tic_labels[whole] = array_map (String_Type, &sprintf, format, log10_tics[whole]); variable is_small = (0.01 <= tics < 99999.5); ifnot (fixed_format) { if (all(is_small)) tic_labels = array_map (String_Type, &sprintf, alt_fmt, tics); else { i = where (is_small and not is_frac); tic_labels[i] = array_map (String_Type, &sprintf, alt_fmt, tics[i]); if ((length(whole) <= 1) && any(is_frac)) { i = where (is_small and is_frac); tic_labels[i] = array_map (String_Type, &sprintf, alt_fmt, tics[i]); i = where (is_frac and (not is_small)); tic_labels[i] = format_labels_using_scientific_notation (tics[i]); } } } } else { if (format == NULL) format = "%.5g"; tic_labels = array_map (String_Type, &sprintf, format, tics); ifnot (fixed_format) { variable abs_tics = abs(tics); % 1.5e-4 = 0.00015 % = 1.5*10-4 % > 0.00001 i = where (((abs_tics > 0) and (abs_tics < 1e-4)) or (abs_tics >= 99999.5)); if (length(i)) { % FIXME: This should be configurable!!! i = where (abs_tics>0); tic_labels[i] = format_labels_using_scientific_notation (tics[i]); } } } return tic_labels; } %}}} private define position_tic_label_objects (axis, tic_pos, tic_label_objects) %{{{ { ifnot (axis.draw_tic_labels) return; variable X = axis.X, dX = axis.dX; variable xmin = double(axis.xmin); variable xmax = double(axis.xmax); variable f = axis.wcs_transform.wcs_func; variable cd = axis.wcs_transform.client_data; variable t0 = (@f)(double(xmin), cd); variable t1 = (@f)(double(xmax), cd); variable dt = t1 - t0; variable Xmax = vector_sum (X, dX); _for (0, length(tic_label_objects)-1, 1) { variable i = (); variable x = tic_pos[i]; x = ((@f)(double(x), cd) - t0)/dt; variable X0 = vector_sum (X, vector_mul(x, dX)); xfig_justify_object (tic_label_objects[i], X0 + axis.tic_labels_tweak, axis.tic_labels_just); ifnot (axis.tic_labels_confine) continue; % else % confine tic label objects to size of plot box in order to prevent overlaps if (dX.x != 0) { % x tic variable x0, x1, dx = 0; (x0,x1,,,,) = tic_label_objects[i].get_bbox(); if (x1 > Xmax.x) dx = Xmax.x - x1; if (x0 < X.x) dx = X.x - x0; if (dx != 0) tic_label_objects[i].translate (vector (dx,0,0)); } if (dX.y != 0) { % y tic variable y0, y1, dy = 0; (,,y0,y1,,) = tic_label_objects[i].get_bbox(); if (y1 > Xmax.y) dy = Xmax.y - y1; if (y0 < X.y) dy = X.y - y0; if (dy != 0) tic_label_objects[i].translate (vector (0,dy,0)); } } % Convert the tic labels to a compound object for ease of manipulation variable compound = xfig_new_compound_list (); foreach (axis.tic_label_objects) { variable label = (); compound.insert(label); } axis.tic_label_objects = compound; } %}}} private define make_tic_label_objects (axis, tic_labels_just, tweakx, tweaky) %{{{ { variable major_tics = axis.major_tics; variable tics = major_tics; variable max_tic_h = 0, max_tic_w = 0; variable num_tics = length (tics); if ((tics == NULL) || (num_tics == 0) || (axis.draw_tic_labels == 0)) { axis.tic_label_objects = NULL; return; } if (axis.islog && (1 <= num_tics <= 2)) { variable major_tic = major_tics[0]; variable new_tics = [major_tic/5.0,major_tic/2.0, major_tic*2.0,major_tic*5.0]; if (num_tics == 2) { major_tic = major_tics[1]; new_tics = [new_tics, major_tic*2,major_tic*5]; } new_tics = new_tics[where (axis.xmin <= new_tics <= axis.xmax)]; tics = [tics, new_tics]; } variable tic_label_strings = construct_tic_label_strings (axis, tics); variable i = wherenot (_isnull (tic_label_strings)); tic_label_strings = tic_label_strings[i]; tics = tics[i]; variable tic_label_objects = array_map (Struct_Type, &xfig_new_text, tic_label_strings, axis.tic_labels_font_struct); variable tic_labels_dX = Struct_Type[length(tic_label_objects)]; foreach (tic_label_objects) { variable obj = (); variable w, h; (w,h) = obj.get_pict_bbox (); if (max_tic_w < w) max_tic_w = w; if (max_tic_h < h) max_tic_h = h; } axis.max_tic_h = max_tic_h + 2*abs(tweaky); axis.max_tic_w = max_tic_w + 2*abs(tweakx); axis.tic_labels_tweak = vector (tweakx, tweaky, 0); axis.tic_labels_just = tic_labels_just; axis.tic_label_objects = tic_label_objects; axis.tic_label_strings = tic_label_strings; position_tic_label_objects (axis, tics, tic_label_objects); } %}}} private define make_major_minor_tic_positions (axis, major_tics, minor_tics) %{{{ { variable xmin = axis.xmin; variable xmax = axis.xmax; if (xmax < xmin) (xmin, xmax) = (xmax, xmin); if (major_tics == NULL) major_tics = axis.user_specified_major_tics; if (minor_tics == NULL) minor_tics = axis.user_specified_minor_tics; if (major_tics == NULL) { (major_tics, minor_tics) = wcs_compute_major_minor_tics (axis.wcs_transform, xmin, xmax, axis.maxtics); } variable i, j; if (major_tics != NULL) { i = where (xmin <= major_tics <= xmax); axis.major_tics = major_tics[i]; if (axis.user_specified_tic_labels != NULL) axis.user_specified_tic_labels = axis.user_specified_tic_labels[i]; if (axis.user_specified_major_tics != NULL) axis.user_specified_major_tics = axis.user_specified_major_tics[i]; if (minor_tics != NULL) minor_tics = minor_tics[where (xmin <= minor_tics <= xmax)]; axis.minor_tics = minor_tics; if ((length(major_tics) > 1) || ((length(major_tics) > 0) && (axis.user_specified_major_tics != NULL))) return; major_tics = NULL; minor_tics = NULL; } variable islog = axis.islog; variable num_minor, num_major; if (islog) { (xmin, xmax) = check_xmin_xmax_for_log (xmin, xmax); } (major_tics, num_minor) = get_major_tics (xmin, xmax, islog, axis.maxtics); if (islog) { num_major = length (where (log10(xmin) <= major_tics <= log10(xmax))); #ifnfalse if ((num_major <= 1) %&& (0.001 <= xmin <= xmax <= 100.0) ) { % 0 or 1 major tic. Format as non-log (linear) variable maxtics = (2*axis.maxtics)/3; if (xmax >= 15.0 * xmin) { (major_tics, minor_tics) = generic_compute_tics (WCS_Transforms["log"], xmin, xmax, axis.maxtics); num_minor = (minor_tics == NULL) ? 0 : length (minor_tics); } else (major_tics, num_minor) = get_major_tics (xmin, xmax, 0, maxtics); axis.islog = -1; islog = 0; } #endif } variable major_tic_interval = major_tics[1] - major_tics[0]; variable minor_tic_interval; j = [1:num_minor]; i = j-1; if (islog && (num_minor == 0)) { num_minor = 8; i = [0:num_minor-1]; j = log10 ([2:9]); % log10([2:9]) minor_tic_interval = 1.0; } else minor_tic_interval = major_tic_interval/(num_minor+1.0); minor_tics = Double_Type[num_minor*length(major_tics)]; if (num_minor) foreach (major_tics) { variable major_tic = (); minor_tics[i] = major_tic + j*minor_tic_interval; i += num_minor; } if (islog) { minor_tics = 10.0^minor_tics; major_tics = 10.0^major_tics; } axis.major_tics = major_tics[where ((major_tics >= xmin) and (major_tics <= xmax))]; axis.minor_tics = minor_tics[where ((minor_tics >= xmin) and (minor_tics <= xmax))]; } %}}} private define setup_axis_tics (p, axis) %{{{ { variable geom = axis.geom; make_tic_label_objects (axis, axis.tic_labels_just, geom.tic_tweak_x, geom.tic_tweak_y); %make_tic_marks_and_tic_labels (axis); make_tic_marks (axis); } %}}} private define position_axis_label (axis) %{{{ { if (axis.axis_label == NULL) return; variable geom = axis.geom; variable X = 0.5 * (2*axis.X + axis.dX); X += vector (geom.tx*axis.max_tic_w, geom.ty*axis.max_tic_h, 0); xfig_justify_object (axis.axis_label, X, axis.tic_labels_just); } %}}} private define add_axis_label (p, axis, label) %{{{ { if (label == NULL) { axis.axis_label = NULL; return; } axis.axis_label = xfig_new_text (label ;; __qualifiers); % Whenever a new (y-)axis label is added, it has to be rotated. variable theta = axis.geom.theta; if (theta != 0) axis.axis_label.rotate_pict (theta); position_axis_label (axis); } %}}} private define add_axis (p, axis, wcs_type, major_tics, minor_tics) %{{{ { if (wcs_type != NULL) setup_axis_wcs (axis, wcs_type); make_major_minor_tic_positions (axis, major_tics, minor_tics); setup_axis_tics (p, axis); position_axis_label (axis); axis.needs_setup = 0; } %}}} private define get_axis_objects (axis) %{{{ { if (axis == NULL) return {}; variable objects = { axis.line, axis.major_tic_marks, axis.tic_label_objects, axis.minor_tic_marks, axis.axis_label, }; return objects [wherenot (_isnull(list_to_array(objects, Struct_Type)))]; } %}}} private define plot_translate (p, X) %{{{ { p = p.plot_data; p.X = vector_sum (p.X, X); variable axis, object; foreach axis ([p.x1axis, p.x2axis, p.y1axis, p.y2axis]) { axis.X = vector_sum (axis.X, X); foreach object (get_axis_objects (axis)) object.translate (X); } p.object_list.translate(X); if (p.title_object != NULL) p.title_object.translate(X); } private define rotate_axis (axis, normal, theta) { axis.X = vector_rotate (axis.X, normal, theta); variable object; foreach object (get_axis_objects (axis)) object.rotate (normal, theta); } %}}} private define plot_rotate (p, normal, theta) %{{{ { p = p.plot_data; p.X = vector_rotate (p.X, normal, theta); rotate_axis (p.x1axis, normal, theta); rotate_axis (p.x2axis, normal, theta); rotate_axis (p.y1axis, normal, theta); rotate_axis (p.y2axis, normal, theta); p.object_list.rotate(normal, theta); if (p.title_object != NULL) p.title_object.rotate(normal, theta); } %}}} private define plot_scale () %{{{ { if (_xfig_check_help (_NARGS, ".scale";; __qualifiers)) return; variable p, sx, sy, sz; (p, sx, sy, sz) = _xfig_get_scale_args (_NARGS); p = p.plot_data; variable X = p.X; X.x *= sx, X.y *= sy, X.z *= sz; p.plot_width *= sx; p.plot_height *= sy; variable axis, object; foreach axis ([p.x1axis, p.y1axis, p.x2axis, p.y2axis]) { foreach X ([axis.X, axis.dX]) X.x *= sx, X.y *= sy, X.z *= sz; foreach object (get_axis_objects (axis)) object.scale (sx, sy, sz); axis.max_tic_w *= sx; axis.max_tic_h *= sy; } foreach object ([p.object_list, p.title_object, p.legend]) if(object != NULL) object.scale (sx, sy, sz); } %}}} private define plot_set_attr (p, attr, val) { } private define merge_bbox (bbox1, bbox2) %{{{ { if (bbox1 == NULL) return bbox2; if (bbox2 == NULL) return bbox1; variable bbox = _max(bbox1, bbox2); bbox[[::2]] = _min(bbox1, bbox2)[[::2]]; return bbox; } %}}} private define get_list_bbox (list) %{{{ { variable bbox = NULL; foreach (list) { variable object = (); if (object == NULL) continue; bbox = merge_bbox (bbox, [object.get_bbox ()]); } return bbox; } %}}} private define get_axis_bbox (axis) %{{{ { variable X0 = axis.X, X1 = X0+axis.dX; variable bbox = [_min(X0.x,X1.x), _max(X0.x,X1.x), _min(X0.y,X1.y), _max(X0.y,X1.y), _min(X0.z,X1.z), _max(X0.z,X1.z)]; return merge_bbox (bbox, get_list_bbox (get_axis_objects(axis))); } %}}} private define plot_get_bbox (p) %{{{ { p = p.plot_data; variable xmin, xmax, ymin, ymax, zmin, zmax; variable x0, x1, y0, y1, z0, z1; variable bbox = get_axis_bbox (p.x1axis); bbox = merge_bbox (bbox, get_axis_bbox (p.x2axis)); bbox = merge_bbox (bbox, get_axis_bbox (p.y1axis)); bbox = merge_bbox (bbox, get_axis_bbox (p.y2axis)); foreach ({p.object_list, {p.title_object}}) { variable objects = (); foreach (objects) { variable o = (); if (o == NULL) continue; bbox = merge_bbox (bbox, [o.get_bbox ()]); } } return bbox[0], bbox[1], bbox[2], bbox[3], bbox[4], bbox[5]; } %}}} private define plot_render (p, fp) %{{{ { p = p.plot_data; p.object_list.render (fp;; __qualifiers); if (p.title_object != NULL) p.title_object.render (fp;; __qualifiers); % It looks better when the axes are rendered after the plot object variable axis, object; foreach axis ([p.x1axis, p.y1axis, p.x2axis, p.y2axis]) foreach object (get_axis_objects (axis)) object.render (fp;; __qualifiers); } %}}} % Axes Geometries %{{{ private variable X1_Axis_Geom = struct { ticofs_x = 0.0, ticofs_y = 0.5, tic_tweak_x = 0.0, tic_tweak_y = -0.1, tx = 0.0, ty = -1.0, theta = 0.0 }; private variable X2_Axis_Geom = struct { ticofs_x = 0.0, ticofs_y = -0.5, tic_tweak_x = 0.0, tic_tweak_y = 0.1, tx = 0.1, ty = 1.0, theta = 0.0 }; private variable Y1_Axis_Geom = struct { ticofs_x = 0.5, ticofs_y = 0.0, tic_tweak_x = -0.1, tic_tweak_y = 0.0, tx = -1.0, ty = 0.0, theta = 90.0 }; private variable Y2_Axis_Geom = struct { ticofs_x = -0.5, ticofs_y = 0.0, tic_tweak_x = 0.1, tic_tweak_y = 0.0, tx = 1.0, ty = 0.0, theta = -90.0 }; %}}} private define allocate_axis_type (len, maxtics, has_tic_labels, xpos, ypos, dirx, diry, ticdirx, ticdiry, geom) %{{{ { variable a = @Plot_Axis_Type; setup_axis_wcs (a, "linear"); a.maxtics = maxtics; a.X = vector (xpos, ypos, 0); a.dX = vector (dirx*len, diry*len, 0); a.dY = vector (ticdirx, ticdiry,0); a.geom = geom; a.tic_labels_just = vector (geom.ticofs_x, geom.ticofs_y, 0); a.draw_tic_labels = has_tic_labels; a.tic_labels_font_struct = xfig_make_font (qualifier ("ticlabel_style"), qualifier ("ticlabel_size"), qualifier ("ticlabel_color")); return a; } %}}} private define get_log_qualifier (name) %{{{ { if (0 == qualifier_exists (name)) return 0; variable q = qualifier (name); if (q == NULL) return 1; return q; } %}}} private define get_log_qualifiers () %{{{ { return (get_log_qualifier ("xlog" ;; __qualifiers) || get_log_qualifier ("logx" ;; __qualifiers) || qualifier_exists ("loglog") , get_log_qualifier ("ylog" ;; __qualifiers) || get_log_qualifier ("logy" ;; __qualifiers) || qualifier_exists ("loglog")); } %}}} private define get_reftype_qualifier (name, defval) %{{{ { variable val = qualifier (name, defval); if (typeof (val) == Ref_Type) { if (not __is_initialized (val) || (@val == NULL)) @val = defval; val = @val; } if (val == NULL) val = defval; return val; } %}}} private define do_axis_method (name, grid_axis) %{{{ %!%+ %\function{xfig_plot.axis} %\usage{xfig_plot.axis([; qualifiers]);} %\qualifiers %\qualifier{on}{draw axis, major and minor tic marks, as well as tic labels}{on} %\qualifier{off}{do not draw axis, major nor minor tic marks, nor tic labels} %\qualifier{linear}{set linear axis scale} %\qualifier{log}{set logarithmic axis scale} %\qualifier{major}{draw major tic marks [precedence over on/off] or array of major tic mark values} %\qualifier{minor}{draw minor tic marks [precedence over on/off] or array of minor tic mark values} %\qualifier{color}{color of axis, major and minor tic marks} %\qualifier{major_color}{color of major tic marks [precedence over color]} %\qualifier{minor_color}{color of minor tic marks [precedence over color]} %\qualifier{width}{width of axis, major and minor tic marks} %\qualifier{major_width}{width of major tic marks [precedence over width]} %\qualifier{minor_width}{width of minor tic marks [precedence over width]} %\qualifier{line}{line style of axis, major and minor tic marks} %\qualifier{major_line}{line style of major tic marks [precedence over line]} %\qualifier{minor_line}{line style of minor tic marks [precedence over line]} %\qualifier{major_len}{length of the major tic marks} %\qualifier{minor_len}{length of the minor tic marks} %\qualifier{grid}{extend major and minor tic marks to a grid} %\qualifier{major_grid}{extend major tic marks to a grid [precedence over grid]} %\qualifier{minor_grid}{extend minor tic marks to a grid [precedence over grid]} %\qualifier{depth}{Xfig depth of the axis} %\qualifier{tic_depth}{Xfig depth of the ticmarks} %\qualifier{maxtics}{ maximum number of major tic marks} %\qualifier{ticlabels}{draw tic labels (requires major tic marks)} %\qualifier{ticlabels_confine}{prevent tic labels from overhanging the plot box} %\qualifier{ticlabel_style}{tic label font style, see \sfun{xfig_make_font}} %\qualifier{ticlabel_color}{tic label font color, see \sfun{xfig_make_font}} %\qualifier{ticlabel_size}{tic label font size, see \sfun{xfig_make_font}} %\qualifier{format}{tic label format string in `sprintf' style} %\qualifier{wcs}{name of a custom world coordinate system transformation} %\description % All axes can be configured with the qualifiers mentioned above. %\seealso{xfig_plot.xaxis, xfig_plot.x1axis, xfig_plot.x2axis, xfig_plot.yaxis, xfig_plot.y1axis, xfig_plot.y2axis} %!%- { variable p; switch (_NARGS-2) { case 1: p = (); } { _pop_n (_NARGS-2); usage (".axis ( [;qualifiers] )\n", + "Qualifiers:\n", + " off, on, color=val, line=val, major=array, minor=array,\n" + " width=val, depth=val, ticlabels=0|1|Array_Type, maxtics=val\n" + " wcs=val, lin, log, format=fmt\n" ); } p = p.plot_data; variable axis = get_struct_field (p, name); variable q = not qualifier_exists("off"); if (qualifier_exists("on")) q = 1; axis.draw_major_tics = q; axis.draw_line = q; axis.draw_minor_tics = q; axis.draw_tic_labels = q; variable minor_tics = NULL; q = qualifier ("minor"); if (typeof (q) == Int_Type) axis.draw_minor_tics = q; else { minor_tics = q; if (minor_tics != NULL) axis.user_specified_minor_tics = minor_tics; } variable major_tics = NULL; q = qualifier ("major"); if (typeof (q) == Int_Type) axis.draw_major_tics = q; else { major_tics = q; if (major_tics != NULL) axis.user_specified_major_tics = major_tics; } q = qualifier ("color"); if (q != NULL) { axis.axis_color = q; axis.major_tic_color = q; axis.minor_tic_color = q; } axis.major_tic_color = qualifier ("major_color", axis.major_tic_color); axis.minor_tic_color = qualifier ("minor_color", axis.major_tic_color); q = qualifier ("width"); if (q != NULL) { axis.axis_thickness = q; axis.major_tic_thickness = q; axis.minor_tic_thickness = q; } axis.minor_tic_thickness = qualifier ("minor_width", axis.minor_tic_thickness); axis.major_tic_thickness = qualifier ("major_width", axis.major_tic_thickness); q = qualifier ("line"); if (q != NULL) { axis.axis_linestyle = q; axis.major_tic_linestyle = q; axis.minor_tic_linestyle = q; } if (grid_axis) { axis.major_tic_linestyle = qualifier ("major_line", axis.major_tic_linestyle); axis.minor_tic_linestyle = qualifier ("minor_line", axis.minor_tic_linestyle); } axis.major_tic_len = qualifier ("major_len", axis.major_tic_len); axis.minor_tic_len = qualifier ("minor_len", axis.minor_tic_len); axis.axis_depth = get_reftype_qualifier ("depth", axis.axis_depth;;__qualifiers); axis.tic_depth = get_reftype_qualifier ("tic_depth", axis.tic_depth;;__qualifiers); axis.maxtics = qualifier ("maxtics", axis.maxtics); variable ticlabel_color = NULL, ticlabel_size = NULL, ticlabel_style = NULL; variable fs = axis.tic_labels_font_struct; fs.style = qualifier ("ticlabel_style", fs.style); fs.size = qualifier ("ticlabel_size", fs.size); fs.color = qualifier ("ticlabel_color", fs.color); % .islog already has a default value. Don't muck with it unless % requested. if (qualifier_exists ("linear")) axis.islog = 0; if (qualifier_exists ("log")) axis.islog = get_log_qualifier ("log";;__qualifiers); if (qualifier_exists ("format")) axis.tic_label_format = qualifier ("format"); q = qualifier ("ticlabels"); if (typeof (q) == Int_Type) { axis.draw_tic_labels = q; axis.user_specified_tic_labels = NULL; } else if ((typeof (q) == Array_Type) && ((_typeof(q) == String_Type) || __is_numeric(q))) { if (major_tics == NULL) message("warning: user specified ticlabels, but no major ticmarks (=> ignoring ticlabels)"); else if (length(major_tics) != length(q)) vmessage("warning: user specified %d major ticmarks, but %d ticlabels (=> ignoring ticlabels)", length(major_tics), length(q)); else axis.user_specified_tic_labels = q; } if (axis.draw_major_tics == 0) axis.draw_tic_labels = 0; if (grid_axis) { variable len = p.plot_height; if (grid_axis == 2) len = p.plot_width; q = qualifier ("grid"); if (q == 1) { axis.major_tic_len = len; axis.minor_tic_len = len; } q = qualifier ("major_grid", qualifier("majorgrid")); if (q == 1) axis.major_tic_len = len; q = qualifier ("minor_grid", qualifier("minorgrid")); if (q == 1) axis.minor_tic_len = len; } variable wcs = qualifier ("wcs"); if ((wcs == NULL) && ((axis.wcs_transform == NULL) || (axis.islog))) { wcs = "linear"; if (axis.islog) wcs = "log"; } axis.inited = 1; axis.tic_labels_confine = qualifier("ticlabels_confine", name[0]=='y'); add_axis (p, axis, wcs, major_tics, minor_tics); } %}}} private define xaxis_method () %{{{ %!%+ %\function{xfig_plot.xaxis} %\usage{xfig_plot.xaxis([; qualifiers]);} %\qualifiers %\qualifier{ticlabels1}{overwrites the \exmp{ticlabels} qualifier for the x1axis} %\qualifier{ticlabels2}{overwrites the \exmp{ticlabels} qualifier for the x2axis} %\description % This method allows for the configuration of both x-axes % via qualifiers -- see \sfun{xfig_plot.axis} for further information. %\seealso{xfig_plot.axis} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.xaxis";; __qualifiers)) return; variable args = __pop_args (_NARGS); variable q = __qualifiers; if(qualifier_exists ("ticlabels1")) q = struct { @q, ticlabels=qualifier("ticlabels1") }; do_axis_method (__push_args (args), "x1axis", 1;; q); q = __qualifiers; if(qualifier_exists ("ticlabels2")) q = struct { @q, ticlabels=qualifier("ticlabels2") }; do_axis_method (__push_args (args), "x2axis", 0;; q); } %}}} private define yaxis_method () %{{{ %!%+ %\function{xfig_plot.yaxis} %\usage{xfig_plot.yaxis([; qualifiers]);} %\qualifiers %\qualifier{ticlabels1}{overwrites the \exmp{ticlabels} qualifier for the y1axis} %\qualifier{ticlabels2}{overwrites the \exmp{ticlabels} qualifier for the y2axis} %\description % This method allows for the configuration of both y-axes % via qualifiers -- see \sfun{xfig_plot.axis} for further information. %\seealso{xfig_plot.axis} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.yaxis";; __qualifiers)) return; variable args = __pop_args (_NARGS); variable q = __qualifiers; if(qualifier_exists ("ticlabels1")) q = struct { @q, ticlabels=qualifier("ticlabels1") }; do_axis_method (__push_args (args), "y1axis", 2;; q); q = __qualifiers; if(qualifier_exists ("ticlabels2")) q = struct { @q, ticlabels=qualifier("ticlabels2") }; do_axis_method (__push_args (args), "y2axis", 0;; q); } %}}} private define x1axis_method () %{{{ %!%+ %\function{xfig_plot.x1axis} %\usage{xfig_plot.x1axis([; qualifiers]);} %\description % This method allows for the configuration of the first x-axis % via qualifiers -- see \sfun{xfig_plot.axis} for further information. %\seealso{xfig_plot.axis} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.x1axis";; __qualifiers)) return; variable args = __pop_args (_NARGS); do_axis_method (__push_args (args), "x1axis", 1 ;; __qualifiers); } %}}} private define x2axis_method () %{{{ %!%+ %\function{xfig_plot.x2axis} %\usage{xfig_plot.x2axis([; qualifiers]);} %\description % This method allows for the configuration of the second x-axis % via qualifiers -- see \sfun{xfig_plot.axis} for further information. %\seealso{xfig_plot.axis} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.x2axis";; __qualifiers)) return; variable args = __pop_args (_NARGS); do_axis_method (__push_args (args), "x2axis", 1 ;; __qualifiers); } %}}} private define y1axis_method () %{{{ %!%+ %\function{xfig_plot.y1axis} %\usage{xfig_plot.y1axis([; qualifiers]);} %\description % This method allows for the configuration of the first y-axis % via qualifiers -- see \sfun{xfig_plot.axis} for further information. %\seealso{xfig_plot.axis} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.y1axis";; __qualifiers)) return; variable args = __pop_args (_NARGS); do_axis_method (__push_args (args), "y1axis", 2 ;; __qualifiers); } %}}} private define y2axis_method () %{{{ %!%+ %\function{xfig_plot.y2axis} %\usage{xfig_plot.y2axis([; qualifiers]);} %\description % This method allows for the configuration of the second y-axis % via qualifiers -- see \sfun{xfig_plot.axis} for further information. %\seealso{xfig_plot.axis} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.y2axis";; __qualifiers)) return; variable args = __pop_args (_NARGS); do_axis_method (__push_args (args), "y2axis", 2 ;; __qualifiers); } %}}} private define axis_method () %{{{ { if (_xfig_check_help (_NARGS, "xfig_plot.axis";; __qualifiers)) return; variable args = __pop_args (_NARGS); xaxis_method (__push_args (args);; __qualifiers); yaxis_method (__push_args (args);; __qualifiers); } %}}} private define get_world_min_max (axis, x0, x1, islog, pad) %{{{ { x0 *= 1.0; x1 *= 1.0; % convert ints if (isnan (x0) || isnan (x1) || isinf (x0) || isinf (x1)) { () = fprintf (stderr, "xfig_plot_define_world: Axis limits must be finite.\n"); return 0.1, 1.0; } % Do not make this tolerance too large-- the user may define custom % tic labels. For examples, minutes given a set of time_t values. if (feqs (x0, x1, 2e-15)) { x1 *= (x1 >= 0) ? 1.01 : 0.99; x0 *= (x0 >= 0) ? 0.99 : 1.01; () = fprintf (stderr, "xfig_plot_define_world: world limits are too small--tweaking: x0=%g x1=%g\n", x0, x1); } if (x0 == x1) { () = fprintf (stderr, "xfig_plot_define_world: invalid world limits: x0=x1=%g\n", x0); x0 -= 0.01; x1 += 0.01; if (x0 == x1) { () = fprintf (stderr, "xfig_plot_define_world: invalid world limits: x0=x1=%g\n", x0); x0 = 0.0; x1 = 1.0; } } if (islog) (x0, x1) = check_xmin_xmax_for_log (x0, x1); if (pad == 0.0) return x0, x1; variable save_x0 = x0; variable save_x1 = x1; if (islog) { x0 = log10 (x0); x1 = log10 (x1); } variable dx = pad*(x1 - x0); x0 -= dx; x1 += dx; if (islog) { x0 = 10^x0; x1 = 10^x1; if (x0 == 0) x0 = save_x0; if (isinf(x1)) x1 = save_x1; } variable wcs = axis.wcs_transform; if (x0 < wcs.xmin) x0 = wcs.xmin; if (x1 > wcs.xmax) x1 = wcs.xmax; return x0, x1; } %}}} private define do_world_method (nth, nargs) %{{{ { variable xdata, ydata; variable w, x0, x1, y0, y1; variable pad = 0.0; switch (nargs) { case 3: (w, xdata, ydata) = (); x0 = NULL; pad = 0.05; } { case 5: (w, x0, x1, y0, y1) = (); } { usage (".world ([x0, x1], [y0, y1] ; xlog, ylog, loglog)"); } variable p = w.plot_data; variable xaxis = get_struct_field (p, "x${nth}axis"$); variable yaxis = get_struct_field (p, "y${nth}axis"$); variable xlog, ylog; (xlog, ylog) = get_log_qualifiers (;;__qualifiers); xlog = xlog || xaxis.islog; ylog = ylog || yaxis.islog; if (x0 == NULL) { if (xlog) xdata = xdata[where (xdata>0)]; if (ylog) ydata = ydata[where (ydata>0)]; xdata = xdata [wherenot (isnan(xdata) or isinf(xdata))]; ydata = ydata [wherenot (isnan(ydata) or isinf(ydata))]; (x0, x1) = (min(xdata), max(xdata)); (y0, y1) = (min(ydata), max(ydata)); } (x0, x1) = get_world_min_max (xaxis, x0, x1, xlog, qualifier ("padx", pad)); (y0, y1) = get_world_min_max (yaxis, y0, y1, ylog, qualifier ("pady", pad)); xaxis.xmin = double(x0); xaxis.xmax = double(x1); xaxis.islog = xlog; yaxis.xmin = double(y0); yaxis.xmax = double(y1); yaxis.islog = ylog; yaxis.needs_setup = 1; xaxis.needs_setup = 1; set_struct_field (p, "world${nth}_inited"$, 1); } %}}} private define world1_method () %{{{ %!%+ %\function{xfig_plot.world1} %\synopsis{define a plot's first world coordinate system} %\seealso{xfig_plot.world} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.world1";; __qualifiers)) return; return do_world_method (1, _NARGS ;; __qualifiers); } %}}} % This function is not to be called implictly. Use do_world_method % instead. private define world2_method () %{{{ %!%+ %\function{xfig_plot.world2} %\synopsis{define a plot's second world coordinate system} %\qualifiers %\qualifier{xticlabels}{flag whether (1) or not (0) to draw ticlabels on x2axis}{1} %\qualifier{yticlabels}{flag whether (1) or not (0) to draw ticlabels on y2axis}{1} %\seealso{xfig_plot.world} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.world2";; __qualifiers)) return; variable w, args; args = __pop_args (_NARGS-1); w = (); w.plot_data.x2axis.draw_tic_labels = qualifier("xticlabels", 1); w.plot_data.y2axis.draw_tic_labels = qualifier("yticlabels", 1); return do_world_method (w, __push_args(args), 2, _NARGS ;; __qualifiers); } %}}} private define world_method () %{{{ %!%+ %\function{xfig_plot.world} %\synopsis{define a plot's world coordinate system} %\usage{xfig_plot.world (Double_Type xdata[], ydata[]); %\altusage{xfig_plot.world (Double_Type x0, x1, y0, y1);} %} %\qualifiers %\qualifier{xlog}{use a logarithmic x-axis} %\qualifier{ylog}{use a logarithmic y-axis} %\qualifier{loglog}{use logarithmic axes} %\qualifier{padx}{fraction of xrange to be padded on both sides}{0.05 or 0} %\qualifier{pady}{fraction of yrange to be padded on both sides}{0.05 or 0} %#c \description %\seealso{xfig_plot.world1, xfig_plot.world2} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.world";; __qualifiers)) return; variable args = __pop_args (_NARGS); do_world_method (__push_args (args), 1, _NARGS ;; __qualifiers); do_world_method (__push_args (args), 2, _NARGS ;; __qualifiers); } %}}} private define get_world_axes (p) %{{{ %!%+ %\function{xfig_plot--wcs} %\synopsis{Qualifiers to specify a plot's world coordinate system} %\qualifiers %\qualifier{world0}{use device coordinates for x- and y-axes} %\qualifier{world1}{use first coordinate system for x- and y-axes} %\qualifier{world2}{use second coordinate system for x- and y-axes} %\qualifier{world{a}{b}}{use a-th WCS for x-axis and b-th WCS for y-axis, where 0 <= a, b <= 2} %\description % If none of these qualifiers is specified, world1 is assumed. % % Device coordinates (0th WCS) run from 0 to 1 along the corresponding axis. % % The first or second coordinate system (1st or 2nd WCS) can be defined % with the .world(1) or .world(2) methods. (If not set before, they are % set automatically by some plot functions, see \sfun{xfig_plot--initialize_plot}.) % % The WCS qualifiers apply to the following functions: % \sfun{xfig_plot.plot}, \sfun{xfig_plot.hplot}, \sfun{xfig_plot.shade_region}, % \sfun{xfig_plot.add_object}, \sfun{xfig_plot.xylabel}, % \sfun{xfig_plot.get_world}, \sfun{xfig_plot.xfig_coords} %\seealso{xfig_plot.world, xfig_plot.world1, xfig_plot.world2, xfig_plot--initialize_plot} %!%- { variable x_axes = [NULL, p.x1axis, p.x2axis]; variable y_axes = [NULL, p.y1axis, p.y2axis]; variable a = 0; loop (3) { variable b = 0; loop (3) { if (qualifier_exists ("world${a}${b}"$)) return x_axes[a], y_axes[b]; b++; } if (qualifier_exists ("world${a}"$)) return x_axes[a], y_axes[a]; a++; } return p.x1axis, p.y1axis; } %}}} private define get_world_for_axis (a) %{{{ { if (a == NULL) return (0.0, 1.0); variable x0 = a.xmin, x1 = a.xmax; variable wcs = a.wcs_transform; if ((wcs.xmin != NULL) && (x0 < wcs.xmin)) x0 = wcs.xmin; if ((wcs.xmax != NULL) && (x1 > wcs.xmax)) x1 = wcs.xmax; return (x0, x1); } %}}} private define scale_coords_for_axis (axis, axis_len, x) %{{{ { return (axis == NULL ? double(x) % device coordinate; x runs from 0 to 1 : world_to_normalized (axis.wcs_transform, x, get_world_for_axis (axis)) ) * axis_len; } %}}} private define xfig_coords_method() %{{{ %!%+ %\function{xfig_plot.xfig_coords} %\usage{(Double_Type xXfig, yXfig) = xfig_plot.xfig_coords (Double_Type x, y); %\altusage{Double_Type xXfig = xfig_plot.xfig_coords (Double_Type x, );} %\altusage{Double_Type yXfig = xfig_plot.xfig_coords (, Double_Type y);} %} %\qualifiers % % qualifiers to specify the world coordinate system, %\seealso{xfig_plot--wcs} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.xfig_coords";; __qualifiers)) return; variable p, x, y; (p, x, y) = (); p = p.plot_data; variable ax, ay; (ax, ay) = get_world_axes (p;; __qualifiers); if(x!=NULL) p.X.x + scale_coords_for_axis (ax, p.plot_width, x); % left on stack if(y!=NULL) p.X.y + scale_coords_for_axis (ay, p.plot_height, y); % left on stack } %}}} private define make_nsided_polygon (n, x0, y0, radius) %{{{ { variable theta = [0:n]*(2*PI/n); theta = [theta, 0]; variable x = x0 + radius * cos (theta); variable y = y0 + radius * sin (theta); return x, y; } %}}} private define plot_lines (p, x, y) %{{{ { p = p.plot_data; variable ax, ay; (ax, ay) = get_world_axes (p ;; __qualifiers); variable w = p.plot_width, h = p.plot_height; if (length (x) < 2) return; x = scale_coords_for_axis (ax, w, x); y = scale_coords_for_axis (ay, h, y); variable bad = Int_Type [length(x)+1]; bad[-1] = 1; variable i = where (isnan (x) or isnan (y)); bad[i] = 1; variable depth = get_reftype_qualifier ("depth", p.line_depth;; __qualifiers); variable thickness = qualifier ("width", p.thickness); variable color = qualifier ("color", p.line_color); variable linestyle = qualifier ("line", p.line_style); variable forward_arrow = qualifier("forward_arrow"); if (qualifier_exists("forward_arrow") && forward_arrow==NULL) forward_arrow = xfig_create_arrow(;; __qualifiers); variable backward_arrow = qualifier("arrow"); if (qualifier_exists("backward_arrow") && backward_arrow==NULL) backward_arrow = xfig_create_arrow(;; __qualifiers); variable i0 = 0; variable list = xfig_new_polyline_list (); foreach (where (bad)) { i = (); if (i != i0) { variable ii = [i0:i-1]; variable lines = xfig_clip_polyline2d (x[ii], y[ii], 0, w, 0, h); lines.translate (p.X); lines.set_depth (depth); lines.set_thickness (thickness); lines.set_pen_color (color); lines.set_line_style (linestyle); lines.forward_arrow = forward_arrow; lines.backward_arrow = backward_arrow; p.object_list.insert(lines); } i0 = i+1; } } %}}} private define insert_errbar(err_axis, lines, const, err) %{{{ { lines.insert (vector (err_axis=="x" ? (err, const) : (const, err), [0., 0.])); } %}}} private define plot_err (p, err_axis, val_const, val_err, err) %{{{ %!%+ %\function{xfig_plot--errorbars} %\qualifiers %\qualifier{eb_line=intval}{line style for error bars}{\exmp{line} qualifier} %\qualifier{eb_color=intval}{color of error bars}{\exmp{color} qualifier} %\qualifier{eb_width=intval}{thickness of error bars}{\exmp{width} qualifier} %\qualifier{eb_depth=intval}{Xfig depth of error bars}{\exmp{depth} qualifier} %\qualifier{[x,y]eb_factor=intval}{terminal size of error bars}{0} %\qualifier{[x,y]min_max}{Asymmetric error bars are already min/max values.} %\description % Asymmetric error bars are specified as lists of negative and positive errors. % If the \exmp{min_max} qualifier (or the appropriate \exmp{{x,y}min_max} qualifier) is set, % then the elements of the list are considered as minimum and maximum values. %\example %#v+ % variable xfig_plot = xfig_plot_new(); % xfig_plot.world(0, 10, 0, 10); % xfig_plot.plot(1, 5, 1 ; sym="x"); % y = 5 (+-1) % xfig_plot.plot(3, 5, {2, 3}; sym="x"); % y = 5 (+3)(-2) % xfig_plot.plot(5, 5, {3, 8}; sym="x", minmax); % y = 5 [3...8] (same as above) % xfig_plot.plot(7, 5, {1, 2}, {3, 8}; sym="x", yminmax); % x = 8 (+1)(-2), but y = 5 [3...8] %#v- %\seealso{xfig_plot.plot, xfig_plot.hplot} %!%- { variable i, err_neg = err, err_pos = err; if (typeof (err) == List_Type) % asymmetric error bars { (err_neg, err_pos) = qualifier_exists ("minmax") || qualifier_exists (err_axis+"minmax") ? (val_err-err[0], err[1]-val_err) : (err[0], err[1]); i = wherenot (isnan(val_const) or isnan(val_err) or isnan(err_neg) or isnan(err_pos)); } else i = wherenot (isnan(val_const) or isnan(val_err) or isnan(err)); if (length (i) != length (val_const)) { val_const = val_const[i]; val_err = val_err [i]; if (typeof(err_neg) == Array_Type) err_neg = err_neg[i]; if (typeof(err_pos) == Array_Type) err_pos = err_pos[i]; } p = p.plot_data; get_world_axes (p ;; __qualifiers); % (ax, ay) left on stack if (err_axis=="x") _stk_roll(2); % (ay, ax) left on stack variable a_err=(), a_const=(); p.plot_width, p.plot_height; % (w, h) left on stack if (err_axis=="x") _stk_roll(2); % (h, w) left on stack variable len_err=(), len_const=(); val_const = scale_coords_for_axis (a_const, len_const, val_const); variable val_err0 = scale_coords_for_axis (a_err, len_err, val_err - err_neg); variable val_err1 = scale_coords_for_axis (a_err, len_err, val_err + err_pos); variable term_factor = qualifier (err_axis+"eb_factor", qualifier ("eb_factor", 0)); variable dt = abs (ERRBAR_TERMINAL_SIZE * term_factor); variable lines = xfig_new_polyline_list (); _for i (0, length (val_const)-1, 1) { variable const_i = val_const[i]; variable const0_i = const_i - dt; variable const1_i = const_i + dt; variable err0_i = val_err0[i]; variable err1_i = val_err1[i]; if ( const1_i <= 0 || const0_i >= len_const || err1_i <= 0 || err0_i >= len_err) continue; variable const_term = [_max (const0_i, 0), _min (const1_i, len_const)]; if (err1_i < len_err) { if (term_factor>0) insert_errbar(err_axis, lines, const_term, [err1_i, err1_i]); } else err1_i = len_err; if (err0_i > 0) { if (term_factor>0) insert_errbar(err_axis, lines, const_term, [err0_i, err0_i]); } else err0_i = 0; insert_errbar(err_axis, lines, [const_i, const_i], [err0_i, err1_i]); } lines.translate(p.X); variable depth = get_reftype_qualifier ("depth", p.line_depth;;__qualifiers); lines.set_depth ( get_reftype_qualifier ("eb_depth", depth;;__qualifiers)); lines.set_thickness ( qualifier ("eb_width", qualifier ("width", p.thickness )) ); lines.set_pen_color ( qualifier ("eb_color", qualifier ("color", p.line_color)) ); lines.set_line_style ( qualifier ("eb_line", p.line_style ) ); p.object_list.insert(lines); } %}}} %{{{ Routines that define and create the plot symbols private variable Make_Symbol_Funs = {}; define xfig_plot_add_symbol (name, fun) %{{{ %!%+ %\function{xfig_plot_add_symbol} %\synopsis{Add a plot symbol} %\usage{xfig_plot_add_symbol (String_Type name, Ref_Type funct)} %\description % This function may be used to add a new plot symbol of the specified name. % The \exmp{funct} parameter specifies a function to be called to create the % symbol. It will be called with a single parameter: a value representing the % scale size of the symbol in fig units. The function must return two arrays % representing the X and Y coordinates of the polygons that represent % the symbol. The center of the object is taken to be (0,0). If more than one % polygon is required to represent the object, an array of arrays may be % returned. %!%- { list_append (Make_Symbol_Funs, struct{name=name, fun=fun}); } %}}} define xfig_plot_get_symbol_names () %{{{ %!%+ %\function{xfig_plot_get_symbol_names} %\usage{String_Type[] xfig_plot_get_symbol_names ()} %\seealso{xfig_plot.plot} %!%- { variable num = length (Make_Symbol_Funs); variable names = String_Type[num]; _for (0, num-1, 1) { variable i = (); names[i] = Make_Symbol_Funs[i].name; } return names; } %}}} private define find_symbol (symp) %{{{ { variable sym = @symp; variable s; if (typeof (sym) != String_Type) { s = Make_Symbol_Funs[sym mod length(Make_Symbol_Funs)]; @symp = s.name; return s.fun; } foreach s (Make_Symbol_Funs) { if (s.name == sym) return s.fun; } return NULL; } %}}} private define make_circle (radius) %{{{ { variable point_size = xfig_scale_to_inches (radius) * 80.0; variable nsides; if (point_size == 0) nsides = 1; else if (point_size < 16) nsides = 4 + (point_size-1)*2; else nsides = 32; return make_nsided_polygon (nsides, 0, 0, radius); } %}}} private define make_point (radius) %{{{ { return make_circle (radius/6.0); } xfig_plot_add_symbol ("point", &make_point); %}}} private define make_triangle_up (radius) %{{{ { variable t = [-30, 90, 210, -30] * (PI/180.0); return radius * cos (t), radius * sin(t); } xfig_plot_add_symbol ("triangle", &make_triangle_up); %}}} private define make_square (radius) %{{{ { variable t = [-45, 45, 135, 225, -45] * (PI/180.0); return radius * cos (t), radius * sin(t); } xfig_plot_add_symbol ("square", &make_square); %}}} private define make_diamond (radius) %{{{ { variable t = [0, 90, 180, 270, 0] * (PI/180.0); return 0.5*radius * cos (t), radius * sin(t); } xfig_plot_add_symbol ("diamond", &make_diamond); %}}} private define make_plus (radius) %{{{ { variable x = Array_Type[2]; variable y = Array_Type[2]; x[0] = [-radius, radius]; y[0] = [0,0]; x[1] = [0, 0]; y[1] = [-radius, radius]; return x,y; } xfig_plot_add_symbol ("+", &make_plus); %}}} private define make_cross (radius) %{{{ { variable x = Array_Type[2]; variable y = Array_Type[2]; radius *= sqrt(0.5); x[0] = [-radius, radius]; y[0] = [-radius, radius]; x[1] = [-radius, radius]; y[1] = [radius, -radius]; return x,y; } xfig_plot_add_symbol ("x", &make_cross); %}}} private define make_asterisk (radius) %{{{ { variable x = Array_Type[3]; variable y = Array_Type[3]; variable r1 = radius * cos (PI/3); variable r2 = radius * cos (PI/6); x[0] = [-radius, radius]; y[0] = [0,0]; x[1] = [-r1, r1]; y[1] = [-r2, r2]; x[2] = [-r1, r1]; y[2] = [r2, -r2]; return x,y; } xfig_plot_add_symbol ("*", &make_asterisk); %}}} xfig_plot_add_symbol ("circle", &make_circle); private define make_triangle_down (radius) %{{{ { variable t = [30, 150, 270, 30] * (PI/180.0); return radius * cos (t), radius * sin(t); } xfig_plot_add_symbol ("triangle1", &make_triangle_down); %}}} private define make_triangle_left (radius) %{{{ { variable t = [60, 180, 300, 60] * (PI/180.0); return radius * cos (t), radius * sin(t); } xfig_plot_add_symbol ("triangle2", &make_triangle_left); %}}} private define make_triangle_right (radius) %{{{ { variable t = [0, 120, 240, 0] * (PI/180.0); return radius * cos (t), radius * sin(t); } xfig_plot_add_symbol ("triangle3", &make_triangle_right); %}}} private define make_arrow_internal (size, a, b, c) %{{{ { variable xs = Array_Type[2]; variable ys = Array_Type[2]; xs[0] = [0, 0]; ys[0] = [0,b]*size; xs[1] = [0, a, -a, 0]*size; ys[1] = [c, b, b, c]*size; return xs, ys; } %}}} private define make_darrow (size) %{{{ { return make_arrow_internal (size, 0.3, -1.4, -2); } xfig_plot_add_symbol ("darr", &make_darrow); %}}} private define make_uarrow (size) %{{{ { return make_arrow_internal (size, 0.3, 1.4, 2); } xfig_plot_add_symbol ("uarr", &make_uarrow); %}}} private define make_larrow (size) %{{{ { return exch (make_arrow_internal (size, 0.3, -1.4, -2)); } xfig_plot_add_symbol ("larr", &make_larrow); %}}} private define make_rarrow (size) %{{{ { return exch (make_arrow_internal (size, 0.3, 1.4, 2)); } xfig_plot_add_symbol ("rarr", &make_rarrow); %}}} private define make_star (size) %{{{ { variable thetas = PI/10.0*(1+2*[0:10]); variable y0 = sin(thetas[0]); variable small_r = hypot (y0, y0*tan(thetas[2]-thetas[1])); variable xs = cos(thetas), ys = sin(thetas); xs[[1::2]] *= small_r; ys[[1::2]] *= small_r; return size*xs, size*ys; } xfig_plot_add_symbol ("star", &make_star); %}}} %}}} private define plot_symbols (p, x, y) %{{{ { p = p.plot_data; variable ax, ay; (ax, ay) = get_world_axes (p ;; __qualifiers); variable bad = Int_Type [length(x)+1]; bad[-1] = 1; variable w = p.plot_width, h = p.plot_height; x = scale_coords_for_axis (ax, w, x); y = scale_coords_for_axis (ay, h, y); variable point_size = qualifier ("size", p.point_size); variable symbol = qualifier ("sym", "point"); variable fun = find_symbol (&symbol); if (fun == NULL) { () = fprintf (stderr, "***Warning: symbol %s does not exist-- using point\n", symbol); symbol = "point"; fun = &make_point; } point_size *= 10; if (point_size == 0) point_size++; variable radius = xfig_scale_from_inches (0.5*point_size/80.0); variable color = qualifier ("color", p.point_color); color = qualifier ("symcolor", color); variable fill_color = qualifier ("fillcolor", color); variable depth = get_reftype_qualifier ("depth", p.point_depth;;__qualifiers); depth = qualifier ("symdepth", depth); variable area_fill = qualifier ("fill", -1); if (area_fill==NULL) area_fill = 20; variable size = qualifier ("width", p.thickness); size = qualifier ("symwidth",size); variable linestyle = qualifier ("symlinestyle", p.line_style); variable list = xfig_new_polyline_list (); variable x0 = p.X.x; variable y0 = p.X.y; variable z0 = p.X.z; variable sym_xs, sym_ys; (sym_xs, sym_ys) = (@fun)(radius); variable is_array = (_typeof(sym_xs) == Array_Type); foreach (where (bad == 0)) { variable i = (); variable lines; if (is_array) { _for (0, length (sym_xs)-1, 1) { variable j = (); variable xx_j = sym_xs[j]; variable yy_j = sym_ys[j]; xx_j += x[i]; yy_j += y[i]; (xx_j, yy_j) = _xfig_clip_polygon2d (__tmp(xx_j), __tmp(yy_j), 0, w, 0, h); if (length(xx_j) == 0) continue; list.insert (vector(xx_j+x0,yy_j+y0,0*xx_j+z0)); } continue; } variable xx = sym_xs + x[i]; variable yy = sym_ys + y[i]; (xx, yy) = _xfig_clip_polygon2d (__tmp(xx), __tmp(yy), 0, w, 0, h); if (length (xx) == 0) continue; list.insert (vector(xx+x0,yy+y0,0*xx+z0)); } list.set_pen_color (color); list.set_fill_color (fill_color); list.set_line_style (linestyle); list.set_area_fill (area_fill); list.set_thickness (size); list.set_depth(depth); p.object_list.insert(list); } %}}} private define check_axis (p, axis, init_fun, ticlabels, has_log_qualifier) %{{{ { if ((axis.inited == 0) || (axis.needs_setup)) { if (has_log_qualifier) (@init_fun)(p; log, ticlabels=axis.draw_tic_labels); else (@init_fun)(p; ticlabels=axis.draw_tic_labels); return; } if (has_log_qualifier && (axis.islog == 0)) add_axis (p.plot_data, axis, "log", NULL, NULL); } %}}} private define initialize_plot (p, x, y) %{{{ %!%+ %\function{xfig_plot--initialize_plot} %\synopsis{Qualifiers to initialize the axes of an xfig_plot object:} %\qualifiers %\qualifier{xlog}{use a logarithmic x-axis} %\qualifier{ylog}{use a logarithmic y-axis} %\qualifier{loglog}{use logarithmic axes} %\qualifier{padx}{[=0.05]: fraction of xrange to be padded on both sides} %\qualifier{pady}{[=0.05]: fraction of xrange to be padded on both sides} %\description % The world coordinate system of an xfig_plot object % are initialized through the following functions, % unless they are already set before: %\seealso{xfig_plot.plot, xfig_plot.hplot, xfig_plot.plot_png, xfig_plot.plot_pict, xfig_plot.shade_region} %!%- { variable d = p.plot_data; d.num_plots++; if (d.num_plots > 1) return; variable x1axis = d.x1axis; variable x2axis = d.x2axis; variable y1axis = d.y1axis; variable y2axis = d.y2axis; variable logx, logy; (logx, logy) = get_log_qualifiers (;;__qualifiers); if ((x != NULL) && (y != NULL)) { if (not d.world1_inited || ((logx || x1axis.islog) && ((x1axis.xmin <= 0) || (x1axis.xmax <= 0))) || ((logy || y1axis.islog) && ((y1axis.xmin <= 0) || (y1axis.xmax <= 0)))) do_world_method (p, x, y, 1, 3;; __qualifiers); if (not d.world2_inited || ((logx || x2axis.islog) && ((x2axis.xmin <= 0) || (x2axis.xmax <= 0))) || ((logy || y2axis.islog) && ((y2axis.xmin <= 0) || (y2axis.xmax <= 0)))) do_world_method (p, x, y, 2, 3;; __qualifiers); } check_axis (p, d.x1axis, &x1axis_method, 1, logx || x1axis.islog); check_axis (p, d.x2axis, &x2axis_method, 0, logx || x2axis.islog); check_axis (p, d.y1axis, &y1axis_method, 1, logy || y1axis.islog); check_axis (p, d.y2axis, &y2axis_method, 0, logy || y2axis.islog); } %}}} private define plot_method () %{{{ %!%+ %\function{xfig_plot.plot} %\usage{xfig_plot.plot ([x,] y); %\altusage{xfig_plot.plot (x, y, [dx,] dy);} %} %\qualifiers % % qualifiers to initialize the first plot only, % see \sfun{xfig_plot--initialize_plot} % % % qualifiers to specifiy the world coordinate system, % see \sfun{xfig_plot--wcs} % % % qualifiers for lines (defaults for error bars and symbols): %\qualifier{color=strval}{color of lines symbols and error bars} %\qualifier{width=intval}{thickness of lines and error bars} %\qualifier{depth=intval}{Xfig depth} %\qualifier{line=intval}{line style for lines and error bars} %\qualifier{forward_arrow}{see \sfun{xfig_create_arrow}}{NULL} %\qualifier{backward_arrow}{see \sfun{xfig_create_arrow}}{NULL} % % % qualifiers for error bars: % see \sfun{xfig_plot--errorbars} % % % qualifiers for symbols: %\qualifier{sym=strval}{symbol, see xfig_plot_get_symbol_names} %\qualifier{symcolor=strval}{color of symbols}{\exmp{color} qualifier} %\qualifier{size=val}{symbol point size} %\qualifier{fill[=intval]}{area fill style}{20, if set; otherwise -1} %\qualifier{fillcolor=strval}{color for filled symbols} %\qualifier{symlinestyle=intval}{line style to draw symbols} %\qualifier{symwidth=intval}{thickness of symbol lines}{\exmp{width} qualifier} %\qualifier{symdepth=intval}{Xfig depth of symbols}{\exmp{depth} qualifier} %\description % If no \exmp{x} values are given, \exmp{x = [1:length(y)]} is assumed. % If a symbol is specified, no lines are drawn % unless the line qualifier is also specified. %\seealso{xfig_plot--initialize_plot, xfig_plot--wcs, xfig_plot--errorbars} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.plot";; __qualifiers)) return; variable x, y, dx = NULL, dy = NULL, p; switch (_NARGS) { case 2: y = (); x = [1:length(y)]; } { case 3: (x,y) = (); } { case 4: (x,y,dy) = (); } { case 5: (x,y,dx,dy) = (); } { _pop_n (_NARGS); usage (".plot (x [, y [, dy | dx, dy]] ; qualifiers\n" + "Common qualifiers:\n" + " color=val, line=val, width=val, sym=val, symcolor=val\n" ); } p = (); initialize_plot (p, x, y ;;__qualifiers); % If a symbol is specified, then do not draw lines unless line is % also specified. variable line = qualifier ("line"); variable sym = qualifier ("sym"); if ((line != NULL) || (sym == NULL)) plot_lines (p, x, y ;; __qualifiers); if (sym != NULL) plot_symbols (p, x, y ;; __qualifiers); if (dx != NULL) plot_err (p, "x", y, x, dx;; __qualifiers); if (dy != NULL) plot_err (p, "y", x, y, dy;; __qualifiers); } %}}} private define plot_histogram (w, xpts, ypts) %{{{ { % length(xpts) == length(ypts) + 1 (last value is last bin's upper limit) variable len2 = 2*length(xpts); variable x = Double_Type[len2]; variable y = Double_Type[len2]; y[0] = qualifier("y_first", ypts[0]); x[[0::2]] = xpts; x[[1::2]] = xpts; y[[1:len2-3:2]] = ypts; y[[2:len2-2:2]] = ypts; y[-1] = qualifier("y_last", ypts[-1]); y[where (isnan (y))] = 0.0; initialize_plot (w, x, y ;;__qualifiers); plot_lines (w, x, y ;; __qualifiers); } %}}} private define plot_shaded_histogram (p, x, y) %{{{ { initialize_plot (p, x, y ;;__qualifiers); p = p.plot_data; variable ax, ay; (ax, ay) = get_world_axes (p ;; __qualifiers); variable w = p.plot_width, h = p.plot_height; x = scale_coords_for_axis (ax, w, x); y = scale_coords_for_axis (ay, h, y); variable y0 = scale_coords_for_axis (ay, h, 0.0); if (y0 < 0.0) y0 = 0.0; variable i0 = wherelast (x <= 0); if (i0 == NULL) i0 = 0; variable i1 = wherefirst (x > w); if (i1 == NULL) i1 = length(x)-1; % length(x) == length(y) + 1 (last value is last bin's upper limit) x = x[[i0:i1]]; y = y[[i0:i1-1]]; x[where(x<0)] = 0; x[where(x>w)] = w; y[where(isnan(y))] = y0; y[where(yh)] = h; variable list = xfig_new_polyline_list (); variable z_box = [0., 0., 0., 0.]; _for i0 (0, length (x)-2, 1) { variable x0 = x[i0]; variable x1 = x[i0+1]; variable y1 = y[i0]; list.insert (vector([x0,x0,x1,x1], [y0,y1,y1,y0], z_box)); } list.translate (p.X); list.set_depth (get_reftype_qualifier("depth", p.line_depth+1;;__qualifiers)); list.set_thickness (qualifier ("width", p.thickness)); variable color = qualifier ("color", p.line_color); list.set_pen_color (color); list.set_line_style (qualifier ("line", p.line_style)); list.set_fill_color (qualifier ("fillcolor", color)); variable area_fill = qualifier ("fill"); if(area_fill==NULL) area_fill = 20; list.set_area_fill (area_fill); p.object_list.insert (list); } %}}} private define hplot_method () %{{{ %!%+ %\function{xfig_plot.hplot} %\usage{xfig_plot.hplot ([x,] y); %\altusage{xfig_plot.hplot (x, y[, dy]);} %} %\qualifiers % % qualifiers to initialize the first plot only, % see \sfun{xfig_plot--initialize_plot} % % % qualifiers to specifiy the world coordinate system, % see \sfun{xfig_plot--wcs} % % % qualifiers for lines (defaults for error bars): %\qualifier{width}{line thickness} %\qualifier{color}{line color} %\qualifier{line}{line style} %\qualifier{fillcolor=fcol}{fill histogram with color \exmp{fcol}}{\svar{color}} %\qualifier{fill[=area_fill]}{use style \exmp{area_fill} for shaded histogram}{20, if set} %\qualifier{depth}{Xfig depth} % % % qualifiers for error bars: % see \sfun{xfig_plot--errorbars} % % % qualifiers for histogram: %\qualifier{y_first}{y-value of first bin's vertical line} %\qualifier{y_last}{y-value of last bin's vertical line} %\description % \exmp{x} is an array of lower bin boundaries corresponding % to the histogram values \exmp{y}. If \exmp{length(x)==length(y)+1}, % then \exmp{x[-1]} is the upper boundary of the last bin, % otherwise, the last bin will be as large as the previous one. % If no \exmp{x} values are given, \exmp{x = [1:length(y)]} is assumed. %\seealso{xfig_plot--initialize_plot, xfig_plot--wcs, xfig_plot--errorbars} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.hplot";; __qualifiers)) return; variable x, y, dy = NULL, p; switch (_NARGS) { case 2: y = (); x = [1:length(y)]; } { case 3: (x,y) = (); } { case 4: (x,y,dy) = (); } { _pop_n (_NARGS); usage (".hplot (x [, y [, dy ]] ; qualifiers\n" + "Common qualifiers:\n" + " color=val, line=val, width=val\n" ); } p = (); variable nx = length(x), ny = length(y); if (ny == 0) return; variable xH; % array including last bin's upper limit if (nx == ny) { if (nx == 1) xH = [x, x+1]; else xH = [x, 2*x[-1]-x[-2]]; } else if (nx == ny+1) xH = x; else throw UsageError, ".hplot(x, y): length(x) must be length(y) or length(y)+1"; if (qualifier_exists ("fill") || qualifier_exists ("fillcolor")) plot_shaded_histogram (p, xH, y;; __qualifiers); else plot_histogram (p, xH, y;; __qualifiers); if (dy != NULL) { variable ax; (ax,) = get_world_axes (p.plot_data;; __qualifiers); variable x0, x1; (x0, x1) = get_world_for_axis(ax); variable xmid = 0.5*(xH[[:-2]] + xH[[1:]]); #iffalse variable xmid = .5 * ( world_to_normalized(ax.wcs_transform, xH[[:-2]], x0, x1) + world_to_normalized(ax.wcs_transform, xH[[1:]], x0, x1) ); xmid = normalized_to_world(ax.wcs_transform, xmid, x0, x1); #endif plot_err (p, "y", xmid, y, dy ;; __qualifiers); } } %}}} define xfig_plot_set_line_color (p, color) %{{{ { p.plot_data.line_color = color; } %}}} define xfig_plot_set_line_style (p, style) %{{{ { p.plot_data.line_style = style; } %}}} define xfig_plot_set_line_thickness (p, thickness) %{{{ { p.plot_data.thickness = thickness; } %}}} define xfig_plot_set_line_depth (p, depth) %{{{ { p.plot_data.line_depth = depth; } %}}} define xfig_plot_set_axis_depth (p, depth) %{{{ { p.plot_data.axis_depth = depth; } %}}} define xfig_plot_set_point_depth (p, depth) %{{{ { p.plot_data.point_depth = depth; } %}}} define xfig_plot_inc_line_depth (p, depth) %{{{ { p.plot_data.line_depth += depth; } %}}} define xfig_plot_inc_axis_depth (p, depth) %{{{ { p.plot_data.axis_depth += depth; } %}}} define xfig_plot_inc_point_depth (p, depth) %{{{ { p.plot_data.point_depth += depth; } %}}} define xfig_plot_get_line_depth (p) %{{{ { return p.plot_data.line_depth; } %}}} define xfig_plot_get_axis_depth (p) %{{{ { return p.plot_data.axis_depth; } %}}} define xfig_plot_get_point_depth (p) %{{{ { return p.plot_data.point_depth; } %}}} define xfig_plot_inc_image_depth (p, depth) %{{{ { p.plot_data.image_depth += depth; } %}}} define xfig_plot_get_image_depth (p) %{{{ { return p.plot_data.image_depth; } %}}} define xfig_plot_set_image_depth (p, depth) %{{{ { p.plot_data.image_depth = depth; } %}}} define xfig_plot_set_point_size (p, point_size) %{{{ { if (point_size < 0) point_size = 0; p.plot_data.point_size = point_size; } %}}} define xfig_plot_set_point_color (p, color) %{{{ { p.plot_data.point_color = color; } %}}} private define add_object_method () %{{{ %!%+ %\function{xfig_plot.add_object} %\synopsis{Add an object to a plot at a world coordinate position} %\usage{xfig_plot.add_object (obj[, x, y[, dx, dy]]);} %\qualifiers % % qualifiers to specifiy the world coordinate system, % see \sfun{xfig_plot--wcs} %\description % This function may be used to add an object to a plot window at a specified % world coordinate. The \exmp{dx} and \exmp{dy} arguments control the % justification of the object. The values of these parameters are offsets % relative to the size of the object, and as such ordinarily have values % in the interval \exmp{[-0.5,0.5]}. For example, \exmp{0,0} will center % the object on \exmp{(x,y)}, and \exmp{(-0.5,-0.5)} will move the lower left % corner of the object to the specified coordinate. %\seealso{xfig_plot--wcs} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.add_object";; __qualifiers)) return; variable p, obj, x=NULL, y=NULL, dx=0, dy=0; switch (_NARGS) { case 6: (x,y,dx,dy) = (); } { case 4: (x,y) = (); } { if (_NARGS != 2) usage ("%s(plot_win, obj [x, y [, dx, dy]])", _function_name); } (p, obj) = (); %%% To ensure that in case of logarithmic axis the added object is placed %%% correctly it is neccessary to initialize the plot. Otherwise the added %%% object is placed on a linear axis, although the axis is set to log. initialize_plot (p, NULL, NULL ;;__qualifiers); p = p.plot_data; if ((x != NULL) and (y != NULL)) { variable ax, ay; (ax, ay) = get_world_axes (p ;; __qualifiers); x = scale_coords_for_axis (ax, p.plot_width, x); y = scale_coords_for_axis (ay, p.plot_height, y); xfig_justify_object (obj, p.X + vector (x,y,0), vector(dx, dy, 0)); } p.object_list.insert(obj); } %}}} define xfig_plot_text () %{{{ %!%+ %\function{xfig_plot_text} %\synopsis{Add text to the plot} %\usage{xfig_plot_text (w, text, x, y [,dx, dy])} %#v+ % w: plot object % x, y: world coordinates % dx, dy: justification %#v- %\description % This function creates a text object at the specified location on the plot. % By default, the text will be centered on the specified world coordinates. % The justification parameters \exmp{dx} and \exmp{dy} may be used to specify % the justifcation of the text. See the documentation for \sfun{xfig_plot_add_object} % for more information. %\example %#v+ % xfig_plot_text (w, "$cos(\omega t)$"R, 3.2, 6.0, -0.5, 0); %#v- % will left justify the text at the position (3.2,6.0). %\seealso{xfig_plot_add_object, xfig_new_text} %!%- { variable w, text, x, y, dx = 0, dy = 0; if (_NARGS == 6) (dx, dy) = (); else if (_NARGS != 4) usage ("%s (win, text, x, y [, dx, dy]);", _function_name); (w, text, x, y) = (); text = xfig_new_text (text;; __qualifiers); add_object_method (w, text, x, y, dx, dy;; __qualifiers); } %}}} private define xylabel_method () %{{{ %!%+ %\function{xfig_plot.xylabel} %\usage{xfig_plot.xylabel (Double_Type x, y, String_Type text[, dx, dy]);} %\qualifiers % % qualifiers to specifiy the world coordinate system, % see \sfun{xfig_plot--wcs} %\seealso{xfig_plot_text, xfig_plot--wcs} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.xylabel";; __qualifiers)) return; variable w, text, x, y, dx = 0, dy = 0; if (_NARGS == 6) (dx, dy) = (); else if (_NARGS != 4) usage (".xylabel(x, y, text [, dx, dy]);"); (w, x, y, text) = (); % Note the different order of the arguments. xfig_plot_text(w, text, x, y, dx, dy;; __qualifiers); } %}}} private define xlabel_method () %{{{ %!%+ %\function{xfig_plot.xlabel} %\synopsis{Add an x-axis label to a plot} %\usage{xfig_plot.xlabel (String_Type xlabel);} %\description % The x-label is created from the string with the % \sfun{xfig_new_text} function using all applied qualifiers. %\seealso{xfig_new_text} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.xlabel";; __qualifiers)) return; if (_NARGS != 2) usage (".xlabel (label [; qualifiers])"); variable p, label; (p, label) = (); p = p.plot_data; add_axis_label (p, p.x1axis, label ;; __qualifiers); } %}}} private define ylabel_method () %{{{ %!%+ %\function{xfig_plot.ylabel} %\synopsis{Add a y-axis label to a plot} %\usage{xfig_plot.ylabel (String_Type ylabel);} %\description % The ylabel is created from the string with the % \sfun{xfig_new_text} function using all applied qualifiers. %\seealso{xfig_new_text} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.ylabel";; __qualifiers)) return; if (_NARGS != 2) usage (".ylabel (label [; qualifiers])"); variable p, label; (p, label) = (); p = p.plot_data; add_axis_label (p, p.y1axis, label ;; __qualifiers); } %}}} private define x2label_method () %{{{ %!%+ %\function{xfig_plot.x2label} %\synopsis{Add a label for the second x-axis to a plot} %\usage{xfig_plot.x2label (String_Type x2label);} %\description % The x2label is created from the string with the % \sfun{xfig_new_text} function using all applied qualifiers. %\seealso{xfig_new_text} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.x2label";; __qualifiers)) return; if (_NARGS != 2) usage (".x2label (label [; qualifiers])"); variable w, p, label; (w, label) = (); p = w.plot_data; add_axis_label (p, p.x2axis, label ;; __qualifiers); % re-adjust the title position if (p.title_object != NULL) w.title (p.title_object); } %}}} private define y2label_method () %{{{ %!%+ %\function{xfig_plot.y2label} %\synopsis{Add a label for the second y-axis to a plot} %\usage{xfig_plot.y2label (String_Type y2label);} %\description % The y2label is created from the string with the % \sfun{xfig_new_text} function using all applied qualifiers. %\seealso{xfig_new_text} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.y2label";; __qualifiers)) return; if (_NARGS != 2) usage (".y2label (label [; qualifiers])"); variable p, label; (p, label) = (); p = p.plot_data; add_axis_label (p, p.y2axis, label ;; __qualifiers); } %}}} private define title_method () %{{{ %!%+ %\function{xfig_plot.title} %\synopsis{Add a title to a plot} %\usage{xfig_plot.title (String_Type title); %\altusage{xfig_plot.title (XFig_Object title);} %} %\description % The title is created from the string with the % \sfun{xfig_new_text} function using all applied qualifiers. % If \exmp{title} is no string, it is assumed to be % an already properly formatted xfig object. % The title is centered above the plot area. % Any previously existing title object is removed. %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.title";; __qualifiers)) return; variable w, title; (w, title) = (); variable x0, x1, y, z; variable p = w.plot_data; % remove the existing title p.title_object = NULL; if (title == NULL) return; (,,,y,,z) = w.get_bbox (); x0 = p.X.x; x1 = x0 + p.plot_width; if (typeof (title) == String_Type) title = xfig_new_text (title ;; __qualifiers); xfig_justify_object (title, vector(0.5*(x0+x1), y, z), vector(0,-1.0,0)); p.title_object = title; } %}}} private define add_pict_to_plot (w, png) %{{{ { variable dx, dy; (dx, dy) = png.get_pict_bbox (); variable p = w.plot_data; variable width = p.plot_width; variable height = p.plot_height; png.scale_pict (width/dx, height/dy); png.center_pict (p.X + 0.5*vector (width,height,0), width, height); w.add_object (png); png.set_depth (qualifier ("depth", p.image_depth)); } %}}} try { require("png"); } catch AnyError: ; define plot_png_method () %{{{ %!%+ %\function{xfig_plot.plot_png} %\synopsis{Add a png file to a plot, scaling it to the window} %\usage{xfig_plot.plot_png (String_Type pngfile); %\altusage{xfig_plot.plot_png (Array_Type image);} %} %\qualifiers %\qualifier{depth}{Xfig depth} % % % qualifiers to initialize the first plot only, % see \sfun{xfig_plot--initialize_plot} %\qualifier{cmap}{name of the color map used by \sfun{png_gray_to_rgb}} %\description % The image from \exmp{pngfile} is drawn in the plot region. % % If a two-dimensional array \exmp{image} is passed to \exmp{.plot_png}, % it is converted to a png file in the temporary directory, % using the \sfun{png_gray_to_rgb} function and possibly a color map. % All other qualifiers are forwarded to \sfun{png_gray_to_rgb}. %\seealso{xfig_plot_new_png, xfig_plot.plot_pict, xfig_set_tmp_dir, png_gray_to_rgb} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.plot_png";; __qualifiers)) return; variable w, png; if (_NARGS != 2) usage (".plot_png (img)"); (w, png) = (); if (typeof(png)==Array_Type) { #ifnexists png_write_flipped throw ApplicationError, "The png module is not available."; #else variable pngfile = xfig_make_tmp_file ("png", ".png"); variable cmap = qualifier ("cmap"); png = png_gray_to_rgb (png, cmap!=NULL ? cmap : ();; __qualifiers); png_write_flipped (pngfile, png); png = pngfile; #endif } png = xfig_new_png (png); initialize_plot (w, NULL, NULL;; __qualifiers); add_pict_to_plot (w, png;; __qualifiers); } %}}} private define plot_pict_method () %{{{ %!%+ %\function{xfig_plot.plot_pict} %\usage{xfig_plot.plot_pict (String_Type imgfile);} %\qualifiers %\qualifier{depth}{Xfig depth} % % % qualifiers to initialize the first plot only, % see \sfun{xfig_plot--initialize_plot} %\seealso{xfig_plot.plot_png} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.plot_pict";; __qualifiers)) return; variable w, img; if (_NARGS != 2) usage (".plot_pict (img)"); (w, img) = (); variable pict = xfig_new_pict(img, 1., 1.); % numbers do not matter here, will be scaled anyway initialize_plot (w, NULL, NULL;; __qualifiers); add_pict_to_plot (w, pict;; __qualifiers); } %}}} private define shade_region_method () %{{{ %!%+ %\function{xfig_plot.shade_region} %\synopsis{Add a filled rectangle or polygon to the plot} %\usage{xfig_plot.shade_region (x[], y[]); %\altusage{xfig_plot.shade_region (xmin, xmax, ymin, ymax);} %} %\qualifiers % % qualifiers to initialize the first plot only % see \sfun{xfig_plot--initialize_plot} % % % qualifiers to specifiy the world coordinate system % see \sfun{xfig_plot--wcs} % %\qualifier{line}{line style} %\qualifier{width}{line thickness} %\qualifier{color}{line color} %\qualifier{fillcolor}{fill color}{\exmp{color}} %\qualifier{fill}{area fill style}{20} %\qualifier{depth}{Xfig depth of shaded region} %\seealso{xfig_plot--initialize_plot, xfig_plot--wcs} %!%- { if (_xfig_check_help (_NARGS, "xfig_plot.shade_region";; __qualifiers)) return; variable p, w, xs, ys, xmin, xmax, ymin, ymax; switch (_NARGS) { case 3: (w, xs, ys) = (); } { case 5: (w, xmin, xmax, ymin, ymax) = (); xs = [xmin, xmax, xmax, xmin, xmin]; ys = [ymin, ymin, ymax, ymax, ymin]; } { usage ("Usage forms:\n" + " .shade_region (xs, ys; qualifiers);\n" + " .shade_region (xmin, ymin, xmax, ymax; qualifiers);\n" + "Qualifiers\n" + " world[012][012], fill=value, color=value, fillcolor=value"); } if (length (xs) < 3) return; initialize_plot (w, xs, ys ;;__qualifiers); p = w.plot_data; variable ax, ay; (ax, ay) = get_world_axes (p ;; __qualifiers); variable width = p.plot_width, height = p.plot_height; xs = scale_coords_for_axis (ax, width, xs); ys = scale_coords_for_axis (ay, height, ys); xs[where(xs>width )] = width ; xs[where(xs<0 or isnan(xs))] = 0; ys[where(ys>height)] = height; ys[where(ys<0 or isnan(ys))] = 0; variable obj = xfig_new_polyline (vector (xs, ys, 0*xs)); obj.translate (p.X); obj.set_depth (get_reftype_qualifier ("depth", p.image_depth;;__qualifiers)); obj.set_thickness (qualifier ("width", p.thickness)); variable color = qualifier ("color", p.line_color); obj.set_pen_color (color); obj.set_line_style (qualifier ("line", p.line_style)); obj.set_area_fill(qualifier ("fill", 20)); obj.set_fill_color (qualifier ("fillcolor", color)); w.add_object (obj); } %}}} private define get_world_method (w) %{{{ %!%+ %\function{xfig_plot.get_world} %\synopsis{Get the world coordinates of a plot} %\usage{[xmin,xmax,ymin,ymax] = xfig_plot.get_world ();} %\qualifiers % % qualifiers to specifiy the world coordinate system %\seealso{xfig_plot--wcs} %!%- { if (_xfig_check_help (_NARGS-1, "xfig_plot.get_world";; __qualifiers)) return; variable p = w.plot_data; variable ax, ay; (ax, ay) = get_world_axes (p ;; __qualifiers); return [get_world_for_axis(ax), get_world_for_axis(ay)]; } %}}} private variable XFig_Plot_Type = struct %{{{ { plot_data, % Methods title = &title_method, add_object = &add_object_method, world = &world_method, world1 = &world1_method, world2 = &world2_method, plot = &plot_method, hplot = &hplot_method, xlabel = &xlabel_method, ylabel = &ylabel_method, x2label = &x2label_method, y2label = &y2label_method, x1axis = &x1axis_method, y1axis = &y1axis_method, x2axis = &x2axis_method, y2axis = &y2axis_method, xaxis = &xaxis_method, yaxis = &yaxis_method, axis = &axis_method, axes = &axis_method, xylabel = &xylabel_method, plot_png = &plot_png_method, plot_pict = &plot_pict_method, shade_region= &shade_region_method, get_world = &get_world_method, xfig_coords=&xfig_coords_method, }; %}}} private variable Default_Width = 14.0; private variable Default_Height = 10.0; define xfig_plot_set_default_size (w, h) %{{{ { Default_Width = w; Default_Height = h; } %}}} define xfig_plot_get_default_size () %{{{ { return Default_Width, Default_Height; } %}}} define xfig_plot_new () %{{{ %!%+ %\function{xfig_plot_new} %\synopsis{Create a new plot object} %\usage{w = xfig_plot_new ( [Int_Type width, Int_Type height] );} %\description % This function creates a new plot object of the specified width and height. % If the width and height parameters are not given, defaults will be used. % The width and height values specify the size of the plotting area and do not % include the space for tic marks and labels. % % The following qualifiers configure all axes' tic labels at once: %\qualifiers %\qualifier{ticlabel_style}{tic label font style, see \sfun{xfig_make_font}} %\qualifier{ticlabel_color}{tic label font color, see \sfun{xfig_make_font}} %\qualifier{ticlabel_size}{tic label font size, see \sfun{xfig_make_font}} %\example %#v+ % w = xfig_plot_new (); %#v- %\seealso{xfig_plot_define_world, xfig_render_object} %!%- { variable w, h; if (_NARGS == 0) (Default_Width, Default_Height); (w, h) = (); variable p = @XFig_Plot_Data_Type; p.plot_width = w; p.plot_height = h; variable maxticsx = int(w*0.5 + 1.5); variable maxticsy = int(h+1.5); p.x1axis = allocate_axis_type (w, maxticsx, 1, (0,0), (1,0), (0,1), X1_Axis_Geom;; __qualifiers); p.y1axis = allocate_axis_type (h, maxticsy, 1, (0,0), (0,1), (1,0), Y1_Axis_Geom;; __qualifiers); p.x2axis = allocate_axis_type (w, maxticsx, 0, (0,h), (1,0), (0,-1), X2_Axis_Geom;; __qualifiers); p.y2axis = allocate_axis_type (h, maxticsy, 0, (w,0), (0,1), (-1,0), Y2_Axis_Geom;; __qualifiers); p.line_color = "black"; p.line_style = 0; p.thickness = 2; p.point_color = "black"; p.point_size = 1; p.line_depth = DEFAULT_LINE_DEPTH; p.point_depth = DEFAULT_POINT_DEPTH; p.axis_depth = DEFAULT_FRAME_DEPTH; p.image_depth = DEFAULT_IMAGE_DEPTH; p.X = vector(0,0,0); p.object_list = xfig_new_compound_list (); variable obj = xfig_new_object (@XFig_Plot_Type); obj.plot_data = p; obj.render_to_fp = &plot_render; obj.rotate = &plot_rotate; obj.translate = &plot_translate; obj.scale = &plot_scale; obj.get_bbox = &plot_get_bbox; obj.flags |= XFIG_RENDER_AS_COMPOUND; return obj; } %}}} define xfig_plot_new_png (png) %{{{ %!%+ %\function{xfig_plot_new_png} %\synopsis{Create a new plot window for a png file} %\usage{w = xfig_plot_new_png (file)} %\qualifiers %\qualifier{depth}{Xfig depth} %\seealso{xfig_plot_new, xfig_plot.plot_png, xfig_plot.plot_pict} %!%- { png = xfig_new_png (png); variable dx, dy; (dx, dy) = png.get_pict_bbox (); variable w = xfig_plot_new (dx, dy); add_pict_to_plot (w, png;; __qualifiers); return w; } %}}} define xfig_multiplot () %{{{ %!%+ %\function{xfig_multiplot} %\synopsis{Create a multiplot from individual panels that share the same x-axes} %\usage{compound = xfig_multiplot (xfig_plot p1[], p2[], ...);} %\qualifiers %\qualifier{cols=intval}{number of columns}{1} %\qualifier{title=strval}{overall title on top of the multiplot} %\qualifier{xlabel=strval}{overall xlabel below the multiplot} %\qualifier{x2label=strval}{overall x2label on top of the multiplot} %\qualifier{ylabel=strval}{overall ylabel left of the multiplot} %\qualifier{y2label=strval}{overall y2label right of the multiplot} %\qualifier{align_ylabels=intval}{bitmask for aligning all y{1,2}axis-labels}{1|2} %\description % \exmp{p1}, \exmp{p2}, ... can be single plot objects or arrays of them. % \sfun{xfig_multiplot} arranges a multi-panel plot with \exmp{cols} columns. % % The plot windows are aligned in left-right, top-down order. % \sfun{xfig_multiplot} switches off titles, axis- and ticmark labels % of those plots for which those would overlap with other plots. It % is thus be desirable to have common sizes of the plot windows, as % well as common ranges and coordinate systems on adjoining axes. % This is particularly important if when more than one column is % used. % % The return value is a compound object containing all plots in the % multiplot (note that their number has to be a multiple of \exmp{cols}). % If the \exmp{title} or \exmp{x(2)label} qualifiers are specified and \exmp{cols>1}, % additional text objects are added above and below the multiplot. % (For \exmp{cols==1}, the title/x(2)label of the first/last plot are set.) % The same holds for the \exmp{y(2)label} qualifiers, for which it depends % on the resulting number of rows whether additional text is added % on the left or right of the multiplot or whether the corresponding % labels of the first or last plot are set (possibly overwritten). %!%- { if (_xfig_check_help (_NARGS, _function_name();; __qualifiers)) return; variable args = __pop_list(_NARGS), element, plots={}; loop(_NARGS) foreach element ( list_pop(args) ) list_append(plots, element); variable cols = qualifier("cols", 1); variable ix, iy, last_ix=cols-1, last_iy=length(plots)/cols-1; variable dy=0., y1label_x=_Inf, y2label_x=-_Inf, X, pd; _for iy (0, last_iy, 1) { % shift all plots at first in negative y-direction (will be corrected at the end): dy -= plots[0].plot_data.plot_height; variable dx=0.; _for ix (0, last_ix, 1) { variable p = list_pop(plots); pd = p.plot_data; X = pd.X; p.translate( vector(dx-X.x, dy-X.y, -X.z) ); if(ix) { p.y1axis(; ticlabels=0); pd.y1axis.axis_label = NULL; } else if (pd.y1axis.axis_label!=NULL) y1label_x = _min(y1label_x, pd.y1axis.axis_label.X.x); if(ix.scale";; __qualifiers)) return; variable obj, sx, sy, sz; (obj, sx, sy, sz) = _xfig_get_scale_args (_NARGS); variable X = obj.X; X.x *= sx; X.y *= sy; X.z *= sz; obj.X = X; } private define polyline_get_bbox (obj) { variable X = obj.X; return min(X.x), max(X.x), min(X.y), max(X.y), min(X.z), max(X.z); } define xfig_create_arrow () %{{{ %!%+ %\function{xfig_create_arrow} %\synopsis{Create a new arrow shape for a polyline object} %\description % \sfun{xfig_create_arrow} creates a structure that can be used % for polyline objects, e.g., with xfig_new_polyline. % All information are passed via qualifiers. %\qualifiers %\qualifier{arrow_type}{shape of arrow heads (values from 0 to 14), e.g., % XFIG_ARROWTYPE_{STICK,TRIANGLE,INDENTED,POINTED} % and others}{XFIG_ARROWTYPE_INDENTED==2} %\qualifier{arrow_style}{XFIG_ARROWSTYLE_{HOLLOW,FILLED}, i.e., 0 or 1; % indicating a filling with white or with the pen color % for \exmp{0 < arrow_type < 13} }{1} %\qualifier{arrow_thickness}{}{1} %\qualifier{arrow_width}{}{4} %\qualifier{arrow_height}{}{8} %\example % % using the same (simple) shape for forward and backward arrow, % % implicitly calling xfig_create_arrow (twice): % variable % a1 = xfig_new_polyline([0,4], [0,3] % ; forward_arrow, backward_arrow, % arrow_type=0, arrow_style=0); % % % explicitly calling xfig_create_arrow, in order to use % % different shapes for forward and backward arrow: % variable % forw_arr = xfig_create_arrow(; arrow_type= 0, arrow_style=0), % back_arr = xfig_create_arrow(; arrow_type=13, arrow_style=1), % a2 = xfig_new_polyline([1,5], [1,4] % ; forward_arrow=forw_arr, % backward_arrow=back_arr); %\seealso{xfig_new_polyline} %!%- { return struct { arrow_type = qualifier("arrow_type", 2), % int (enumeration type) arrow_style = qualifier("arrow_style", 1), % int (enumeration type) arrow_thickness = qualifier("arrow_thickness", 1), % float (1/80 inch) arrow_width = qualifier("arrow_width", 4)*2.54/80., % float (Fig units) arrow_height = qualifier("arrow_height", 8)*2.54/80. % float (Fig units) }; } %}}} define xfig_new_polyline (X) %{{{ %!%+ %\function{xfig_new_polyline} %\synopsis{Create a new polyline object} %\usage{p = xfig_new_polyline(Vector_Type X); %\altusage{p = xfig_new_polyline(Array_Type x [, y [, z]]);} %} %\description % If \sfun{xfig_new_polyline} is called with one \exmp{Vector_Type} argument \exmp{X}, % the fields \exmp{x}, \exmp{y}, and \exmp{z} are expected to contain coordinate arrays % of the polyline's vertices. % These can also be specified directly as \exmp{Array_Type} arguements; % all unspecified coordinates are set to zero. %\qualifiers %\qualifier{closed}{closes the polygon by repeating the first vertex at the end} %\qualifier{line}{line style} %\qualifier{width}{line width} %\qualifier{color}{line color} %\qualifier{fillcolor}{color to fill the region inside the polyline object} %\qualifier{areafill}{darkness or pattern}{20} %\qualifier{depth}{Xfig depth} %\qualifier{join}{shape of the vertex of lines: MITER, ROUNDED, BEVEL} %\qualifier{cap}{shape of end points of lines: BUTT, ROUND, PROJECTING)} %\qualifier{forward_arrow}{see documentation of \sfun{xfig_create_arrow}} %\qualifier{backward_arrow}{see documentation of \sfun{xfig_create_arrow}} %\seealso{xfig_create_arrow} %!%- { if ((_NARGS>1) || (typeof(X)!=Vector_Type) && (typeof(X) != Struct_Type)) { variable x, y, z, zeros = 0*X; switch(_NARGS) { case 1: (x, y, z) = (X, zeros, zeros); } { case 2: x = (); y = X; z = zeros;} { case 3: (x,y) = (); z = X;} X = vector(x, y, z); } if(qualifier_exists("closed")) { X.x = [X.x, X.x[0]]; X.y = [X.y, X.y[0]]; X.z = [X.z, X.z[0]]; } variable p = @Polyline_Type; p.sub_type = SUBTYPE_POLYLINE; p.X = X; variable obj = xfig_new_object (p); obj.render_to_fp = &polyline_render_to_fp; obj.rotate = &polyline_rotate; obj.translate = &polyline_translate; obj.scale = &polyline_scale; obj.get_bbox = &polyline_get_bbox; obj.line_style = qualifier("line", obj.line_style); obj.thickness = qualifier("width", obj.thickness); if (qualifier_exists("color")) obj.pen_color = xfig_lookup_color(qualifier("color")); if (qualifier_exists("fillcolor")) { obj.fill_color = xfig_lookup_color(qualifier("fillcolor")); obj.area_fill = 20; } obj.area_fill = qualifier ("areafill", obj.area_fill); obj.depth = qualifier("depth", obj.depth); obj.join_style = qualifier("join", obj.join_style); obj.cap_style = qualifier("cap", obj.cap_style); variable arrow; if (qualifier_exists("forward_arrow")) { arrow = qualifier("forward_arrow"); if (arrow == NULL) arrow = xfig_create_arrow(;; __qualifiers); obj.forward_arrow = arrow; } if (qualifier_exists("backward_arrow")) { arrow = qualifier("backward_arrow"); if (arrow == NULL) arrow = xfig_create_arrow(;; __qualifiers); obj.backward_arrow = arrow; } return obj; } %}}} %------------------------------------------------------------------------ % Polyline_List % % All objects in the polyline list have the same attributes. %------------------------------------------------------------------------ %{{{ private define polyline_list_render_to_fp (p, fp) { ifnot (_xfig_render_depth (p;; __qualifiers)) return; #iffalse foreach (p.list) { variable X = (); write_one_polyline (fp, p, X); } #else % Since a polyline list has the same attributes, avoid the expensive % call to write_polyline_header variable hdrstr = make_polyline_header_string (p); foreach (p.list) { variable X = (); variable x, y, n; (x,y) = xfig_project_to_xfig_plane (X); n = length (x); if (n < 2) continue; x = xfig_convert_units (__tmp(x)); y = xfig_convert_units (__tmp(y)); (x,y) = prune (__tmp(x), __tmp(y)); n = length (x); if (n < 2) continue; xfig_vwrite (fp, "%s %d\n", hdrstr, n); % polyline header if (p.forward_arrow != NULL) write_arrow (fp, p.forward_arrow, X, -2, -1); if (p.backward_arrow != NULL) write_arrow (fp, p.backward_arrow, X, 1, 0); write_polyline_data (fp, x, y); } #endif } private define polyline_list_rotate (obj, axis, theta) { variable list = obj.list; _for (0, length(list)-1, 1) { variable i = (); list[i] = vector_rotate (list[i], axis, theta); } } private define polyline_list_translate (obj, dX) { variable list = obj.list; _for (0, length(list)-1, 1) { variable i = (); list[i] = vector_sum (list[i], dX); } } private define polyline_list_scale () { if (_xfig_check_help (_NARGS, ".scale";; __qualifiers)) return; variable obj, sx, sy, sz; (obj, sx, sy, sz) = _xfig_get_scale_args (_NARGS); variable list = obj.list; _for (0, length(list)-1, 1) { variable i = (); variable X = list[i]; X.x *= sx; X.y *= sy; X.z *= sz; list[i] = X; } } private define polyline_list_get_bbox (obj) { variable x0, x1, y0, y1, z0, z1; variable xmin = _Inf, ymin = _Inf, zmin = _Inf; variable xmax = -_Inf, ymax = -_Inf, zmax = -_Inf; foreach (obj.list) { variable X = (); variable tmp; tmp = X.x; xmin = _min (xmin, min(tmp)); xmax = _max (xmax, max(tmp)); tmp = X.y; ymin = _min (ymin, min(tmp)); ymax = _max (ymax, max(tmp)); tmp = X.z; zmin = _min (zmin, min(tmp)); zmax = _max (zmax, max(tmp)); } return xmin, xmax, ymin, ymax, zmin, zmax; } private define polyline_list_insert (p, X) { list_insert (p.list, X); } define xfig_new_polyline_list () { variable p = xfig_new_polyline (vector(0,0,0)); p = struct_combine (p, struct { insert=&polyline_list_insert, list={} }); p.render_to_fp = &polyline_list_render_to_fp; p.rotate = &polyline_list_rotate; p.translate = &polyline_list_translate; p.scale = &polyline_list_scale; p.get_bbox = &polyline_list_get_bbox; return p; } %}}} %------------------------------------------------------------------------ % Polygon_Type % %------------------------------------------------------------------------ %{{{ private define polygon_render_to_fp (obj, fp) { ifnot (_xfig_render_depth (obj;; __qualifiers)) return; variable eye = xfig_get_eye ()-xfig_get_focus(); variable n = obj.n; variable X = obj.X; variable dX = vector_diff (eye, vector(X.x[0],X.y[0],X.z[0])); if (dotprod (dX, n) < 0) return; write_one_polyline (fp, obj, X); } define xfig_new_polygon (X) { variable x, y, z; if (_NARGS>1 || typeof(X)!=Vector_Type) { variable zeros = Double_Type[length(X)]; switch(_NARGS) { case 1: (x, y, z) = (X, zeros, zeros); } { case 2: (x, y, z) = ((), X, zeros); } { case 3: (x, y, z) = ((), X); } X = vector(x, y, z); } else (x, y, z) = (X.x, X.y, X.z); variable x0 = vector (x[0], y[0], z[0]); variable x1 = vector (x[1], y[1], z[1]); variable x2 = vector (x[2], y[2], z[2]); variable p = struct_combine (xfig_new_polyline (X;; __qualifiers()), struct { n = crossprod (vector_diff (x1, x0), vector_diff (x2, x1)) }); normalize_vector (p.n); p.sub_type = SUBTYPE_POLYGON; return p; } %}}} %------------------------------------------------------------------------ % Polygon_List % % A Polygon_List_Type consists of a linked list of (closed) polygons. % When rendered, it properly takes into account the position of the polygons % with respect to the viewer. % % If drawing 3d objects, then use polygons and not polylines. %------------------------------------------------------------------------ %{{{ private define poly_sort (a, b) { variable eye = xfig_get_eye (); variable aX = a.X, bX = b.X; % min. distances of vertices to eye variable da = min( (eye.x-aX.x)^2 + (eye.y-aX.y)^2 + (eye.z-aX.z)^2 ); variable db = min( (eye.x-bX.x)^2 + (eye.y-bX.y)^2 + (eye.z-bX.z)^2 ); if (da < db) return +1; % a is closer to eye than b => "a > b" => draw b first if (da > db) return -1; variable na = a.n; variable nb = b.n; if (na == NULL) { if (nb != NULL) return 1; } else if (nb == NULL) return -1; variable foc = xfig_get_focus (); variable cosa = abs(dotprod(na, foc-eye)); variable cosb = abs(dotprod(nb, foc-eye)); if(cosa > cosb) return +1; % a is "more perpendicular" to line of sight than b => "a > b" => draw b first if(cosa < cosb) return -1; % Using the length has the feature that a single line will get drawn % after something more complex. return (length (aX) < length (bX)); } private define sort_polygons (list) { variable ps = list_to_array (list, Struct_Type); return ps[array_sort (ps, &poly_sort)]; } private define polygon_list_render_to_fp (obj, fp) { ifnot (_xfig_render_depth (obj;; __qualifiers)) return; variable ps = sort_polygons (obj.list); variable eye = xfig_get_eye (); variable hide_interior = not qualifier_exists("show_interior"); foreach (ps) { variable p = (); variable n = p.n; variable X = p.X; if (hide_interior) { variable dX = vector_diff (eye, vector(X.x[0],X.y[0],X.z[0])); if (dotprod (dX, n) < 0) continue; } write_one_polyline (fp, p, p.X); } variable frame = qualifier ("frame"); variable framex = qualifier ("framex", frame); variable framey = qualifier ("framey", frame); if (framex!=NULL && framey!=NULL) { % add a frame in absolute xfig coordinates (no projection) % centered at the XFig_Origin framex = xfig_convert_units (framex); framey = xfig_convert_units (framey); write_polyline_header (fp, xfig_new_polyline (vector(0,0,0);; __qualifiers()), 5); % dummy polyline write_polyline_data (fp, 4858+framex*[1,-1,-1,1,1], 6287+framey*[1,1,-1,-1,1]); } } private define polygon_list_set_line_style (obj, val) { foreach (obj.list) { obj = (); obj.line_style = val; } } private define polygon_list_set_thickness (obj, val) { foreach (obj.list) { obj = (); obj.thickness = val; } } private define polygon_list_set_pen_color (obj, val) { val = xfig_lookup_color (val); foreach (obj.list) { obj = (); obj.pen_color = val; } } private define polygon_list_set_fill_color (obj, val) { val = xfig_lookup_color (val); foreach (obj.list) { obj = (); obj.fill_color = val; } } private define polygon_list_set_area_fill (obj, val) { foreach (obj.list) { obj = (); obj.area_fill = val; } } private define polygon_list_rotate (obj, axis, angle) { foreach (obj.list) { obj = (); obj.n = vector_rotate (obj.n, axis, angle); obj.rotate (axis, angle); } } define xfig_new_polygon_list () { return struct_combine (xfig_new_compound_list (), struct { set_line_style = &polygon_list_set_line_style, set_thickness = &polygon_list_set_thickness, set_pen_color = &polygon_list_set_pen_color, set_fill_color = &polygon_list_set_fill_color, set_area_fill = &polygon_list_set_area_fill, render_to_fp = &polygon_list_render_to_fp, rotate = &polygon_list_rotate, }); } %}}} %----------------------------------------------------------------------- % Pict_Type % %----------------------------------------------------------------------- %{{{ private define pict_render_to_fp (p, fp) { ifnot (_xfig_render_depth (p;; __qualifiers)) return; variable flipped = 0; variable x0, y0, x1, y1, x, y; (x0,y0) = xfig_project_to_xfig_plane (p.X); % This point must correspond to the lower left corner of the picture % or, in fig units the corner with the smallest x and the largest y. variable bbox_x = p.bbox_x + (x0 - 0.5*max(p.bbox_x)); variable bbox_y = p.bbox_y; bbox_y = bbox_y + (y0 - 0.5*max(bbox_y)); bbox_x = xfig_convert_units (bbox_x); bbox_y = xfig_convert_units (bbox_y); write_polyline_header (fp, p, 5); xfig_vwrite (fp, " %d %s\n", p.flipped, p.pict_file); write_polyline_data (fp, bbox_x, bbox_y); } private define pict_get_bbox (p) { variable X = p.X; variable dx, dy, dz, x, y, z; dx = 0.5*maxabs(p.bbox_x); dy = 0.5*maxabs(p.bbox_y); dz = 0.0; x = X.x; y = X.y; z = X.z; return x-dx, x+dx, y-dy, y+dy, z, z+dz; } private define pict_scale () { if (_xfig_check_help (_NARGS, ".scale";; __qualifiers)) return; variable p, sx, sy, sz; (p, sx, sy, sz) = _xfig_get_scale_args (_NARGS); variable X = p.X; X.x *= sx; X.y *= sy; X.z *= sz; p.bbox_x *= sx; p.bbox_y *= sy; %polyline_list_scale (p, sx, sy, sz); } define pict_rotate_pict () %{{{ %!%+ %\function{pict.rotate_pict} %\usage{pict.rotate_pict (theta_degrees);} %\description % A picture object can only be rotated by multiples of 90 degrees. %!%- { if (_xfig_check_help (_NARGS, "pict.rotate_pict";; __qualifiers)) return; variable pict, theta_degrees; if (_NARGS == 2) (pict, theta_degrees) = (); else usage(".rotate_pict (theta_degrees);"); % The convention adopted here is that the location of the picture is % specified by the lower left corner of the box, rotated or % otherwise. In fig units, this corner will have the largest y % value and smallest x value (UL in diagram below, displayed in fig % system): % % UL UR % LL LR % % The rotation of the figure itself is encoded by how the box is % written out: % % 0 degrees: LL LR UR UL LL (dx>0, dy>0) % 90 degrees: LR UR UL LL LR (dx<0, dy>0) % 180 degrees: UR UL LL LR UR (dx<0, dy<0) % 270 degrees: UL LL LR UR UL (dx>0, dy<0) variable bbox_x = pict.bbox_x; variable bbox_y = pict.bbox_y; theta_degrees = theta_degrees mod 360.0; if (theta_degrees < 0) theta_degrees += 360; loop ( int(theta_degrees/90.0 + 0.5) ) { bbox_x[[0:3]] = bbox_x[[1:4]]; bbox_x[4] = bbox_x[0]; bbox_y[[0:3]] = bbox_y[[1:4]]; bbox_y[4] = bbox_y[0]; (bbox_x, bbox_y) = (bbox_y, bbox_x); } pict.bbox_x = bbox_x; pict.bbox_y = bbox_y; } %}}} private define pict_rotate (p, axis, theta) { p.X = vector_rotate (p.X, axis, theta); % pict objects cannot be rotated at arbitrary angles. variable costheta = dotprod (axis, vector(0,0,1))/vector_norm(axis); if (feqs (abs(costheta), 1)) { theta *= 180.0/PI; if (costheta < 0) {theta = -theta; costheta = -costheta;} p.rotate_pict (theta); } } private define pict_translate (p, dX) { p.X += dX; } private define pict_scale_pict () %!%+ %\function{xfig_pict.scale} %\synopsis{Scale an xfig pict object} %\usage{xfig_pict.scale (s); %\altusage{xfig_pict.scale (sx, sy);} %} %\seealso{xfig_new_pict} %!%- { if (_xfig_check_help (_NARGS, "xfig_pict.scale";; __qualifiers)) return; variable pict, sx, sy; if (_NARGS == 2) { (pict, sx) = (); sy = sx; } else { (pict, sx, sy) = (); } pict.bbox_x *= sx; pict.bbox_y *= sy; } % FIXME: This does not look right define pict_get_pict_bbox (pict) { return maxabs(pict.bbox_x), maxabs(pict.bbox_y); } %!%+ %\function{xfig_center_pict_in_box} %\synopsis{Center a pict object in a box} %\usage{xfig_center_pict_in_box (pict_object, X, dx, dy} %\description % This function takes a pict object and centers it in a box whose width % is \var{dx} and whose height is \var{dy}. The vector \var{X} denotes the % position of the lower-left corner of the box. If the pict object is too % big to fit in the box, then its lower-left corner will coincide with the % lower-left corner of the box. %\seealso{xfig_translate_object} %!%- private define pict_center_pict (pict, X, dx, dy) { variable w, h; (w, h) = pict_get_pict_bbox (pict); variable yoff = 0.5*(dy - h); if (yoff < 0) yoff = 0.0*dy; variable xoff = 0.5*(dx - w); if (xoff < 0) xoff = 0.0*dx; % used to be 0.1*dx pict_translate (pict, vector_sum(X, vector (xoff, yoff, 0))); } %!%+ %\function{xfig_new_pict} %\synopsis{Create an object that encapsulates an image file} %\usage{obj = xfig_new_pict(filename, width, height [; qualifiers])} %\description % This function creates an object containing the specified image file % and scales it to the specified width an height. The resulting % object containing the image will be centered at (0,0,0). %\qualifiers %\qualifier{depth}{XFig depth} %\qualifier{x0}{x-position}{0} %\qualifier{y0}{y-position}{0} %\qualifier{z0}{z-position}{0} %\qualifier{just=[jx,jy]}{justification}{[0,0]} % The \exmp{just} qualifier may be used to indicate how the object is % to be justified with respect to the origin. Its value must be a 2d % numeric array [dx,dy] that gives the offset of the center of the % image scaled with respect to the bounding box. Examples include: %#v+ % just=[0,0] Center object upon the origin (default) % just=[-0.5,-0.5] Put the lower-left corner at the origin % just=[0.5,-0.5] Put the lower-right corner at the origin % just=[0.5,0.5] Put the upper-right corner at the origin % just=[-0.5,-0.5] Put the upper-left corner at the origin %#v- %\seealso{xfig_new_text, xfig_justify_object} %!%- define xfig_new_pict (file, dx, dy) { variable X = vector(qualifier("x0",0), qualifier("y0",0), qualifier("z0",0)); variable p = xfig_new_polyline (X ;; __qualifiers); p.sub_type = SUBTYPE_IMPPICT; p = struct_combine (p, struct { pict_file = file, % Use the corners for the polyline flipped = (dy<0), bbox_x = [0, dx, dx, 0, 0], bbox_y = abs(dy)*[0, 0, 1, 1, 0], rotate_pict = &pict_rotate_pict, scale_pict = &pict_scale_pict, get_pict_bbox = &pict_get_pict_bbox, center_pict = &pict_center_pict }); p.render_to_fp = &pict_render_to_fp; p.scale = &pict_scale; p.rotate = &pict_rotate; p.get_bbox = &pict_get_bbox; variable just = qualifier ("just"); if (just != NULL) { if (length (just) == 2) just = [just, 0]; xfig_justify_object (p, X, vector(just[0], just[1], just[2])); } return p; } %}}} define xfig_new_pyramid (n, radius, height) { variable a = xfig_new_polygon_list (); variable thetas = [n:0:-1]*(2*PI)/n; variable xs = radius * cos (thetas); variable ys = radius * sin (thetas); % base variable X = vector (xs, ys, Double_Type[n+1]); a.insert (xfig_new_polygon (X)); _for (0, n-1, 1) { variable i = (); variable j = i+1; X = vector ([xs[i], 0, xs[j], xs[i]], [ys[i], 0, ys[j], ys[i]], [0, height, 0, 0]); a.insert (xfig_new_polygon (X)); } return a; } define xfig_new_arrow_head (w, h, dX) { dX = @dX; normalize_vector (dX); variable a = xfig_new_pyramid (6, w*0.5, h); variable theta = acos (dX.z); if (theta != 0.0) { variable axis = unit_vector (crossprod (vector (0,0,1), dX)); a.rotate (axis, theta); } a.set_area_fill (20); a.set_fill_color ("default"); return a; } slxfig-pre0.2.0-138/src/xfig/ellipse.sl0000644000175000000620000001742413745227527016412 0ustar johnstaffprivate define render_ellipse_to_fp (e, fp) { ifnot (_xfig_render_depth (e;; __qualifiers)) return; variable x, y; (x,y) = xfig_project_to_xfig_plane (e.X); variable center_x = x[0]; variable center_y = y[0]; x -= center_x; y -= center_y; variable a_x = x[1], b_x = x[2], a_y = y[1], b_y = y[2]; variable a = sqrt (a_x^2 + a_y^2); variable b = sqrt (b_x^2 + b_y^2); % Make a the major axis, and b the minor if (b > a) (a, a_x, a_y, b, b_x, b_y) = (b, b_x, b_y, a, a_x, a_y); if (a == 0) return; variable angle = -atan2(a_y, a_x); % Note XFig's sign convention! if (b != 0) { variable cos_theta = (a_x*b_x+a_y*b_y)/(a*b); if(cos_theta != 0) { variable denom = 1.0 - (b/a*cos_theta)^2; if (denom != 0) b *= sqrt ((1-cos_theta*cos_theta)/denom); } } xfig_vwrite (fp, "%d %d %d %d %d %d %d %d %d %g %d ", e.object_code, e.sub_type, e.line_style, e.thickness, e.pen_color, e.fill_color, e.depth, e.pen_style, e.area_fill, e.style_val, e.direction); a_x = xfig_convert_units (center_x + a_x); a_y = xfig_convert_units (center_y + a_y); center_x = xfig_convert_units (center_x); center_y = xfig_convert_units (center_y); a = xfig_convert_units (a); b = xfig_convert_units (b); xfig_vwrite (fp, "%g %g %g %g %g %g %g %g %g\n", angle, center_x, center_y, a, b, center_x, center_y, % ("the 1st point entered") a_x, a_y); % ("the last point entered") -> used in XFig to select ellipse } private define rotate_ellipse () %!%+ %\function{xfig_ellipse.rotate} %\usage{xfig_ellipse.rotate([Vector_Type axis,] Double_Type theta);} %\description % If no \exmp{axis} is given, the ellipse is rotated % in the x-y-plane around \exmp{axis = vector(0,0,1)}. % % The rotation angle \exmp{theta} is measured in radians. %!%- { variable e, axis, theta; switch(_NARGS) { case 2: (e, theta) = (); axis = vector(0,0,1); } { case 3: (e, axis, theta) = (); } { % else: usage("xfig_ellipse.rotate ([axis,] theta);"); } e.X = vector_rotate (e.X, axis, theta); } private define translate_ellipse (e, dX) { e.X = vector_sum (e.X, dX); } private define scale_ellipse () { if (_xfig_check_help (_NARGS, ".scale";; __qualifiers)) return; variable e, sx, sy, sz; (e, sx, sy, sz) = _xfig_get_scale_args (_NARGS); variable X = e.X; % The following code assumes an ellipse in the x-y-plane, % seen from the z-direction. % Note that for sx != sy, % the vectors that specify major and minor axes of the scaled ellipse % differ from the scaled vectors specifying these axes of the previous ellipse. % They therefore have to be recalculated. variable center_x = X.x[0]; variable center_y = X.y[0]; variable x = X.x - center_x; variable y = X.y - center_y; variable a_x = x[1], b_x = x[2], a_y = y[1], b_y = y[2]; variable a = sqrt (a_x^2 + a_y^2); variable b = sqrt (b_x^2 + b_y^2); variable angle = atan2(a_y, a_x); % angle in SLxfig coordinates, unlike XFig convention % parameterization of the scaled ellipse: % x(t) = sx * ( cos(angle) * a*cos(t) - sin(angle) * b*sin(t) ) % y(t) = sy * ( sin(angle) * a*cos(t) + cos(angle) * b*sin(t) ) % r^2(t) = x(t)^2 + y(t)^2 % d(r^2)/dt(T) =!= 0 variable T = atan2( a*b*(sy^2-sx^2)*sin(2*angle), (a^2*sx^2 - b^2*sy^2)*cos(angle)^2 + (a^2*sy^2 - b^2*sx^2)*sin(angle)^2 ) * 0.5 + [0, PI/2]; % One gives the maximal r^2, the other the minimal r^2. variable i; _for i (1, 2, 1) { variable t = T[i-1]; X.x[i] = center_x + cos(angle) * a*cos(t) - sin(angle) * b*sin(t); % scaling by sx applied afterwards X.y[i] = center_y + sin(angle) * a*cos(t) + cos(angle) * b*sin(t); % scaling by sy applied afterwards } X.x *= sx; X.y *= sy; X.z *= sz; } private define get_bbox_ellipse (e) { variable X = e.X; % The following code assumes an ellipse in the x-y-plane, % seen from the z-direction. variable center_x = X.x[0]; variable center_y = X.y[0]; variable x = X.x - center_x; variable y = X.y - center_y; variable a_x = x[1], b_x = x[2], a_y = y[1], b_y = y[2]; variable a = sqrt (a_x^2 + a_y^2); variable b = sqrt (b_x^2 + b_y^2); variable angle = atan2(a_y, a_x); % x(t) = cos(angle) * a*cos(t) - sin(angle) * b*sin(t) % y(t) = sin(angle) * a*cos(t) + cos(angle) * b*sin(t) variable tx = atan2(-b*sin(angle), a*cos(angle)); % => dx/dt(tx) = 0 variable ty = atan2( b*cos(angle), a*sin(angle)); % => dy/dt(ty) = 0 variable x_tx = a*cos(angle)*cos(tx) - b*sin(angle)*sin(tx); variable y_ty = a*sin(angle)*cos(ty) + b*cos(angle)*sin(ty); x = [X.x, center_x + x_tx, center_x - x_tx]; y = [X.y, center_y + y_ty, center_y - y_ty]; return min(x), max(x), min(y), max(y), min(X.z), max(X.z); } private define set_depth (obj, depth) { obj.depth = _xfig_verify_depth (depth); } private define set_pen_color (obj, pc) { obj.pen_color = xfig_lookup_color (pc); } private define set_thickness (obj, th) { obj.thickness = th; } private define set_line_style (obj, ls) { obj.line_style = ls; } private define set_area_fill (obj, af) { obj.area_fill = af; } private define set_fill_color (obj, fc) { obj.fill_color = xfig_lookup_color(fc); } define xfig_new_ellipse () %{{{ %!%+ %\function{xfig_new_ellipse} %\synopsis{Create a new ellipse object} %\usage{XFig_Ellipse_Type xfig_create_ellipse (Double_Type a [, b])} %\qualifiers %\qualifier{line}{line style}{0} %\qualifier{width}{line width}{1} %\qualifier{color}{line color}{-1} %\qualifier{fillcolor}{}{-1} %\qualifier{areafill}{darkness or pattern}{-1 or 20, depending on \exmp{fillcolor}} %\qualifier{depth}{XFig depth}{50} %\qualifier{x0}{x-position}{0} %\qualifier{y0}{y-position}{0} %\qualifier{z0}{z-position}{0} %!%- { if (_xfig_check_help (_NARGS, _function_name;; __qualifiers)) return; variable a, b; switch(_NARGS) { case 1: a = (); b = a; } { case 2: (a, b) = (); } { % else: usage("xfig_new_ellipse (a [, b])"); } variable obj = xfig_new_object (struct { object_code = 1, % int (always 1) sub_type = 1, % int (1: ellipse defined by radii % 2: ellipse defined by diameters % 3: circle defined by radius % 4: circle defined by diameter) line_style % int (enumeration type) = qualifier ("line", 0), thickness % int (1/80 inch) = qualifier ("width", 1), pen_color % int (enumeration type, pen color) = qualifier_exists ("color") ? xfig_lookup_color (qualifier ("color")) : -1, fill_color % int (enumeration type, fill color) = qualifier_exists ("fillcolor") ? xfig_lookup_color (qualifier ("fillcolor")) : -1, depth % int (enumeration type) = qualifier ("depth", 50), pen_style = -1, % int (pen style, not used) area_fill % int (enumeration type, -1 = no fill) = qualifier ("areafill", qualifier_exists ("fillcolor") ? 20 : -1), style_val = 1., % float (1/80 inch) direction = 1, % int (always 1) % The shape of the ellipse can be described by % 3 points that specify the center, major, and minor axes. X = vector (qualifier ("x0", 0) + [0,a,0], qualifier ("y0", 0) + [0,0,b], qualifier ("z0", 0) + [0,0,0]) }); obj.render_to_fp = &render_ellipse_to_fp; obj.set_depth = &set_depth; obj.rotate = &rotate_ellipse; obj.translate = &translate_ellipse; obj.scale = &scale_ellipse; obj.get_bbox = &get_bbox_ellipse; obj.set_thickness = &set_thickness; obj.set_pen_color = &set_pen_color; obj.set_line_style = &set_line_style; obj.set_area_fill = &set_area_fill; obj.set_fill_color = &set_fill_color; return obj; } %}}} slxfig-pre0.2.0-138/src/xfig/text.sl0000644000175000000620000001362213745227527015735 0ustar johnstaff% This file is obsolete and has been replaced by the functions in latex.sl private variable Text_Type = struct { object, %int (always 4) sub_type, %int (0: Left justified, 1: Center justified, 2: Right justified) color, %int (enumeration type) depth, %int (enumeration type) pen_style, %int (enumeration , not used) font, %int (enumeration type) font_size, %float (font size in points) angle, %float (radians, the angle of the text) font_flags, %int --- bitmapped, see below height, %float (Fig units) length, %float (Fig units) X, % vector, projected x, y, %int (Fig units, coordinate of the origin % of the string. If sub_type = 0, it is the lower left corner of % the string. If sub_type = 1, it is the lower center. Otherwise % it is the lower right corner of the string.) string, %char (ASCII characters; starts after a blank %character following the last number and ends before the sequence %'\001'. This sequence is not part of the string. Characters %above octal 177 are represented by \xxx where xxx is the octal %value. This permits fig files to be edited with 7-bit editors %and sent by e-mail without data loss. Note that the string may %contain '\n'. }; private variable XFIG_FONT_FLAGS_RIGID = 0x1; % no scaling in compound private variable XFIG_FONT_FLAGS_SPECIAL = 0x2; % for LaTeX private variable XFIG_FONT_FLAGS_PS = 0x4; % Postscript private variable XFIG_FONT_FLAGS_HIDDEN = 0x4; % Hidden % The font field depends upon the value of bit 2. If 0, latex fonts are used: private variable Font_Table = Assoc_Type[Int_Type]; Font_Table["default"] = 0; Font_Table["roman"] = 1; Font_Table["bold"] = 2; Font_Table["italic"] = 3; Font_Table["sansserif"] = 4; Font_Table["typewriter"] = 5; %If bit 2 isset, Postscript fonts are used: Font_Table["psdefault"] = -1; Font_Table["pstimesroman"] = 0; Font_Table["pstimesitalic"] = 1; Font_Table["pstimesbold"] = 2; Font_Table["pstimesbolditalic"] = 3; Font_Table["psavantgardebook"] = 4; Font_Table["psavantgardebookoblique"] = 5; Font_Table["psavantgardedemi"] = 6; Font_Table["psavantgardedemioblique"] = 7; Font_Table["psbookmanlight"] = 8; Font_Table["psbookmanlightitalic"] = 9; Font_Table["psbookmandemi"] = 10; Font_Table["psbookmandemiitalic"] = 11; Font_Table["pscourier"] = 12; Font_Table["pscourieroblique"] = 13; Font_Table["pscourierbold"] = 14; Font_Table["pscourierboldoblique"] = 15; Font_Table["pshelvetica"] = 16; Font_Table["pshelveticaoblique"] = 17; Font_Table["pshelveticabold"] = 18; Font_Table["pshelveticaboldoblique"] = 19; Font_Table["pshelveticanarrow"] = 20; Font_Table["pshelveticanarrowoblique"] = 21; Font_Table["pshelveticanarrowbold"] = 22; Font_Table["pshelveticanarrowboldoblique"] = 23; Font_Table["psnewcenturyschoolbookroman"] = 24; Font_Table["psnewcenturyschoolbookitalic"] = 25; Font_Table["psnewcenturyschoolbookbold"] = 26; Font_Table["psnewcenturyschoolbookbolditalic"] = 27; Font_Table["pspalatinoroman"] = 28; Font_Table["pspalatinoitalic"] = 29; Font_Table["pspalatinobold"] = 30; Font_Table["pspalatinobolditalic"] = 31; Font_Table["pssymbol"] = 32; Font_Table["pszapfchancerymediumitalic"] = 33; Font_Table["pszapfdingbats"] = 34; % usage: (isps, font) = lookup_font (name); define xfig_lookup_font (name) { if (typeof (name) != String_Type) return XFIG_FONT_FLAGS_PS, name; variable str = strlow (strtrans (name, " \t_", "")); if (0 == assoc_key_exists (Font_Table, str)) { str = "ps" + str; if (0 == assoc_key_exists (Font_Table, str)) { () = fprintf (stderr, "*** Warning: font %s is not supported\n", name); return 0,0; } } variable flags = 0; if (0 == strncmp (str, "ps", 2)) flags |= XFIG_FONT_FLAGS_PS; return flags, Font_Table[str]; } define xfig_make_xfig_text (fontname, str) { variable flags, font; variable t = @Text_Type; t.object = 4; t.sub_type = 0; % left-justified t.color = xfig_lookup_color ("default"); t.depth = 50; t.pen_style = 0; (t.font_flags, t.font) = xfig_lookup_font (fontname); t.font_size = 12; t.angle = 0.0; t.height = NULL; t.length = NULL; t.X = vector (0, 0, 0); t.string = str; return t; } private define text_render (f, fp) { variable x, y; variable height = f.height, length = f.length; variable font = xfig_lookup_font (f.font); % There is no way to compute the width and height without knowing % information about the specific font. A crude estimate is used below. if (height == NULL) height = xfig_convert_inches (1.5*f.font_size/80.0); else height = xfig_convert_units (height); if (length == NULL) length = 0.75*xfig_convert_inches (f.font_size/80.0)*strlen (f.string); else length = xfig_convert_units (length); xfig_vwrite (fp, "%d %d %d %d %d %d %g %g %d %g %g ", f.object, f.sub_type, f.color, f.depth, f.pen_style, font, f.font_size, f.angle, f.font_flags, height, length); (x, y) = xfig_project_to_xfig_plane (f.X); xfig_vwrite (fp, "%d %d ", xfig_convert_units (x), xfig_convert_units (y)); xfig_vwrite (fp, "%s\\001\n",f.string); } private define text_translate (f, dX) { f.X = vector_sum (f.X, dX); } private define text_rotate (f, axis, theta) { f.X = vector_rotate (f.X, axis, theta); } private define text_scale () { variable f, sx, sy, sz; (f, sx, sy, sz) = _xfig_get_scale_args (_NARGS); variable X = f.X; X.x *= sx; X.y *= sy; X.z *= sz; } private define text_set_depth (obj, depth) { obj.depth = _xfig_verify_depth (depth); } define xfig_new_xfig_text (fontname, str) { variable text = xfig_make_xfig_text (fontname, str); variable obj = xfig_new_object (text); obj.render = &text_render; obj.translate = &text_translate; obj.rotate = &text_rotate; obj.scale = &text_scale; obj.set_depth = &text_set_depth; return obj; } slxfig-pre0.2.0-138/src/xfig/multipage.sl0000644000175000000620000001605113473706127016733 0ustar johnstaffrequire ("process"); % Render a file with multiple pages. This is accomplished by creating % a series of intermediate .eps files, and then use gs create the % final outout file % private variable Multipage_Type = struct { add, close, base, ext, save, page_files, bboxes, flags, }; private variable MP_SAVE = 0x01; private variable MP_RESCALE = 0x02; private variable MP_CENTER = 0x04; %!%+ %\function{xfig_multipage.add} %\synopsis{Add an xfig object to a multipage file} %\usage{.add(ob)} %\description % This function is used to render an xfig object to a multipage file. % This is done by rendering the object to an intermediate .eps file. % The file will removed upon closing the multipage file. %\qualifiers %\qualifier{save}{Keep the intermediate file, do not remove it} %\qualifier{file=fname}{Use \exmp{fname} as the basename of the %intermediate file. The .eps extension will be used.} %\seealso{xfig_multipage_open, xfig_multipage_close} %!%- private define multipage_add () { if (_NARGS != 2) usage (".multipage_add (m, obj; file=filename, save, rescale)"); variable m, obj; (m, obj) = (); variable page = length (m.page_files); variable file = qualifier ("file", m.base + "_pg$page"$ + ".eps"); if (path_extname (file) == "") file += ".eps"; obj.render (file); list_append (m.page_files, file); variable flags = 0; if (m.save || qualifier_exists ("save")) flags |= MP_SAVE; if (qualifier_exists ("rescale")) flags |= MP_RESCALE; list_append (m.flags, flags); if (path_extname (file) == ".eps") { list_append (m.bboxes, [xfig_get_eps_bbox (file)]); } } %!%+ %\function{xfig_multipage.close} %\synopsis{Close a multipage file} %\usage{.close} %\description % This function is used to close a multipage file. It will invoke % ghostscript to write the intermediate files to the final document, % and then remove those intermediate files that were flagged for % removal. %\qualifiers %\qualifier{verbose=value}{If greater than 0, show the ghostscript command line.} %\qualifier{crop}{If given, crop the resulting multipage file to the % largest bounding box of intermediate files.} %\qualifier{margin=value}{When not cropping, add a margins to each % page of the specified size in inches. The default is 0.5 inches} %\seealso{xfig_multipage_open, xfig_multipage.add} %!%- define xfig_multipage_close (m) { variable file = m.base + m.ext; variable verbose = (qualifier ("verbose", _XFig_Verbose) > 0); variable margin = qualifier ("margin", 0.5); variable crop = qualifier_exists ("crop"); variable close_flags = 0; if (qualifier_exists ("center")) close_flags |= MP_CENTER; if (qualifier_exists ("rescale")) close_flags |= MP_RESCALE; variable i, n = length (m.bboxes); variable pinfo = xfig_get_paper_size_info (); variable psscale = 72.0; % points per inch variable dev_width = pinfo.width*psscale, dev_height = pinfo.height*psscale, dev_margin = margin*psscale; variable input_files = m.page_files; variable bboxes = m.bboxes; variable new_input_files = {}; variable need_bbox_flags = MP_RESCALE|MP_CENTER; _for i (0, n-1, 1) { variable flags = m.flags[i] | close_flags; if (flags & need_bbox_flags) { variable bbox = bboxes[i]; variable x0 = bbox[0], y0 = bbox[1], x1 = bbox[2], y1 = bbox[3]; variable dx = double(x1-x0), dy = double(y1-y0), xc = 0.5*(x0+x1), yc = 0.5*(y0+y1); variable scale = 1.0, tx = 0.0, ty = 0.0; if (flags & MP_RESCALE) { variable sx = (dev_width-2*dev_margin)/dx; variable sy = (dev_height-2*dev_margin)/dy; scale = _min(sx,sy); tx = dev_margin - sx*x0; ty = dev_margin - sy*y0; } if (flags & MP_CENTER) { tx = (0.5*dev_width - scale*xc); ty = (0.5*dev_height - scale*yc); } list_append (new_input_files, "-c"); list_append (new_input_files, "<> setpagedevice"$); list_append (new_input_files, "-f"); } list_append (new_input_files, input_files[i]); } input_files = list_to_array (new_input_files); dev_width = nint(dev_width); dev_height = nint(dev_height); variable argv = ["gs", "-q", "-dNOPAUSE", "-dBATCH", "-dSAFER", "-dCompatibilityLevel=1.3", "-sPAPERSIZE=" + strlow(pinfo.name), "-dPDFSETTINGS=/printer", %"-dDEVICEWIDTH=$dev_width"$, "-dDEVICEHEIGHT=$dev_height"$, "-dPDFFitPage", %"-dFIXEDMEDIA", crop ? ["-dEPSCrop"] : (), "-sDEVICE=pdfwrite", "-dSubsetFonts=true", "-dEmbedAllFonts=true", "-sOutputFile=" + file, input_files ]; %argv = ["pdftk", list_to_array(m.page_files), "cat", "output", file]; variable cmd = strjoin (argv, " "); if (verbose) message ("$ " + cmd); variable s = new_process (argv).wait(); if ((s.exited == 0) || s.exit_status) throw OSError, "Process failed:\n" + cmd; _for i (0, n-1, 1) { ifnot (m.flags[i] & MP_SAVE) () = remove (m.page_files[i]); } } %!%+ %\function{xfig_multipage_open} %\synopsis{Create an xfig multipage file} %\usage{m = xfig_multipage_open (String_Type file [;qualifiers])} %\description % This function will create a new multipage file. Xfig objects may % be written to the multipage file using the .add method. Each call % to the .add method will result in the object being rendered to an % intermediate eps file. When finished, the .close method must be used to % produce the final file and remove the intermediate files. % % The \exmp{file} parameter is used to specify the name of the % multipage file. Only multipage pdf files are supported; hence, the % filename extension must be \exmp{.pdf}. %\qualifiers %\qualifier{save}{Do not remove the intermediate files} %\example % m = xfig_multipage_open ("example.pdf"); % w = xfig_plot_new (); % % Code create the first plot % m.add (w); % w = xfig_plot_new (); % % Code to create the second plot % m.add (w); % m.close (); %\seealso{xfig_multipage.close, xfig_multipage.add} %!%- define xfig_multipage_open () { if (_NARGS != 1) { usage ("\n\ m = xfig_multipage_open (file; save)\n\ m.add (obj; file=name, save)\n\ m.close()\n\ Note: The save qualifier means that the intermediate file will be saved.\n\ Intermediate filenames will created with the basename suffixes _pgN\n\ " ); } variable file = (); variable m = @Multipage_Type; m.add = &multipage_add; m.close = &xfig_multipage_close; m.base = path_sans_extname (file); m.ext = path_extname (file); if (m.ext == "") m.ext = ".pdf"; if (m.ext != ".pdf") throw NotImplementedError, "Only a multipage .pdf files are supported"; m.save = qualifier_exists("save"); m.page_files = {}; m.flags = {}; m.bboxes = {}; m.close = &xfig_multipage_close; return m; } slxfig-pre0.2.0-138/src/xfig/latex.sl0000644000175000000620000005054614243360327016062 0ustar johnstaff% -*- mode: slang; mode: fold -*- % LaTeX and EPS interface %{{{ Tmpfile and Dir handling Functions try require ("chksum"); % for sha1 catch AnyError; private variable EPS_Dir = NULL; private variable Latex_Cache = NULL; define xfig_set_autoeps_dir (dir) { xfig_mkdir (dir); ifnot (path_is_absolute (dir)) { variable cwd = getcwd (); if (cwd != NULL) dir = path_concat(cwd, dir); } EPS_Dir = dir; Latex_Cache = NULL; } define xfig_get_autoeps_dir () { if (EPS_Dir == NULL) xfig_set_autoeps_dir ("autoeps"); return EPS_Dir; } private define make_sha1_cached_filename (sha1, ext) { variable dir = path_concat (xfig_get_autoeps_dir (), sprintf ("%c%c", sha1[0], sha1[1])); return path_concat (dir, strcat (sha1, ext)); } private define make_auto_file (base, ext, sha1) { if (sha1 == NULL) { base = path_concat (xfig_get_autoeps_dir (), base); return xfig_make_tmp_file (base, ext); } variable file = make_sha1_cached_filename (sha1, ext); variable dir = path_dirname (file); if ((-1 == mkdir (dir)) && (errno != EEXIST)) throw OSError, sprintf ("Unable to mkdir %s: %s", dir, errno_string()); return file; } private define make_tmp_latex_file (base) { variable file = xfig_make_tmp_file (base, ".tex"); foreach (path_sans_extname (file) + [".log", ".dvi", ".aux", ".tex"]) { variable f = (); xfig_add_tmp_file (f); } return file; } %}}} %{{{ Running LaTeX and dvips private variable LaTeX_Pgm = "latex"; private variable Dvi2Eps_Method = 0; private define search_for_executable (file) { variable path = getenv ("PATH"); if (path == NULL) return NULL; variable delim = path_get_delimiter (); foreach (strtok (path, char(delim))) { variable dir = (); variable dirfile = path_concat (dir, file); if (NULL != stat_file (dirfile)) return dirfile; } return NULL; } #ifdef SLXFIG_RENDER_LATEX_AS_TRANSPARENT_PNG if ((NULL == search_for_executable ("dvipng")) || (NULL == search_for_executable ("rsvg-convert"))) { () = fprintf (stderr, "\ *** ERROR: SLXFIG_RENDER_LATEX_AS_TRANSPARENT_PNG is defined but \n\ required programs `dvipng` and `rsvg-convert` coult no be found.\n\ " ); throw RunTimeError; } private variable Png_Resolution = 600; define xfig_set_png_resolution (png_resolution) { Png_Resolution = png_resolution; } #endif private define run_cmd (do_error, cmd) { variable verbose = qualifier("verbose", _XFig_Verbose); variable exec_exists = 1; variable exec = strtok (cmd, " \t")[0]; if (path_is_absolute (exec)) { if (NULL == stat_file (exec)) exec_exists = 0; } else { exec_exists = (NULL != search_for_executable (exec)); } ifnot (exec_exists) verbose = 1; if (verbose <= 0) cmd += " >/dev/null 2>&1"; if (verbose >= 0) message("$ "+cmd); variable status = system_intr (cmd); if (status != 0) { variable msg = sprintf ("%s returned a non-zero status=%d\n", cmd, status); if (do_error) throw OSError, msg; vmessage ("****WARNING: %s", msg); } return status; } private define run_latex (file) { variable switches = "-interaction=batchmode"; variable dir = path_dirname (file); variable base = path_basename (file); if (0 == run_cmd (0, sprintf ("cd '%s'; %s %s '%s'", dir, LaTeX_Pgm, switches, base))) return; switches = ""; () = run_cmd (1, sprintf ("cd '%s'; %s %s '%s'", dir, LaTeX_Pgm, switches, base) ; verbose=1 ); } private define process_dvi (dvi, target) { #ifdef SLXFIG_RENDER_LATEX_AS_TRANSPARENT_PNG () = run_cmd (1, sprintf ("dvipng -bgTransparent -D%d -Ttight '%s' -o '%s'", Png_Resolution, dvi, target)); #else variable tmp_eps = xfig_make_tmp_file (path_basename_sans_extname(target), ".eps"); variable tmp_ps = path_sans_extname (tmp_eps) + ".ps"; switch (qualifier ("dvi2eps_method", Dvi2Eps_Method)) { case 0: % works fine for non-rotated text, but clips BoundingBox for rotated text () = run_cmd (1, sprintf ("dvips -E '%s' -o '%s'", dvi, target)); } { case 1: % eps output is ugly, also when converted to png, but okay when converted to pdf. % eps2eps does not preserve the text (in vector format)! % eps2eps sometimes generates 0 size bounding box, causing gs to produce NaNs. () = run_cmd (1, sprintf ("dvips -E '%s' -o '%s'", dvi, tmp_eps)); () = run_cmd (1, sprintf ("eps2eps '%s' '%s'", tmp_eps, target)); } { case 2: % ps2epsi fails for some colors including #FF00000 () = run_cmd (1, sprintf ("dvips -E '%s' -o '%s'", dvi, tmp_eps)); () = run_cmd (1, sprintf ("ps2epsi '%s' '%s'", tmp_eps, target)); % () = remove (tmp_eps); % tidy up tmp dir? } { case 3: % ps2eps sometimes clips BoundingBox for rotated text (despite the -B option) () = run_cmd (1, sprintf ("dvips '%s' -o '%s'", dvi, tmp_ps)); () = run_cmd (1, sprintf ("ps2eps -B -f '%s'", tmp_ps)); () = run_cmd (1, sprintf ("mv '%s' '%s'", tmp_eps, target)); % S-Lang's `rename' might fail % () = remove (tmp_ps); % tidy up tmp dir? } { case 4: % ps2eps with --loose (does not produce a tight BoundingBox) () = run_cmd (1, sprintf ("dvips '%s' -o '%s'", dvi, tmp_ps)); () = run_cmd (1, sprintf ("ps2eps -l -B -f '%s'", tmp_ps)); () = run_cmd (1, sprintf ("mv '%s' '%s'", tmp_eps, target)); % S-Lang's `rename' might fail % () = remove (tmp_ps); % tidy up tmp dir? } #endif } %}}} private variable Latex_Packages = {"amsmath", "color"}; private variable Latex_Font_Size = 12; private variable Latex_Default_Color = "black"; private variable Latex_Default_Font_Style = `\bf\boldmath`; private variable Supported_Font_Sizes = [ `\tiny`, `\scriptsize`, `\footnotesize`, `\small`, `\normalsize`, `\large`, `\Large`, `\LARGE`, `\huge`, `\Huge` ]; private variable Preamble_Commands = NULL; define xfig_get_eps_bbox (file) { variable x0, y0, x1, y1; variable fp = fopen (file, "r"); if (fp == NULL) verror ("Unable to open %s", file); variable inside = 0; foreach (fp) using ("line") { variable line = (); if (line[0] != '%') continue; if (0 == strncmp ("%%Begin", line, 7)) { inside++; continue; } if (0 == strncmp ("%%End", line, 5)) { if (inside) inside--; continue; } if (inside) continue; if (strncmp ("%%BoundingBox:", line, 14)) continue; if (is_substr (line, "(atend)")) continue; line = strchop (line, ':', 0)[1]; if (4 != sscanf (line, "%f %f %f %f", &x0, &y0, &x1, &y1)) break; return (x0, y0, x1, y1); } verror ("Bad or no bounding box in EPS file %s", file); } private define output (fp, s) { if (-1 == fputs (s, fp)) verror ("Write to latex file failed"); } private define open_latex_file (file) { variable fp = fopen (file, "w"); if (fp == NULL) verror ("Unable to open %s", file); return fp; } private define check_font_struct (s) { variable f = s.size; if (f == NULL) f = "\\normalsize"; if (f[0] != '\\') f = strcat ("\\", f); if (all (Supported_Font_Sizes != f)) { () = fprintf (stderr, "*** Warning: font size %s not supported\n", f); f = "\\normalsize"; } s.size = f; f = s.color; if (f == NULL) f = 0; if (typeof (f) == String_Type) f = xfig_lookup_color_rgb ( strreplace (strlow (f), " ", "") ); s.color = f; f = s.style; if (f != NULL) { if (f[0] != '\\') f = strcat ("\\", f); #iffalse if (0 == length (where (f == Supported_Styles))) { () = fprintf (stderr, "*** Warning: font style %s not supported\n", f); f = NULL; } #endif } s.style = f; } private define make_font_struct () { return struct { color = qualifier ("color", Latex_Default_Color), style = qualifier ("style", Latex_Default_Font_Style), size = qualifier ("size", "\\normalsize"), }; } define xfig_make_font () %!%+ %\function{xfig_make_font} %\synopsis{Create a font structure used by SLxfig's LaTeX interface} %\usage{Struct_Type xfig_make_font ([String_Type style, size, color])} %\qualifiers %\qualifier{style}{}{"\\bf\\boldmath"R} %\qualifier{size}{}{"\\normalsize"R} %\qualifier{color}{}{"black"} %\description % If \exmp{color} is a string, it is considered to be % a named color from the SLxfig color interface. % Alternatively, \exmp{color} can be an integer number, % representing the color's RGB value. % % \exmp{style}, \exmp{size}, \exmp{color} arguments different from \exmp{NULL} % overwrite qualifier values. %\seealso{xfig_new_text} %!%- { variable s = make_font_struct (;;__qualifiers); if (_NARGS == 0) return s; if (_NARGS != 3) usage ("font = %s (style, size, color)", _function_name ()); variable color=(), size=(), style=(); if (style != NULL) s.style = style; if (size != NULL) s.size = size; if (color != NULL) s.color = color; return s; } private define add_unique_packages (list, dlist) { variable p, l; foreach p (dlist) { foreach l (list) { if (l == p) break; } then list_append (list, p); } } private define get_package_list (extra) { variable packages = {}; add_unique_packages (packages, Latex_Packages); if (extra != NULL) { if ((typeof(extra) != List_Type) && (typeof(extra) != Array_Type)) extra = {extra}; add_unique_packages (packages, extra); } return packages; } private define make_preamble (font) { variable str; str = sprintf ("\\documentclass[%dpt]{article}\n", Latex_Font_Size); foreach (get_package_list (qualifier("extra_packages"))) { variable package = (); variable m = string_matches(package, `\(.*\)\(\[.*\]\)`); % package has options? str += sprintf ( m==NULL ? ("\\usepackage{%s}\n", package) : ("\\usepackage%s{%s}\n", m[2], m[1]) ); } if (font == NULL) font = xfig_make_font (NULL, NULL, NULL); check_font_struct (font); if (font.color != 0) { variable rgb = font.color; variable r = (rgb & 0xFF0000) shr 16; variable g = (rgb & 0xFF00) shr 8; variable b = (rgb & 0xFF); str = sprintf ("%s\\definecolor{defaultcolor}{rgb}{%.3g,%.3g,%.3g}\n", str, r / 255.0, g/255.0, b/255.0); str = strcat (str, "\\color{defaultcolor}\n"); } if (Preamble_Commands != NULL) str = strcat (str, Preamble_Commands, "\n"); variable preamble = qualifier ("preamble", NULL); if (preamble != NULL) { if (preamble[-1] != '\n') preamble += "\n"; str = strcat (str, preamble); } % End of preamble str = strcat (str, "\\begin{document}\n\\pagestyle{empty}\n"); if (font.style != NULL) str = strcat (str, font.style, "\n"); if ((font.size != NULL) && (font.size != "\\normalsize")) str = strcat (str, font.size, "\n"); return str; } private define close_latex_file (fp) { output (fp, "\n\\end{document}\n"); if (-1 == fclose (fp)) verror ("Error closing latex file"); } private define make_latex_env (env, envargs, body) { if (env != NULL) body = sprintf ("\\begin{%s}%s\n%s\n\\end{%s}", env, envargs, body, env); return body; } private define write_latex_file (file, str) { variable fp = open_latex_file (file); output (fp, str); close_latex_file (fp); } private define make_latex_string (env, envargs, text, fontstruct) { variable str = make_preamble (fontstruct;; __qualifiers); return strcat (str, make_latex_env (env, envargs, text)); } private define escape_latex_string (str) { return strtrans (str, "\n\t", "\001\002"); } private define find_cached_file_sha1 (sha1, ext) { variable file = make_sha1_cached_filename (sha1, ext); if (-1 == access (file, R_OK)) file = NULL; return file; } private define upgrade_autoeps_file_to_sha1 (epsfile, ext, sha1) { variable sha1file = make_sha1_cached_filename (sha1, ext); variable dir = path_dirname (sha1file); () = mkdir (dir); if (-1 == rename (epsfile, sha1file)) { throw OSError, sprintf ("Unable to rename %s to %s: %s", epsfile, sha1file, errno_string ()); } return sha1file; } private define add_to_cache (epsfile, escaped_str) { if (NULL == stat_file (epsfile)) return; if (Latex_Cache == NULL) Latex_Cache = Assoc_Type[String_Type]; Latex_Cache[escaped_str] = epsfile; } private define open_cache_data (mode) { variable dir = xfig_get_autoeps_dir (); variable file = path_concat (dir, "epscache.dat"); variable fp = fopen (file, mode); if(fp==NULL && mode=="w") throw WriteError, sprintf ("Writing to cache file %s failed: %S", file, errno_string (errno)); return fp; } private define close_cache (fp) { () = fclose (fp); } private define load_cache () { if (Latex_Cache != NULL) return; variable fp = open_cache_data ("r"); if (fp == NULL) return; foreach (fp) using ("line") { variable line = (); line = strtok (line, "\t\n"); if (length (line) != 2) continue; add_to_cache (line[0], line[1]); } close_cache (fp); } private define save_cache () { if (Latex_Cache == NULL) return; variable fp = open_cache_data ("w"); variable k, v; foreach k, v (Latex_Cache) using ("keys", "values") { () = fprintf (fp, "%s\t%s\n", v, k); } close_cache (fp); } private define find_cached_file (str) { load_cache (); if (Latex_Cache == NULL) return NULL; ifnot (assoc_key_exists (Latex_Cache, str)) return NULL; variable file = Latex_Cache[str]; if (-1 == access (file, R_OK)) { assoc_delete_key (Latex_Cache, str); #ifexists sha1sum save_cache (); % shrink the cache table on disk #endif file = NULL; } return file; } private define latex_xxx2eps (env, envargs, xxx, base, fontstruct) { variable str = make_latex_string (env, envargs, xxx, fontstruct;; __qualifiers); variable hash = escape_latex_string (str); variable sha1, target; #ifdef SLXFIG_RENDER_LATEX_AS_TRANSPARENT_PNG variable ext = ".png"; #else variable ext = ".eps"; #endif #ifexists sha1sum sha1 = sha1sum (hash); target = find_cached_file_sha1 (sha1, ext); if (target == NULL) { target = find_cached_file (hash); if (target != NULL) { target = upgrade_autoeps_file_to_sha1 (target, ext, sha1); save_cache (); } } #else target = find_cached_file (hash); sha1 = NULL; #endif if (target != NULL) { if (_XFig_Verbose > 0) { vmessage ("Using cached file %s", target); } return target; } variable tex = make_tmp_latex_file (base); target = make_auto_file (base, ext, sha1); write_latex_file (tex, str); run_latex (tex); process_dvi (path_sans_extname (tex) + ".dvi", target ;; __qualifiers); if (sha1 == NULL) { add_to_cache (target, hash); save_cache (); } return target; } private define xfig_text2eps (text, fontstruct) { return latex_xxx2eps (NULL, NULL, text, "text", fontstruct;; __qualifiers); } private variable Equation_Number = 0; private define equation_function_env (eq, env, fontstruct) { Equation_Number++; variable base = sprintf ("eq_%d", Equation_Number); eq += " \\nonumber"; return latex_xxx2eps (env, "", eq, base, fontstruct;; __qualifiers); } define xfig_eq2eps () { variable fontstruct = NULL; if (_NARGS == 2) fontstruct = (); if (fontstruct == NULL) fontstruct = make_font_struct (;;__qualifiers); variable eq = (); return equation_function_env (eq, "equation*", fontstruct;; __qualifiers); } define xfig_eqnarray2eps () { variable fontstruct = NULL; if (_NARGS == 2) fontstruct = (); if (fontstruct == NULL) fontstruct = make_font_struct (;;__qualifiers); variable eq = (); return equation_function_env (eq, "eqnarray*", fontstruct;; __qualifiers); } define xfig_new_eps (file) %!%+ %\function{xfig_new_eps} %\synopsis{Create an SLxfig picture object from an eps file} %\usage{obj = xfig_new_eps(String_Type filename);} %\qualifiers % All qualifiers are passed to the \sfun{xfig_new_pict} function. %\seealso{xfig_new_pict} %!%- { variable x0, x1, y0, y1; (x0, y0, x1, y1) = xfig_get_eps_bbox (file); variable dx = xfig_scale_from_inches ((x1 - x0)/72.0); variable dy = xfig_scale_from_inches ((y1 - y0)/72.0); return xfig_new_pict (file, dx, dy;; __qualifiers); } private define do_xfig_new_xxx (fun, text, fontstruct) { variable eps = (@fun) (text, fontstruct;; __qualifiers); #ifdef SLXFIG_RENDER_LATEX_AS_TRANSPARENT_PNG variable png = xfig_new_png (eps;; __qualifiers); png.scale(72./Png_Resolution); return png; #else return xfig_new_eps (eps;; __qualifiers); #endif } define xfig_new_eq (eq) { variable fontstruct = NULL; if (_NARGS == 2) fontstruct = (); if (fontstruct == NULL) fontstruct = make_font_struct (;;__qualifiers); do_xfig_new_xxx (&xfig_eq2eps, eq, fontstruct;; __qualifiers); } define xfig_new_text () %{{{ %!%+ %\function{xfig_new_text} %\synopsis{Create a text object by running LaTeX} %\usage{obj = xfig_new_text (String_Type text [,font_object])} %\qualifiers %\qualifier{extra_packages}{NULL} %\qualifier{preamble}{}{NULL} %\qualifier{color=strval}{}{"black"} %\qualifier{style=strval}{}{"\\bf\\boldmath"R} %\qualifier{size=strval}{}{"\\normalsize"R} %\qualifier{rotate=angle}{rotate text by \exmp{angle} in degrees}{0} %\qualifier{dvi2eps_method}{} %\qualifier{x0}{x-position}{0} %\qualifier{y0}{y-position}{0} %\qualifier{z0}{z-position}{0} %\qualifier{depth}{Xfig depth} %\qualifier{just=[jx,jy]}{justification, see \sfun{xfig_new_pict}}{[0,0]} %\description % This function runs LaTeX on the specified text string and returns the % resulting object. The text string must be formatted according to the LaTeX % rules. The optional parameter is a structure that may be used to specify % the font, color, pointsize, etc to use when calling LaTeX. This structure % may be instantiated using the xfig_make_font. %\seealso{xfig_make_font, xfig_add_latex_package, xfig_set_latex_preamble, xfig_new_pict} %!%- %#c make_font_struct %#c -> rotate %#c do_xfig_new_xxx %#c + xfig_text2eps %#c | + latex_xxx2eps %#c | + make_latex_string %#c | | + make_preamble %#c | | +-> extra_packages %#c | | +-> preamble %#c | + process_dvi %#c | +-> dvi2eps_method %#c + xfig_new_eps %#c + xfig_new_pict %#c +-> x0, y0, z0 %#c + xfig_new_polyline %#c | -> depth, ... %#c +-> just { variable fontstruct = NULL; if (_NARGS == 2) fontstruct = (); if (fontstruct == NULL) fontstruct = make_font_struct (;;__qualifiers); variable text = (); variable q = __qualifiers(); variable rotate = qualifier("rotate"); variable theta = 0; if ((rotate!=NULL) && (0 < __is_datatype_numeric(typeof(rotate)) < 3)) { if (rotate mod 90 != 0) { text = sprintf ("\\rotatebox{%S}{%s}", rotate, text); q = struct_combine (struct{extra_packages="graphicx", dvi2eps_method=3}, q); } else theta = rotate; } variable eps = do_xfig_new_xxx (&xfig_text2eps, text, fontstruct;; q); if (theta != 0) eps.rotate_pict(theta); return eps; } %}}} define xfig_set_font_style (style) %!%+ %\function{xfig_set_font_style} %\synopsis{Set the default font style for LaTeX} %\usage{xfig_set_font_style (String_Type style);} %\description % Unless changed, the default font style is "\\bf\\boldmath"R. %\seealso{xfig_make_font, xfig_new_text, xfig_add_latex_package} %!%- { Latex_Default_Font_Style = style; } define xfig_add_latex_package () %!%+ %\function{xfig_add_latex_package} %\synopsis{Load a package in the preamble of latex documents.} %\usage{xfig_add_latex_package (String_Type package[, package2, ...]);} %\qualifiers %\qualifier{prepend}{\exmp{package} is inserted before previous packages} %\description % Options can be added to \exmp{package} in square brackets: %\example % xfig_add_latex_package("fontenc[T1]", "mathpazo[osf]"); %!%- { variable package; foreach package (__pop_list (_NARGS)) if(qualifier_exists("prepend")) list_insert (Latex_Packages, package, 0); else list_append (Latex_Packages, package, -1); } define xfig_set_latex_preamble (preamble) %!%+ %\function{xfig_set_latex_preamble} %\usage{xfig_set_latex_preamble (String_Type preamble)} %\seealso{xfig_get_latex_preamble} %!%- { Preamble_Commands = preamble; } define xfig_get_latex_preamble () %!%+ %\function{xfig_get_latex_preamble} %\usage{String_Typer xfig_get_latex_preamble ()} %\seealso{xfig_set_latex_preamble} %!%- { return Preamble_Commands; } define xfig_dvi2eps_method (method) { Dvi2Eps_Method = method; } slxfig-pre0.2.0-138/INSTALL0000644000175000000620000000303611453303746013704 0ustar johnstaff-*- text -*- To use this package you need to have slang (2.2.3 or higher), LaTeX, and xfig installed. Installing the package involves running the configure script, then running `make`, followed by `make install`. The configure script has two important options: --prefix=/installation-path-prefix This specifies path-prefix for the slxfig package --with-slang=/prefix-for-slang-2 This option is used to specify where slang-2 is located. If this option is unspecified, the argument specified for --prefix will be used. For example, suppose that slang-2 is installed under /usr/local, and that you wish to install the slxfig package under /home/bob/soft/. Then run the configure script via: ./configure --prefix=/home/bob/soft --with-slang=/usr/local This will cause the slxfig package to be installed in /home/bob/soft/lib/slang/v2/modules/ /home/bob/soft/share/slsh/local-packages/ Since in this case the installation directory is different from the slang location, slsh will not be able to find the slxfig package unless told where to look. The standard mechanism for doing this is to add: append_to_slang_load_path("/home/bob/soft/share/slsh/local-packages"); set_import_module_path (get_import_module_path() + ":/home/bob/soft/lib/slang/v2/modules); to your ~/.slshrc file. Now type make to create the package: make Assuming this step was successful, install it: make install To test the installation, try building some of the examples in the examples directory. slxfig-pre0.2.0-138/COPYING0000644000175000000620000004312711325613443013707 0ustar johnstaff GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. slxfig-pre0.2.0-138/changes.txt0000644000175000000620000003673014551442151015027 0ustar johnstaffChanges since 0.1.0 1. src/xfig/plot.sl: modified major/minor axis routines to better deal with tic marks that span many orders of magnitude for log plots. 2. src/xfig/plot.sl: If a log-axis does not include a point 10^n, then use linear tics-marks. 3. src/xfig/plot.sl: Allow major/minor tic positions to be specified. 4. src/xfig/core.sl: Changed the way the colors are indexed to allow and allow colors to be specified by index. 5. src/xfig/polyline.sl: pict_scale was using the wrong object. 6. src/xfig/plot.sl: Use \times instead of \cdot for labels in the alt format 7. src/xfig/plot.sl: If a sym qualifier is given, do not draw lines unless line is also specified. 8. src/xfig/plot.sl: hplot method added for plotting histograms. 9. src/xfig/plot.sl: get_*_depth functions included a depth argument 10. src/xfig/plot.sl: Avoid the use of (@Array_Type) to create an array. 11. src/xfig/core.sl: Added orange, orange2-4 colors. 12. src/xfig/core.sl: All objects get set_pen_color, set_area_fill, set_thickness, set_lines_style, and set_fill_color methods. 13. src/xfig/objects.sl: Added qualifier support to a few functions. 14. src/xfig/polyline.sl: Added "just" qualifier to the xfig_new_pict function to specify its local coordinate system origin. 15. src/xfig/ellipse.sl: Fixed some bugs that surfaced when porting old code to use this version of xfig. 16. src/xfig/latex.sl: Added qualifier support to allow the "just" qualifier to propagate into the xfig_new_pict function. 17. examples/plot.sl: Tweaked some of the examples 18. src/xfig/plot.sl: plot_symbols now uses a polyline_list instead of individual polylines. This makes it run faster when many points are involved. 19. src/xfig/core.sl: If an integer is passed to xfig_lookup_color, the value returned will be modulo num_colors. 20. src/xfig/polyline.sl: Use xfig_lookup_color in set_color methods. 21. src/xfig/plot.sl: Added "star", "larr", "rarr", "uarr", and "darr" symbols. Also added xfig_plot_get_symbol_names functions. 22. examples/plot/symbol.sl: Rewrote this example. 23. src/vector.c: Modified the "vector" function to avoid an extra function when converting numeric value to a double. 24. src/xfig/polyline.sl: Tweaked the polyline_list_bbox method to improve performance. 25. src/xfig/plot.sl: added areafill and fillcolor qualifiers to the xfig_new_legend function. 26. src/xfig/polyline.sl: pict_scale was not accounting for the absolute position of the pict. 27. src/xfig/plot.sl: Added support for plotting via mixed world systems, e.g., world12, world21, etc. Also, world0 may be used to refer to device coordinates, which run from 0 to 1. 28. src/xfig/plot.sl: The hplot method will call the shaded histogram routine if a fill qualifier is given. 29. examples/plot/world.sl: A new example. Also some other examples were updated. 30. src/xfig/plot.sl: Added shade_region method and updated the world.sl example to illustrate its use. 31. src/xfig/plot.sl: When placing the title, account for the x2label. 32. src/xfig/plot.sl: Ignore tic_linestyle qualifier unless gridding. 33. src/xfig/plot.sl: Cleaned up the tic labeling code and added some minor tic labels when using log scaling. 34. src/vector.sl: small optimizations 35. src/xfig/clip.sl: Use slang2.2.0 list_to_array. 36. src/xfig/core.sl: Inline the vector calls in intersect_focal_plane. 37. src/xfig/plot.sl: Rewrote the way custom world coordinate systems were handled. I also added a "cdf" system that is designed for plots of cumulative distribution functions. 38. src/xfig/*.sl: Replaced calls to system by calls to system_intr. 39. src/xfig/core.sl: Added an entry for .pdf to the device table. 40. src/xfig/latex.sl: Rewrote the cache code to use an assoc array. 41. src/xfig/plot.sl: Added format=val qualifier to axis method 42. src/xfig/plot.sl: Invalid index error in plot_shaded_histogram 43. src/xfig/plot.sl: Added sqrt plot transform 44. src/xfig/latex.sl: Added xfig_get/set_latex_preamble for adding additional elements to the preamble. 45. A preamble=value qualifier added to the latex functions to add additional lines to the latex preamble. 46. src/xfig/plot.sl: Added xfig_plot_get/set_default_size functions for setting the default plot sizes (w=14, h=10 are the defaults). 47. src/xfig/core.sl: Added "gray" color. 48. src/xfig/core.sl: rewrote Eye code to allow for a "roll". 49. src/xfig/core.sl: Modified the way the roll was implemented. 50. src/xfig/*.sl: Added a number of changes from Manfred Hanke. 51. src/xfig/core.sl: Defer the color lookups by the container objects to the objects themselves. 52. doc/*: Updated docs. 53. src/gcontour.sl: Remove unused code and fix a typo involving a reference to a local variable. (Manfred Hanke) 54. src/xfig/plot.sl: New function: xfig_multiplot, which may be used to conveniently stack plot objects on top of one another. (Manfred Hanke). 55. examples/plot/multiplot.sl: New example provided by Manfred Hanke. 56. examples/plot/image.sl: Use xfig_meshgrid instead of maplib function (Manfred Hanke). 57. src/xfig/polyline.sl: Allow xfig_new_polyline to accept a structure mimicking a Vector_Type object. (Manfred Hanke). 58. src/xfig/plot.sl: Added support for asymmetric error bars. Also error bars for histograms are added at the center of the bin. (Manfred Hanke). 59. src/Makefile.in: Changes made to have the value of the _xfig_version_string track the changes.txt file. 60. src/xfig/plot.sl: The "ticlabels" qualifier to the plot functions may be used to specify user-defined labels. See the examples/plot/ticlabels.sl for examples. (Manfred Hanke). 61. src/xfig/plot.sl: Added a get_world method to the plot object: w = xfig_plot_new (); . . world = w.get_world(); % ==> xmin=world[0], xmax=world[1],... 62. src/xfig/core.sl: Adjusted the order of plotting colors. Also added "colors" example, which shows the colors. 63. src/xfig/core.sl: Added xfig_set_verbose and a new function called _xfig_check_help which handles the "help" qualifier. 64. src/xfig/polyline.sl: Added qualifier support to xfig_create_arrow for various arrow types (Manfred Hanke). 65. src/xfig/plot.sl: Numerous doc updates, and added support for a "help" qualifier (Manfred Hanke). 66. doc/: documentation updates (requires very recent version of tmexpand) (Manfred Hanke) 67. src/xfig/plot.sl: When creating tic labels in scientific notation, use the same exponent. 68. src/xfig/clip.sl: clips involving infinite values were not always being handled properly. 69. examples/plot/*.sl: removed dependence upon gsl. 70. merged a number of changes from Manfred Hanke (see git log for details): * documentation updates * Additional examples * added src/test/* * latex.sl: graphicx added to package latex package list, xfig_set_latex_verbosity function, ... * plot.sl: fixes to the plot_scale method. depth qualifiers for error bars, etc, 71. xfig/latex.sl: Changed the way verbose is handled. Also if latex fails, run it again in interactive mode so that the error message gets displayed. 72. src/tests/: Renamed and modified the test scripts. 73. src/xfig/plot.sl: Pass qualifiers to _xfig_check_help. 74. src/*: Merged a number of changes from Manfred Hanke, including: Documentation updates Misc bugs fixes Updated examples Some code simplifications To see the details, use `git diff 9bacc1f..8595a99`. 75. src/xfig/plot.sl: The "depth" qualifier may be a reference to a variable, which if NULL, will be set upon return to the depth used: depth = NULL; w.plot (x1, y1; depth=&depth); w.plot (x2, y2; depth=depth-1); 76. src/xfig/latex.sl: If latex fails, run again with verbose=1. 77. examples/: Added pict/ and draw/ examples. 78. src/xfig.sl: Obsolete text.sl is nolonger loaded. 79. src/xfig/core.sl,latex.sl: tmpfile functions moved to core.sl 80. src/xfig/core.sl: added xfig_add_tmp_file, which will schedule a file for deletion at exit. The ;delete qualifier to xfig_make_tmp_file will also do this. 81. src/plot.sl: Tweak ticlabels when min/max axis limits are nearly equal. 82. examples/plot/overlay.sl: img1 and img2 were not always the same size. 83. src/plot.sl: Modified change #81. 84. src/xfig/polyline.sl: Avoid writing really long lines to the output file. 85. Various updated from Manfred Hanke: * ticlabels in a plot respect default font style; font-related docs updated * xfig_plot.plot_png accepts arrays and produces pngs automatically * new .justify method; xfig_justify_object can work relative to other objects * colors can be specified as "#RRGGBB" with 6 hex-digits for RGB * A histogram plot's x-array may now also contain the last bin's upper limit, if it has one element more than the y-array of the histogram data. 86. src/xfig/plot.sl: positioning bug-fix in xfig_multiplot (Manfred Hanke). 87. src/xfig/core.sl: #85 introduced a bug in the hbox/vbox functions (Manfred Hanke). 88. src/xfig/plot.sl: Change 67 introduced duplicate tic marks for grids running from, e.g, 0 to 30000. 89. src/xfig/plot.sl: Remove NaNs and Infs when determining the axis limits from the data. 90. merged Manfred's changes: - some documentation updates - unification of all examples' Makefiles - simplification of some plot-axes related code and improved support for axis bounding boxes - plots can include Xfig arrows - filled plot symbols do not require explicit area fill style = 20 - plots support depth qualifier for pngs / picts 91. src/xfig/plot.sl: tweaked the axis bbox code to fix a bbox problem in #90. 92. src/xfig/plot.sl: silly error introduced by #91 fixed (Manfred Hanke). 93. Used _min/_max in various places for bbox computations. 94. src/xfig/plot.sl: Add support for lists in convert_to_array. 95. src/xfig/plot.sl: Allow uninitialized reference in get_reftype_qualifier. 96. src/xfig/latex.sl: If the chksum module is present, use it create autoeps cache filenames based upon the sha1 checksum of the latex code. This makes the separate epscache.dat file obsolete. 97. Added labelsize qualifier to xfig_new_legend. 98. src/xfig/core.sl: Added jpeg output option. 99. src/xfig/polyline.sl: pict.rotate was not rotating the actual pict objec, just its bbox. 100. src/xfig/plot.sl: Allow the depth qualifier to be NULL. 101. Added patches from Manfred: documentation updates, render to a specified depth, different dvips methods. 102. tweak the tic code in plot.sl 103. xfig_new_photon: add npts qualifier to specify the number of pts per period. 104. Added support for W3C colornames, and a new example showing the colors (examples/pict/colornames.sl) 105. Justification qualifiers added to the xfig_new_h/vbox_compound functions: c = xfig_new_vbox_compound (a,b;just=-1) will left justify the objects. 106. src/xfig/polyline.sl: The rotate method was not rotating surface normals. 107. src/xfig/core.sl: autoload readascii (Thomas Dauser). 108. src/xfig/core.sl: Moved xfig_meshgrid from plot.sl, and reindented plot.sl 109. src/xfig/plot.sl: Tweaked the code to xfig_multiplot, and reformtted its documentation. 110. examples/plot/scilabel.sl was not in the git repository. 111. src/xfig/core.sl: A "fig" qualifier added to the render method: If 0, the .fig will be removed, otherwise it will be kept. The default is 0. 112. src/xfig/plot.sl: xfig_plot_new supports ticlabel qualifiers to define defaults. 113. Merged Manfred's updates: new example showing xfig fill-styles added description of 'format' qualifier to xfig_plot.axis documentation update reflecting change 112 Experimental support for for rendering LaTex as tranparent PNGs. (See examples/transparent/README) 114. mandlebrot.sl,font-style.sl: minor (cosmetic) tweaks: z^2 -> z*z and avoid \ at end of string literal (so that editors such as jed do not have to understand the semantics associated with backtick strings). 115. src/xfig/latex.sl: If an executable cannot be found on the path, enable verbose mode for better error checking. 116. src/xfig/latex.sl: in xfig_new_text set dvi2eps_method to 3 (was 2) for rotated text (Sebastian Falkner). 117. src/xfig/plot.sl: %.add_object was not working correctly if a log qualifier was given and was called before %.plot. To fix this %.add_object now initializes the plot. (Sebastian Falkner) 118. avoid empty line in .fig file for a polyline with n x 16 vertices, which does not work with some versions of fig2dev. (Manfred Hanke) 119. src/xfig/core.sl: Added xfig_get/add_paper_info functions that may be used to obtain get or add paper size information. 120. src/xfig/multiplot.sl: Added xfig_multipage_open function that allows the creation of a PDF file with multiple pages. 121. src/xfig/plot.sl: The hplot function was generating an exception plotting error bars when the number of elements in the x array is one larger than the y array. 122. src/Makefile.in: Added defintions for CC, CFLAGS, LDFLAGS 123. src/xfig/timetics.sl: Added xfig_timetics, which generates tic labels for a specified time range. See examples/plot/timetics.sl for an example. 124. src/xfig/timetics.sl: Tweaked the year labels so that the month/day are not included when each label has the same month/day. 125. src/xfig/plot.sl: The plot label position for a single user-specified label was being ignored. 126. src/xfig/timetics.sl: Added an extra level of day tics to the xfig_timetics function. 127. src/xfig/core.sl: Preserve the configured case of the paper size string when calling fig2dev. Some versions of fig2dev appear to use case-sensitive values. (Jakob Stierhof). 128. src/xfig/latex.sl: Check for the presence of `dvipng` and `rsvg-convert` when SLXFIG_RENDER_LATEX_AS_TRANSPARENT_PNG is defined. 129. New versions of fig2dev will fail when an object has a depth value outside the fig format specified range 0-999. SLxfig was modified to issue a warning if the depth falls outside this range, and then clip it accordingly. (Jakob Stierhof) 130. Changed the way that '%P' is processed in the output driver string. Now it will get expanded to "-z " only when the ";papersize" qualifier is given when rendering. This change was necessary to deal with newer versions of fig2dev, which has different semantics when -z is used for the pdf driver. (Jakob Stierhof) 131. Add support for setting a background color in the output driver. This is accomplished by expanding the %G specifier for the output device string to "-g ", where is the value of the ";background" qualifier passed to the render method. (Jakob Stierhof) 132. When creating tic marks, remove minor tic marks that are at the positions of major ones. This fixes a bug where a major grid line appears with the attributes of the minor ones. 133. Added nodates qualifier to the xfig_timetics function to turn off date (YYYY-MM-DD) labels. 134. Updated aclocal.m4; added support for CPPFLAGS (based upon patch from Rafael Laboissière) 135. Updated the README file 136. Remove temporary latex-generated .aux, .dvi, and .log file upon exit 137. Added dateformat and timeformat qualifiers to the xfig_timetics function 138. src/Makefile.in: Added the install_directories dependency to the other install_* targets to avoid a race condition in parallel builds slxfig-pre0.2.0-138/README0000644000175000000620000000073514160042347013531 0ustar johnstaffslxfig is a package that implements a number of S-Lang interpreter routines that interface with fig2dev and LaTeX to produce publication quality plots and drawings. INSTALLATION: Read the INSTALL file. The examples/ subdirectory contains a number of scripts that illustrate many of slxfig's features. See for an impressive list of examples. Visit for more information. slxfig-pre0.2.0-138/autoconf/0002755000175000000620000000000014146404547014474 5ustar johnstaffslxfig-pre0.2.0-138/autoconf/config.sub0000755000175000000620000010645014146404547016463 0ustar johnstaff#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-02-22' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo "$1" | sed 's/-[^-]*$//'` if [ "$basic_machine" != "$1" ] then os=`echo "$1" | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ | e2k | epiphany \ | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 | or1k | or1knd | or32 \ | pdp10 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pru \ | pyramid \ | riscv32 | riscv64 \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | visium \ | wasm32 \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; leon|leon[3-9]) basic_machine=sparc-$basic_machine ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ | ip2k-* | iq2000-* \ | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pru-* \ | pyramid-* \ | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | visium-* \ | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-pc os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; asmjs) basic_machine=asmjs-unknown ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2*) basic_machine=m68k-bull os=-sysv3 ;; e500v[12]) basic_machine=powerpc-unknown os=$os"spe" ;; e500v[12]-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=$os"spe" ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; leon-*|leon[3-9]-*) basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i686-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; moxiebox) basic_machine=moxie-unknown os=-moxiebox ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i686-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; nsv-tandem) basic_machine=nsv-tandem ;; nsx-tandem) basic_machine=nsx-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh5el) basic_machine=sh5le-unknown ;; simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; x64) basic_machine=x86_64-pc ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases that might get confused # with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # es1800 is here to avoid being matched by es* (a different OS) -es1800*) os=-ose ;; # Now accept the basic system types. # The portable systems comes first. # Each alternative MUST end in a * to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ | -midnightbsd*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -xray | -os68k* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo "$os" | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo "$os" | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo "$os" | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4*) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -pikeos*) # Until real need of OS specific support for # particular features comes up, bare metal # configurations are quite functional. case $basic_machine in arm*) os=-eabi ;; *) os=-elf ;; esac ;; -nacl*) ;; -ios) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; c8051-*) os=-elf ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; pru-*) os=-elf ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -cnk*|-aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` ;; esac echo "$basic_machine$os" exit # Local variables: # eval: (add-hook 'write-file-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: slxfig-pre0.2.0-138/autoconf/Makefile0000644000175000000620000000047311325613443016127 0ustar johnstaff../configure: aclocal.m4 configure.ac /bin/rm -rf autom4te.cache autoconf && mv ./configure .. update: config.sub config.guess config.guess: /usr/share/misc/config.guess /bin/cp -f /usr/share/misc/config.guess config.guess config.sub: /usr/share/misc/config.sub /bin/cp -f /usr/share/misc/config.sub config.sub slxfig-pre0.2.0-138/autoconf/install.sh0000755000175000000620000001273611325613443016501 0ustar johnstaff#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 slxfig-pre0.2.0-138/autoconf/configure.ac0000644000175000000620000000250111325613443016747 0ustar johnstaffdnl -*- sh -*- AC_INIT(src/gcontour-module.c) AC_PREFIX_DEFAULT(/usr/local) AC_CONFIG_AUX_DIR(autoconf) AC_CANONICAL_HOST AC_PROG_RANLIB AC_PROG_INSTALL AC_PROG_MAKE_SET JD_INIT JD_ANSI_CC JD_ELF_COMPILER JD_IEEE_CFLAGS AC_PATH_XTRA JD_WITH_LIBRARY(slang) dnl# This macro inits the module installation dir JD_SLANG_MODULE_INSTALL_DIR if test "X$slang_major_version" = "X1" then AC_MSG_ERROR("This software will not work with slang-1. Specify a path to slang-2") fi dnl Check these header since they cause trouble AC_CHECK_HEADERS( \ stdlib.h \ unistd.h \ ) AC_CHECK_SIZEOF(short, 2) AC_CHECK_SIZEOF(int, 4) AC_CHECK_SIZEOF(long, 4) AC_CHECK_SIZEOF(float, 4) AC_CHECK_SIZEOF(double, 8) JD_SET_RPATH($libdir) ELF_CFLAGS="$ELF_CFLAGS $IEEE_CFLAGS" CFLAGS="$CFLAGS $IEEE_CFLAGS" AC_CONFIG_HEADER(src/config.h:src/config.hin) AC_OUTPUT(Makefile:autoconf/Makefile.in src/Makefile) echo "" echo "You are compiling with the following compiler configuration:" echo " CC =" "$CC" echo " CC_SHARED =" "$CC_SHARED" echo " CFLAGS =" "$CFLAGS" echo " LDFLAGS =" "$LDFLAGS" "$DYNAMIC_LINK_FLAGS" echo "" echo "The modules will be installed in $MODULE_INSTALL_DIR." echo "Any associated .sl files will be install in $SL_FILES_INSTALL_DIR" echo "" echo "If any of these quantities are incorrect, edit src/Makefile accordingly." echo "" slxfig-pre0.2.0-138/autoconf/Makefile.in0000644000175000000620000000212611653730343016534 0ustar johnstaff# -*- sh -*- @SET_MAKE@ SHELL = /bin/sh all: makefiles cd src; $(MAKE) all Makefile: configure autoconf/Makefile.in @echo "Makefile is older than the configure script". @echo "Please re-run the configure script." @exit 1 src/Makefile: configure src/Makefile.in src/config.hin @echo "src/Makefile is older than its dependencies". @echo "Please re-run the configure script." @exit 1 makefiles: Makefile src/Makefile clean: cd src; $(MAKE) clean cd examples/plot; $(MAKE) clean /bin/rm -f *~ \#* distclean: clean cd src; $(MAKE) distclean /bin/rm -f config.log config.cache config.status Makefile update-help: cd doc/tm; $(MAKE) install clean install: cd src; $(MAKE) install # configure: autoconf/aclocal.m4 autoconf/configure.ac cd autoconf && autoconf && mv ./configure .. update: autoconf/config.sub autoconf/config.guess autoconf/config.guess: /usr/share/misc/config.guess /bin/cp -f /usr/share/misc/config.guess autoconf/config.guess autoconf/config.sub: /usr/share/misc/config.sub /bin/cp -f /usr/share/misc/config.sub autoconf/config.sub # .PHONY: all install clean update makefiles # slxfig-pre0.2.0-138/autoconf/mkinsdir.sh0000755000175000000620000000113611325613443016643 0ustar johnstaff#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d in ${1+"$@"} ; do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" 1>&2 mkdir "$pathcomp" || errstatus=$? fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here slxfig-pre0.2.0-138/autoconf/config.guess0000755000175000000620000012637314146404547017026 0ustar johnstaff#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2018 Free Software Foundation, Inc. timestamp='2018-02-24' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > "$dummy.c" ; for c in cc gcc c89 c99 ; do if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval "$set_cc_for_build" cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" # If ldd exists, use it to detect musl libc. if command -v ldd >/dev/null && \ ldd --version 2>&1 | grep -q ^musl then LIBC=musl fi ;; esac # Note: order is significant - the case branches are not exclusive. case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)` case "$UNAME_MACHINE_ARCH" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` machine="${arch}${endian}"-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case "$UNAME_MACHINE_ARCH" in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval "$set_cc_for_build" if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "$UNAME_VERSION" in Debian*) release='-gnu' ;; *) release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "$machine-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) echo "$UNAME_MACHINE"-unknown-sortix exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-unknown-redox exit ;; mips:OSF1:*.*) echo mips-dec-osf1 exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval "$set_cc_for_build" SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`"$dummy" "$dummyarg"` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] then if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ [ "$TARGET_BINARY_INTERFACE"x = x ] then echo m88k-dg-dgux"$UNAME_RELEASE" else echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/lslpp ] ; then IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` case "$UNAME_MACHINE" in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "$sc_cpu_version" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "$sc_kernel_bits" in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if [ "$HP_ARCH" = "" ]; then eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ "$HP_ARCH" = hppa2.0w ] then eval "$set_cc_for_build" # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo "$UNAME_MACHINE"-unknown-osf1mk else echo "$UNAME_MACHINE"-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-pc-cygwin exit ;; *:MINGW64*:*) echo "$UNAME_MACHINE"-pc-mingw64 exit ;; *:MINGW*:*) echo "$UNAME_MACHINE"-pc-mingw32 exit ;; *:MSYS*:*) echo "$UNAME_MACHINE"-pc-msys exit ;; i*:PW*:*) echo "$UNAME_MACHINE"-pc-pw32 exit ;; *:Interix*:*) case "$UNAME_MACHINE" in x86) echo i586-pc-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix"$UNAME_RELEASE" exit ;; IA64) echo ia64-unknown-interix"$UNAME_RELEASE" exit ;; esac ;; i*:UWIN*:*) echo "$UNAME_MACHINE"-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" exit ;; *:GNU:*:*) # the GNU system echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" exit ;; i*86:Minix:*:*) echo "$UNAME_MACHINE"-pc-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; arm*:Linux:*:*) eval "$set_cc_for_build" if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi else echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; cris:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; frv:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; hexagon:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:Linux:*:*) echo "$UNAME_MACHINE"-pc-linux-"$LIBC" exit ;; ia64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; k1om:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; m68*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval "$set_cc_for_build" sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) echo or1k-unknown-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; padre:Linux:*:*) echo sparc-unknown-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; *) echo hppa-unknown-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-"$LIBC" exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) echo powerpc64le-unknown-linux-"$LIBC" exit ;; ppcle:Linux:*:*) echo powerpcle-unknown-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sh*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; tile*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; vax:Linux:*:*) echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) if objdump -f /bin/sh | grep -q elf32-x86-64; then echo "$UNAME_MACHINE"-pc-linux-"$LIBC"x32 else echo "$UNAME_MACHINE"-pc-linux-"$LIBC" fi exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo "$UNAME_MACHINE"-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo "$UNAME_MACHINE"-unknown-stop exit ;; i*86:atheos:*:*) echo "$UNAME_MACHINE"-unknown-atheos exit ;; i*86:syllable:*:*) echo "$UNAME_MACHINE"-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) echo "$UNAME_MACHINE"-pc-msdosdjgpp exit ;; i*86:*:4.*:*) UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" else echo "$UNAME_MACHINE"-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-unknown-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-unknown-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux"$UNAME_RELEASE" exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux"$UNAME_RELEASE" exit ;; SX-ACE:SUPER-UX:*:*) echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval "$set_cc_for_build" if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi fi elif test "$UNAME_PROCESSOR" = i386 ; then # Avoid executing cc on OS X 10.9, as it ships with a stub # that puts up a graphical alert prompting to install # developer tools. Any system running Mac OS X 10.7 or # later (Darwin 11 and later) is required to have a 64-bit # processor. This is not true of the ARM version of Darwin # that Apple uses in portable devices. UNAME_PROCESSOR=x86_64 fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; NSV-*:NONSTOP_KERNEL:*:*) echo nsv-tandem-nsk"$UNAME_RELEASE" exit ;; NSX-*:NONSTOP_KERNEL:*:*) echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo "$UNAME_MACHINE"-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-pc-rdos exit ;; i*86:AROS:*:*) echo "$UNAME_MACHINE"-pc-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-unknown-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-unknown-onefs exit ;; esac echo "$0: unable to guess system type" >&2 case "$UNAME_MACHINE:$UNAME_SYSTEM" in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 </dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF exit 1 # Local variables: # eval: (add-hook 'write-file-functions 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: slxfig-pre0.2.0-138/autoconf/aclocal.m40000644000175000000620000007212414146404547016340 0ustar johnstaffdnl# -*- mode: sh; mode: fold -*- dnl# 0.3.4.0: Added $(CPPFLAGS) dnl# 0.3.3-1: Use INSTALL instead of INSTALL_DATA to install modules to get executable permissions dnl# 0.3.3-0: Added $(OBJ_O_DEPS) and $(ELF_O_DEPS) to PROGRAM_OBJECT_RULES dnl# 0.3.2-0: Add rpath support for freebsd dnl# 0.3.1-0: New output variable: CC_SHARED_FLAGS; CC_SHARED is deprecated dnl# 0.3.0-0: Added support for parsing /etc/ld.so.conf dnl# 0.2.7-3: Change ncurses5w-config to ncursesw5-config (Gilles Espinasse) dnl# 0.2.7-2: For the Makefile rules, use cd foo && bar instead of cd foo; bar dnl# 0.2.7-1: Use "$ARCH"elfobjs instead of elf"$ARCH"objs for better flexibility dnl# 0.2.7-0: Instead of expanding $ARCH at configure time, use \$ARCH for compile-time expansion dnl# 0.2.6-2: Missing hyphen for cygwin ELFLIB_MAJOR (Marco Atzeri) dnl# 0.2.6-1: Added optional second and third arguments to AC_DEFINE (Marco Atzeri) dnl# 0.2.6-0: On cygwin, change libfooX_Y_Z.dll to cygfoo-X_Y_Z.dll (Marco Atzeri) dnl# 0.2.5-3: Changed AC_DEFUN(foo...) to AC_DEFUN([foo]...) dnl# 0.2.5-2: JD_CHECK_FOR_LIBRARY will alse output *_INC_DIR and *_LIB_DIR dnl# 0.2.5-1: Updated using autoupdate dnl# 0.2.5-0: M_LIB output variable created for haiku support (Scott McCreary) dnl# 0.2.4-0: Added optional 3rd argument to JD_WITH_LIBRARY for a default path dnl# 0.2.3-2: X was missing in a "test" statement (Joerg Sommer) dnl# 0.2.3-1: AC_AIX needs to be called before running the compiler (Miroslav Lichvar) dnl# 0.2.3: rewrote JD_CHECK_FOR_LIBRARY to loop over include/lib pairs dnl# 0.2.2-1: JD_WITH_LIBRARY bug-fix dnl# 0.2.2: Use ncurses5-config to search for terminfo dirs. dnl# 0.2.1: Add .dll.a to list of extensions to when searching for libs (cygwin) dnl# 0.2.0: Added install target name and more fixes for cygwin dnl# 0.1.12: Improved support for cygwin dnl# 0.1.11: Fixed elf linking on freebsd (Renato Botelho (garga at freebsd, org) dnl# Version 0.1.10: rpath support for netbsd dnl# Version 0.1.9: When searching for libs, use dylib on darwin dnl# Version 0.1.8: Add rpath support for OpenBSD dnl# Version 0.1.7: removed "-K pic" from IRIX compiler lines dnl# Version 0.1.6: Added cygwin module support dnl# Version 0.1.5: Added gcc version-script support. AC_DEFUN([JD_INIT], dnl#{{{ [ #These variable are initialized by JD init function CONFIG_DIR=`pwd` cd $srcdir if test "`pwd`" != "$CONFIG_DIR" then AC_MSG_ERROR("This software does not support configuring from another directory. See the INSTALL file") fi dnl# if test "X$PWD" != "X" dnl# then dnl# CONFIG_DIR="$PWD" dnl# fi AC_SUBST(CONFIG_DIR)dnl # Note: these will differ if one is a symbolic link if test -f /usr/bin/dirname; then JD_Above_Dir=`dirname $CONFIG_DIR` else # system is a loser JD_Above_Dir=`cd ..;pwd` fi JD_Above_Dir2=`cd ..;pwd` ]) dnl#}}} dnl# This function expand the "prefix variables. For example, it will expand dnl# values such as ${exec_prefix}/foo when ${exec_prefix} itself has a dnl# of ${prefix}. This function produces the shell variables: dnl# jd_prefix_libdir, jd_prefix_incdir AC_DEFUN([JD_EXPAND_PREFIX], dnl#{{{ [ if test "X$jd_prefix" = "X" then jd_prefix=$ac_default_prefix if test "X$prefix" != "XNONE" then jd_prefix="$prefix" fi jd_exec_prefix="$jd_prefix" if test "X$exec_prefix" != "XNONE" then jd_exec_prefix="$exec_prefix" fi dnl#Unfortunately, exec_prefix may have a value like ${prefix}, etc. dnl#Let the shell expand those. Yuk. eval `sh <>)dnl define(<<$2>>, translit($1, [a-z], [A-Z]))dnl changequote([, ])dnl ]) #}}} AC_DEFUN([JD_SIMPLE_LIB_DIR], dnl#{{{ [ JD_UPPERCASE($1,JD_UP_NAME) JD_UP_NAME[]_LIB_DIR=$JD_Above_Dir/$1/libsrc/"$ARCH"objs JD_UP_NAME[]_INCLUDE=$JD_Above_Dir/$1/libsrc if test ! -d "[$]JD_UP_NAME[]_INCLUDE" then JD_UP_NAME[]_LIB_DIR=$JD_Above_Dir/$1/src/"$ARCH"objs JD_UP_NAME[]_INCLUDE=$JD_Above_Dir/$1/src if test ! -d "[$]JD_UP_NAME[]_INCLUDE" then echo "" echo WARNING------Unable to find the JD_UP_NAME directory echo You may have to edit $CONFIG_DIR/src/Makefile. echo "" fi fi AC_SUBST(JD_UP_NAME[]_LIB_DIR)dnl AC_SUBST(JD_UP_NAME[]_INCLUDE)dnl undefine([JD_UP_NAME])dnl ]) dnl#}}} AC_DEFUN([JD_FIND_GENERIC], dnl#{{{ [ AC_REQUIRE([JD_EXPAND_PREFIX])dnl changequote(<<, >>)dnl define(<>, translit($1, [a-z], [A-Z]))dnl changequote([, ])dnl # Look for the JD_UP_NAME package #JD_UP_NAME[]_INCLUDE="" #JD_UP_NAME[]_LIB_DIR="" # This list consists of "include,lib include,lib ..." JD_Search_Dirs="$JD_Above_Dir2/$1/libsrc,$JD_Above_Dir2/$1/libsrc/"$ARCH"objs \ $JD_Above_Dir/$1/libsrc,$JD_Above_Dir/$1/libsrc/"$ARCH"objs \ $JD_Above_Dir2/$1/src,$JD_Above_Dir2/$1/src/"$ARCH"objs \ $JD_Above_Dir/$1/src,$JD_Above_Dir/$1/src/"$ARCH"objs" JD_Search_Dirs="$JD_Search_Dirs \ $jd_prefix_incdir,$jd_prefix_libdir \ $HOME/include,$HOME/lib" if test -n "$ARCH" then JD_Search_Dirs="$JD_Search_Dirs $HOME/include,$HOME/$ARCH/lib" JD_Search_Dirs="$JD_Search_Dirs $HOME/include,$HOME/sys/$ARCH/lib" fi # Now add the standard system includes. The reason for doing this is that # the other directories may have a better chance of containing a more recent # version. JD_Search_Dirs="$JD_Search_Dirs \ /usr/local/include,/usr/local/lib \ /usr/include,/usr/lib \ /usr/include/$1,/usr/lib \ /usr/include/$1,/usr/lib/$1" echo looking for the JD_UP_NAME library for include_and_lib in $JD_Search_Dirs do # Yuk. Is there a better way to set these variables?? generic_include=`echo $include_and_lib | tr ',' ' ' | awk '{print [$]1}'` generic_lib=`echo $include_and_lib | tr ',' ' ' | awk '{print [$]2}'` echo Looking for $1.h in $generic_include echo and lib$1.a in $generic_lib if test -r $generic_include/$1.h && test -r $generic_lib/lib$1.a then echo Found it. JD_UP_NAME[]_LIB_DIR="$generic_lib" JD_UP_NAME[]_INCLUDE="$generic_include" break else if test -r $generic_include/$1.h && test -r $generic_lib/lib$1.so then echo Found it. JD_UP_NAME[]_LIB_DIR="$generic_lib" JD_UP_NAME[]_INCLUDE="$generic_include" break fi fi done if test -n "[$]JD_UP_NAME[]_LIB_DIR" then jd_have_$1="yes" else echo Unable to find the $JD_UP_NAME library. echo You may have to edit $CONFIG_DIR/src/Makefile. JD_UP_NAME[]_INCLUDE=$JD_Above_Dir/$1/src JD_UP_NAME[]_LIB_DIR=$JD_Above_Dir/$1/src/"$ARCH"objs jd_have_$1="no" fi JD_UP_NAME[]_INC="-I[$]JD_UP_NAME[]_INCLUDE" JD_UP_NAME[]_LIB="-L[$]JD_UP_NAME[]_LIB_DIR" JD_SET_RPATH([$]JD_UP_NAME[]_LIB_DIR) dnl# if test "X$GCC" = Xyes dnl# then dnl# RPATH_[]JD_UP_NAME="-Wl,-R[$]JD_UP_NAME[]_LIB_DIR" dnl# else dnl# RPATH_[]JD_UP_NAME="-R[$]JD_UP_NAME[]_LIB_DIR" dnl# fi # gcc under solaris is often not installed correctly. Avoid specifying # -I/usr/include. if test "[$]JD_UP_NAME[]_INC" = "-I/usr/include" then JD_UP_NAME[]_INC="" fi if test "[$]JD_UP_NAME[]_LIB" = "-L/usr/lib" then JD_UP_NAME[]_LIB="" RPATH_[]JD_UP_NAME="" fi AC_SUBST(JD_UP_NAME[]_LIB)dnl AC_SUBST(JD_UP_NAME[]_INC)dnl AC_SUBST(JD_UP_NAME[]_LIB_DIR)dnl AC_SUBST(JD_UP_NAME[]_INCLUDE)dnl dnl# AC_SUBST(RPATH_[]JD_UP_NAME)dnl undefine([JD_UP_NAME])dnl ]) dnl#}}} AC_DEFUN([JD_FIND_SLANG], dnl#{{{ [ JD_FIND_GENERIC(slang) ]) dnl#}}} AC_DEFUN([JD_GCC_WARNINGS], dnl#{{{ [ AC_ARG_ENABLE(warnings, AC_HELP_STRING([--enable-warnings],[turn on GCC compiler warnings]), [gcc_warnings=$enableval]) if test -n "$GCC" then #CFLAGS="$CFLAGS -fno-strength-reduce" if test -n "$gcc_warnings" then CFLAGS="$CFLAGS -Wall -W -pedantic -Winline -Wmissing-prototypes \ -Wnested-externs -Wpointer-arith -Wcast-align -Wshadow -Wstrict-prototypes \ -Wformat=2" # Now trim excess whitespace CFLAGS=`echo $CFLAGS` fi fi ]) dnl#}}} IEEE_CFLAGS="" AC_DEFUN([JD_IEEE_CFLAGS], dnl#{{{ [ case "$host_cpu" in *alpha* ) if test "$GCC" = yes then IEEE_CFLAGS="-mieee" else IEEE_CFLAGS="-ieee_with_no_inexact" fi ;; * ) IEEE_CFLAGS="" esac ]) dnl#}}} AC_DEFUN([JD_CREATE_ORULE], dnl#{{{ [ PROGRAM_OBJECT_RULES="$PROGRAM_OBJECT_RULES \$(OBJDIR)/$1.o : \$(SRCDIR)/$1.c \$(DOT_O_DEPS) \$(OBJ_O_DEPS) \$("$1"_O_DEP) cd \$(OBJDIR) && \$(COMPILE_CMD) \$("$1"_C_FLAGS) \$(SRCDIR)/$1.c " ]) dnl#}}} AC_DEFUN([JD_CREATE_ELFORULE], dnl#{{{ [ PROGRAM_ELF_ORULES="$PROGRAM_ELF_ORULES \$(ELFDIR)/$1.o : \$(SRCDIR)/$1.c \$(DOT_O_DEPS) \$(ELF_O_DEPS) \$("$1"_O_DEP) cd \$(ELFDIR) && \$(ELFCOMPILE_CMD) \$("$1"_C_FLAGS) \$(SRCDIR)/$1.c " ]) dnl#}}} AC_DEFUN([JD_CREATE_EXEC_RULE], dnl#{{{ [ PROGRAM_OBJECT_RULES="$PROGRAM_OBJECT_RULES $1 : \$(OBJDIR)/$1 @echo $1 created in \$(OBJDIR) \$(OBJDIR)/$1 : \$(OBJDIR)/$1.o \$("$1"_DEPS) \$(EXECDEPS) \$(CC) -o \$(OBJDIR)/$1 \$(LDFLAGS) \$(OBJDIR)/$1.o \$("$1"_LIBS) \$(EXECLIBS) \$(OBJDIR)/$1.o : \$(SRCDIR)/$1.c \$(DOT_O_DEPS) \$("$1"_O_DEP) cd \$(OBJDIR) && \$(COMPILE_CMD) \$("$1"_INC) \$(EXECINC) \$(SRCDIR)/$1.c " ]) dnl#}}} AC_DEFUN([JD_CREATE_MODULE_ORULES], dnl#{{{ [ for program_module in $Program_Modules; do JD_CREATE_ORULE($program_module) JD_CREATE_ELFORULE($program_module) done ]) dnl#}}} AC_DEFUN([JD_GET_MODULES], dnl#{{{ [ PROGRAM_HFILES="" PROGRAM_OFILES="" PROGRAM_CFILES="" PROGRAM_OBJECTS="" PROGRAM_ELFOBJECTS="" PROGRAM_OBJECT_RULES="" PROGRAM_ELF_ORULES="" if test -z "$1" then Program_Modules="" else comment_re="^#" Program_Modules=`grep -v '$comment_re' $1 | awk '{print [$]1}'` Program_H_Modules=`grep -v '$comment_re' $1 | awk '{print [$]2}'` for program_module in $Program_H_Modules; do PROGRAM_HFILES="$PROGRAM_HFILES $program_module" done fi for program_module in $Program_Modules; do PROGRAM_OFILES="$PROGRAM_OFILES $program_module.o" PROGRAM_CFILES="$PROGRAM_CFILES $program_module.c" PROGRAM_OBJECTS="$PROGRAM_OBJECTS \$(OBJDIR)/$program_module.o" PROGRAM_ELFOBJECTS="$PROGRAM_ELFOBJECTS \$(ELFDIR)/$program_module.o" done dnl echo $PROGRAM_OFILES dnl echo $PROGRAM_HFILES AC_SUBST(PROGRAM_OFILES)dnl AC_SUBST(PROGRAM_CFILES)dnl AC_SUBST(PROGRAM_HFILES)dnl AC_SUBST(PROGRAM_OBJECTS)dnl AC_SUBST(PROGRAM_ELFOBJECTS)dnl ]) dnl#}}} AC_DEFUN([JD_APPEND_RULES], dnl#{{{ [ echo "$PROGRAM_OBJECT_RULES" >> $1 ]) dnl#}}} AC_DEFUN([JD_APPEND_ELFRULES], dnl#{{{ [ echo "$PROGRAM_ELF_ORULES" >> $1 ]) dnl#}}} AC_DEFUN([JD_CREATE_MODULE_EXEC_RULES], dnl#{{{ [ for program_module in $Program_Modules; do JD_CREATE_EXEC_RULE($program_module) done ]) dnl#}}} AC_DEFUN([JD_TERMCAP], dnl#{{{ [ AC_PATH_PROG(nc5config, ncurses5-config, no) if test "$nc5config" = "no" then AC_PATH_PROG(nc5config, ncursesw5-config, no) fi AC_MSG_CHECKING(for terminfo) if test "$nc5config" != "no" then MISC_TERMINFO_DIRS=`$nc5config --terminfo` else MISC_TERMINFO_DIRS="" fi JD_Terminfo_Dirs="$MISC_TERMINFO_DIRS \ /usr/lib/terminfo \ /usr/share/terminfo \ /usr/share/lib/terminfo \ /usr/local/lib/terminfo" TERMCAP=-ltermcap for terminfo_dir in $JD_Terminfo_Dirs do if test -d $terminfo_dir then AC_MSG_RESULT(yes) TERMCAP="" break fi done if test "$TERMCAP"; then AC_MSG_RESULT(no) AC_DEFINE(USE_TERMCAP,1,[Define to use termcap]) fi AC_SUBST(TERMCAP)dnl AC_SUBST(MISC_TERMINFO_DIRS)dnl ]) dnl#}}} AC_DEFUN([JD_ANSI_CC], dnl#{{{ [ AC_AIX AC_REQUIRE([AC_PROG_CC]) AC_REQUIRE([AC_PROG_CPP]) AC_REQUIRE([AC_PROG_GCC_TRADITIONAL]) AC_ISC_POSIX dnl #This stuff came from Yorick config script dnl dnl # HPUX needs special stuff dnl AC_EGREP_CPP(yes, [#ifdef hpux yes #endif ], [ AC_DEFINE(_HPUX_SOURCE,1,[Special define needed for HPUX]) if test "$CC" = cc; then CC="cc -Ae"; fi ])dnl dnl dnl #Be sure we've found compiler that understands prototypes dnl AC_MSG_CHECKING(C compiler that understands ANSI prototypes) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[ extern int silly (int);]])],[ AC_MSG_RESULT($CC looks ok. Good.)],[ AC_MSG_RESULT($CC is not a good enough compiler) AC_MSG_ERROR(Set env variable CC to your ANSI compiler and rerun configure.) ])dnl ])dnl dnl#}}} AC_DEFUN([JD_ELF_COMPILER], dnl#{{{ [ dnl #------------------------------------------------------------------------- dnl # Check for dynamic linker dnl #------------------------------------------------------------------------- DYNAMIC_LINK_LIB="" dnl# AH_TEMPLATE([HAVE_DLOPEN],1,[Define if you have dlopen]) AC_CHECK_HEADER(dlfcn.h,[ AC_DEFINE(HAVE_DLFCN_H,1,[Define if you have the dlfcn.h header]) AC_CHECK_LIB(dl,dlopen,[ DYNAMIC_LINK_LIB="-ldl" AC_DEFINE(HAVE_DLOPEN,1,[Define if you have dlopen]) ],[ AC_CHECK_FUNC(dlopen,AC_DEFINE(HAVE_DLOPEN,[Define if you have dlopen])) if test "$ac_cv_func_dlopen" != yes then AC_MSG_WARN(cannot perform dynamic linking) fi ])]) AC_SUBST(DYNAMIC_LINK_LIB) if test "$GCC" = yes then if test X"$CFLAGS" = X then CFLAGS="-O2" fi fi dnl #Some defaults ELFLIB="lib\$(THIS_LIB).so" ELFLIB_MAJOR="\$(ELFLIB).\$(ELF_MAJOR_VERSION)" ELFLIB_MAJOR_MINOR="\$(ELFLIB_MAJOR).\$(ELF_MINOR_VERSION)" ELFLIB_MAJOR_MINOR_MICRO="\$(ELFLIB_MAJOR_MINOR).\$(ELF_MICRO_VERSION)" dnl# This specifies the target to use in the makefile to install the shared library INSTALL_ELFLIB_TARGET="install-elf-and-links" ELFLIB_BUILD_NAME="\$(ELFLIB_MAJOR_MINOR_MICRO)" INSTALL_MODULE="\$(INSTALL)" SLANG_DLL_CFLAGS="" M_LIB="-lm" case "$host_os" in *linux*|*gnu*|k*bsd*-gnu ) DYNAMIC_LINK_FLAGS="-Wl,-export-dynamic" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-O1 -Wl,--version-script,\$(VERSION_SCRIPT) -Wl,-soname,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED_FLAGS="-shared -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" ;; *solaris* ) if test "$GCC" = yes then DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-ztext -Wl,-h,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED_FLAGS="-G -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" else DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -K PIC" ELF_LINK="\$(CC) \$(LDFLAGS) -G -h\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED_FLAGS="-G -K PIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" fi ;; # osr5 or unixware7 with current or late autoconf *sco3.2v5* | *unixware-5* | *sco-sysv5uw7*) if test "$GCC" = yes then DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-h,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED_FLAGS="-G -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" else DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -K pic" # ELF_LINK="ld -G -z text -h#" ELF_LINK="\$(CC) \$(LDFLAGS) -G -z text -h\$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED_FLAGS="-G -K pic" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" fi ;; *irix6.5* ) echo "Note: ELF compiler for host_os=$host_os may not be correct" echo "double-check: 'mode_t', 'pid_t' may be wrong!" if test "$GCC" = yes then # not tested DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-h,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED_FLAGS="-shared -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" else DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS)" # default anyhow ELF_LINK="\$(CC) \$(LDFLAGS) -shared -o \$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED_FLAGS="-shared" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" fi ;; *darwin* ) DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fno-common" ELF_LINK="\$(CC) \$(LDFLAGS) -dynamiclib -install_name \$(install_lib_dir)/\$(ELFLIB_MAJOR) -compatibility_version \$(ELF_MAJOR_VERSION) -current_version \$(ELF_MAJOR_VERSION).\$(ELF_MINOR_VERSION)" ELF_DEP_LIBS="\$(LDFLAGS) \$(DL_LIB)" CC_SHARED_FLAGS="-bundle -flat_namespace -undefined suppress -fno-common" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" ELFLIB="lib\$(THIS_LIB).dylib" ELFLIB_MAJOR="lib\$(THIS_LIB).\$(ELF_MAJOR_VERSION).dylib" ELFLIB_MAJOR_MINOR="lib\$(THIS_LIB).\$(ELF_MAJOR_VERSION).\$(ELF_MINOR_VERSION).dylib" ELFLIB_MAJOR_MINOR_MICRO="lib\$(THIS_LIB).\$(ELF_MAJOR_VERSION).\$(ELF_MINOR_VERSION).\$(ELF_MICRO_VERSION).dylib" ;; *freebsd* ) ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" #if test "X$PORTOBJFORMAT" = "Xelf" ; then # ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-soname,\$(ELFLIB_MAJOR)" #else # ELF_LINK="ld -Bshareable -x" #fi ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-soname,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB) -lm" CC_SHARED_FLAGS="-shared -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" ;; *cygwin* ) DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" SLANG_DLL_CFLAGS="-DSLANG_DLL=1" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -DBUILD_DLL=1" DLL_IMPLIB_NAME="lib\$(THIS_LIB)\$(ELFLIB_MAJOR_VERSION).dll.a" #ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-O1 -Wl,--version-script,\$(VERSION_SCRIPT) -Wl,-soname,\$(ELFLIB_MAJOR) -Wl,--out-implib=\$(DLL_IMPLIB_NAME) -Wl,-export-all-symbols -Wl,-enable-auto-import" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-O1 -Wl,--version-script,\$(VERSION_SCRIPT) -Wl,-soname,\$(ELFLIB_MAJOR) -Wl,--out-implib=\$(DLL_IMPLIB_NAME)" ELF_DEP_LIBS="\$(DL_LIB) -lm" CC_SHARED_FLAGS="-shared -DSLANG_DLL=1" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" dnl# CYGWIN prohibits undefined symbols when linking shared libs SLANG_LIB_FOR_MODULES="-L\$(ELFDIR) -lslang" INSTALL_MODULE="\$(INSTALL)" INSTALL_ELFLIB_TARGET="install-elf-cygwin" ELFLIB="lib\$(THIS_LIB).dll" ELFLIB_MAJOR="cyg\$(THIS_LIB)-\$(ELF_MAJOR_VERSION).dll" ELFLIB_MAJOR_MINOR="cyg\$(THIS_LIB)-\$(ELF_MAJOR_VERSION)_\$(ELF_MINOR_VERSION).dll" ELFLIB_MAJOR_MINOR_MICRO="cyg\$(THIS_LIB)-\$(ELF_MAJOR_VERSION)_\$(ELF_MINOR_VERSION)_\$(ELF_MICRO_VERSION).dll" ELFLIB_BUILD_NAME="\$(ELFLIB_MAJOR)" ;; *haiku* ) M_LIB="" DYNAMIC_LINK_FLAGS="-Wl,-export-dynamic" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-O1 -Wl,--version-script,\$(VERSION_SCRIPT) -Wl,-soname,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB)" CC_SHARED_FLAGS="-shared -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" ;; * ) echo "Note: ELF compiler for host_os=$host_os may be wrong" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED_FLAGS="-shared -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" esac AC_SUBST(ELF_CC) AC_SUBST(ELF_CFLAGS) AC_SUBST(ELF_LINK) AC_SUBST(ELF_LINK_CMD) AC_SUBST(ELF_DEP_LIBS) AC_SUBST(DYNAMIC_LINK_FLAGS) AC_SUBST(CC_SHARED_FLAGS) AC_SUBST(CC_SHARED) AC_SUBST(ELFLIB) AC_SUBST(ELFLIB_MAJOR) AC_SUBST(ELFLIB_MAJOR_MINOR) AC_SUBST(ELFLIB_MAJOR_MINOR_MICRO) AC_SUBST(SLANG_LIB_FOR_MODULES) AC_SUBST(DLL_IMPLIB_NAME) AC_SUBST(INSTALL_MODULE) AC_SUBST(INSTALL_ELFLIB_TARGET) AC_SUBST(ELFLIB_BUILD_NAME) AC_SUBST(SLANG_DLL_CFLAGS) AC_SUBST(M_LIB) ]) dnl#}}} AC_DEFUN([JD_F77_COMPILER], dnl#{{{ [ case "$host_os" in *linux* ) F77="g77" F77_LIBS="-lg2c" ;; *solaris*) F77=f77 #F77_LIBS="-lF77 -lM77 -L/opt/SUNWspro/SC4.0/lib -lsunmath" F77_LIBS="-lF77 -lM77 -lsunmath" ;; *) echo "" echo "WARNING: Assuming f77 as your FORTRAN compiler" echo "" F77=f77 F77_LIBS="" esac AC_SUBST(F77) AC_SUBST(F77_LIBS) ]) dnl#}}} dnl# This macro process the --with-xxx, --with-xxxinc, and --with-xxxlib dnl# command line arguments and returns the values as shell variables dnl# jd_xxx_include_dir and jd_xxx_library_dir. It does not perform any dnl# substitutions, nor check for the existence of the supplied values. AC_DEFUN([JD_WITH_LIBRARY_PATHS], dnl#{{{ [ JD_UPPERCASE($1,JD_ARG1) jd_$1_include_dir="" jd_$1_library_dir="" if test X"$jd_with_$1_library" = X then jd_with_$1_library="" fi AC_ARG_WITH($1, [ --with-$1=DIR Use DIR/lib and DIR/include for $1], [jd_with_$1_arg=$withval], [jd_with_$1_arg=unspecified]) case "x$jd_with_$1_arg" in xno) jd_with_$1_library="no" ;; x) dnl# AC_MSG_ERROR(--with-$1 requires a value-- try yes or no) jd_with_$1_library="yes" ;; xunspecified) ;; xyes) jd_with_$1_library="yes" ;; *) jd_with_$1_library="yes" jd_$1_include_dir="$jd_with_$1_arg"/include jd_$1_library_dir="$jd_with_$1_arg"/lib ;; esac AC_ARG_WITH($1lib, [ --with-$1lib=DIR $1 library in DIR], [jd_with_$1lib_arg=$withval], [jd_with_$1lib_arg=unspecified]) case "x$jd_with_$1lib_arg" in xunspecified) ;; xno) ;; x) AC_MSG_ERROR(--with-$1lib requres a value) ;; *) jd_with_$1_library="yes" jd_$1_library_dir="$jd_with_$1lib_arg" ;; esac AC_ARG_WITH($1inc, [ --with-$1inc=DIR $1 include files in DIR], [jd_with_$1inc_arg=$withval], [jd_with_$1inc_arg=unspecified]) case "x$jd_with_$1inc_arg" in x) AC_MSG_ERROR(--with-$1inc requres a value) ;; xunspecified) ;; xno) ;; *) jd_with_$1_library="yes" jd_$1_include_dir="$jd_with_$1inc_arg" ;; esac ]) dnl#}}} dnl# This function checks for the existence of the specified library $1 with dnl# header file $2. If the library exists, then the shell variables will dnl# be created: dnl# jd_with_$1_library=yes/no, dnl# jd_$1_inc_file dnl# jd_$1_include_dir dnl# jd_$1_library_dir dnl# If $3 is present, then also look in $3/include+$3/lib AC_DEFUN([JD_CHECK_FOR_LIBRARY], dnl#{{{ [ AC_REQUIRE([JD_EXPAND_PREFIX])dnl AC_REQUIRE([JD_GET_SYS_INCLIBS])dnl dnl JD_UPPERCASE($1,JD_ARG1) JD_WITH_LIBRARY_PATHS($1) AC_MSG_CHECKING(for the $1 library and header files $2) if test X"$jd_with_$1_library" != Xno then jd_$1_inc_file=$2 dnl# jd_with_$1_library="yes" if test "X$jd_$1_inc_file" = "X" then jd_$1_inc_file=$1.h fi if test X"$jd_$1_include_dir" = X then inc_and_lib_dirs="\ $jd_prefix_incdir,$jd_prefix_libdir \ /usr/local/$1/include,/usr/local/$1/lib \ /usr/local/include/$1,/usr/local/lib \ /usr/local/include,/usr/local/lib \ $JD_SYS_INCLIBS \ /usr/include/$1,/usr/lib \ /usr/$1/include,/usr/$1/lib \ /usr/include,/usr/lib \ /opt/include/$1,/opt/lib \ /opt/$1/include,/opt/$1/lib \ /opt/include,/opt/lib" if test X$3 != X then inc_and_lib_dirs="$3/include,$3/lib $inc_and_lib_dirs" fi case "$host_os" in *darwin* ) exts="dylib so a" ;; *cygwin* ) exts="dll.a so a" ;; * ) exts="so a" esac xincfile="$jd_$1_inc_file" xlibfile="lib$1" jd_with_$1_library="no" for include_and_lib in $inc_and_lib_dirs do # Yuk. Is there a better way to set these variables?? xincdir=`echo $include_and_lib | tr ',' ' ' | awk '{print [$]1}'` xlibdir=`echo $include_and_lib | tr ',' ' ' | awk '{print [$]2}'` found=0 if test -r $xincdir/$xincfile then for E in $exts do if test -r "$xlibdir/$xlibfile.$E" then jd_$1_include_dir="$xincdir" jd_$1_library_dir="$xlibdir" jd_with_$1_library="yes" found=1 break fi done fi if test $found -eq 1 then break fi done fi fi if test X"$jd_$1_include_dir" != X -a X"$jd_$1_library_dir" != X then AC_MSG_RESULT(yes: $jd_$1_library_dir and $jd_$1_include_dir) jd_with_$1_library="yes" dnl# Avoid using /usr/lib and /usr/include because of problems with dnl# gcc on some solaris systems. JD_ARG1[]_LIB=-L$jd_$1_library_dir JD_ARG1[]_LIB_DIR=$jd_$1_library_dir if test "X$jd_$1_library_dir" = "X/usr/lib" -o "X$jd_$1_include_dir" = "X/usr/include" then JD_ARG1[]_LIB="" else JD_SET_RPATH($jd_$1_library_dir) fi JD_ARG1[]_INC=-I$jd_$1_include_dir JD_ARG1[]_INC_DIR=$jd_$1_include_dir if test "X$jd_$1_include_dir" = "X/usr/include" then JD_ARG1[]_INC="" fi else AC_MSG_RESULT(no) jd_with_$1_library="no" JD_ARG1[]_INC="" JD_ARG1[]_LIB="" JD_ARG1[]_INC_DIR="" JD_ARG1[]_LIB_DIR="" fi AC_SUBST(JD_ARG1[]_LIB) AC_SUBST(JD_ARG1[]_INC) AC_SUBST(JD_ARG1[]_LIB_DIR) AC_SUBST(JD_ARG1[]_INC_DIR) ]) dnl#}}} AC_DEFUN([JD_WITH_LIBRARY], dnl#{{{ [ JD_CHECK_FOR_LIBRARY($1, $2, $3) if test "$jd_with_$1_library" = "no" then AC_MSG_ERROR(unable to find the $1 library and header file $jd_$1_inc_file) fi ]) dnl#}}} AC_DEFUN([JD_SLANG_VERSION], dnl#{{{ [ slang_h=$jd_slang_include_dir/slang.h AC_MSG_CHECKING(SLANG_VERSION in $slang_h) slang_version=`grep "^#define *SLANG_VERSION " $slang_h | awk '{ print [$]3 }'` slang_major_version=`echo $slang_version | awk '{ print int([$]1/10000) }'` slang_minor_version=`echo $slang_version $slang_major_version | awk '{ print int(([$]1 - [$]2*10000)/100) }'` slang_patchlevel_version=`echo $slang_version $slang_major_version $slang_minor_version | awk '{ print ([$]1 - [$]2*10000 - [$]3*100) }'` AC_MSG_RESULT($slang_major_version.$slang_minor_version.$slang_patchlevel_version) AC_SUBST(slang_version) AC_SUBST(slang_major_version) AC_SUBST(slang_minor_version) AC_SUBST(slang_patchlevel_version) ]) #}}} AC_DEFUN([JD_SLANG_MODULE_INSTALL_DIR], dnl#{{{ [ AC_REQUIRE([JD_SLANG_VERSION]) if test "X$slang_major_version" = "X1" then MODULE_INSTALL_DIR="$libdir/slang/modules" else MODULE_INSTALL_DIR="$libdir/slang/v$slang_major_version/modules" fi SL_FILES_INSTALL_DIR=$datadir/slsh/local-packages AC_SUBST(MODULE_INSTALL_DIR) AC_SUBST(SL_FILES_INSTALL_DIR) ]) #}}} AC_DEFUN([JD_CHECK_LONG_LONG], dnl#{{{ [ AC_CHECK_TYPES(long long) AC_CHECK_SIZEOF(long long) ]) dnl#}}} AC_DEFUN([JD_LARGE_FILE_SUPPORTXXX], dnl#{{{ [ AC_REQUIRE([JD_CHECK_LONG_LONG]) AC_MSG_CHECKING(whether to explicitly activate long file support) AC_DEFINE(_LARGEFILE_SOURCE, 1) AC_DEFINE(_FILE_OFFSET_BITS, 64) jd_large_file_support=no if test X$ac_cv_type_long_long = Xyes then if test $ac_cv_sizeof_long_long -ge 8 then jd_large_file_support=yes fi fi if test $jd_large_file_support = yes then AC_DEFINE(HAVE_LARGEFILE_SUPPORT, 1) AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi ]) dnl#}}} AC_DEFUN([JD_LARGE_FILE_SUPPORT], dnl#{{{ [ AC_SYS_LARGEFILE AC_FUNC_FSEEKO AC_TYPE_OFF_T AC_CHECK_SIZEOF(off_t) ]) #}}} AC_DEFUN([JD_HAVE_ISINF], dnl#{{{ [ AC_MSG_CHECKING([for isinf]) AC_LINK_IFELSE([AC_LANG_PROGRAM( [[#include ]], [[isinf (0.0);]])], [AC_MSG_RESULT([yes]) AC_DEFINE(HAVE_ISINF, 1)]) ]) #}}} slxfig-pre0.2.0-138/examples/0002755000175000000620000000000013726105127014467 5ustar johnstaffslxfig-pre0.2.0-138/examples/Makefile0000644000175000000620000000024012463364752016131 0ustar johnstaffSUBDIRS = \ 3d \ draw \ transparent \ pict \ plot \ polyline all clean distclean: @for subdir in $(SUBDIRS); do \ make -C $$subdir $@; \ done slxfig-pre0.2.0-138/examples/pict/0002755000175000000620000000000011761627347015440 5ustar johnstaffslxfig-pre0.2.0-138/examples/pict/Makefile0000644000175000000620000000011211761627347017070 0ustar johnstaffPNG_FILES = \ colormaps.png \ colornames.png include ../Makefile.sub slxfig-pre0.2.0-138/examples/pict/colornames.sl0000644000175000000620000000320411761627347020137 0ustar johnstaffrequire ("xfig"); private define get_bbox (obj) { variable x0, x1, y0, y1; (x0, x1, y0, y1,,) = obj.get_bbox(); return x0, x1, y0, y1; } define slsh_main () { variable colors = xfig_get_color_names (); variable color, i, n = length(colors); variable text, text_objs = Struct_Type[n], min_x, max_x, min_y, max_y; _for i (0, n-1, 1) { color = colors[i]; variable rgb = xfig_lookup_color_rgb (color); variable is_dark = 0; loop (3) { is_dark += ((rgb&0xFF) <= 0xC0); rgb = rgb >> 8; } if (color == "default") is_dark = 3; text_objs[i] = xfig_new_text (color; size="large", color=is_dark>1?"white":"black"); } (min_x, max_x, min_y, max_y) = array_map (Double_Type, Double_Type, Double_Type, Double_Type, &get_bbox, text_objs); variable dx = max(max_x)-min(min_x), dy = max(max_y)-min(min_y), dX = vector(-0.5*dx, -0.5*dy, 0); variable vbox_objs = {}; variable nrows = n/5; variable row = 0; variable column_objs = {}; variable obj; _for i (0, n-1, 1) { color = colors[i]; obj = xfig_new_rectangle (dx, dy); obj.set_pen_color (color); obj.set_fill_color (color); obj.set_area_fill (20); obj.translate (dX); obj = xfig_new_compound (obj, text_objs[i]); list_append (column_objs, obj); row++; if (row == nrows) { list_append (vbox_objs, xfig_new_vbox_compound (__push_list(column_objs))); column_objs = {}; row = 0; } } if (length (column_objs)) list_append (vbox_objs, xfig_new_vbox_compound (__push_list(column_objs))); obj = xfig_new_hbox_compound (__push_list(vbox_objs)); obj.render ("colornames.png"); } slxfig-pre0.2.0-138/examples/pict/colormaps.sl0000644000175000000620000000146411761627347020002 0ustar johnstaffrequire ("png"); require ("xfig"); define slsh_main () { variable width = 10; variable height = 1; variable cmaps = png_get_colormap_names (); cmaps = cmaps[array_sort (cmaps)]; variable list = {}; variable tmpnames = {}; foreach (cmaps) { variable name = (); variable cmap = png_get_colormap (name); variable tmpname = "tmp-$name.png"$; png_write (tmpname, _reshape(cmap, [1, length(cmap)])); list_append (tmpnames, tmpname); variable png = xfig_new_pict (tmpname, width, height); variable label = xfig_new_text ("\\verb|$name|"$; size="Large"); variable obj = xfig_new_hbox_compound (png, label, 1); list_append (list, obj); } obj = xfig_new_vbox_compound (__push_list(list), 0); obj.render ("colormaps.png"); foreach tmpname (tmpnames) () = remove (tmpname); } slxfig-pre0.2.0-138/examples/polyline/0002755000175000000620000000000012463364752016332 5ustar johnstaffslxfig-pre0.2.0-138/examples/polyline/fill-styles.sl0000644000175000000620000000074512463364752021145 0ustar johnstaffrequire("xfig"); define slsh_main() { variable x, y, fill, c = xfig_new_compound(); _for x (0, 9, 1) c.append( xfig_new_text(`\_`+string(x); x0=x+.5, y0=1.5) ); _for y (0, 6, 1) c.append( xfig_new_text(string(y)+`\_`; x0=-.5, y0=-y+.5) ); _for fill (0, 62, 1) { x = (fill mod 10) + [0,1,1,0]; y = -(fill / 10) + [0,0,1,1]; variable p = xfig_new_polyline(x, y; closed, areafill=fill, fillcolor=1); c.append(p); } c.render("fill-styles.png"); } slxfig-pre0.2.0-138/examples/polyline/Makefile0000644000175000000620000000011212463364752017762 0ustar johnstaffPNG_FILES = \ arrows.png \ fill-styles.png \ include ../Makefile.sub slxfig-pre0.2.0-138/examples/polyline/arrows.sl0000644000175000000620000000136711532666762020216 0ustar johnstaffrequire("xfig"); variable dy = 2.5; variable c = xfig_new_compound(); variable a, txt; _for a (0, 1, 1) { txt = xfig_new_text(`\centering\tt arrow\_\\style=$a`$); xfig_justify_object(txt, vector((a ? dy : -dy), .5, 0), vector(0, -.5, 0)); c.append(txt); } _for a (0, 14, 1) { variable q = struct { arrow_type=a, arrow_style=1, arrow_width=16, arrow_heigth=32 }; c.append(xfig_new_polyline([-dy,dy], [-a, -a] ; width=2, depth=a, backward_arrow=xfig_create_arrow(; @q, arrow_style=0), forward_arrow =xfig_create_arrow(; @q, arrow_style=1) ) ); txt = xfig_new_text(`\tt arrow\_type=$a`$); xfig_justify_object(txt, vector(0, -a, 0), vector(0, -.5, 0)); c.append(txt); } c.render("arrows.png"); slxfig-pre0.2.0-138/examples/Makefile.sub0000644000175000000620000000027412463364752016730 0ustar johnstaff# -*- make -*- all: $(PNG_FILES) %.png: %.sl ../run.sl ./$< clean: -/bin/rm -f *.fig *~ -/bin/rm -rf autoeps distclean: clean -/bin/rm -f $(PNG_FILES) $(ADDITIONAL_FILES_TO_CLEAN) slxfig-pre0.2.0-138/examples/plot/0002755000175000000620000000000014540004350015434 5ustar johnstaffslxfig-pre0.2.0-138/examples/plot/Makefile0000644000175000000620000000053113557512750017110 0ustar johnstaffPNG_FILES = \ axisxform.png \ color.png \ colors.png \ errbar.png \ font-style.png \ histplt.png \ image.png \ multiplot.png \ multiplot2.png \ overlay.png \ scatter.png \ simple.png \ subplot.png \ symbol.png \ scilabel.png \ ticlabels.png \ timetics.png \ world.png # project.png \ include ../Makefile.sub slxfig-pre0.2.0-138/examples/plot/scilabel.sl0000644000175000000620000000134212034510744017555 0ustar johnstaffrequire ("xfig"); define slsh_main () { xfig_plot_set_default_size (10,10); variable x, y, w1, w2, w3, w4, w5, w6; w1 = xfig_plot_new (); x = [1e-6:1.1e-5:#100], w1.plot (x,x); w2 = xfig_plot_new (); x = [1e-6:1.1e-5:#100], w2.plot (x,x;logy); w3 = xfig_plot_new (); x = [1e7:1.1e9:#100], w3.plot (x,x;logy); w4 = xfig_plot_new (); x = [9e7:1.1e20:#100]; w4.plot (x,x;logy); w5 = xfig_plot_new (); x = [3e7:8e7:#100]; w5.plot (x,x;logy); w6 = xfig_plot_new (); x = [4e-2:6e1:#100]; y = [4e-7:4e27:#100]; w6.plot (x,y;loglog); xfig_new_vbox_compound (xfig_new_hbox_compound(w1,w2,w3,1), xfig_new_hbox_compound(w4,w5,w6,1), 1).render ("scilabel.png"); } slxfig-pre0.2.0-138/examples/plot/simple.sl0000644000175000000620000000061711435424403017274 0ustar johnstaffrequire ("xfig"); public define slsh_main () { variable x = 10^[-0.5:1.5:#200]; variable y = sin (1/x)*exp(-x); variable w = xfig_plot_new (); w.plot (x, y;logx); variable legend = xfig_new_legend (["Damped"], ["black"], 0, 3, 2); w.add_object (legend, 6, 0.37); w.xlabel ("Time[s]"R); w.ylabel ("Voltage [mV]"R); w.title ("Simple Example"); w.render("simple.png"); } slxfig-pre0.2.0-138/examples/plot/timetics.sl0000644000175000000620000000131114540004350017607 0ustar johnstaffrequire ("xfig"); public define slsh_main () { variable wlist = {}; variable t0 = 1546300800 + 5*3600; foreach ([1, 2, 5, 10, 20, 50, 100, 200, 500, 1000]) { variable f = (); variable tmax = t0 + 1.2*86400; variable tmin = t0 - 1.2*86400*f; variable tinfo = xfig_timetics (tmin, tmax; localtime, maxtics=6); variable t = [tmin:tmax:#1024]; variable y = sin(2*PI/(1*86400)*(t-tmin)); % 1 day period variable w = xfig_plot_new(20, 2); w.plot (t, y; color="blue"); w.x1axis (;; tinfo); %major=tinfo.major, minor=tinfo.minor, ticlabels=tinfo.ticlabels); w.ylabel ("Value"); list_append (wlist, w); } xfig_new_vbox_compound (__push_list (wlist), 0.25).render ("timetics.png"); } slxfig-pre0.2.0-138/examples/plot/subplot.sl0000644000175000000620000000127411325613443017475 0ustar johnstaffrequire ("xfig"); public define slsh_main () { variable t = [0:5:#1000]; variable y = cos (2*PI*t)*exp(-t); variable w1 = xfig_plot_new (14, 6); variable w2 = xfig_plot_new (14, 3); variable w1w2 = xfig_new_vbox_compound (w1, w2, 0); w1.world (t, y;xlog); w1.x1axis(;ticlabels=0); w1.plot (t, y; color="blue3"); w1.plot (t[[::10]], y[[::10]]; sym="diamond", color="green2", line=0, fill=1); w1.title ("\Huge Two subplots"R); y = cos (2*PI*t); w2.world (t, y;xlog); w2.xlabel("\bf Time [s]"R); w2.plot (t, y); w1.ylabel("\bf Damped Oscillation"R); w2.ylabel("\bf\begin{center}Undamped\\Oscillation\end{center}"R); w1w2.render ("subplot.png"); } slxfig-pre0.2.0-138/examples/plot/project.sl0000644000175000000620000000173111325613443017451 0ustar johnstaff#!/usr/bin/env slsh () = fprintf (stderr, "This example is a work-in-progress\n"); exit (1); require ("xfig"); private define project_image (img, X, xhat, yhat, pixel_size) { xfig_set_eye (1000, 60, 0); variable nx, ny, dims; dims = array_shape (img); nx = dims[1]; ny = dims[0]; variable xll, xlr, xul, xur; variable dx = (nx*pixel_size)*xhat; variable dy = (ny*pixel_size)*yhat; Xll = X - 0.5*dx - 0.5*dy; Xlr = X + 0.5*dx - 0.5*dy; Xul = X - 0.5*dx + 0.5*dy; Xur = X + 0.5*dx + 0.5*dy; variable xll, xlr, xul, xur, yll, ylr, yul, yur; (xll, yll) = xfig_project_to_xfig_plane (Xll); (xlr, ylr) = xfig_project_to_xfig_plane (Xlr); (xur, yur) = xfig_project_to_xfig_plane (Xur); (xul, yul) = xfig_project_to_xfig_plane (Xul); variable xmin, ymin, xmax, ymax; xmin = min ([xll, xlr, xur, xul]); xmax = max ([xll, xlr, xur, xul]); ymin = min ([yll, ylr, yur, yul]); ymax = max ([yll, ylr, yur, yul]); } slxfig-pre0.2.0-138/examples/plot/color.sl0000644000175000000620000000210311325613443017113 0ustar johnstaffrequire ("xfig"); public define slsh_main () { variable t = 10^[-1:1:#20]; variable y = cos (2*PI*t)*exp(-t); variable dy = 0.2 + 0.1*abs(y); variable w = xfig_plot_new (14, 10); w.title("Example with colors and fonts"; color="red4", size="Huge"); w.world (0.09, 12, -1.0, 1.0; xlog); w.axis (;grid=1, major_line=1, minor_line=2); w.xaxis (;color="magenta4",major_color="green2"); w.yaxis (;color="magenta4"); w.x1axis (;ticlabel_color="blue2"); w.y1axis (;ticlabel_color="green2"); w.plot (t, y, dy; line=2, color="red3", sym="triangle", symcolor="blue", symsize=2, fill=20, eb_color="green4"); w.xlabel ("Time [s]"R; color="cyan4", size="large"); w.ylabel ("Voltage [mV]"; color="red"); w.x2label ("This is the x2label";size="large", color="orange"); xfig_new_color ("aquamarine3", (102 shl 16)|(205 shl 8)|170); variable text = xfig_new_text ("Equation: \bf $e^{-t}\cos(2\pi t)$"R; color="black", size="Huge", style="sc"); text.set_depth(1); w.add_object (text, 10, 0.75, 0.5, 0); w.render ("color.png"); } slxfig-pre0.2.0-138/examples/plot/errbar.sl0000644000175000000620000000202111435153535017254 0ustar johnstaffrequire ("xfig"); require ("rand"); try { require ("histogram"); } catch IOError: { () = fprintf (stderr, "This example requires the histogram module\n"); exit (0); } private define gaussian_pdf (x, sigma) { return exp(-0.5*(x/sigma)^2)/sigma/sqrt(2*PI); } define slsh_main () { variable mu = 5, sigma = 1; variable data = mu + rand_gauss (sigma, 100); variable dx = 0.4; variable x = [min(data):max(data):dx]; variable y = hist1d (data, x); variable dy = sqrt (y); variable xx = [mu-5*sigma:mu+5*sigma:0.1*dx]; variable yy = (dx*length (data)) * gaussian_pdf (xx-mu, sigma); variable w = xfig_plot_new (); w.world (min(x), max(x), 0.9, max(y)*1.1); w.plot (xx, yy); x += 0.5*dx; w.plot (x,y, dx, {dy, 0.75*dy}; line=1, color="blue", sym="diamond", symcolor="blue1", width=3, size=3, fill=10, eb_color="orange"); w.title ("Example with asymmetric error bars"); w.xlabel("$\lambda$ [\AA]"R); w.ylabel("Counts per bin"R); xfig_render_object (w, "errbar.png"); } slxfig-pre0.2.0-138/examples/plot/histplt.sl0000644000175000000620000000141611435424403017470 0ustar johnstaffrequire ("xfig"); require ("rand"); try { require ("histogram"); } catch IOError: { () = fprintf (stderr, "This example requires the histogram module\n"); exit (0); } private define gauss_pdf (x, sigma) { return 1.0/sqrt(2*PI*sigma^2) * exp(-0.5*x^2/sigma^2); } public define slsh_main () { variable mu = 100, sigma = 15, dx = 1.0; variable data = mu + rand_gauss (sigma, 10000); variable x = [min(data):max(data):dx]; variable h = hist1d (data, x)/(dx*length(data)); variable w = xfig_plot_new (); w.world (x,h); w.hplot (x, h; fillcolor="red", fill=20); h = gauss_pdf (x-mu,sigma); w.plot (x,h; color="blue"); w.xlabel ("IQ"); w.ylabel ("Probability [bin$^{-1}$]"); w.title (`$\mu=100;\sigma=15$`); w.render ("histplt.png"); } slxfig-pre0.2.0-138/examples/plot/scatter.sl0000644000175000000620000000054211435153535017452 0ustar johnstaffrequire ("xfig"); require ("rand"); public define slsh_main () { variable w = xfig_plot_new (14,14); variable x = rand_gauss (1.0, 10000); variable y = rand_gauss (1.0, 10000); w.world (-5,5,-5,5); w.plot (x,y;sym="point",size=0.1); w.add_object (xfig_new_text ("\\large points"), 0.25, 0.75 ; world00); w.render ("scatter.png"); } slxfig-pre0.2.0-138/examples/plot/world.sl0000644000175000000620000000153011325613443017127 0ustar johnstaffrequire ("xfig"); require ("rand"); private define f2c (f) { return 5.0/9.0 * (f-32.0); } define slsh_main () { variable w = xfig_plot_new (); w.xlabel ("Length [inches]"); w.x2label ("Length [cm]"); w.ylabel ("Temperature [F]"); w.y2label ("Temperature [C]"); % Fake some data variable npts = 30; variable sigma_l = 0.2; variable sigma_t = 20.0; variable lengths = [3.0:12.0:#npts] + rand_gauss (sigma_l, npts); variable temps = [-200:120:#npts] + rand_gauss (sigma_t, npts); w.world1 (lengths, temps); w.world2 (2.54*lengths, f2c(temps)); % For fun, plot the data as inches-vs-C, which is world12 w.plot (lengths, f2c(temps), sigma_l, 5.0/9.0*sigma_t; world12, sym="x", color="blue"); w.shade_region (6, 8, 0, 1; world10, fillcolor="black", fill=5); w.render ("world.png"); } slxfig-pre0.2.0-138/examples/plot/overlay.sl0000644000175000000620000000433511471172372017472 0ustar johnstaffrequire ("xfig"); require ("png"); require ("rand"); try { require ("histogram"); } catch IOError: { () = fprintf (stderr, "This example requires the histogram module\n"); exit (0); } private define make_hist_image (x, h, xmin, xmax, ymin, ymax, color) { variable w = xfig_plot_new (); w.world (xmin, xmax, ymin, ymax); w.axes (; off); w.hplot (x, h; fill=20, color=color); w.plot ([xmin, xmax], [ymin, ymax]; sym="point"); % registration marks variable tmp = "tmp.png"; w.render (tmp); variable img = png_read (tmp); ()=remove (tmp); return img; } public define slsh_main () { variable mu = 100, sigma = 15; variable data1 = mu + rand_gauss (sigma, 10000); variable data2 = 10 + mu + rand_gauss (sigma, 10000); variable all_data = [data1, data2]; variable x = [int(min(all_data)):1+int(max(all_data)):1]; variable h1 = hist1d (data1, x)/(1.0*length(data1)); variable h2 = hist1d (data2, x)/(1.0*length(data2)); variable xmin = x[0], xmax = x[-1], ymin = 0, ymax = max([h1,h2]); variable img1 = make_hist_image (x, h1, xmin, xmax, ymin, ymax, "red"); variable img2 = make_hist_image (x, h2, xmin, xmax, ymin, ymax, "blue"); variable img1_r = png_rgb_get_r (img1); variable img1_g = png_rgb_get_g (img1); variable img1_b = png_rgb_get_b (img1); variable img2_r = png_rgb_get_r (img2); variable img2_g = png_rgb_get_g (img2); variable img2_b = png_rgb_get_b (img2); variable w1 = 0.5 + img1_r*0.0; variable i = where ((img1 == 0xFFFFFF) and (img2 != 0xFFFFFF)); w1[i] = 0.0; i = where ((img2 == 0xFFFFFF) and (img1 != 0xFFFFFF)); w1[i] = 1.0; variable w2 = 1.0 - w1; variable img12_r = typecast (w1*img1_r + w2*img2_r, UChar_Type); variable img12_g = typecast (w1*img1_g + w2*img2_g, UChar_Type); variable img12_b = typecast (w1*img1_b + w2*img2_b, UChar_Type); variable img12 = (img12_r shl 16)|(img12_g shl 8)|(img12_b); variable png = "tmp.png"; png_write (png, img12); variable w = xfig_plot_new (); w.world (xmin, xmax, ymin, ymax); w.plot_png (png); w.xlabel ("IQ"); w.ylabel ("Probability [bin$^{-1}$]"); w.title (`$\mu=100;\sigma=15$ vs. $\mu=110;\sigma=15$`); w.render("overlay.png"); ()=remove (png); } slxfig-pre0.2.0-138/examples/plot/ticlabels.sl0000644000175000000620000000315311366243142017745 0ustar johnstaffrequire ("xfig"); public define slsh_main () { variable i; _for i (1, 4, 1) { variable w = xfig_plot_new(); variable x = [0:10:0.1]; w.plot(x, x^2); switch(i) { case 1: message("The following statement will produce the warning" +` "4 major ticmarks / 3 ticlabels":`); w.x1axis(; major=[ 1, 2, 5, 10 ], ticlabels=[ "one?", "two?", "five?" ], minor=[0:10]); } { case 2: message("The following statement will produce the warning" +` "3 major ticmarks / 4 ticlabels":`); w.x1axis(; major=[ 1, 2, 5 ], ticlabels=[ "one?", "two?", "five?", "ten?"], minor=[0:10]); } { case 3: % The major and ticlabels qualifiers % should be used in the following way: w.x1axis(; major=[ 1, 2, 5, 10 ], ticlabels=[ "one!", "two!", "five!", "ten!"], minor=[0:10]); } { case 4: % The following statement will work correctly: % both user_specified_major_tic -1 % and user_specified_tic_label "minus one!" will be ignored. w.x1axis(; major=[-1, 1, 2, 5, 10 ], ticlabels=["minus one!", "one!", "two!", "five!", "ten!"], minor=[0:10]); } w.render("ticlabels.png"); } } slxfig-pre0.2.0-138/examples/plot/image.sl0000644000175000000620000000217311357313335017070 0ustar johnstaffrequire ("xfig"); require ("png"); static define func (x, y) { (x, y) = xfig_meshgrid (x, y); return 3*(1-x)^2*exp(-x^2 - (y+1)^2) - 10*(x/5 - x^3 - y^5)*exp(-x^2-y^2) -0.5*exp(-(x+1)^2 - y^2); } define slsh_main () { variable x = [-3:3:0.05]; variable y = [-3:3:0.05]; variable z = func (x, y); variable colormap = "drywet"; png_write_flipped ("tmp1.png", png_gray_to_rgb (z, colormap)); variable scale = png_gray_to_rgb (_reshape([0:255],[256,1]), colormap); png_write_flipped ("tmp2.png", scale); variable width = 14, height = 14; variable w1 = xfig_plot_new (width, height); w1.world(x, y); w1.plot_png ("tmp1.png"); w1.xlabel ("$x$"; size="Large"); w1.ylabel ("$y$"; size="Large"); w1.title ("$f(x,y)=3(1-x)^2 e^{-x^2-(y+1)^2} +\ldots$"R; size="Large",color="blue"); variable w2 = xfig_plot_new (1, height); w2.world (0, 1, min(z), max(z)); w2.xaxis (;off); w2.y1axis (;off); w2.y2axis (;on); w2.y2label ("$f(x,y)$"); w2.plot_png ("tmp2.png"); xfig_new_hbox_compound (w1, w2, 2).render ("image.png"); () = remove ("tmp1.png"); () = remove ("tmp2.png"); } slxfig-pre0.2.0-138/examples/plot/axisxform.sl0000644000175000000620000000111611325613443020020 0ustar johnstaffrequire ("xfig"); require ("rand"); private define wcs_func (x, cd) { variable s = sign(x); return s*sqrt(s*x); } private define wcs_invfunc (x, cd) { return sign(x)*x*x; } xfig_plot_add_transform ("sqrt", &wcs_func, &wcs_invfunc, NULL); define slsh_main () { variable n = 100000; variable x = rand_gauss (1.0, n); x = x[array_sort(x)]; variable c = cumsum(1+Double_Type[n]); c /= c[-1]; variable w = xfig_plot_new (); w.xaxis(;wcs="sqrt",); w.yaxis(;wcs="cdf",); % built-in method for CDFs w.plot (x, c); w.render ("axisxform.png"); } slxfig-pre0.2.0-138/examples/plot/font-style.sl0000644000175000000620000000253612463364752020125 0ustar johnstaffrequire ("xfig"); public define slsh_main () { xfig_add_latex_package ("fontenc[T1]", "yfonts", "marvosym"); %, "mathabx"); xfig_set_font_style (`\swabfamily`); variable p = xfig_plot_new (); variable a = exp([-1.5:4:#100]); variable P = a^1.5; p.world (a, P; xlog, ylog); p.world2 (a*1.49598e8, P*365.2425; xlog, ylog); p.plot (a, P; line=1); variable a_planet = [0.39, 0.72, 1, 1.52, 5.20, 9.54, 19.22, 30.06]; variable P_planet = [0.24, 0.62, 1, 1.88, 11.86, 29.46, 84.01, 164.8 ]; variable planet = ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"]; p.plot (a_planet, P_planet; sym="diamond", fill=20); variable i; _for i (0, 7, 1) p.xylabel (a_planet[i]*1.05, P_planet[i], "\\Large\\"+planet[i], -0.5, 0.5); p.xlabel ("Axis: semimaior [unitas: astronomica]"); p.ylabel ("Periodus: orbitalis: [annus:]"); p.x2label ("Axis: semimaior [chiliometrum]"); p.y2label ("Periodus: orbitalis: [dies:]"); p.xylabel (.05, .93, `\begin{minipage}{95mm}` +"Sed res: est certissima exactissimaque, quod proportio quae est inter binorum quorumcunque Planetarum tempora periodica, sit praecise sesquialtera proportionis: mediarum distantiarum, id est Orbium ipsorum." +`\end{minipage}`, -0.5, 0.5; world0); p.scale(1.5); p.render ("font-style.png"); } slxfig-pre0.2.0-138/examples/plot/multiplot2.sl0000644000175000000620000000133611435153535020122 0ustar johnstaffrequire ("xfig"); define sin_series(x, n) { variable y = 0*x; variable i, sign_and_factorial=1.; _for i (0, n, 1) { y += x^(2*i+1)/sign_and_factorial; sign_and_factorial *= -(2*i+2) * (2*i+3); } return y; } public define slsh_main () { variable n = 12; variable w = Struct_Type[n]; variable x = [-2*PI:2*PI:#1000]; variable i; _for i (0, n-1, 1) { w[i] = xfig_plot_new (10, 4); w[i].world (-2*PI, 2*PI, -PI, PI); w[i].plot (x, sin_series(x, i)); w[i].xylabel(0.1, 0.85, "$n="+string(i)+"$"; world0); } xfig_multiplot (w; cols=3, xlabel="$x$", ylabel="$y$", title="$\displaystyle y_n=\sum_{i=0}^n(-1)^i\frac{x^{2i+1}}{(2i+1)!}$"R ).render ("multiplot2.png"); } slxfig-pre0.2.0-138/examples/plot/multiplot.sl0000644000175000000620000000105011357313335020030 0ustar johnstaffrequire ("xfig"); public define slsh_main () { variable n = 3; variable w = Struct_Type[n]; variable x = [0:1:#1000]; variable i; variable pow = [0.5, 1, 2]; _for i (0, n-1, 1) { w[i] = xfig_plot_new (12, 3); w[i].plot (x, x^pow[i]); w[i].xlabel ("$x$"); w[i].ylabel (sprintf ("$n = %g$", pow[i])); w[i].title (sprintf ("$y = x^{%g}$", pow[i])); } variable increasing = 1; xfig_multiplot (increasing ? (w[0], w[1], w[2]) : (w[2], w[1], w[0]) ; title="$y = x^n$" ).render ("multiplot.png"); } slxfig-pre0.2.0-138/examples/plot/symbol.sl0000644000175000000620000000150011325613443017302 0ustar johnstaffrequire ("xfig"); require ("rand"); public define slsh_main () { variable w = xfig_plot_new (); variable symbols = xfig_plot_get_symbol_names (); variable num = length (symbols); w.world (0, 1, 0, num+1); w.xaxis (;color="green3", width=2); w.yaxis (;color="green3", width=2); variable color = "blue"; variable dx = 0.1; _for (0, num-1, 1) { variable i = (); variable sym = symbols[i]; variable text = xfig_new_text (sym; size="Large"); w.plot (0.25, i+1; sym=sym, size=1, width=1, color=color, fill=20, fillcolor=color); w.add_object (text, 0.5, i+1); w.plot (0.8+dx, i+1; sym=sym, size=3, width=1, color="red"); dx = -dx; } w.title (w, "A plot with symbols"); w.xlabel ("Time [s]"R; color=0xFFCC00, size="Huge"); w.ylabel ("Voltage [mV]"R); w.render ("symbol.png"); } slxfig-pre0.2.0-138/examples/plot/colors.sl0000644000175000000620000000076611532666762017327 0ustar johnstaffrequire ("xfig"); public define slsh_main () { variable color, ncolors = 33; variable w = xfig_plot_new (14, 20); w.world (0, 1, ncolors, -1); w.xaxis(; major=[-1, 2]); _for color (0, ncolors-1, 1) { w.plot ([0.1, 0.5], [color, color]; width=6, color=color); variable info = xfig_get_color_info (color); if (info == NULL) continue; w.xylabel (0.6, color, sprintf (`\verb|#%06X %3d %s|`, info.rgb, color, info.name), -0.5, 0); } w.render ("colors.png"); } slxfig-pre0.2.0-138/examples/draw/0002755000175000000620000000000011532666762015436 5ustar johnstaffslxfig-pre0.2.0-138/examples/draw/Makefile0000644000175000000620000000007411532666762017075 0ustar johnstaffPNG_FILES = \ inclinometer.png \ include ../Makefile.sub slxfig-pre0.2.0-138/examples/draw/inclinometer.sl0000644000175000000620000000404011532666762020462 0ustar johnstaffrequire ("xfig"); private define new_opaque_box (obj) { variable x0, x1, y0, y1; (x0, x1, y0, y1,,) = obj.get_bbox (); variable box = xfig_new_polygon (vector([x0, x1, x1, x0, x0], [y0, y0, y1, y1, y0], [0, 0, 0, 0, 0])); box.set_pen_color ("white"); box.set_area_fill (20); box.set_fill_color ("white"); return box; } define slsh_main () { xfig_use_inches (); variable rmax = 6, bigtic = 1, medtic = 0.5*bigtic, smalltic = 0.2*bigtic, border = 0.5; variable obj = xfig_new_compound_list (); variable tics = xfig_new_polyline_list (); variable theta; _for theta (0, 90, 1) { variable theta_rad = theta * PI/180.0; variable ticsize = smalltic; variable draw_label = 0; if ((theta mod 5) == 0) ticsize = medtic; if ((theta mod 10) == 0) { ticsize = bigtic; draw_label = 1; } variable rmin = rmax - ticsize, xs = [rmin, rmax]*sin(theta_rad), ys = -[rmin, rmax]*cos(theta_rad), zs = [0, 0]; tics.insert (vector (xs, ys, zs)); if (draw_label) { variable label = xfig_new_text ("$theta"$; size="LARGE"); variable dX = 1.0*vector (sin(theta_rad), -cos(theta_rad), 0); xfig_justify_object(label, vector(xs[0], ys[0], 0), dX); variable box = new_opaque_box (label); box.set_depth (10); label.set_depth (0); obj.insert (label); obj.insert (box); } if ((theta == 0) || (theta == 90)) { xs[0] = -border*sin(theta_rad), ys[0] = border*cos(theta_rad); tics.insert (vector(xs,ys,zs)); } } tics.set_thickness (3); tics.set_depth (20); obj.insert (tics); % Now draw a circle around the origin variable circle = xfig_new_ellipse (border*0.25, border*0.25); % and add the border variable xmin = -border, xmax = rmax+border, ymin = -rmax-border, ymax = border; box = xfig_new_polygon (vector([xmin, xmax, xmax, xmin, xmin], [ymin, ymin, ymax, ymax, ymin], [0, 0, 0, 0, 0])); obj.insert (circle); obj.insert (box); obj.render ("inclinometer.png"); } slxfig-pre0.2.0-138/examples/slxfigrc0000644000175000000620000000133711325613443016233 0ustar johnstaff%-*- slang -*- % This file should be copied to $HOME/.slxfigrc. It gets loaded each % time slxfig is loaded. % % slxfig autogenerates eps files by running latex. The xfig_set_autoeps_dir % function specifies the directory where these files are to be placed. xfig_set_autoeps_dir ("$HOME/.slxfig/autoeps"$); % Directory where temporary files are to be placed. xfig_set_tmp_dir ("slxfigtmp"); xfig_set_paper_size ("Letter"); % A4, .... xfig_add_latex_package ("mathpazo"); % If you have ps2ps installed, you might try using this command to % create the postscript files: % % xfig_set_output_driver ("ps", "fig2dev -L ps -c -z %P %I %B-tmp.ps" % + ";ps2ps %B-tmp.ps %O; rm -f %B-tmp.ps"); slxfig-pre0.2.0-138/examples/3d/0002755000175000000620000000000011653730343014776 5ustar johnstaffslxfig-pre0.2.0-138/examples/3d/Makefile0000644000175000000620000000022511653730343016433 0ustar johnstaffPNG_FILES = \ rotating_cube.png \ rotating_cube.pdf \ # rotating_cube.pdf is generated together with rotating_cube.png include ../Makefile.sub slxfig-pre0.2.0-138/examples/3d/rotating_cube.sl0000644000175000000620000000540611653730343020166 0ustar johnstaffrequire ("xfig"); define slsh_main () { % % position of the eye % variable distance = 2; % must be > sqrt(3)/2 to view the cube from the outside % small distances lead to strong projective effects % large distances lead to a quasi-orthogonal projection variable THETA = 57 + [0:359:10]; % array of theta values variable PHI = 30; % (possible) array of phi values % % defining squares in different coordinate planes % variable c1 = [0, 1, 1, 0, 0] - .5; % coordinates for axis 1 variable c2 = [0, 0, 1, 1, 0] - .5; % coordinates for axis 2 variable cm = [0, 0, 0, 0, 0] - .5; % constant (-) coordinates for axis 3 variable cp = [1, 1, 1, 1, 1] - .5; % constant (+) coordinates for axis 3 variable plist = xfig_new_polygon_list(); % Mind the orientation! Only polygons with normal vector pointing toward the eye will currently be rendered. plist.insert ( xfig_new_polygon (vector(c1, c2, cp); fillcolor="#FF0000") ); % normal vector ( 0, 0, 1) => "outwards" plist.insert ( xfig_new_polygon (vector(cp, c1, c2); fillcolor="#00EE00") ); % normal vector ( 1, 0, 0) => "outwards" plist.insert ( xfig_new_polygon (vector(c2, cp, c1); fillcolor="#0000FF") ); % normal vector ( 0, 1, 0) => "outwards" plist.insert ( xfig_new_polygon (vector(c2, c1, cm); fillcolor="#EEEE00") ); % normal vector ( 0, 0, -1) => "outwards" plist.insert ( xfig_new_polygon (vector(cm, c2, c1); fillcolor="#00EEEE") ); % normal vector (-1, 0, 0) => "outwards" plist.insert ( xfig_new_polygon (vector(c1, cm, c2); fillcolor="#EE00EE") ); % normal vector ( 0, -1, 0) => "outwards" % % rendering several perspectives and including them into one pdf via LaTeX % variable render_png = 1; variable base = path_basename_sans_extname (__FILE__); variable dir = base; ()=mkdir (dir); variable fp = fopen ("$base.tex"$, "w"); ()=fprintf (fp, `\documentclass{article} \usepackage{graphicx} \usepackage[dvipdfm,paperwidth=10cm,paperheight=10cm,margin=0cm]{geometry} \setlength{\parindent}{0cm} \pagestyle{empty} \begin{document} `); foreach (THETA) { variable theta = (); foreach (PHI) { variable phi = (); xfig_set_eye (distance, theta, phi); if (render_png) { plist.render ("$base.png"$); render_png = 0; } variable ps_filename = path_concat (dir, sprintf ("%03.f_%03.f.ps", theta, phi)); plist.render (ps_filename); ()=fprintf (fp, "\\includegraphics[viewport=280 370 330 420,width=\\textwidth]{%s}\n", ps_filename); } } ()=fprintf (fp, `\end{document}`); ()=fclose (fp); ()=system ("latex $base.tex; dvipdfm $base.dvi; rm $base.log $base.aux $base.dvi"$); % % purge tex files % ()=system ("rm -rf $base.tex $dir/"$); } slxfig-pre0.2.0-138/examples/transparent/0002755000175000000620000000000013726105127017030 5ustar johnstaffslxfig-pre0.2.0-138/examples/transparent/Makefile0000644000175000000620000000030612463364752020475 0ustar johnstaffPNG_FILES = \ mandelbrot.pdf ADDITIONAL_FILES_TO_CLEAN = \ mandelbrot.svg mandelbrot_alpha.png %.pdf: %.sl slsh -DSLXFIG_RENDER_LATEX_AS_TRANSPARENT_PNG ../run.sl $< include ../Makefile.sub slxfig-pre0.2.0-138/examples/transparent/README0000644000175000000620000000142612463364752017721 0ustar johnstaffSLxfig supports -DSLXFIG_RENDER_LATEX_AS_TRANSPARENT_PNG When the symbol SLXFIG_RENDER_LATEX_AS_TRANSPARENT_PNG is defined, any LaTeX output is rendered as transparent png (instead of eps) -- which may be desirable when other transparent pngs are used. In this case, its probably best to render the Xfig output to svg. The following can be used to generate a pdf from an intermediate svg: xfig_set_output_driver ("pdf", "fig2dev -L svg %I %B.svg && rsvg-convert -f pdf %B.svg > %O && rm %B.svg"); % or xfig_set_output_driver ("pdf", "fig2dev -L svg %I %B.svg && inkscape %B.svg --export-pdf=%O && rm %B.svg"); The current implementation requires the following programs to be installed: dvipng (debian package: dvipng) rsvg-convert (debian package: librsvg2-bin) slxfig-pre0.2.0-138/examples/transparent/mandelbrot.sl0000644000175000000620000000652013726105127021520 0ustar johnstaff% -*- mode: slang; mode: fold -*- try { require("xfig"); } catch AnyError: exit (1); variable use_inkscape = 0; xfig_set_output_driver("pdf", "fig2dev -L svg %I %B.svg" + " && " + (use_inkscape ? "inkscape %B.svg --export-pdf=%O" : "rsvg-convert -f pdf %B.svg -o %O") % + " && rm %B.svg" ); variable width = 1024, height = width*3/4; variable x = [-2:2/3.:#width], y = [-1:1:#height]; variable mandelbrot_max = 200; private define in_cardioid(x, y) { variable p = hypot(x-.25, y); return x < p - 2*p*p + .25; } define mandelbrot(x, y) { if (in_cardioid(x, y)) return 1.; variable c = x + 1i*y, z = c, i = 0; while (i < mandelbrot_max && abs(z) < 2) { z = z*z + c; i++; } return log(1 + i) / log(1 + mandelbrot_max); } variable png = "mandelbrot_alpha.png"; if (stat_file(png) == NULL) { xfig_meshgrid(y, x); variable X = (), Y = (); variable m = array_map(Double_Type, &mandelbrot, X, Y); png_write(png, 0xFFFFFF + (int(255-255*m)<<24), 1); } variable text = `%{{{ The Mandelbrot set is the set of complex numbers $c$ for which the sequence $\big(c$, $c^2 + c$, $(c^2+c)^2 + c$, $((c^2+c)^2+c)^2 + c$, $(((c^2+c)^2+c)^2+c)^2 + c$, \ldots$\big)$ does not approach infinity. The set is closely related to Julia sets (which include similarly complex shapes) and is named after the mathematician Beno\^it Mandelbrot, who studied and popularized it. Mandelbrot set images are made by sampling complex numbers and determining for each whether the result tends towards infinity when a particular mathematical operation is iterated on it. Treating the real and imaginary parts of each number as image coordinates, pixels are colored according to how rapidly the sequence diverges, if at all. More precisely, the Mandelbrot set is the set of values of $c$ in the complex plane for which the orbit of 0 under iteration of the complex quadratic polynomial \[ z_{n+1} \quad=\quad z_n^2 \;\;+\;\; c \] remains bounded. That is, a complex number $c$ is part of the Mandelbrot set if, when starting with $z_0 = 0$ and applying the iteration repeatedly, the absolute value of $z_n$ remains bounded however large $n$ gets. For example, letting $c = 1$ gives the sequence 0, 1, 2, 5, 26, \ldots, which tends to infinity. As this sequence is unbounded, 1 is not an element of the Mandelbrot set. On the other hand, $c = -1$ gives the sequence $0, -1, 0, -1, 0, \ldots$, which is bounded, and so $-1$ belongs to the Mandelbrot set. Images of the Mandelbrot set display an elaborate boundary that reveals progressively ever-finer recursive detail at increasing magnifications. The ``style'' of this repeating detail depends on the region of the set being examined. The set's boundary also incorporates smaller versions of the main shape, so the fractal property of self-similarity applies to the entire set, and not just to its parts. The Mandelbrot set has become popular outside mathematics both for its aesthetic appeal and as an example of a complex structure arising from the application of simple rules, and is one of the best-known examples of mathematical visualization. `; %}}} variable pl = xfig_plot_new(16, 12); pl.world(x[0], x[-1], y[0], y[-1]); pl.shade_region(0,1, 0,1; world0, color="gray", depth=100); pl.xylabel(.5, .5, `\begin{minipage}{17cm}\footnotesize $text \end{minipage}`$; world0, depth=99); pl.plot_png(png); pl.render("mandelbrot.pdf"); slxfig-pre0.2.0-138/examples/run.sl0000755000175000000620000000100113726105127015624 0ustar johnstaff#!/usr/bin/env slsh _traceback=1; prepend_to_slang_load_path (path_concat (getcwd (), "../../src")); try { require ("xfig"); } catch AnyError: { #ifdef SLXFIG_RENDER_LATEX_AS_TRANSPARENT_PNG exit (1); #else throw; #endif } xfig_set_tmp_dir (sprintf ("/tmp/slxfig-%d", getuid())); private define main () { if (__argc != 2) { () = fprintf (stderr, "Usage: ./%s \n", path_basename (__argv[0])); exit (1); } () = evalfile (path_concat ("./", __argv[1])); } main (); slxfig-pre0.2.0-138/configure0000755000175000000620000060054614146404547014576 0ustar johnstaff#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME= PACKAGE_TARNAME= PACKAGE_VERSION= PACKAGE_STRING= PACKAGE_BUGREPORT= PACKAGE_URL= ac_unique_file="src/gcontour-module.c" ac_default_prefix=/usr/local # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='LTLIBOBJS LIBOBJS SL_FILES_INSTALL_DIR MODULE_INSTALL_DIR slang_patchlevel_version slang_minor_version slang_major_version slang_version SLANG_INC_DIR SLANG_LIB_DIR SLANG_INC SLANG_LIB X_EXTRA_LIBS X_LIBS X_PRE_LIBS X_CFLAGS XMKMF M_LIB SLANG_DLL_CFLAGS ELFLIB_BUILD_NAME INSTALL_ELFLIB_TARGET INSTALL_MODULE DLL_IMPLIB_NAME SLANG_LIB_FOR_MODULES ELFLIB_MAJOR_MINOR_MICRO ELFLIB_MAJOR_MINOR ELFLIB_MAJOR ELFLIB CC_SHARED CC_SHARED_FLAGS DYNAMIC_LINK_FLAGS ELF_DEP_LIBS ELF_LINK_CMD ELF_LINK ELF_CFLAGS ELF_CC DYNAMIC_LINK_LIB EGREP GREP CPP OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC CONFIG_DIR SET_MAKE INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM RANLIB host_os host_vendor host_cpu host build_os build_vendor build_cpu build target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir runstatedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL RPATH' ac_subst_files='' ac_user_opts=' enable_option_checking with_x with_slang with_slanglib with_slanginc ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP XMKMF' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir runstatedir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures this package to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF X features: --x-includes=DIR X include files are in DIR --x-libraries=DIR X library files are in DIR System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then cat <<\_ACEOF Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-x use the X Window System --with-slang=DIR Use DIR/lib and DIR/include for slang --with-slanglib=DIR slang library in DIR --with-slanginc=DIR slang include files in DIR Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor XMKMF Path to xmkmf, Makefile generator for X Window System Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF configure generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes # INCLUDES, setting VAR accordingly. Returns whether the value could be # computed ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid; break else as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=$ac_mid; break else as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid else as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; '') ac_retval=1 ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 static long int longval () { return $2; } static unsigned long int ulongval () { return $2; } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (($2) < 0) { long int i = longval (); if (i != ($2)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ($2)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : echo >>conftest.val; read $3 config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in autoconf "$srcdir"/autoconf; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in autoconf \"$srcdir\"/autoconf" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi #These variable are initialized by JD init function CONFIG_DIR=`pwd` cd $srcdir if test "`pwd`" != "$CONFIG_DIR" then as_fn_error $? "\"This software does not support configuring from another directory. See the INSTALL file\"" "$LINENO" 5 fi # Note: these will differ if one is a symbolic link if test -f /usr/bin/dirname; then JD_Above_Dir=`dirname $CONFIG_DIR` else # system is a loser JD_Above_Dir=`cd ..;pwd` fi JD_Above_Dir2=`cd ..;pwd` ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" if test "x$ac_cv_header_minix_config_h" = xyes; then : MINIX=yes else MINIX= fi if test "$MINIX" = yes; then $as_echo "#define _POSIX_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h $as_echo "#define _MINIX 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 $as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } if ${ac_cv_safe_to_define___extensions__+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ # define __EXTENSIONS__ 1 $ac_includes_default int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_safe_to_define___extensions__=yes else ac_cv_safe_to_define___extensions__=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } test $ac_cv_safe_to_define___extensions__ = yes && $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h $as_echo "#define _ALL_SOURCE 1" >>confdefs.h $as_echo "#define _GNU_SOURCE 1" >>confdefs.h $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h if test $ac_cv_c_compiler_gnu = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 $as_echo_n "checking whether $CC needs -traditional... " >&6; } if ${ac_cv_prog_gcc_traditional+:} false; then : $as_echo_n "(cached) " >&6 else ac_pattern="Autoconf.*'x'" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 $as_echo "$ac_cv_prog_gcc_traditional" >&6; } if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing strerror" >&5 $as_echo_n "checking for library containing strerror... " >&6; } if ${ac_cv_search_strerror+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char strerror (); int main () { return strerror (); ; return 0; } _ACEOF for ac_lib in '' cposix; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_strerror=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_strerror+:} false; then : break fi done if ${ac_cv_search_strerror+:} false; then : else ac_cv_search_strerror=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_strerror" >&5 $as_echo "$ac_cv_search_strerror" >&6; } ac_res=$ac_cv_search_strerror if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef hpux yes #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "yes" >/dev/null 2>&1; then : $as_echo "#define _HPUX_SOURCE 1" >>confdefs.h if test "$CC" = cc; then CC="cc -Ae"; fi fi rm -f conftest* { $as_echo "$as_me:${as_lineno-$LINENO}: checking C compiler that understands ANSI prototypes" >&5 $as_echo_n "checking C compiler that understands ANSI prototypes... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { extern int silly (int); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC looks ok. Good." >&5 $as_echo "$CC looks ok. Good." >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC is not a good enough compiler" >&5 $as_echo "$CC is not a good enough compiler" >&6; } as_fn_error $? "Set env variable CC to your ANSI compiler and rerun configure." "$LINENO" 5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext DYNAMIC_LINK_LIB="" ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default" if test "x$ac_cv_header_dlfcn_h" = xyes; then : $as_echo "#define HAVE_DLFCN_H 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : DYNAMIC_LINK_LIB="-ldl" $as_echo "#define HAVE_DLOPEN 1" >>confdefs.h else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : $as_echo "#define HAVE_DLOPEN Define if you have dlopen" >>confdefs.h fi if test "$ac_cv_func_dlopen" != yes then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot perform dynamic linking" >&5 $as_echo "$as_me: WARNING: cannot perform dynamic linking" >&2;} fi fi fi if test "$GCC" = yes then if test X"$CFLAGS" = X then CFLAGS="-O2" fi fi ELFLIB="lib\$(THIS_LIB).so" ELFLIB_MAJOR="\$(ELFLIB).\$(ELF_MAJOR_VERSION)" ELFLIB_MAJOR_MINOR="\$(ELFLIB_MAJOR).\$(ELF_MINOR_VERSION)" ELFLIB_MAJOR_MINOR_MICRO="\$(ELFLIB_MAJOR_MINOR).\$(ELF_MICRO_VERSION)" INSTALL_ELFLIB_TARGET="install-elf-and-links" ELFLIB_BUILD_NAME="\$(ELFLIB_MAJOR_MINOR_MICRO)" INSTALL_MODULE="\$(INSTALL)" SLANG_DLL_CFLAGS="" M_LIB="-lm" case "$host_os" in *linux*|*gnu*|k*bsd*-gnu ) DYNAMIC_LINK_FLAGS="-Wl,-export-dynamic" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-O1 -Wl,--version-script,\$(VERSION_SCRIPT) -Wl,-soname,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED_FLAGS="-shared -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" ;; *solaris* ) if test "$GCC" = yes then DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-ztext -Wl,-h,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED_FLAGS="-G -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" else DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -K PIC" ELF_LINK="\$(CC) \$(LDFLAGS) -G -h\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED_FLAGS="-G -K PIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" fi ;; # osr5 or unixware7 with current or late autoconf *sco3.2v5* | *unixware-5* | *sco-sysv5uw7*) if test "$GCC" = yes then DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-h,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED_FLAGS="-G -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" else DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -K pic" # ELF_LINK="ld -G -z text -h#" ELF_LINK="\$(CC) \$(LDFLAGS) -G -z text -h\$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED_FLAGS="-G -K pic" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" fi ;; *irix6.5* ) echo "Note: ELF compiler for host_os=$host_os may not be correct" echo "double-check: 'mode_t', 'pid_t' may be wrong!" if test "$GCC" = yes then # not tested DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-h,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED_FLAGS="-shared -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" else DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS)" # default anyhow ELF_LINK="\$(CC) \$(LDFLAGS) -shared -o \$(ELFLIB_MAJOR)" ELF_DEP_LIBS= CC_SHARED_FLAGS="-shared" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" fi ;; *darwin* ) DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fno-common" ELF_LINK="\$(CC) \$(LDFLAGS) -dynamiclib -install_name \$(install_lib_dir)/\$(ELFLIB_MAJOR) -compatibility_version \$(ELF_MAJOR_VERSION) -current_version \$(ELF_MAJOR_VERSION).\$(ELF_MINOR_VERSION)" ELF_DEP_LIBS="\$(LDFLAGS) \$(DL_LIB)" CC_SHARED_FLAGS="-bundle -flat_namespace -undefined suppress -fno-common" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" ELFLIB="lib\$(THIS_LIB).dylib" ELFLIB_MAJOR="lib\$(THIS_LIB).\$(ELF_MAJOR_VERSION).dylib" ELFLIB_MAJOR_MINOR="lib\$(THIS_LIB).\$(ELF_MAJOR_VERSION).\$(ELF_MINOR_VERSION).dylib" ELFLIB_MAJOR_MINOR_MICRO="lib\$(THIS_LIB).\$(ELF_MAJOR_VERSION).\$(ELF_MINOR_VERSION).\$(ELF_MICRO_VERSION).dylib" ;; *freebsd* ) ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" #if test "X$PORTOBJFORMAT" = "Xelf" ; then # ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-soname,\$(ELFLIB_MAJOR)" #else # ELF_LINK="ld -Bshareable -x" #fi ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-soname,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB) -lm" CC_SHARED_FLAGS="-shared -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" ;; *cygwin* ) DYNAMIC_LINK_FLAGS="" ELF_CC="\$(CC)" SLANG_DLL_CFLAGS="-DSLANG_DLL=1" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -DBUILD_DLL=1" DLL_IMPLIB_NAME="lib\$(THIS_LIB)\$(ELFLIB_MAJOR_VERSION).dll.a" #ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-O1 -Wl,--version-script,\$(VERSION_SCRIPT) -Wl,-soname,\$(ELFLIB_MAJOR) -Wl,--out-implib=\$(DLL_IMPLIB_NAME) -Wl,-export-all-symbols -Wl,-enable-auto-import" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-O1 -Wl,--version-script,\$(VERSION_SCRIPT) -Wl,-soname,\$(ELFLIB_MAJOR) -Wl,--out-implib=\$(DLL_IMPLIB_NAME)" ELF_DEP_LIBS="\$(DL_LIB) -lm" CC_SHARED_FLAGS="-shared -DSLANG_DLL=1" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" SLANG_LIB_FOR_MODULES="-L\$(ELFDIR) -lslang" INSTALL_MODULE="\$(INSTALL)" INSTALL_ELFLIB_TARGET="install-elf-cygwin" ELFLIB="lib\$(THIS_LIB).dll" ELFLIB_MAJOR="cyg\$(THIS_LIB)-\$(ELF_MAJOR_VERSION).dll" ELFLIB_MAJOR_MINOR="cyg\$(THIS_LIB)-\$(ELF_MAJOR_VERSION)_\$(ELF_MINOR_VERSION).dll" ELFLIB_MAJOR_MINOR_MICRO="cyg\$(THIS_LIB)-\$(ELF_MAJOR_VERSION)_\$(ELF_MINOR_VERSION)_\$(ELF_MICRO_VERSION).dll" ELFLIB_BUILD_NAME="\$(ELFLIB_MAJOR)" ;; *haiku* ) M_LIB="" DYNAMIC_LINK_FLAGS="-Wl,-export-dynamic" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared -Wl,-O1 -Wl,--version-script,\$(VERSION_SCRIPT) -Wl,-soname,\$(ELFLIB_MAJOR)" ELF_DEP_LIBS="\$(DL_LIB)" CC_SHARED_FLAGS="-shared -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" ;; * ) echo "Note: ELF compiler for host_os=$host_os may be wrong" ELF_CC="\$(CC)" ELF_CFLAGS="\$(CFLAGS) \$(CPPFLAGS) -fPIC" ELF_LINK="\$(CC) \$(LDFLAGS) -shared" ELF_DEP_LIBS="\$(DL_LIB) -lm -lc" CC_SHARED_FLAGS="-shared -fPIC" CC_SHARED="\$(CC) $CC_SHARED_FLAGS \$(CFLAGS) \$(CPPFLAGS)" esac case "$host_cpu" in *alpha* ) if test "$GCC" = yes then IEEE_CFLAGS="-mieee" else IEEE_CFLAGS="-ieee_with_no_inexact" fi ;; * ) IEEE_CFLAGS="" esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5 $as_echo_n "checking for X... " >&6; } # Check whether --with-x was given. if test "${with_x+set}" = set; then : withval=$with_x; fi # $have_x is `yes', `no', `disabled', or empty when we do not yet know. if test "x$with_x" = xno; then # The user explicitly disabled X. have_x=disabled else case $x_includes,$x_libraries in #( *\'*) as_fn_error $? "cannot use X directory names containing '" "$LINENO" 5;; #( *,NONE | NONE,*) if ${ac_cv_have_x+:} false; then : $as_echo_n "(cached) " >&6 else # One or both of the vars are not set, and there is no cached value. ac_x_includes=no ac_x_libraries=no rm -f -r conftest.dir if mkdir conftest.dir; then cd conftest.dir cat >Imakefile <<'_ACEOF' incroot: @echo incroot='${INCROOT}' usrlibdir: @echo usrlibdir='${USRLIBDIR}' libdir: @echo libdir='${LIBDIR}' _ACEOF if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. for ac_var in incroot usrlibdir libdir; do eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" done # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. for ac_extension in a so sl dylib la dll; do if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && test -f "$ac_im_libdir/libX11.$ac_extension"; then ac_im_usrlibdir=$ac_im_libdir; break fi done # Screen out bogus values from the imake configuration. They are # bogus both because they are the default anyway, and because # using them would break gcc on systems where it needs fixed includes. case $ac_im_incroot in /usr/include) ac_x_includes= ;; *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;; esac case $ac_im_usrlibdir in /usr/lib | /usr/lib64 | /lib | /lib64) ;; *) test -d "$ac_im_usrlibdir" && ac_x_libraries=$ac_im_usrlibdir ;; esac fi cd .. rm -f -r conftest.dir fi # Standard set of common directories for X headers. # Check X11 before X11Rn because it is often a symlink to the current release. ac_x_header_dirs=' /usr/X11/include /usr/X11R7/include /usr/X11R6/include /usr/X11R5/include /usr/X11R4/include /usr/include/X11 /usr/include/X11R7 /usr/include/X11R6 /usr/include/X11R5 /usr/include/X11R4 /usr/local/X11/include /usr/local/X11R7/include /usr/local/X11R6/include /usr/local/X11R5/include /usr/local/X11R4/include /usr/local/include/X11 /usr/local/include/X11R7 /usr/local/include/X11R6 /usr/local/include/X11R5 /usr/local/include/X11R4 /usr/X386/include /usr/x386/include /usr/XFree86/include/X11 /usr/include /usr/local/include /usr/unsupported/include /usr/athena/include /usr/local/x11r5/include /usr/lpp/Xamples/include /usr/openwin/include /usr/openwin/share/include' if test "$ac_x_includes" = no; then # Guess where to find include files, by looking for Xlib.h. # First, try using that file with no special directory specified. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # We can compile using X headers with no special include directory. ac_x_includes= else for ac_dir in $ac_x_header_dirs; do if test -r "$ac_dir/X11/Xlib.h"; then ac_x_includes=$ac_dir break fi done fi rm -f conftest.err conftest.i conftest.$ac_ext fi # $ac_x_includes = no if test "$ac_x_libraries" = no; then # Check for the libraries. # See if we find them without any special options. # Don't add to $LIBS permanently. ac_save_LIBS=$LIBS LIBS="-lX11 $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { XrmInitialize () ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : LIBS=$ac_save_LIBS # We can link X programs with no special library path. ac_x_libraries= else LIBS=$ac_save_LIBS for ac_dir in `$as_echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! for ac_extension in a so sl dylib la dll; do if test -r "$ac_dir/libX11.$ac_extension"; then ac_x_libraries=$ac_dir break 2 fi done done fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi # $ac_x_libraries = no case $ac_x_includes,$ac_x_libraries in #( no,* | *,no | *\'*) # Didn't find X, or a directory has "'" in its name. ac_cv_have_x="have_x=no";; #( *) # Record where we found X for the cache. ac_cv_have_x="have_x=yes\ ac_x_includes='$ac_x_includes'\ ac_x_libraries='$ac_x_libraries'" esac fi ;; #( *) have_x=yes;; esac eval "$ac_cv_have_x" fi # $with_x != no if test "$have_x" != yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_x" >&5 $as_echo "$have_x" >&6; } no_x=yes else # If each of the values was on the command line, it overrides each guess. test "x$x_includes" = xNONE && x_includes=$ac_x_includes test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries # Update the cache value to reflect the command line values. ac_cv_have_x="have_x=yes\ ac_x_includes='$x_includes'\ ac_x_libraries='$x_libraries'" { $as_echo "$as_me:${as_lineno-$LINENO}: result: libraries $x_libraries, headers $x_includes" >&5 $as_echo "libraries $x_libraries, headers $x_includes" >&6; } fi if test "$no_x" = yes; then # Not all programs may use this symbol, but it does not hurt to define it. $as_echo "#define X_DISPLAY_MISSING 1" >>confdefs.h X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= else if test -n "$x_includes"; then X_CFLAGS="$X_CFLAGS -I$x_includes" fi # It would also be nice to do this for all -L options, not just this one. if test -n "$x_libraries"; then X_LIBS="$X_LIBS -L$x_libraries" # For Solaris; some versions of Sun CC require a space after -R and # others require no space. Words are not sufficient . . . . { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -R must be followed by a space" >&5 $as_echo_n "checking whether -R must be followed by a space... " >&6; } ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries" ac_xsave_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } X_LIBS="$X_LIBS -R$x_libraries" else LIBS="$ac_xsave_LIBS -R $x_libraries" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } X_LIBS="$X_LIBS -R $x_libraries" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: neither works" >&5 $as_echo "neither works" >&6; } fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_c_werror_flag=$ac_xsave_c_werror_flag LIBS=$ac_xsave_LIBS fi # Check for system-dependent libraries X programs must link with. # Do this before checking for the system-independent R6 libraries # (-lICE), since we may need -lsocket or whatever for X linking. if test "$ISC" = yes; then X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" else # Martyn Johnson says this is needed for Ultrix, if the X # libraries were built with DECnet support. And Karl Berry says # the Alpha needs dnet_stub (dnet does not exist). ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char XOpenDisplay (); int main () { return XOpenDisplay (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet" >&5 $as_echo_n "checking for dnet_ntoa in -ldnet... " >&6; } if ${ac_cv_lib_dnet_dnet_ntoa+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dnet_ntoa (); int main () { return dnet_ntoa (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dnet_dnet_ntoa=yes else ac_cv_lib_dnet_dnet_ntoa=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_dnet_ntoa" >&5 $as_echo "$ac_cv_lib_dnet_dnet_ntoa" >&6; } if test "x$ac_cv_lib_dnet_dnet_ntoa" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet" fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dnet_ntoa in -ldnet_stub" >&5 $as_echo_n "checking for dnet_ntoa in -ldnet_stub... " >&6; } if ${ac_cv_lib_dnet_stub_dnet_ntoa+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldnet_stub $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dnet_ntoa (); int main () { return dnet_ntoa (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dnet_stub_dnet_ntoa=yes else ac_cv_lib_dnet_stub_dnet_ntoa=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5 $as_echo "$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; } if test "x$ac_cv_lib_dnet_stub_dnet_ntoa" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub" fi fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$ac_xsave_LIBS" # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, # to get the SysV transport functions. # Chad R. Larson says the Pyramis MIS-ES running DC/OSx (SVR4) # needs -lnsl. # The nsl library prevents programs from opening the X display # on Irix 5.2, according to T.E. Dickey. # The functions gethostbyname, getservbyname, and inet_addr are # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking. ac_fn_c_check_func "$LINENO" "gethostbyname" "ac_cv_func_gethostbyname" if test "x$ac_cv_func_gethostbyname" = xyes; then : fi if test $ac_cv_func_gethostbyname = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lnsl" >&5 $as_echo_n "checking for gethostbyname in -lnsl... " >&6; } if ${ac_cv_lib_nsl_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_nsl_gethostbyname=yes else ac_cv_lib_nsl_gethostbyname=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_nsl_gethostbyname" >&5 $as_echo "$ac_cv_lib_nsl_gethostbyname" >&6; } if test "x$ac_cv_lib_nsl_gethostbyname" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl" fi if test $ac_cv_lib_nsl_gethostbyname = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname in -lbsd" >&5 $as_echo_n "checking for gethostbyname in -lbsd... " >&6; } if ${ac_cv_lib_bsd_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_bsd_gethostbyname=yes else ac_cv_lib_bsd_gethostbyname=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bsd_gethostbyname" >&5 $as_echo "$ac_cv_lib_bsd_gethostbyname" >&6; } if test "x$ac_cv_lib_bsd_gethostbyname" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd" fi fi fi # lieder@skyler.mavd.honeywell.com says without -lsocket, # socket/setsockopt and other routines are undefined under SCO ODT # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary # on later versions), says Simon Leinen: it contains gethostby* # variants that don't use the name server (or something). -lsocket # must be given before -lnsl if both are needed. We assume that # if connect needs -lnsl, so does gethostbyname. ac_fn_c_check_func "$LINENO" "connect" "ac_cv_func_connect" if test "x$ac_cv_func_connect" = xyes; then : fi if test $ac_cv_func_connect = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for connect in -lsocket" >&5 $as_echo_n "checking for connect in -lsocket... " >&6; } if ${ac_cv_lib_socket_connect+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char connect (); int main () { return connect (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_socket_connect=yes else ac_cv_lib_socket_connect=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_connect" >&5 $as_echo "$ac_cv_lib_socket_connect" >&6; } if test "x$ac_cv_lib_socket_connect" = xyes; then : X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS" fi fi # Guillermo Gomez says -lposix is necessary on A/UX. ac_fn_c_check_func "$LINENO" "remove" "ac_cv_func_remove" if test "x$ac_cv_func_remove" = xyes; then : fi if test $ac_cv_func_remove = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for remove in -lposix" >&5 $as_echo_n "checking for remove in -lposix... " >&6; } if ${ac_cv_lib_posix_remove+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lposix $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char remove (); int main () { return remove (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_posix_remove=yes else ac_cv_lib_posix_remove=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix_remove" >&5 $as_echo "$ac_cv_lib_posix_remove" >&6; } if test "x$ac_cv_lib_posix_remove" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix" fi fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. ac_fn_c_check_func "$LINENO" "shmat" "ac_cv_func_shmat" if test "x$ac_cv_func_shmat" = xyes; then : fi if test $ac_cv_func_shmat = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shmat in -lipc" >&5 $as_echo_n "checking for shmat in -lipc... " >&6; } if ${ac_cv_lib_ipc_shmat+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lipc $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shmat (); int main () { return shmat (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ipc_shmat=yes else ac_cv_lib_ipc_shmat=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ipc_shmat" >&5 $as_echo "$ac_cv_lib_ipc_shmat" >&6; } if test "x$ac_cv_lib_ipc_shmat" = xyes; then : X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc" fi fi fi # Check for libraries that X11R6 Xt/Xaw programs need. ac_save_LDFLAGS=$LDFLAGS test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to # check for ICE first), but we must link in the order -lSM -lICE or # we get undefined symbols. So assume we have SM if we have ICE. # These have to be linked with before -lX11, unlike the other # libraries we check for below, so use a different variable. # John Interrante, Karl Berry { $as_echo "$as_me:${as_lineno-$LINENO}: checking for IceConnectionNumber in -lICE" >&5 $as_echo_n "checking for IceConnectionNumber in -lICE... " >&6; } if ${ac_cv_lib_ICE_IceConnectionNumber+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char IceConnectionNumber (); int main () { return IceConnectionNumber (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_ICE_IceConnectionNumber=yes else ac_cv_lib_ICE_IceConnectionNumber=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5 $as_echo "$ac_cv_lib_ICE_IceConnectionNumber" >&6; } if test "x$ac_cv_lib_ICE_IceConnectionNumber" = xyes; then : X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE" fi LDFLAGS=$ac_save_LDFLAGS fi if test "X$jd_prefix" = "X" then jd_prefix=$ac_default_prefix if test "X$prefix" != "XNONE" then jd_prefix="$prefix" fi jd_exec_prefix="$jd_prefix" if test "X$exec_prefix" != "XNONE" then jd_exec_prefix="$exec_prefix" fi eval `sh <&5 $as_echo_n "checking for the slang library and header files ... " >&6; } if test X"$jd_with_slang_library" != Xno then jd_slang_inc_file= if test "X$jd_slang_inc_file" = "X" then jd_slang_inc_file=slang.h fi if test X"$jd_slang_include_dir" = X then inc_and_lib_dirs="\ $jd_prefix_incdir,$jd_prefix_libdir \ /usr/local/slang/include,/usr/local/slang/lib \ /usr/local/include/slang,/usr/local/lib \ /usr/local/include,/usr/local/lib \ $JD_SYS_INCLIBS \ /usr/include/slang,/usr/lib \ /usr/slang/include,/usr/slang/lib \ /usr/include,/usr/lib \ /opt/include/slang,/opt/lib \ /opt/slang/include,/opt/slang/lib \ /opt/include,/opt/lib" if test X != X then inc_and_lib_dirs="/include,/lib $inc_and_lib_dirs" fi case "$host_os" in *darwin* ) exts="dylib so a" ;; *cygwin* ) exts="dll.a so a" ;; * ) exts="so a" esac xincfile="$jd_slang_inc_file" xlibfile="libslang" jd_with_slang_library="no" for include_and_lib in $inc_and_lib_dirs do # Yuk. Is there a better way to set these variables?? xincdir=`echo $include_and_lib | tr ',' ' ' | awk '{print $1}'` xlibdir=`echo $include_and_lib | tr ',' ' ' | awk '{print $2}'` found=0 if test -r $xincdir/$xincfile then for E in $exts do if test -r "$xlibdir/$xlibfile.$E" then jd_slang_include_dir="$xincdir" jd_slang_library_dir="$xlibdir" jd_with_slang_library="yes" found=1 break fi done fi if test $found -eq 1 then break fi done fi fi if test X"$jd_slang_include_dir" != X -a X"$jd_slang_library_dir" != X then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: $jd_slang_library_dir and $jd_slang_include_dir" >&5 $as_echo "yes: $jd_slang_library_dir and $jd_slang_include_dir" >&6; } jd_with_slang_library="yes" SLANG_LIB=-L$jd_slang_library_dir SLANG_LIB_DIR=$jd_slang_library_dir if test "X$jd_slang_library_dir" = "X/usr/lib" -o "X$jd_slang_include_dir" = "X/usr/include" then SLANG_LIB="" else if test "X$jd_slang_library_dir" != "X" then if test "X$RPATH" = "X" then case "$host_os" in *linux*|*solaris* ) if test "X$GCC" = Xyes then if test "X$ac_R_nospace" = "Xno" then RPATH="-Wl,-R," else RPATH="-Wl,-R" fi else if test "X$ac_R_nospace" = "Xno" then RPATH="-R " else RPATH="-R" fi fi ;; *osf*|*openbsd*|*freebsd*) if test "X$GCC" = Xyes then RPATH="-Wl,-rpath," else RPATH="-rpath " fi ;; *netbsd*) if test "X$GCC" = Xyes then RPATH="-Wl,-R" fi ;; esac if test "X$RPATH" != "X" then RPATH="$RPATH$jd_slang_library_dir" fi else _already_there=0 for X in `echo $RPATH | sed 's/:/ /g'` do if test "$X" = "$jd_slang_library_dir" then _already_there=1 break fi done if test $_already_there = 0 then RPATH="$RPATH:$jd_slang_library_dir" fi fi fi fi SLANG_INC=-I$jd_slang_include_dir SLANG_INC_DIR=$jd_slang_include_dir if test "X$jd_slang_include_dir" = "X/usr/include" then SLANG_INC="" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } jd_with_slang_library="no" SLANG_INC="" SLANG_LIB="" SLANG_INC_DIR="" SLANG_LIB_DIR="" fi if test "$jd_with_slang_library" = "no" then as_fn_error $? "unable to find the slang library and header file $jd_slang_inc_file" "$LINENO" 5 fi slang_h=$jd_slang_include_dir/slang.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking SLANG_VERSION in $slang_h" >&5 $as_echo_n "checking SLANG_VERSION in $slang_h... " >&6; } slang_version=`grep "^#define *SLANG_VERSION " $slang_h | awk '{ print $3 }'` slang_major_version=`echo $slang_version | awk '{ print int($1/10000) }'` slang_minor_version=`echo $slang_version $slang_major_version | awk '{ print int(($1 - $2*10000)/100) }'` slang_patchlevel_version=`echo $slang_version $slang_major_version $slang_minor_version | awk '{ print ($1 - $2*10000 - $3*100) }'` { $as_echo "$as_me:${as_lineno-$LINENO}: result: $slang_major_version.$slang_minor_version.$slang_patchlevel_version" >&5 $as_echo "$slang_major_version.$slang_minor_version.$slang_patchlevel_version" >&6; } if test "X$slang_major_version" = "X1" then MODULE_INSTALL_DIR="$libdir/slang/modules" else MODULE_INSTALL_DIR="$libdir/slang/v$slang_major_version/modules" fi SL_FILES_INSTALL_DIR=$datadir/slsh/local-packages if test "X$slang_major_version" = "X1" then as_fn_error $? "\"This software will not work with slang-1. Specify a path to slang-2\"" "$LINENO" 5 fi for ac_header in \ stdlib.h \ unistd.h \ do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of short" >&5 $as_echo_n "checking size of short... " >&6; } if ${ac_cv_sizeof_short+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (short))" "ac_cv_sizeof_short" "$ac_includes_default"; then : else if test "$ac_cv_type_short" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (short) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_short=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_short" >&5 $as_echo "$ac_cv_sizeof_short" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_SHORT $ac_cv_sizeof_short _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5 $as_echo_n "checking size of int... " >&6; } if ${ac_cv_sizeof_int+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then : else if test "$ac_cv_type_int" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (int) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_int=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5 $as_echo "$ac_cv_sizeof_int" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_INT $ac_cv_sizeof_int _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5 $as_echo_n "checking size of long... " >&6; } if ${ac_cv_sizeof_long+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then : else if test "$ac_cv_type_long" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (long) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_long=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5 $as_echo "$ac_cv_sizeof_long" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_LONG $ac_cv_sizeof_long _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of float" >&5 $as_echo_n "checking size of float... " >&6; } if ${ac_cv_sizeof_float+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (float))" "ac_cv_sizeof_float" "$ac_includes_default"; then : else if test "$ac_cv_type_float" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (float) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_float=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_float" >&5 $as_echo "$ac_cv_sizeof_float" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_FLOAT $ac_cv_sizeof_float _ACEOF # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of double" >&5 $as_echo_n "checking size of double... " >&6; } if ${ac_cv_sizeof_double+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (double))" "ac_cv_sizeof_double" "$ac_includes_default"; then : else if test "$ac_cv_type_double" = yes; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "cannot compute sizeof (double) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_double=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_double" >&5 $as_echo "$ac_cv_sizeof_double" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_DOUBLE $ac_cv_sizeof_double _ACEOF if test "X$libdir" != "X" then if test "X$RPATH" = "X" then case "$host_os" in *linux*|*solaris* ) if test "X$GCC" = Xyes then if test "X$ac_R_nospace" = "Xno" then RPATH="-Wl,-R," else RPATH="-Wl,-R" fi else if test "X$ac_R_nospace" = "Xno" then RPATH="-R " else RPATH="-R" fi fi ;; *osf*|*openbsd*|*freebsd*) if test "X$GCC" = Xyes then RPATH="-Wl,-rpath," else RPATH="-rpath " fi ;; *netbsd*) if test "X$GCC" = Xyes then RPATH="-Wl,-R" fi ;; esac if test "X$RPATH" != "X" then RPATH="$RPATH$libdir" fi else _already_there=0 for X in `echo $RPATH | sed 's/:/ /g'` do if test "$X" = "$libdir" then _already_there=1 break fi done if test $_already_there = 0 then RPATH="$RPATH:$libdir" fi fi fi ELF_CFLAGS="$ELF_CFLAGS $IEEE_CFLAGS" CFLAGS="$CFLAGS $IEEE_CFLAGS" ac_config_headers="$ac_config_headers src/config.h:src/config.hin" ac_config_files="$ac_config_files Makefile:autoconf/Makefile.in src/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by $as_me, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ config.status configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h:src/config.hin" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile:autoconf/Makefile.in" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi echo "" echo "You are compiling with the following compiler configuration:" echo " CC =" "$CC" echo " CC_SHARED =" "$CC_SHARED" echo " CFLAGS =" "$CFLAGS" echo " LDFLAGS =" "$LDFLAGS" "$DYNAMIC_LINK_FLAGS" echo "" echo "The modules will be installed in $MODULE_INSTALL_DIR." echo "Any associated .sl files will be install in $SL_FILES_INSTALL_DIR" echo "" echo "If any of these quantities are incorrect, edit src/Makefile accordingly." echo "" slxfig-pre0.2.0-138/TODO0000644000175000000620000000221111653730343013334 0ustar johnstaff* An interactive plot viewer. * Add a mechanism to the .plot method that facilitates the creation of the legend: w.plot (x1,y1;color=3,label="First curve"); w.plot (x2,y2;color=4,sym="triangle",label="Triangles"); w.legend(0.2, 0.8; world00); * A .shade_between method that shades between two curves: private define shade_between_curves (w, x, ylo, yhi) { variable x = [x, reverse(x)]; variable y = [ylo, reverse(yhi)]; w.shade_region (x, y; __qualifiers); } * Various time/date related tic labels. * Additional flexibility for tic labels-- perhaps via a callback function. Perhaps time/date labels could be implemented via such callbacks. * allow to set only some world coordinate limits, and have the others be determined automatically, in analogy to, e.g., isis> xrange(xmin, ); * connection between world coordinates and size of plot box to have several plots with different ranges, but same scales * duplicate method for XFig_Object's -> allow xfig_multiplot to operate on copies of plots * define an empty picture object that could be returned by xfig_new_text when called with NULL or "" slxfig-pre0.2.0-138/slxfig.lis0000644000175000000620000000346412463364752014673 0ustar johnstaff@slxfig.lis @INSTALL @README @TODO @COPYING @changes.txt @configure 0755 @autoconf/Makefile.in @autoconf/aclocal.m4 @autoconf/config.guess 0755 @autoconf/config.sub 0755 @autoconf/configure.ac @autoconf/install.sh 0755 @autoconf/mkinsdir.sh 0755 @autoconf/Makefile @doc/tm/Makefile @doc/tm/fixtex.sl @doc/tm/slxfig.tm @doc/help/slxfig.hlp @doc/help/gcontour.hlp @doc/text/slxfig.txt @examples/Makefile @examples/Makefile.sub @examples/run.sl 0755 @examples/slxfigrc @examples/3d/rotating_cube.sl @examples/3d/Makefile @examples/draw/inclinometer.sl @examples/draw/Makefile @examples/pict/colormaps.sl @examples/pict/Makefile @examples/plot/Makefile @examples/plot/axisxform.sl @examples/plot/color.sl @examples/plot/colors.sl @examples/plot/errbar.sl @examples/plot/font-style.sl @examples/plot/histplt.sl @examples/plot/image.sl @examples/plot/Makefile @examples/plot/multiplot.sl @examples/plot/multiplot2.sl @examples/plot/overlay.sl @examples/plot/project.sl @examples/plot/scatter.sl @examples/plot/simple.sl @examples/plot/subplot.sl @examples/plot/symbol.sl @examples/plot/scatter.sl @examples/plot/ticlabels.sl @examples/plot/world.sl @examples/polyline/arrows.sl @examples/polyline/fill-styles.sl @examples/polyline/Makefile @src/Makefile.in @src/config.hin @src/gcontour-module.c @src/gcontour.sl @src/mkversion.sh 0755 @src/version.h @src/xfig.sl @src/vector.sl @src/xfig/clip.sl @src/xfig/core.sl @src/xfig/ellipse.sl @src/xfig/latex.sl @src/xfig/objects.sl @src/xfig/plot.sl @src/xfig/png.sl @src/xfig/polyline.sl @src/xfig/text.sl @src/tests/setup.sl @src/tests/test_ellipse.sl @src/tests/test_hplot-shaded.sl @src/tests/test_multiplot_align_ylabels.sl @src/tests/test_plot_axis-labels.sl @src/tests/test_plot_scale.sl @src/tests/test_plot_ticlabels-confine.sl @src/tests/test_textrotate.sl @src/tests/test_world1log_world2lin.sl slxfig-pre0.2.0-138/doc/0002755000175000000620000000000011325613443013414 5ustar johnstaffslxfig-pre0.2.0-138/doc/help/0002755000175000000620000000000014540004350014335 5ustar johnstaffslxfig-pre0.2.0-138/doc/help/slxfig.hlp0000644000175000000620000014156314540004350016346 0ustar johnstaff.justify SYNOPSIS Justify an object at a specified position USAGE .justify (Vector_Type X [, Vector_Type dX]); % or .justify (XFig_Object o [, Vector_Type dX]); SEE ALSO xfig_justify_object -------------------------------------------------------------- .render SYNOPSIS Render an xfig object to a file. USAGE .render(String_Type filename); % or .render(Struct_Type dev); DESCRIPTION If the argument is a `filename' string, the file is created through `xfig_create_file', and the `' is rendered. `xfig_close_file' finally closes the file and runs Xfig's `fig2dev' program on it. QUALIFIERS ; depth=intarray: if specified, only objects of these depths are rendered ; verbose=intval: if >=0, the fig2dev command is displayed ; fig=0|1: if 0 (default), the .fig file will be removed, otherwise kept ; papersize[=VAL]: Process the %P string in the output driver. If VAL is given, use it for the papersize ; background=color: Process the %G string in the output driver with the specified color SEE ALSO xfig_set_verbose -------------------------------------------------------------- .scale SYNOPSIS Scale an xfig object USAGE .scale (s); % or .scale (sx, sy[, sz]]); DESCRIPTION If the `.scale' method is called with one argument `s', the object is scaled by `s' in all directions. If two (three) arguments `sx', `sy' (and `sz') are given, x, y (and z) coordinates are scaled differently. -------------------------------------------------------------- pict.rotate_pict USAGE pict.rotate_pict (theta_degrees); DESCRIPTION A picture object can only be rotated by multiples of 90 degrees. -------------------------------------------------------------- xfig_add_latex_package SYNOPSIS Load a package in the preamble of latex documents. USAGE xfig_add_latex_package (String_Type package[, package2, ...]); QUALIFIERS ; prepend: `package' is inserted before previous packages DESCRIPTION Options can be added to `package' in square brackets: EXAMPLE xfig_add_latex_package("fontenc[T1]", "mathpazo[osf]"); -------------------------------------------------------------- xfig_center_pict_in_box SYNOPSIS Center a pict object in a box USAGE xfig_center_pict_in_box (pict_object, X, dx, dy DESCRIPTION This function takes a pict object and centers it in a box whose width is `dx' and whose height is `dy'. The vector `X' denotes the position of the lower-left corner of the box. If the pict object is too big to fit in the box, then its lower-left corner will coincide with the lower-left corner of the box. SEE ALSO xfig_translate_object -------------------------------------------------------------- xfig_clip_polyline2d SYNOPSIS Clip a list of 2d line segments USAGE list = xfig_clip_polyline2d (x[], y[], xmin, xmax, ymin, ymax) DESCRIPTION This function clips a polyline composed individual line segments that run from (x_i,y_i) to (x_{i+1},y_{i+1}) at the boundaries of the window defined by the `xmin', `xmax', `ymin', and `ymax' parameters. The result is returned as an xfig polyline object. NOTES This function should be used if the order of the line segments does not matter. Otherwise, the `xfig_clip_polygon2d' function should be used. SEE ALSO xfig_clip_polygon2d, xfig_new_polyline_list -------------------------------------------------------------- xfig_compound.append SYNOPSIS Append one or more xfig objects to a compound USAGE xfig_compound.append( o[, ...]); SEE ALSO xfig_compound.insert -------------------------------------------------------------- xfig_compound.insert SYNOPSIS Insert one or more xfig objects to a compound USAGE xfig_compound.insert( o[, ...]); SEE ALSO xfig_compound.append -------------------------------------------------------------- xfig_create_arrow SYNOPSIS Create a new arrow shape for a polyline object DESCRIPTION `xfig_create_arrow' creates a structure that can be used for polyline objects, e.g., with xfig_new_polyline. All information are passed via qualifiers. QUALIFIERS ; arrow_type: shape of arrow heads (values from 0 to 14), e.g., XFIG_ARROWTYPE_{STICK,TRIANGLE,INDENTED,POINTED} and others (default: XFIG_ARROWTYPE_INDENTED==2) ; arrow_style: XFIG_ARROWSTYLE_{HOLLOW,FILLED}, i.e., 0 or 1; indicating a filling with white or with the pen color for `0 < arrow_type < 13' (default: 1) ; arrow_thickness: (default: 1) ; arrow_width: (default: 4) ; arrow_height: (default: 8) EXAMPLE % using the same (simple) shape for forward and backward arrow, % implicitly calling xfig_create_arrow (twice): variable a1 = xfig_new_polyline([0,4], [0,3] ; forward_arrow, backward_arrow, arrow_type=0, arrow_style=0); % explicitly calling xfig_create_arrow, in order to use % different shapes for forward and backward arrow: variable forw_arr = xfig_create_arrow(; arrow_type= 0, arrow_style=0), back_arr = xfig_create_arrow(; arrow_type=13, arrow_style=1), a2 = xfig_new_polyline([1,5], [1,4] ; forward_arrow=forw_arr, backward_arrow=back_arr); SEE ALSO xfig_new_polyline -------------------------------------------------------------- xfig_ellipse.rotate USAGE xfig_ellipse.rotate([Vector_Type axis,] Double_Type theta); DESCRIPTION If no `axis' is given, the ellipse is rotated in the x-y-plane around `axis = vector(0,0,1)'. The rotation angle `theta' is measured in radians. -------------------------------------------------------------- xfig_get_color_names SYNOPSIS Get a list color names USAGE Array_Type xfig_get_color_names () DESCRIPTION This function returns an array of strings giving the available color names. This list includes the Xfig color names, user-defined colors, and the W3C color names. SEE ALSO xfig_new_color, xfig_list_colors, xfig_lookup_w3c_color -------------------------------------------------------------- xfig_get_eye SYNOPSIS Obtain the point from which the projection of 3d space is seen USAGE Vector_Type xfig_get_eye () SEE ALSO xfig_set_eye -------------------------------------------------------------- xfig_get_eye_roll SYNOPSIS Obtain the roll angle under which the projection of 3d space is seen USAGE Double_Type xfig_get_eye_roll () DESCRIPTION The roll angle is measured in degrees. SEE ALSO xfig_set_eye_roll, xfig_set_eye -------------------------------------------------------------- xfig_get_focus SYNOPSIS Obtain the focus point of the projection of 3d space USAGE Vector_Type xfig_get_focus () SEE ALSO xfig_set_focus -------------------------------------------------------------- xfig_get_latex_preamble USAGE String_Typer xfig_get_latex_preamble () SEE ALSO xfig_set_latex_preamble -------------------------------------------------------------- xfig_justify_object SYNOPSIS Justify an object at a specified position USAGE xfig_justify_object (XFig_Object obj, Vector_Type X [, Vector_Type dX]); % or xfig_justify_object (XFig_Object obj, XFig_Object o [, Vector_Type dX]); DESCRIPTION This function moves the object to the specified position `X' (a vector) and justifies it at that position according to the offsets specified by the vector `dX'. The components of `dX' are normally in the range -0.5 to 0.5 and represent offsets relative to the size of the object. If the components of `dX' are 0, then the object will be centered at `X'. Alternatively, the second argument may be an XFig object `o' itself. The position vector `X' is then determined from the position of `o' and the justification vector `dX': `obj' will be justified relative to the outer boundary of `o', unless the `inside' qualifier is set, in which case it will be justified relative to the inner boundary. QUALIFIERS ; inside: justify `obj' relative to the inner boundary of `o' EXAMPLE For `dX = vector (0,0,0)': the object `obj' will be justified concentrically with `o'. For `dX = vector (0,-0.5,0)' (i.e., `obj' will be horizontally centered and vertically aligned at its lower baseline): `X' is the horizontal center of the upper vertical baseline of `o' such that `obj' will be placed on top of `o'. For `dX = vector (0,-0.5,0)', together with the `inside' qualifier: `X' is the horizontal center of the lower vertical baseline of `o' such that `obj' will be coaligned with `o' at their lower baselines. SEE ALSO .justify, .get_bbox, .translate -------------------------------------------------------------- xfig_lookup_w3c_color (name) SYNOPSIS Lookup an RGB value for an W3C color name USAGE rgb = xfig_lookup_w3c_color (name) DESCRIPTION This function may be used to lookup the RGB value for a specified W3C color name. If the W3C rgb.txt file could not be loaded, or the color name does not exist within he file, NULL will be returned. The primary purpose of this function is to provide a mechanism for overriding Xfig color values with those defined by W3C. EXAMPLE Xfig uses 0x00FF00 for green, whereas W3C defines 0x008000. Use the W3C value: xfig_new_color ("green", xfig_lookup_w3c_color ("green")); SEE ALSO xfig_new_color, xfig_list_colors, xfig_get_color_names -------------------------------------------------------------- xfig_make_font SYNOPSIS Create a font structure used by SLxfig's LaTeX interface USAGE Struct_Type xfig_make_font ([String_Type style, size, color]) QUALIFIERS ; style: (default: "\bf\boldmath"R) ; size: (default: "\normalsize"R) ; color: (default: "black") DESCRIPTION If `color' is a string, it is considered to be a named color from the SLxfig color interface. Alternatively, `color' can be an integer number, representing the color's RGB value. `style', `size', `color' arguments different from `NULL' overwrite qualifier values. SEE ALSO xfig_new_text -------------------------------------------------------------- xfig_meshgrid SYNOPSIS Produce grid points for an image USAGE (xx,yy) = xfig_meshgrid (xx, yy) DESCRIPTION This function takes two 1-d vectors representing the orthogonal grids for a rectangular region in the (x,y) plane and returns two 2-d arrays corresponding to the (x,y) coordinates of each intersecting grid point. Suppose that one wants to evaluate a function `f(x,y)' at each point defined by the two grid vectors. Simply calling `f(x,y)' using the grid vectors would lead to either a type-mismatch error or produce a 1-d result. The correct way to do this is to use the `xfig_meshgrid' function: result = f(xfig_meshgrid(x,y)); -------------------------------------------------------------- xfig_multipage.add SYNOPSIS Add an xfig object to a multipage file USAGE .add(ob) DESCRIPTION This function is used to render an xfig object to a multipage file. This is done by rendering the object to an intermediate .eps file. The file will removed upon closing the multipage file. QUALIFIERS ; save: Keep the intermediate file, do not remove it ; file=fname: Use `fname' as the basename of the intermediate file. The .eps extension will be used. SEE ALSO xfig_multipage_open, xfig_multipage_close -------------------------------------------------------------- xfig_multipage.close SYNOPSIS Close a multipage file USAGE .close DESCRIPTION This function is used to close a multipage file. It will invoke ghostscript to write the intermediate files to the final document, and then remove those intermediate files that were flagged for removal. QUALIFIERS ; verbose=value: If greater than 0, show the ghostscript command line. ; crop: If given, crop the resulting multipage file to the largest bounding box of intermediate files. ; margin=value: When not cropping, add a margins to each page of the specified size in inches. The default is 0.5 inches SEE ALSO xfig_multipage_open, xfig_multipage.add -------------------------------------------------------------- xfig_multipage_open SYNOPSIS Create an xfig multipage file USAGE m = xfig_multipage_open (String_Type file [;qualifiers]) DESCRIPTION This function will create a new multipage file. Xfig objects may be written to the multipage file using the .add method. Each call to the .add method will result in the object being rendered to an intermediate eps file. When finished, the .close method must be used to produce the final file and remove the intermediate files. The `file' parameter is used to specify the name of the multipage file. Only multipage pdf files are supported; hence, the filename extension must be `.pdf'. QUALIFIERS ; save: Do not remove the intermediate files EXAMPLE m = xfig_multipage_open ("example.pdf"); w = xfig_plot_new (); % Code create the first plot m.add (w); w = xfig_plot_new (); % Code to create the second plot m.add (w); m.close (); SEE ALSO xfig_multipage.close, xfig_multipage.add -------------------------------------------------------------- xfig_multiplot SYNOPSIS Create a multiplot from individual panels that share the same x-axes USAGE compound = xfig_multiplot (xfig_plot p1[], p2[], ...); QUALIFIERS ; cols=intval: number of columns (default: 1) ; title=strval: overall title on top of the multiplot ; xlabel=strval: overall xlabel below the multiplot ; x2label=strval: overall x2label on top of the multiplot ; ylabel=strval: overall ylabel left of the multiplot ; y2label=strval: overall y2label right of the multiplot ; align_ylabels=intval: bitmask for aligning all y{1,2}axis-labels (default: 1|2) DESCRIPTION `p1', `p2', ... can be single plot objects or arrays of them. `xfig_multiplot' arranges a multi-panel plot with `cols' columns. The plot windows are aligned in left-right, top-down order. `xfig_multiplot' switches off titles, axis- and ticmark labels of those plots for which those would overlap with other plots. It is thus be desirable to have common sizes of the plot windows, as well as common ranges and coordinate systems on adjoining axes. This is particularly important if when more than one column is used. The return value is a compound object containing all plots in the multiplot (note that their number has to be a multiple of `cols'). If the `title' or `x(2)label' qualifiers are specified and `cols>1', additional text objects are added above and below the multiplot. (For `cols==1', the title/x(2)label of the first/last plot are set.) The same holds for the `y(2)label' qualifiers, for which it depends on the resulting number of rows whether additional text is added on the left or right of the multiplot or whether the corresponding labels of the first or last plot are set (possibly overwritten). -------------------------------------------------------------- xfig_new_color SYNOPSIS Add a new color definition USAGE xfig_new_color (name, RGB [,&id] DESCRIPTION This function may be used to add a new color called `name' with the specified RGB (24 bit integer) value. If the optional third parameter is provided, it must be a reference to a variable whose value upon return will be set to the integer index of the color. NOTES Color names are converted to a canonical form by removing whitespace from the name and converting it to lowercase. This means that `"OffWhite"', `"offwhite"', and `"off White"' are all equivalent. SEE ALSO xfig_lookup_color_rgb, xfig_lookup_color -------------------------------------------------------------- xfig_new_compound SYNOPSIS Create an XFig compound list USAGE c = xfig_new_compound ([obj1, obj2, ...]); DESCRIPTION An empty compound list is created with `xfig_new_compound_list'. All arguments passed to the `xfig_new_compound' function are inserted in the newly created list. SEE ALSO xfig_new_vbox_compound, xfig_new_hbox_compound -------------------------------------------------------------- xfig_new_ellipse SYNOPSIS Create a new ellipse object USAGE XFig_Ellipse_Type xfig_create_ellipse (Double_Type a [, b]) QUALIFIERS ; line: line style (default: 0) ; width: line width (default: 1) ; color: line color (default: -1) ; fillcolor: (default: -1) ; areafill: darkness or pattern (default: -1 or 20, depending on `fillcolor') ; depth: XFig depth (default: 50) ; x0: x-position (default: 0) ; y0: y-position (default: 0) ; z0: z-position (default: 0) -------------------------------------------------------------- xfig_new_eps SYNOPSIS Create an SLxfig picture object from an eps file USAGE obj = xfig_new_eps(String_Type filename); QUALIFIERS All qualifiers are passed to the `xfig_new_pict' function. SEE ALSO xfig_new_pict -------------------------------------------------------------- xfig_new_hbox_compound SYNOPSIS Create an XFig compound list of horizontally aligned objects USAGE c = xfig_new_hbox_compound (obj1, obj2 [, ...] [, space]); DESCRIPTION The objects `obj2', ... are translated in negative y-direction such that all of them align horizontally according to their size. If the last argument `space' is numeric, it indicates additional horizontal space that is inserted between each of the objects. QUALIFIERS ; just=val: Justifiy the objects with respect to the first. If `val' is 0 then the objects will be centered. If val is 1, the objects will be aligned at the top. If val is -1, they will be aligned at the bottom. ; center: Center the objects with respect to the first SEE ALSO xfig_new_vbox_compound, xfig_new_compound -------------------------------------------------------------- xfig_new_legend SYNOPSIS Create a plot legend object USAGE legend = xfig_new_legend (labels[], colors[], linestyles[], thicknesses[], width); QUALIFIERS ; areafill=intval: (default: 20) ; fillcolor=strval: (default: "white") ; labelsize=strval: (default: "large") DESCRIPTION The `xfig_new_legend' function creates a legend object suitable for adding to a plot. The legend will consist of ... -------------------------------------------------------------- xfig_new_pict SYNOPSIS Create an object that encapsulates an image file USAGE obj = xfig_new_pict(filename, width, height [; qualifiers]) DESCRIPTION This function creates an object containing the specified image file and scales it to the specified width an height. The resulting object containing the image will be centered at (0,0,0). QUALIFIERS ; depth: XFig depth ; x0: x-position (default: 0) ; y0: y-position (default: 0) ; z0: z-position (default: 0) ; just=[jx,jy]: justification (default: [0,0]) The `just' qualifier may be used to indicate how the object is to be justified with respect to the origin. Its value must be a 2d numeric array [dx,dy] that gives the offset of the center of the image scaled with respect to the bounding box. Examples include: just=[0,0] Center object upon the origin (default) just=[-0.5,-0.5] Put the lower-left corner at the origin just=[0.5,-0.5] Put the lower-right corner at the origin just=[0.5,0.5] Put the upper-right corner at the origin just=[-0.5,-0.5] Put the upper-left corner at the origin SEE ALSO xfig_new_text, xfig_justify_object -------------------------------------------------------------- xfig_new_png SYNOPSIS Create an object that encapsulates a png image USAGE obj = xfig_new_png(String_Type filename); QUALIFIERS ; depth: XFig depth ; x0: x-position (default: 0) ; y0: y-position (default: 0) ; z0: z-position (default: 0) ; just=[jx,jy]: justification (default: [0,0]) DESCRIPTION `xfig_new_png' reads the image dimensions from the file header and passes them to `xfig_new_pict'. See its documentation for a detailed description of the qualifiers. SEE ALSO xfig_new_pict -------------------------------------------------------------- xfig_new_polyline SYNOPSIS Create a new polyline object USAGE p = xfig_new_polyline(Vector_Type X); % or p = xfig_new_polyline(Array_Type x [, y [, z]]); DESCRIPTION If `xfig_new_polyline' is called with one `Vector_Type' argument `X', the fields `x', `y', and `z' are expected to contain coordinate arrays of the polyline's vertices. These can also be specified directly as `Array_Type' arguements; all unspecified coordinates are set to zero. QUALIFIERS ; closed: closes the polygon by repeating the first vertex at the end ; line: line style ; width: line width ; color: line color ; fillcolor: color to fill the region inside the polyline object ; areafill: darkness or pattern (default: 20) ; depth: Xfig depth ; join: shape of the vertex of lines: MITER, ROUNDED, BEVEL ; cap: shape of end points of lines: BUTT, ROUND, PROJECTING) ; forward_arrow: see documentation of `xfig_create_arrow' ; backward_arrow: see documentation of `xfig_create_arrow' SEE ALSO xfig_create_arrow -------------------------------------------------------------- xfig_new_text SYNOPSIS Create a text object by running LaTeX USAGE obj = xfig_new_text (String_Type text [,font_object]) QUALIFIERS ; extra_packages: NULL ; preamble: (default: NULL) ; color=strval: (default: "black") ; style=strval: (default: "\bf\boldmath"R) ; size=strval: (default: "\normalsize"R) ; rotate=angle: rotate text by `angle' in degrees (default: 0) ; dvi2eps_method: ; x0: x-position (default: 0) ; y0: y-position (default: 0) ; z0: z-position (default: 0) ; depth: Xfig depth ; just=[jx,jy]: justification, see `xfig_new_pict' (default: [0,0]) DESCRIPTION This function runs LaTeX on the specified text string and returns the resulting object. The text string must be formatted according to the LaTeX rules. The optional parameter is a structure that may be used to specify the font, color, pointsize, etc to use when calling LaTeX. This structure may be instantiated using the xfig_make_font. SEE ALSO xfig_make_font, xfig_add_latex_package, xfig_set_latex_preamble, xfig_new_pict -------------------------------------------------------------- xfig_new_vbox_compound SYNOPSIS Create an XFig compound list of vertically aligned objects USAGE c = xfig_new_vbox_compound (obj1, obj2 [, ...] [, space]); DESCRIPTION The objects `obj2', ... are translated in negative y-direction such that all of them align vertically according to their size. If the last argument `space' is numeric, it indicates additional vertical space that is inserted between each of the objects. QUALIFIERS ; just=val: Justifiy the objects with respect to the first. If `val' is 0 then the objects will be centered. If val is -1, the objects will be left justified. If val is +1, they will be right justified. ; center: Center the objects with respect to the first SEE ALSO xfig_new_hbox_compound, xfig_new_compound -------------------------------------------------------------- xfig_pict.scale SYNOPSIS Scale an xfig pict object USAGE xfig_pict.scale (s); % or xfig_pict.scale (sx, sy); SEE ALSO xfig_new_pict -------------------------------------------------------------- xfig_plot--errorbars QUALIFIERS ; eb_line=intval: line style for error bars (default: `line' qualifier) ; eb_color=intval: color of error bars (default: `color' qualifier) ; eb_width=intval: thickness of error bars (default: `width' qualifier) ; eb_depth=intval: Xfig depth of error bars (default: `depth' qualifier) ; [x,y]eb_factor=intval: terminal size of error bars (default: 0) ; [x,y]min_max: Asymmetric error bars are already min/max values. DESCRIPTION Asymmetric error bars are specified as lists of negative and positive errors. If the `min_max' qualifier (or the appropriate `{x,y}min_max' qualifier) is set, then the elements of the list are considered as minimum and maximum values. EXAMPLE variable xfig_plot = xfig_plot_new(); xfig_plot.world(0, 10, 0, 10); xfig_plot.plot(1, 5, 1 ; sym="x"); % y = 5 (+-1) xfig_plot.plot(3, 5, {2, 3}; sym="x"); % y = 5 (+3)(-2) xfig_plot.plot(5, 5, {3, 8}; sym="x", minmax); % y = 5 [3...8] (same as above) xfig_plot.plot(7, 5, {1, 2}, {3, 8}; sym="x", yminmax); % x = 8 (+1)(-2), but y = 5 [3...8] SEE ALSO xfig_plot.plot, xfig_plot.hplot -------------------------------------------------------------- xfig_plot--initialize_plot SYNOPSIS Qualifiers to initialize the axes of an xfig_plot object: QUALIFIERS ; xlog: use a logarithmic x-axis ; ylog: use a logarithmic y-axis ; loglog: use logarithmic axes ; padx: [=0.05]: fraction of xrange to be padded on both sides ; pady: [=0.05]: fraction of xrange to be padded on both sides DESCRIPTION The world coordinate system of an xfig_plot object are initialized through the following functions, unless they are already set before: SEE ALSO xfig_plot.plot, xfig_plot.hplot, xfig_plot.plot_png, xfig_plot.plot_pict, xfig_plot.shade_region -------------------------------------------------------------- xfig_plot--wcs SYNOPSIS Qualifiers to specify a plot's world coordinate system QUALIFIERS ; world0: use device coordinates for x- and y-axes ; world1: use first coordinate system for x- and y-axes ; world2: use second coordinate system for x- and y-axes ; world{a}{b}: use a-th WCS for x-axis and b-th WCS for y-axis, where 0 <= a, b <= 2 DESCRIPTION If none of these qualifiers is specified, world1 is assumed. Device coordinates (0th WCS) run from 0 to 1 along the corresponding axis. The first or second coordinate system (1st or 2nd WCS) can be defined with the .world(1) or .world(2) methods. (If not set before, they are set automatically by some plot functions, see `xfig_plot--initialize_plot'.) The WCS qualifiers apply to the following functions: `xfig_plot.plot', `xfig_plot.hplot', `xfig_plot.shade_region', `xfig_plot.add_object', `xfig_plot.xylabel', `xfig_plot.get_world', `xfig_plot.xfig_coords' SEE ALSO xfig_plot.world, xfig_plot.world1, xfig_plot.world2, xfig_plot--initialize_plot -------------------------------------------------------------- xfig_plot.add_object SYNOPSIS Add an object to a plot at a world coordinate position USAGE xfig_plot.add_object (obj[, x, y[, dx, dy]]); QUALIFIERS % qualifiers to specifiy the world coordinate system, see `xfig_plot--wcs' DESCRIPTION This function may be used to add an object to a plot window at a specified world coordinate. The `dx' and `dy' arguments control the justification of the object. The values of these parameters are offsets relative to the size of the object, and as such ordinarily have values in the interval `[-0.5,0.5]'. For example, `0,0' will center the object on `(x,y)', and `(-0.5,-0.5)' will move the lower left corner of the object to the specified coordinate. SEE ALSO xfig_plot--wcs -------------------------------------------------------------- xfig_plot.axis USAGE xfig_plot.axis([; qualifiers]); QUALIFIERS ; on: draw axis, major and minor tic marks, as well as tic labels (default: on) ; off: do not draw axis, major nor minor tic marks, nor tic labels ; linear: set linear axis scale ; log: set logarithmic axis scale ; major: draw major tic marks [precedence over on/off] or array of major tic mark values ; minor: draw minor tic marks [precedence over on/off] or array of minor tic mark values ; color: color of axis, major and minor tic marks ; major_color: color of major tic marks [precedence over color] ; minor_color: color of minor tic marks [precedence over color] ; width: width of axis, major and minor tic marks ; major_width: width of major tic marks [precedence over width] ; minor_width: width of minor tic marks [precedence over width] ; line: line style of axis, major and minor tic marks ; major_line: line style of major tic marks [precedence over line] ; minor_line: line style of minor tic marks [precedence over line] ; major_len: length of the major tic marks ; minor_len: length of the minor tic marks ; grid: extend major and minor tic marks to a grid ; major_grid: extend major tic marks to a grid [precedence over grid] ; minor_grid: extend minor tic marks to a grid [precedence over grid] ; depth: Xfig depth of the axis ; tic_depth: Xfig depth of the ticmarks ; maxtics: maximum number of major tic marks ; ticlabels: draw tic labels (requires major tic marks) ; ticlabels_confine: prevent tic labels from overhanging the plot box ; ticlabel_style: tic label font style, see `xfig_make_font' ; ticlabel_color: tic label font color, see `xfig_make_font' ; ticlabel_size: tic label font size, see `xfig_make_font' ; format: tic label format string in `sprintf' style ; wcs: name of a custom world coordinate system transformation DESCRIPTION All axes can be configured with the qualifiers mentioned above. SEE ALSO xfig_plot.xaxis, xfig_plot.x1axis, xfig_plot.x2axis, xfig_plot.yaxis, xfig_plot.y1axis, xfig_plot.y2axis -------------------------------------------------------------- xfig_plot.get_world SYNOPSIS Get the world coordinates of a plot USAGE [xmin,xmax,ymin,ymax] = xfig_plot.get_world (); QUALIFIERS % qualifiers to specifiy the world coordinate system SEE ALSO xfig_plot--wcs -------------------------------------------------------------- xfig_plot.hplot USAGE xfig_plot.hplot ([x,] y); % or xfig_plot.hplot (x, y[, dy]); QUALIFIERS % qualifiers to initialize the first plot only, see `xfig_plot--initialize_plot' % qualifiers to specifiy the world coordinate system, see `xfig_plot--wcs' % qualifiers for lines (defaults for error bars): ; width: line thickness ; color: line color ; line: line style ; fillcolor=fcol: fill histogram with color `fcol' (default: `color') ; fill[=area_fill]: use style `area_fill' for shaded histogram (default: 20, if set) ; depth: Xfig depth % qualifiers for error bars: see `xfig_plot--errorbars' % qualifiers for histogram: ; y_first: y-value of first bin's vertical line ; y_last: y-value of last bin's vertical line DESCRIPTION `x' is an array of lower bin boundaries corresponding to the histogram values `y'. If `length(x)==length(y)+1', then `x[-1]' is the upper boundary of the last bin, otherwise, the last bin will be as large as the previous one. If no `x' values are given, `x = [1:length(y)]' is assumed. SEE ALSO xfig_plot--initialize_plot, xfig_plot--wcs, xfig_plot--errorbars -------------------------------------------------------------- xfig_plot.plot USAGE xfig_plot.plot ([x,] y); % or xfig_plot.plot (x, y, [dx,] dy); QUALIFIERS % qualifiers to initialize the first plot only, see `xfig_plot--initialize_plot' % qualifiers to specifiy the world coordinate system, see `xfig_plot--wcs' % qualifiers for lines (defaults for error bars and symbols): ; color=strval: color of lines symbols and error bars ; width=intval: thickness of lines and error bars ; depth=intval: Xfig depth ; line=intval: line style for lines and error bars ; forward_arrow: see `xfig_create_arrow' (default: NULL) ; backward_arrow: see `xfig_create_arrow' (default: NULL) % qualifiers for error bars: see `xfig_plot--errorbars' % qualifiers for symbols: ; sym=strval: symbol, see xfig_plot_get_symbol_names ; symcolor=strval: color of symbols (default: `color' qualifier) ; size=val: symbol point size ; fill[=intval]: area fill style (default: 20, if set; otherwise -1) ; fillcolor=strval: color for filled symbols ; symlinestyle=intval: line style to draw symbols ; symwidth=intval: thickness of symbol lines (default: `width' qualifier) ; symdepth=intval: Xfig depth of symbols (default: `depth' qualifier) DESCRIPTION If no `x' values are given, `x = [1:length(y)]' is assumed. If a symbol is specified, no lines are drawn unless the line qualifier is also specified. SEE ALSO xfig_plot--initialize_plot, xfig_plot--wcs, xfig_plot--errorbars -------------------------------------------------------------- xfig_plot.plot_pict USAGE xfig_plot.plot_pict (String_Type imgfile); QUALIFIERS ; depth: Xfig depth % qualifiers to initialize the first plot only, see `xfig_plot--initialize_plot' SEE ALSO xfig_plot.plot_png -------------------------------------------------------------- xfig_plot.plot_png SYNOPSIS Add a png file to a plot, scaling it to the window USAGE xfig_plot.plot_png (String_Type pngfile); % or xfig_plot.plot_png (Array_Type image); QUALIFIERS ; depth: Xfig depth % qualifiers to initialize the first plot only, see `xfig_plot--initialize_plot' ; cmap: name of the color map used by `png_gray_to_rgb' DESCRIPTION The image from `pngfile' is drawn in the plot region. If a two-dimensional array `image' is passed to `.plot_png', it is converted to a png file in the temporary directory, using the `png_gray_to_rgb' function and possibly a color map. All other qualifiers are forwarded to `png_gray_to_rgb'. SEE ALSO xfig_plot_new_png, xfig_plot.plot_pict, xfig_set_tmp_dir, png_gray_to_rgb -------------------------------------------------------------- xfig_plot.shade_region SYNOPSIS Add a filled rectangle or polygon to the plot USAGE xfig_plot.shade_region (x[], y[]); % or xfig_plot.shade_region (xmin, xmax, ymin, ymax); QUALIFIERS % qualifiers to initialize the first plot only see `xfig_plot--initialize_plot' % qualifiers to specifiy the world coordinate system see `xfig_plot--wcs' ; line: line style ; width: line thickness ; color: line color ; fillcolor: fill color (default: `color') ; fill: area fill style (default: 20) ; depth: Xfig depth of shaded region SEE ALSO xfig_plot--initialize_plot, xfig_plot--wcs -------------------------------------------------------------- xfig_plot.title SYNOPSIS Add a title to a plot USAGE xfig_plot.title (String_Type title); % or xfig_plot.title (XFig_Object title); DESCRIPTION The title is created from the string with the `xfig_new_text' function using all applied qualifiers. If `title' is no string, it is assumed to be an already properly formatted xfig object. The title is centered above the plot area. Any previously existing title object is removed. -------------------------------------------------------------- xfig_plot.world SYNOPSIS define a plot's world coordinate system USAGE xfig_plot.world (Double_Type xdata[], ydata[]); % or xfig_plot.world (Double_Type x0, x1, y0, y1); QUALIFIERS ; xlog: use a logarithmic x-axis ; ylog: use a logarithmic y-axis ; loglog: use logarithmic axes ; padx: fraction of xrange to be padded on both sides (default: 0.05 or 0) ; pady: fraction of yrange to be padded on both sides (default: 0.05 or 0) SEE ALSO xfig_plot.world1, xfig_plot.world2 -------------------------------------------------------------- xfig_plot.world1 SYNOPSIS define a plot's first world coordinate system SEE ALSO xfig_plot.world -------------------------------------------------------------- xfig_plot.world2 SYNOPSIS define a plot's second world coordinate system QUALIFIERS ; xticlabels: flag whether (1) or not (0) to draw ticlabels on x2axis (default: 1) ; yticlabels: flag whether (1) or not (0) to draw ticlabels on y2axis (default: 1) SEE ALSO xfig_plot.world -------------------------------------------------------------- xfig_plot.x1axis USAGE xfig_plot.x1axis([; qualifiers]); DESCRIPTION This method allows for the configuration of the first x-axis via qualifiers -- see `xfig_plot.axis' for further information. SEE ALSO xfig_plot.axis -------------------------------------------------------------- xfig_plot.x2axis USAGE xfig_plot.x2axis([; qualifiers]); DESCRIPTION This method allows for the configuration of the second x-axis via qualifiers -- see `xfig_plot.axis' for further information. SEE ALSO xfig_plot.axis -------------------------------------------------------------- xfig_plot.x2label SYNOPSIS Add a label for the second x-axis to a plot USAGE xfig_plot.x2label (String_Type x2label); DESCRIPTION The x2label is created from the string with the `xfig_new_text' function using all applied qualifiers. SEE ALSO xfig_new_text -------------------------------------------------------------- xfig_plot.xaxis USAGE xfig_plot.xaxis([; qualifiers]); QUALIFIERS ; ticlabels1: overwrites the `ticlabels' qualifier for the x1axis ; ticlabels2: overwrites the `ticlabels' qualifier for the x2axis DESCRIPTION This method allows for the configuration of both x-axes via qualifiers -- see `xfig_plot.axis' for further information. SEE ALSO xfig_plot.axis -------------------------------------------------------------- xfig_plot.xfig_coords USAGE (Double_Type xXfig, yXfig) = xfig_plot.xfig_coords (Double_Type x, y); % or Double_Type xXfig = xfig_plot.xfig_coords (Double_Type x, ); % or Double_Type yXfig = xfig_plot.xfig_coords (, Double_Type y); QUALIFIERS % qualifiers to specify the world coordinate system, SEE ALSO xfig_plot--wcs -------------------------------------------------------------- xfig_plot.xlabel SYNOPSIS Add an x-axis label to a plot USAGE xfig_plot.xlabel (String_Type xlabel); DESCRIPTION The x-label is created from the string with the `xfig_new_text' function using all applied qualifiers. SEE ALSO xfig_new_text -------------------------------------------------------------- xfig_plot.xylabel USAGE xfig_plot.xylabel (Double_Type x, y, String_Type text[, dx, dy]); QUALIFIERS % qualifiers to specifiy the world coordinate system, see `xfig_plot--wcs' SEE ALSO xfig_plot_text, xfig_plot--wcs -------------------------------------------------------------- xfig_plot.y1axis USAGE xfig_plot.y1axis([; qualifiers]); DESCRIPTION This method allows for the configuration of the first y-axis via qualifiers -- see `xfig_plot.axis' for further information. SEE ALSO xfig_plot.axis -------------------------------------------------------------- xfig_plot.y2axis USAGE xfig_plot.y2axis([; qualifiers]); DESCRIPTION This method allows for the configuration of the second y-axis via qualifiers -- see `xfig_plot.axis' for further information. SEE ALSO xfig_plot.axis -------------------------------------------------------------- xfig_plot.y2label SYNOPSIS Add a label for the second y-axis to a plot USAGE xfig_plot.y2label (String_Type y2label); DESCRIPTION The y2label is created from the string with the `xfig_new_text' function using all applied qualifiers. SEE ALSO xfig_new_text -------------------------------------------------------------- xfig_plot.yaxis USAGE xfig_plot.yaxis([; qualifiers]); QUALIFIERS ; ticlabels1: overwrites the `ticlabels' qualifier for the y1axis ; ticlabels2: overwrites the `ticlabels' qualifier for the y2axis DESCRIPTION This method allows for the configuration of both y-axes via qualifiers -- see `xfig_plot.axis' for further information. SEE ALSO xfig_plot.axis -------------------------------------------------------------- xfig_plot.ylabel SYNOPSIS Add a y-axis label to a plot USAGE xfig_plot.ylabel (String_Type ylabel); DESCRIPTION The ylabel is created from the string with the `xfig_new_text' function using all applied qualifiers. SEE ALSO xfig_new_text -------------------------------------------------------------- xfig_plot_add_symbol SYNOPSIS Add a plot symbol USAGE xfig_plot_add_symbol (String_Type name, Ref_Type funct) DESCRIPTION This function may be used to add a new plot symbol of the specified name. The `funct' parameter specifies a function to be called to create the symbol. It will be called with a single parameter: a value representing the scale size of the symbol in fig units. The function must return two arrays representing the X and Y coordinates of the polygons that represent the symbol. The center of the object is taken to be (0,0). If more than one polygon is required to represent the object, an array of arrays may be returned. -------------------------------------------------------------- xfig_plot_add_transform USAGE xfig_plot_add_transform (String_Type name, Ref_Type &wcs_func, &wcs_invfunc, Any_Type client_data); QUALIFIERS ; xmin: (default: -inf) ; xmax: (default: +inf) ; ticfun: (default: &generic_compute_tics) DESCRIPTION `wcs_func' (`wcs_invfunc') is a function of two arguments: the world (plot) coordinate and some client data. It has to return the correspondig plot (world) coordinate. The qualifier `ticfun' may reference a function that takes 4 arguments: xmin, xmax, maxtics, and client_data. It is supposed to return two arrays of major and minor tic marks. -------------------------------------------------------------- xfig_plot_get_symbol_names USAGE String_Type[] xfig_plot_get_symbol_names () SEE ALSO xfig_plot.plot -------------------------------------------------------------- xfig_plot_new SYNOPSIS Create a new plot object USAGE w = xfig_plot_new ( [Int_Type width, Int_Type height] ); DESCRIPTION This function creates a new plot object of the specified width and height. If the width and height parameters are not given, defaults will be used. The width and height values specify the size of the plotting area and do not include the space for tic marks and labels. The following qualifiers configure all axes' tic labels at once: QUALIFIERS ; ticlabel_style: tic label font style, see `xfig_make_font' ; ticlabel_color: tic label font color, see `xfig_make_font' ; ticlabel_size: tic label font size, see `xfig_make_font' EXAMPLE w = xfig_plot_new (); SEE ALSO xfig_plot_define_world, xfig_render_object -------------------------------------------------------------- xfig_plot_new_png SYNOPSIS Create a new plot window for a png file USAGE w = xfig_plot_new_png (file) QUALIFIERS ; depth: Xfig depth SEE ALSO xfig_plot_new, xfig_plot.plot_png, xfig_plot.plot_pict -------------------------------------------------------------- xfig_plot_text SYNOPSIS Add text to the plot USAGE xfig_plot_text (w, text, x, y [,dx, dy]) w: plot object x, y: world coordinates dx, dy: justification DESCRIPTION This function creates a text object at the specified location on the plot. By default, the text will be centered on the specified world coordinates. The justification parameters `dx' and `dy' may be used to specify the justifcation of the text. See the documentation for `xfig_plot_add_object' for more information. EXAMPLE xfig_plot_text (w, "$cos(\omega t)$"R, 3.2, 6.0, -0.5, 0); will left justify the text at the position (3.2,6.0). SEE ALSO xfig_plot_add_object, xfig_new_text -------------------------------------------------------------- xfig_render_object SYNOPSIS Render an object to a device USAGE xfig_render_object (obj, device) DESCRIPTION This function renders the specified object to a specified device. If the device parameter is a string, then a device will be opened with the specified name. SEE ALSO xfig_create_file, xfig_close_file -------------------------------------------------------------- xfig_set_eye SYNOPSIS Define the point from which the projection of 3d space is seen USAGE xfig_set_eye (Double_Type dist, theta, phi [, roll]); DESCRIPTION `dist' - distance of the eye from the focus `theta' - polar angle from the z-axis (in degrees) `phi' - azimuthal angle in the x-y-plane (in degrees) `roll' - roll angle (in degrees) SEE ALSO xfig_get_eye, xfig_get_eye_roll, xfig_set_eye_roll, xfig_set_focus -------------------------------------------------------------- xfig_set_eye_roll SYNOPSIS Set the roll angle under which the projection of 3d space is seen USAGE xfig_get_eye_roll (Double_Type roll); DESCRIPTION The `roll' angle is measured in degrees. SEE ALSO xfig_get_eye_roll, xfig_set_eye, xfig_set_focus -------------------------------------------------------------- xfig_set_focus SYNOPSIS Define the focus point of the projection of 3d space USAGE xfig_set_focus (Vector_Type X); SEE ALSO xfig_get_focus, xfig_set_eye -------------------------------------------------------------- xfig_set_font_style SYNOPSIS Set the default font style for LaTeX USAGE xfig_set_font_style (String_Type style); DESCRIPTION Unless changed, the default font style is "\bf\boldmath"R. SEE ALSO xfig_make_font, xfig_new_text, xfig_add_latex_package -------------------------------------------------------------- xfig_set_latex_preamble USAGE xfig_set_latex_preamble (String_Type preamble) SEE ALSO xfig_get_latex_preamble -------------------------------------------------------------- xfig_set_output_driver SYNOPSIS Associate an output driver to a file extension USAGE xfig_set_output_driver (String_Type ext, String_Type cmd) DESCRIPTION This may may be used to define the command that runs to created the specified output format (dictated by the extension) from the corresponding .fig file. The `ext' parameter specifies the filename extension and `cmd' is the shell command that will be used to generate the file. The `cmd' may contain the following format descriptors that will be replaced by the corresponding objects before being passed to the shell: %I Input .fig file %O Output file %B basename of the file %P This will resolve to -z %G This will resolve to -g The `%P' specifier will only be expanded if the "papersize" qualifier is given when rendering the output; otherwise it will be ignored. The `%G' specifier will be expanded when the "background" qualifier is given when rendering the output; otherwise it is ignored. Not all output devices support setting a background color. EXAMPLE The default driver for postscript output is given by: xfig_set_output_driver ("ps", "fig2dev -L ps -c %P %I %O"); The `ps2ps' command may result in a smaller file size at a slight cost of resolution. It may be used as follows: xfig_set_output_driver ("ps", "fig2dev -L ps -c %I %B-tmp.ps" + ";ps2ps %B-tmp.ps %O; rm -f %B-tmp.ps"); SEE ALSO xfig_set_paper_size -------------------------------------------------------------- xfig_set_verbose SYNOPSIS Control the level of chattiness USAGE xfig_set_verbose(Integer_Type level); DESCRIPTION This function may be used to control the verbosity level of the xfig functions that display informational messages. NOTES It is not always possible to control the verbosity level of external programs. For the LaTeX/eps interface, if the level is 0, then only the running command will be displayed and any output will be redirected to `/dev/null'. Otherwise if level > 0, then the output will not be redirected. -------------------------------------------------------------- xfig_timetics USAGE xfig_timetics(tmin, tmax [;qualifiers]) DESCRIPTION This function may be used to construct nice tic-labels for the time interval specified by the tmin and tmax variables. By default, these values represent the number of seconds since the POSIX epoch 1970-01-01T00:00:00Z. The format of the tic-labels may be controlled by qualifiers. This function returns a structure with the following fields: tmin The value of the tmin parameter tmax The value of the tmax parameter major An array of major tic positions minor An array of minor tic positions ticlabels An array of ticlabels correponding to the major tic positions The field names of this structure were chosen to correspond to the qualifiers accepted by the plot axis methods. QUALIFIERS ; localtime: Construct tic labels using localtime ; timetotm=&func: Use func to convert a time value to a tm structure ; tmtotime=&func: Use func to convert a tm structure to a time value ; nodates[=0|1]: Turn on or off date (YYYY-MM-DD) labels ; dateformat=VAL: strftime format for date labels (default: `"%Y-%m-%d"' ; timeformat=VAL: strftime format for time labels (default:`"%H:%M:%S"' The default is to format the time as UTC using the `gmtime' and `timegm' functions. If the `localtime' qualifier is given, the `localtime' and `mktime' functions will be used. The `timetotm' and `tmtotime' qualifiers may be used to specify the functions to be used convert to and from tm structures. The default (no qualifiers) corresponds to using `timetotm=&gmtime' and `tmtotime=timegm'. EXAMPLE tmax = _time(); % Current time tmin = tmax - 100*86400; % 100 days prior tinfo = xfig_timetics (tmin, tmax; localtime, maxtics=6); t = [tmin:tmax:#1024]; y = sin(2*PI/(5*86400)*(t-tmin)); % 5 day period w = xfig_plot_new(); w.plot (t, y; color="blue"); w.x1axis (;;tinfo); w.render ("/tmp/example.pdf"); Note that the structure returned by the `xfig_timetics' was passed as a structure of qualifiers to the `x1axis' method. -------------------------------------------------------------- slxfig-pre0.2.0-138/doc/help/vector.hlp0000644000175000000620000001543011653730343016357 0ustar johnstaffVector_Type SYNOPSIS vector data type DESCRIPTION The data type used by various vector functions is defined as a structure with the fields x, y, z A vector can be initialized, e.g., by v = vector(x, y ,z); The following common operators can be used for vector arithmetics: +/- : addition/subtraction of scalars or vectors * : scaling of vectors or dot product of vectors ^ : cross product of two vectors !=/== : (in)equality of two vectors sqr : scalar product of a vector with itself abs : norm of a vector SEE ALSO vector -------------------------------------------------------------- vector SYNOPSIS returns a vector object given by its cartesian or spherical coordinates USAGE Vector_Type vector(Double_Type x, y, z) % or Vector_Type vector(Double_Type r, phi, theta; sph) QUALIFIERS ; sph: consider the given coordinates to be spherical (r, phi, theta) DESCRIPTION The components of the vector are returned within the Vector_Type and are accessible like a structure with the fields x, y, and z. If the `sph' qualifier is given, the cartesian coordinates are calculated as [x, y, z] = r * [cos(phi)*sin(theta), sin(phi)*sin(theta), cos(theta)] SEE ALSO Vector_Type -------------------------------------------------------------- dotprod SYNOPSIS calculates the dot product of the given vectors USAGE Double_Type dotprod(Vector_Type a, b) QUALIFIERS none DESCRIPTION The dot product is calculated as a.x*b.x + a.y*b.y + a.z*b.z SEE ALSO vector -------------------------------------------------------------- crossprod SYNOPSIS calculates the cross product of the given vectors USAGE Vector_Type crossprod(a, b) QUALIFIERS none DESCRIPTION The returned vector is calculated as x = a.y*b.z - b.y*a.z y = a.z*b.x - b.z*a.x z = a.x*b.y - b.x*a.y SEE ALSO vector -------------------------------------------------------------- vector_sqr SYNOPSIS returns the scalar product of the given vector with itself USAGE Double_Type vector_sqr(Vector_Type v) QUALIFIERS none DESCRIPTION The scalar product of the given vector is returned using dotprod(v, v) SEE ALSO dotprod, vector -------------------------------------------------------------- vector_norm SYNOPSIS returns the norm of the given vector USAGE Double_Type vector_norm(Vector_Type v) QUALIFIERS none DESCRIPTION The norm of the given vector is calculated as sqrt(v.x^2 + v.y^2 + v.z^2) SEE ALSO vector_sqr, vector -------------------------------------------------------------- normalize_vector SYNOPSIS normalizes the given vector USAGE normalize_vector(Vector_Type v); QUALIFIERS none DESCRIPTION The given vector is normalized such that vector_norm(v) = 1 SEE ALSO vector_norm, vector -------------------------------------------------------------- unit_vector SYNOPSIS normalizes the given vector USAGE Vector_Type unit_vector(Vector_Type v) QUALIFIERS none DESCRIPTION The given vector is normalized such that vector_norm(v) = 1 SEE ALSO normalize_vector -------------------------------------------------------------- vector_sum SYNOPSIS calculates the sum of two vectors USAGE Vector_Type vector_sum(Vector_Type a, b) QUALIFIERS none DESCRIPTION The components of the two given vectors are added and the resulting vector is returned. Instead of calling this function, operator arithmetic can be used as well: a + b SEE ALSO vector_diff, vector -------------------------------------------------------------- vector_a_plus_bt SYNOPSIS calculates the time dependent sum of two vectors USAGE Vector_Type vector_a_plus_bt(Vector_Type a, b, Double_Type t) QUALIFIERS none DESCRIPTION The components of the second vector are scaled by t and added to the first vector: a + t*b This can be done by pure operator arithmetic as well as using other functions like vector_sum(a, vector_mul(t, b)) SEE ALSO vector_sum, vector_mul, vector -------------------------------------------------------------- vector_diff SYNOPSIS calculates the difference of two vectors USAGE Vector_Type vector_diff(Vector_Type a, b) QUALIFIERS none DESCRIPTION The components of the two given vectors are subtracted and the resulting vector is returned. Instead of calling this function, operator arithmetic can be used as well: a - b SEE ALSO vector_sum, vector -------------------------------------------------------------- vector_mul SYNOPSIS the given vector is scaled by a scalar USAGE Vector_Type vector_mul(Double_Type a, Vector_Type v) QUALIFIERS none DESCRIPTION The components of the given vector are scaled by a scalar and the resulting vector is returned. Instead of calling this function, operator arithmetic can be used as well: a*v SEE ALSO vector -------------------------------------------------------------- vector_change_basis SYNOPSIS applies a basis transformation to the given vector USAGE Vector_Type vector_change_basis(Vector_Type v, e1, e2, e3) QUALIFIERS none DESCRIPTION The components of the given vector are transformed into the new basis given by the unit vectors e1, e2 and e3: v.x*e1 + v.y*e2 + v.z*e3 SEE ALSO unit_vector, vector -------------------------------------------------------------- vector_rotate SYNOPSIS rotates the given vector around another vector USAGE Vector_Type vector_rotate(Vector_Type v, n, Double_Type theta) QUALIFIERS none DESCRIPTION The vector v is rotated around the given vector n by the angle theta: cos(theta)*v + dotprod(v,n)*(1-cos(theta))*n + sin(theta)*crossprod(n,v) SEE ALSO dotprod, crossprod, vector -------------------------------------------------------------- vector_get_transformation SYNOPSIS finds a rotation axis and angle that will produce the given basis USAGE (Vector_Type, Double_Type) vector_get_transformation(Vector_Type x1_hat, y1_hat); QUALIFIERS none DESCRIPTION The orthonormal basis, given by the unit vectors x1_hat, y1_hat and x1_hat cross y1_hat = z1_hat, can be produced by a transformation of the standard orthonormal basis (1,0,0), (0,1,0), (0,0,1) by rotation around an axis and angle, which are returned by this function. SEE ALSO vector_rotate, vector_change_basis, unit_vector, vector -------------------------------------------------------------- vector_chs SYNOPSIS inverts the given vector USAGE Vector_Type vector_chs(Vector_Type v) QUALIFIERS none DESCRIPTION The components of the given vector are inverted such that v + vector_chs(v) = (0, 0, 0) SEE ALSO vector_sum, vector -------------------------------------------------------------- slxfig-pre0.2.0-138/doc/help/gcontour.hlp0000644000175000000620000000221511357313335016711 0ustar johnstaffgcontour SYNOPSIS USAGE gcontour(img, levels, &callback_fun [, callback_args...]); DESCRIPTION `img' is a 2d-array of numbers, `levels' is an array of contour-levels, and `callback_fun' is a callback function that will be called as callback_fun(x, y, iz [, callback_args...]); for each contour line at the level `levels[iz]' with the image coordinates `x' and `y'. SEE ALSO gcontour_compute -------------------------------------------------------------- gcontour_compute USAGE Struct_Type[] gcontour_compute(img, levels) DESCRIPTION This function takes a 2d array of numbers (`img') and an array of array of N contour-levels (`levels') and returns the corresponding contours in the form of an array of N structures. Each structure contains the contour lines for the corresponding level via the fields `x_list' and `y_list'. As the names indicate, the values of these fields are lists. Each element of the x_list contains the image x coordinate of the contour. Similarly each element of the y_list field is an array of image y coordinates. SEE ALSO gcontour -------------------------------------------------------------- slxfig-pre0.2.0-138/doc/text/0002755000175000000620000000000014540004350014371 5ustar johnstaffslxfig-pre0.2.0-138/doc/text/slxfig.txt0000644000175000000620000015746314540004350016444 0ustar johnstaff SLxfig Reference John E. Davis, with numerous contributions from Manfred Hanke Dec 17, 2023 ____________________________________________________________ Table of Contents 1. Introduction 1.1 History 2. Function Reference 2.1 .justify 2.2 .render 2.3 .scale 2.4 pict.rotate_pict 2.5 xfig_add_latex_package 2.6 xfig_center_pict_in_box 2.7 xfig_clip_polyline2d 2.8 xfig_compound.append 2.9 xfig_compound.insert 2.10 xfig_create_arrow 2.11 xfig_ellipse.rotate 2.12 xfig_get_color_names 2.13 xfig_get_eye 2.14 xfig_get_eye_roll 2.15 xfig_get_focus 2.16 xfig_get_latex_preamble 2.17 xfig_justify_object 2.18 xfig_lookup_w3c_color (name) 2.19 xfig_make_font 2.20 xfig_meshgrid 2.21 xfig_multipage.add 2.22 xfig_multipage.close 2.23 xfig_multipage_open 2.24 xfig_multiplot 2.25 xfig_new_color 2.26 xfig_new_compound 2.27 xfig_new_ellipse 2.28 xfig_new_eps 2.29 xfig_new_hbox_compound 2.30 xfig_new_legend 2.31 xfig_new_pict 2.32 xfig_new_png 2.33 xfig_new_polyline 2.34 xfig_new_text 2.35 xfig_new_vbox_compound 2.36 xfig_pict.scale 2.37 xfig_plot--errorbars 2.38 xfig_plot--initialize_plot 2.39 xfig_plot--wcs 2.40 xfig_plot.add_object 2.41 xfig_plot.axis 2.42 xfig_plot.get_world 2.43 xfig_plot.hplot 2.44 xfig_plot.plot 2.45 xfig_plot.plot_pict 2.46 xfig_plot.plot_png 2.47 xfig_plot.shade_region 2.48 xfig_plot.title 2.49 xfig_plot.world 2.50 xfig_plot.world1 2.51 xfig_plot.world2 2.52 xfig_plot.x1axis 2.53 xfig_plot.x2axis 2.54 xfig_plot.x2label 2.55 xfig_plot.xaxis 2.56 xfig_plot.xfig_coords 2.57 xfig_plot.xlabel 2.58 xfig_plot.xylabel 2.59 xfig_plot.y1axis 2.60 xfig_plot.y2axis 2.61 xfig_plot.y2label 2.62 xfig_plot.yaxis 2.63 xfig_plot.ylabel 2.64 xfig_plot_add_symbol 2.65 xfig_plot_add_transform 2.66 xfig_plot_get_symbol_names 2.67 xfig_plot_new 2.68 xfig_plot_new_png 2.69 xfig_plot_text 2.70 xfig_render_object 2.71 xfig_set_eye 2.72 xfig_set_eye_roll 2.73 xfig_set_focus 2.74 xfig_set_font_style 2.75 xfig_set_latex_preamble 2.76 xfig_set_output_driver 2.77 xfig_set_verbose 2.78 xfig_timetics ______________________________________________________________________ 1. Introduction SLxfig is a S-Lang package that produces plots, drawings, etc in a variety of formats (.ps, .eps, .png, .jpeg,...). It accomplishes this via S-Lang functions that automatically run Xfig's fig2dev and LaTeX to produce the desired output format. See the examples page for some sample publication-quality plots and the code that produced them. 1.1. History In October of 2003 I was asked to give a talk at a workshop on modeling pileup in the Chandra CCDs and was told that it should be an electronic presentation using, for example, powerpoint. I installed the OpenOffice version of powerpoint and started working on the presentation. After about 30 minutes of frustration, I turned to xfig, which is a very flexible and simple to use drawing program familiar to many scientists and engineers. Using xfig, I proceeded to draw several grids representing the CCD pixels. At some point, I wanted to go back and change the orientation of some of the grids such as changing vertical lines to diagonal ones. Unfortunately, this would require recreating the grids, which would take time. But what if I was not happy with the new orientation and wanted to try another one? Clearly, a manual approach was not going to work. So I started to look for an automated approach to xfig. I searched the web and found the specification of the xfig file format and proceeded to write a S-Lang script to automatically generate the appropriate .fig file from a mathematical description of the object as coded in S-Lang. SLxfig was born. The following set of SLxfig-generated figures, which shows two perspectives of a pair photons interacting in the CCD, illustrates the solution to the orientation problem described above. Figure 1, Figure 2 See the updated version of the pileup-presentation for more examples of SLxfig generated drawings and plots. 2. Function Reference 2.1. .justify Synopsis Justify an object at a specified position Usage .justify (Vector_Type X [, Vector_Type dX]); % or .justify (XFig_Object o [, Vector_Type dX]); See Also ``xfig_justify_object'' 2.2. .render Synopsis Render an xfig object to a file. Usage .render(String_Type filename); % or .render(Struct_Type dev); Description If the argument is a filename string, the file is created through xfig_create_file, and the is rendered. xfig_close_file finally closes the file and runs Xfig's fig2dev program on it. Qualifiers ; depth=intarray: if specified, only objects of these depths are rendered ; verbose=intval: if >=0, the fig2dev command is displayed ; fig=0|1: if 0 (default), the .fig file will be removed, otherwise kept ; papersize[=VAL]: Process the %P string in the output driver. If VAL is given, use it for the papersize ; background=color: Process the %G string in the output driver with the specified color See Also ``xfig_set_verbose'' 2.3. .scale Synopsis Scale an xfig object Usage .scale (s); % or .scale (sx, sy[, sz]]); Description If the .scale method is called with one argument s, the object is scaled by s in all directions. If two (three) arguments sx, sy (and sz) are given, x, y (and z) coordinates are scaled differently. 2.4. pict.rotate_pict Usage pict.rotate_pict (theta_degrees); Description A picture object can only be rotated by multiples of 90 degrees. 2.5. xfig_add_latex_package Synopsis Load a package in the preamble of latex documents. Usage xfig_add_latex_package (String_Type package[, package2, ...]); Qualifiers ; prepend: package is inserted before previous packages Description Options can be added to package in square brackets: Example xfig_add_latex_package("fontenc[T1]", "mathpazo[osf]"); 2.6. xfig_center_pict_in_box Synopsis Center a pict object in a box Usage xfig_center_pict_in_box (pict_object, X, dx, dy Description This function takes a pict object and centers it in a box whose width is dx and whose height is dy. The vector X denotes the position of the lower-left corner of the box. If the pict object is too big to fit in the box, then its lower-left corner will coincide with the lower-left corner of the box. See Also ``xfig_translate_object'' 2.7. xfig_clip_polyline2d Synopsis Clip a list of 2d line segments Usage list = xfig_clip_polyline2d (x[], y[], xmin, xmax, ymin, ymax) Description This function clips a polyline composed individual line segments that run from (x_i,y_i) to (x_{i+1},y_{i+1}) at the boundaries of the window defined by the xmin, xmax, ymin, and ymax parameters. The result is returned as an xfig polyline object. Notes This function should be used if the order of the line segments does not matter. Otherwise, the xfig_clip_polygon2d function should be used. See Also ``xfig_clip_polygon2d'', ``xfig_new_polyline_list'' 2.8. xfig_compound.append Synopsis Append one or more xfig objects to a compound Usage xfig_compound.append( o[, ...]); See Also ``xfig_compound.insert'' 2.9. xfig_compound.insert Synopsis Insert one or more xfig objects to a compound Usage xfig_compound.insert( o[, ...]); See Also ``xfig_compound.append'' 2.10. xfig_create_arrow Synopsis Create a new arrow shape for a polyline object Description xfig_create_arrow creates a structure that can be used for polyline objects, e.g., with xfig_new_polyline. All information are passed via qualifiers. Qualifiers ; arrow_type: shape of arrow heads (values from 0 to 14), e.g., XFIG_ARROWTYPE_{STICK,TRIANGLE,INDENTED,POINTED} and others (default: XFIG_ARROWTYPE_INDENTED==2) ; arrow_style: XFIG_ARROWSTYLE_{HOLLOW,FILLED}, i.e., 0 or 1; indicating a filling with white or with the pen color for 0 < arrow_type < 13 (default: 1) ; arrow_thickness: (default: 1) ; arrow_width: (default: 4) ; arrow_height: (default: 8) Example % using the same (simple) shape for forward and backward arrow, % implicitly calling xfig_create_arrow (twice): variable a1 = xfig_new_polyline([0,4], [0,3] ; forward_arrow, backward_arrow, arrow_type=0, arrow_style=0); % explicitly calling xfig_create_arrow, in order to use % different shapes for forward and backward arrow: variable forw_arr = xfig_create_arrow(; arrow_type= 0, arrow_style=0), back_arr = xfig_create_arrow(; arrow_type=13, arrow_style=1), a2 = xfig_new_polyline([1,5], [1,4] ; forward_arrow=forw_arr, backward_arrow=back_arr); See Also ``xfig_new_polyline'' 2.11. xfig_ellipse.rotate Usage xfig_ellipse.rotate([Vector_Type axis,] Double_Type theta); Description If no axis is given, the ellipse is rotated in the x-y-plane around axis = vector(0,0,1). The rotation angle theta is measured in radians. 2.12. xfig_get_color_names Synopsis Get a list color names Usage Array_Type xfig_get_color_names () Description This function returns an array of strings giving the available color names. This list includes the Xfig color names, user- defined colors, and the W3C color names. See Also ``xfig_new_color'', ``xfig_list_colors'', ``xfig_lookup_w3c_color'' 2.13. xfig_get_eye Synopsis Obtain the point from which the projection of 3d space is seen Usage Vector_Type xfig_get_eye () See Also ``xfig_set_eye'' 2.14. xfig_get_eye_roll Synopsis Obtain the roll angle under which the projection of 3d space is seen Usage Double_Type xfig_get_eye_roll () Description The roll angle is measured in degrees. See Also ``xfig_set_eye_roll'', ``xfig_set_eye'' 2.15. xfig_get_focus Synopsis Obtain the focus point of the projection of 3d space Usage Vector_Type xfig_get_focus () See Also ``xfig_set_focus'' 2.16. xfig_get_latex_preamble Usage String_Typer xfig_get_latex_preamble () See Also ``xfig_set_latex_preamble'' 2.17. xfig_justify_object Synopsis Justify an object at a specified position Usage xfig_justify_object (XFig_Object obj, Vector_Type X [, Vector_Type dX]); % or xfig_justify_object (XFig_Object obj, XFig_Object o [, Vector_Type dX]); Description This function moves the object to the specified position X (a vector) and justifies it at that position according to the offsets specified by the vector dX. The components of dX are normally in the range -0.5 to 0.5 and represent offsets relative to the size of the object. If the components of dX are 0, then the object will be centered at X. Alternatively, the second argument may be an XFig object o itself. The position vector X is then determined from the position of o and the justification vector dX: obj will be justified relative to the outer boundary of o, unless the inside qualifier is set, in which case it will be justified relative to the inner boundary. Qualifiers ; inside: justify obj relative to the inner boundary of o Example For dX = vector (0,0,0): the object obj will be justified concentrically with o. For dX = vector (0,-0.5,0) (i.e., obj will be horizontally centered and vertically aligned at its lower baseline): X is the horizontal center of the upper vertical baseline of o such that obj will be placed on top of o. For dX = vector (0,-0.5,0), together with the inside qualifier: X is the horizontal center of the lower vertical baseline of o such that obj will be coaligned with o at their lower baselines. See Also ``.justify'', ``.get_bbox'', ``.translate'' 2.18. xfig_lookup_w3c_color (name) Synopsis Lookup an RGB value for an W3C color name Usage rgb = xfig_lookup_w3c_color (name) Description This function may be used to lookup the RGB value for a specified W3C color name. If the W3C rgb.txt file could not be loaded, or the color name does not exist within he file, NULL will be returned. The primary purpose of this function is to provide a mechanism for overriding Xfig color values with those defined by W3C. Example Xfig uses 0x00FF00 for green, whereas W3C defines 0x008000. Use the W3C value: xfig_new_color ("green", xfig_lookup_w3c_color ("green")); See Also ``xfig_new_color'', ``xfig_list_colors'', ``xfig_get_color_names'' 2.19. xfig_make_font Synopsis Create a font structure used by SLxfig's LaTeX interface Usage Struct_Type xfig_make_font ([String_Type style, size, color]) Qualifiers ; style: (default: "\bf\boldmath"R) ; size: (default: "\normalsize"R) ; color: (default: "black") Description If color is a string, it is considered to be a named color from the SLxfig color interface. Alternatively, color can be an integer number, representing the color's RGB value. style, size, color arguments different from NULL overwrite qualifier values. See Also ``xfig_new_text'' 2.20. xfig_meshgrid Synopsis Produce grid points for an image Usage (xx,yy) = xfig_meshgrid (xx, yy) Description This function takes two 1-d vectors representing the orthogonal grids for a rectangular region in the (x,y) plane and returns two 2-d arrays corresponding to the (x,y) coordinates of each intersecting grid point. Suppose that one wants to evaluate a function f(x,y) at each point defined by the two grid vectors. Simply calling f(x,y) using the grid vectors would lead to either a type-mismatch error or produce a 1-d result. The correct way to do this is to use the xfig_meshgrid function: result = f(xfig_meshgrid(x,y)); 2.21. xfig_multipage.add Synopsis Add an xfig object to a multipage file Usage .add(ob) Description This function is used to render an xfig object to a multipage file. This is done by rendering the object to an intermediate .eps file. The file will removed upon closing the multipage file. Qualifiers ; save: Keep the intermediate file, do not remove it ; file=fname: Use fname as the basename of the intermediate file. The .eps extension will be used. See Also ``xfig_multipage_open'', ``xfig_multipage_close'' 2.22. xfig_multipage.close Synopsis Close a multipage file Usage .close Description This function is used to close a multipage file. It will invoke ghostscript to write the intermediate files to the final document, and then remove those intermediate files that were flagged for removal. Qualifiers ; verbose=value: If greater than 0, show the ghostscript command line. ; crop: If given, crop the resulting multipage file to the largest bounding box of intermediate files. ; margin=value: When not cropping, add a margins to each page of the specified size in inches. The default is 0.5 inches See Also ``xfig_multipage_open'', ``xfig_multipage.add'' 2.23. xfig_multipage_open Synopsis Create an xfig multipage file Usage m = xfig_multipage_open (String_Type file [;qualifiers]) Description This function will create a new multipage file. Xfig objects may be written to the multipage file using the .add method. Each call to the .add method will result in the object being rendered to an intermediate eps file. When finished, the .close method must be used to produce the final file and remove the intermediate files. The file parameter is used to specify the name of the multipage file. Only multipage pdf files are supported; hence, the filename extension must be .pdf. Qualifiers ; save: Do not remove the intermediate files Example m = xfig_multipage_open ("example.pdf"); w = xfig_plot_new (); % Code create the first plot m.add (w); w = xfig_plot_new (); % Code to create the second plot m.add (w); m.close (); See Also ``xfig_multipage.close'', ``xfig_multipage.add'' 2.24. xfig_multiplot Synopsis Create a multiplot from individual panels that share the same x- axes Usage compound = xfig_multiplot (xfig_plot p1[], p2[], ...); Qualifiers ; cols=intval: number of columns (default: 1) ; title=strval: overall title on top of the multiplot ; xlabel=strval: overall xlabel below the multiplot ; x2label=strval: overall x2label on top of the multiplot ; ylabel=strval: overall ylabel left of the multiplot ; y2label=strval: overall y2label right of the multiplot ; align_ylabels=intval: bitmask for aligning all y{1,2}axis- labels (default: 1|2) Description p1, p2, ... can be single plot objects or arrays of them. xfig_multiplot arranges a multi-panel plot with cols columns. The plot windows are aligned in left-right, top-down order. xfig_multiplot switches off titles, axis- and ticmark labels of those plots for which those would overlap with other plots. It is thus be desirable to have common sizes of the plot windows, as well as common ranges and coordinate systems on adjoining axes. This is particularly important if when more than one column is used. The return value is a compound object containing all plots in the multiplot (note that their number has to be a multiple of cols). If the title or x(2)label qualifiers are specified and cols>1, additional text objects are added above and below the multiplot. (For cols==1, the title/x(2)label of the first/last plot are set.) The same holds for the y(2)label qualifiers, for which it depends on the resulting number of rows whether additional text is added on the left or right of the multiplot or whether the corresponding labels of the first or last plot are set (possibly overwritten). 2.25. xfig_new_color Synopsis Add a new color definition Usage xfig_new_color (name, RGB [,&id] Description This function may be used to add a new color called name with the specified RGB (24 bit integer) value. If the optional third parameter is provided, it must be a reference to a variable whose value upon return will be set to the integer index of the color. Notes Color names are converted to a canonical form by removing whitespace from the name and converting it to lowercase. This means that "OffWhite", "offwhite", and "off White" are all equivalent. See Also ``xfig_lookup_color_rgb'', ``xfig_lookup_color'' 2.26. xfig_new_compound Synopsis Create an XFig compound list Usage c = xfig_new_compound ([obj1, obj2, ...]); Description An empty compound list is created with xfig_new_compound_list. All arguments passed to the xfig_new_compound function are inserted in the newly created list. See Also ``xfig_new_vbox_compound'', ``xfig_new_hbox_compound'' 2.27. xfig_new_ellipse Synopsis Create a new ellipse object Usage XFig_Ellipse_Type xfig_create_ellipse (Double_Type a [, b]) Qualifiers ; line: line style (default: 0) ; width: line width (default: 1) ; color: line color (default: -1) ; fillcolor: (default: -1) ; areafill: darkness or pattern (default: -1 or 20, depending on fillcolor) ; depth: XFig depth (default: 50) ; x0: x-position (default: 0) ; y0: y-position (default: 0) ; z0: z-position (default: 0) 2.28. xfig_new_eps Synopsis Create an SLxfig picture object from an eps file Usage obj = xfig_new_eps(String_Type filename); Qualifiers All qualifiers are passed to the xfig_new_pict function. See Also ``xfig_new_pict'' 2.29. xfig_new_hbox_compound Synopsis Create an XFig compound list of horizontally aligned objects Usage c = xfig_new_hbox_compound (obj1, obj2 [, ...] [, space]); Description The objects obj2, ... are translated in negative y-direction such that all of them align horizontally according to their size. If the last argument space is numeric, it indicates additional horizontal space that is inserted between each of the objects. Qualifiers ; just=val: Justifiy the objects with respect to the first. If val is 0 then the objects will be centered. If val is 1, the objects will be aligned at the top. If val is -1, they will be aligned at the bottom. ; center: Center the objects with respect to the first See Also ``xfig_new_vbox_compound'', ``xfig_new_compound'' 2.30. xfig_new_legend Synopsis Create a plot legend object Usage legend = xfig_new_legend (labels[], colors[], linestyles[], thicknesses[], width); Qualifiers ; areafill=intval: (default: 20) ; fillcolor=strval: (default: "white") ; labelsize=strval: (default: "large") Description The xfig_new_legend function creates a legend object suitable for adding to a plot. The legend will consist of ... 2.31. xfig_new_pict Synopsis Create an object that encapsulates an image file Usage obj = xfig_new_pict(filename, width, height [; qualifiers]) Description This function creates an object containing the specified image file and scales it to the specified width an height. The resulting object containing the image will be centered at (0,0,0). Qualifiers ; depth: XFig depth ; x0: x-position (default: 0) ; y0: y-position (default: 0) ; z0: z-position (default: 0) ; just=[jx,jy]: justification (default: [0,0]) The just qualifier may be used to indicate how the object is to be justified with respect to the origin. Its value must be a 2d numeric array [dx,dy] that gives the offset of the center of the image scaled with respect to the bounding box. Examples include: just=[0,0] Center object upon the origin (default) just=[-0.5,-0.5] Put the lower-left corner at the origin just=[0.5,-0.5] Put the lower-right corner at the origin just=[0.5,0.5] Put the upper-right corner at the origin just=[-0.5,-0.5] Put the upper-left corner at the origin See Also ``xfig_new_text'', ``xfig_justify_object'' 2.32. xfig_new_png Synopsis Create an object that encapsulates a png image Usage obj = xfig_new_png(String_Type filename); Qualifiers ; depth: XFig depth ; x0: x-position (default: 0) ; y0: y-position (default: 0) ; z0: z-position (default: 0) ; just=[jx,jy]: justification (default: [0,0]) Description xfig_new_png reads the image dimensions from the file header and passes them to xfig_new_pict. See its documentation for a detailed description of the qualifiers. See Also ``xfig_new_pict'' 2.33. xfig_new_polyline Synopsis Create a new polyline object Usage p = xfig_new_polyline(Vector_Type X); % or p = xfig_new_polyline(Array_Type x [, y [, z]]); Description If xfig_new_polyline is called with one Vector_Type argument X, the fields x, y, and z are expected to contain coordinate arrays of the polyline's vertices. These can also be specified directly as Array_Type arguements; all unspecified coordinates are set to zero. Qualifiers ; closed: closes the polygon by repeating the first vertex at the end ; line: line style ; width: line width ; color: line color ; fillcolor: color to fill the region inside the polyline object ; areafill: darkness or pattern (default: 20) ; depth: Xfig depth ; join: shape of the vertex of lines: MITER, ROUNDED, BEVEL ; cap: shape of end points of lines: BUTT, ROUND, PROJECTING) ; forward_arrow: see documentation of xfig_create_arrow ; backward_arrow: see documentation of xfig_create_arrow See Also ``xfig_create_arrow'' 2.34. xfig_new_text Synopsis Create a text object by running LaTeX Usage obj = xfig_new_text (String_Type text [,font_object]) Qualifiers ; extra_packages: NULL ; preamble: (default: NULL) ; color=strval: (default: "black") ; style=strval: (default: "\bf\boldmath"R) ; size=strval: (default: "\normalsize"R) ; rotate=angle: rotate text by angle in degrees (default: 0) ; dvi2eps_method: ; x0: x-position (default: 0) ; y0: y-position (default: 0) ; z0: z-position (default: 0) ; depth: Xfig depth ; just=[jx,jy]: justification, see xfig_new_pict (default: [0,0]) Description This function runs LaTeX on the specified text string and returns the resulting object. The text string must be formatted according to the LaTeX rules. The optional parameter is a structure that may be used to specify the font, color, pointsize, etc to use when calling LaTeX. This structure may be instantiated using the xfig_make_font. See Also ``xfig_make_font'', ``xfig_add_latex_package'', ``xfig_set_latex_preamble'', ``xfig_new_pict'' 2.35. xfig_new_vbox_compound Synopsis Create an XFig compound list of vertically aligned objects Usage c = xfig_new_vbox_compound (obj1, obj2 [, ...] [, space]); Description The objects obj2, ... are translated in negative y-direction such that all of them align vertically according to their size. If the last argument space is numeric, it indicates additional vertical space that is inserted between each of the objects. Qualifiers ; just=val: Justifiy the objects with respect to the first. If val is 0 then the objects will be centered. If val is -1, the objects will be left justified. If val is +1, they will be right justified. ; center: Center the objects with respect to the first See Also ``xfig_new_hbox_compound'', ``xfig_new_compound'' 2.36. xfig_pict.scale Synopsis Scale an xfig pict object Usage xfig_pict.scale (s); % or xfig_pict.scale (sx, sy); See Also ``xfig_new_pict'' 2.37. xfig_plot--errorbars Qualifiers ; eb_line=intval: line style for error bars (default: line qualifier) ; eb_color=intval: color of error bars (default: color qualifier) ; eb_width=intval: thickness of error bars (default: width qualifier) ; eb_depth=intval: Xfig depth of error bars (default: depth qualifier) ; [x,y]eb_factor=intval: terminal size of error bars (default: 0) ; [x,y]min_max: Asymmetric error bars are already min/max values. Description Asymmetric error bars are specified as lists of negative and positive errors. If the min_max qualifier (or the appropriate {x,y}min_max qualifier) is set, then the elements of the list are considered as minimum and maximum values. Example variable xfig_plot = xfig_plot_new(); xfig_plot.world(0, 10, 0, 10); xfig_plot.plot(1, 5, 1 ; sym="x"); % y = 5 (+-1) xfig_plot.plot(3, 5, {2, 3}; sym="x"); % y = 5 (+3)(-2) xfig_plot.plot(5, 5, {3, 8}; sym="x", minmax); % y = 5 [3...8] (same as above) xfig_plot.plot(7, 5, {1, 2}, {3, 8}; sym="x", yminmax); % x = 8 (+1)(-2), but y = 5 [3...8] See Also ``xfig_plot.plot'', ``xfig_plot.hplot'' 2.38. xfig_plot--initialize_plot Synopsis Qualifiers to initialize the axes of an xfig_plot object: Qualifiers ; xlog: use a logarithmic x-axis ; ylog: use a logarithmic y-axis ; loglog: use logarithmic axes ; padx: [=0.05]: fraction of xrange to be padded on both sides ; pady: [=0.05]: fraction of xrange to be padded on both sides Description The world coordinate system of an xfig_plot object are initialized through the following functions, unless they are already set before: See Also ``xfig_plot.plot'', ``xfig_plot.hplot'', ``xfig_plot.plot_png'', ``xfig_plot.plot_pict'', ``xfig_plot.shade_region'' 2.39. xfig_plot--wcs Synopsis Qualifiers to specify a plot's world coordinate system Qualifiers ; world0: use device coordinates for x- and y-axes ; world1: use first coordinate system for x- and y-axes ; world2: use second coordinate system for x- and y-axes ; world{a}{b}: use a-th WCS for x-axis and b-th WCS for y-axis, where 0 <= a, b <= 2 Description If none of these qualifiers is specified, world1 is assumed. Device coordinates (0th WCS) run from 0 to 1 along the corresponding axis. The first or second coordinate system (1st or 2nd WCS) can be defined with the .world(1) or .world(2) methods. (If not set before, they are set automatically by some plot functions, see xfig_plot--initialize_plot.) The WCS qualifiers apply to the following functions: xfig_plot.plot, xfig_plot.hplot, xfig_plot.shade_region, xfig_plot.add_object, xfig_plot.xylabel, xfig_plot.get_world, xfig_plot.xfig_coords See Also ``xfig_plot.world'', ``xfig_plot.world1'', ``xfig_plot.world2'', ``xfig_plot--initialize_plot'' 2.40. xfig_plot.add_object Synopsis Add an object to a plot at a world coordinate position Usage xfig_plot.add_object (obj[, x, y[, dx, dy]]); Qualifiers % qualifiers to specifiy the world coordinate system, see xfig_plot--wcs Description This function may be used to add an object to a plot window at a specified world coordinate. The dx and dy arguments control the justification of the object. The values of these parameters are offsets relative to the size of the object, and as such ordinarily have values in the interval [-0.5,0.5]. For example, 0,0 will center the object on (x,y), and (-0.5,-0.5) will move the lower left corner of the object to the specified coordinate. See Also ``xfig_plot--wcs'' 2.41. xfig_plot.axis Usage xfig_plot.axis([; qualifiers]); Qualifiers ; on: draw axis, major and minor tic marks, as well as tic labels (default: on) ; off: do not draw axis, major nor minor tic marks, nor tic labels ; linear: set linear axis scale ; log: set logarithmic axis scale ; major: draw major tic marks [precedence over on/off] or array of major tic mark values ; minor: draw minor tic marks [precedence over on/off] or array of minor tic mark values ; color: color of axis, major and minor tic marks ; major_color: color of major tic marks [precedence over color] ; minor_color: color of minor tic marks [precedence over color] ; width: width of axis, major and minor tic marks ; major_width: width of major tic marks [precedence over width] ; minor_width: width of minor tic marks [precedence over width] ; line: line style of axis, major and minor tic marks ; major_line: line style of major tic marks [precedence over line] ; minor_line: line style of minor tic marks [precedence over line] ; major_len: length of the major tic marks ; minor_len: length of the minor tic marks ; grid: extend major and minor tic marks to a grid ; major_grid: extend major tic marks to a grid [precedence over grid] ; minor_grid: extend minor tic marks to a grid [precedence over grid] ; depth: Xfig depth of the axis ; tic_depth: Xfig depth of the ticmarks ; maxtics: maximum number of major tic marks ; ticlabels: draw tic labels (requires major tic marks) ; ticlabels_confine: prevent tic labels from overhanging the plot box ; ticlabel_style: tic label font style, see xfig_make_font ; ticlabel_color: tic label font color, see xfig_make_font ; ticlabel_size: tic label font size, see xfig_make_font ; format: tic label format string in `sprintf' style ; wcs: name of a custom world coordinate system transformation Description All axes can be configured with the qualifiers mentioned above. See Also ``xfig_plot.xaxis'', ``xfig_plot.x1axis'', ``xfig_plot.x2axis'', ``xfig_plot.yaxis'', ``xfig_plot.y1axis'', ``xfig_plot.y2axis'' 2.42. xfig_plot.get_world Synopsis Get the world coordinates of a plot Usage [xmin,xmax,ymin,ymax] = xfig_plot.get_world (); Qualifiers % qualifiers to specifiy the world coordinate system See Also ``xfig_plot--wcs'' 2.43. xfig_plot.hplot Usage xfig_plot.hplot ([x,] y); % or xfig_plot.hplot (x, y[, dy]); Qualifiers % qualifiers to initialize the first plot only, see xfig_plot--initialize_plot % qualifiers to specifiy the world coordinate system, see xfig_plot--wcs % qualifiers for lines (defaults for error bars): ; width: line thickness ; color: line color ; line: line style ; fillcolor=fcol: fill histogram with color fcol (default: color) ; fill[=area_fill]: use style area_fill for shaded histogram (default: 20, if set) ; depth: Xfig depth % qualifiers for error bars: see xfig_plot--errorbars % qualifiers for histogram: ; y_first: y-value of first bin's vertical line ; y_last: y-value of last bin's vertical line Description x is an array of lower bin boundaries corresponding to the histogram values y. If length(x)==length(y)+1, then x[-1] is the upper boundary of the last bin, otherwise, the last bin will be as large as the previous one. If no x values are given, x = [1:length(y)] is assumed. See Also ``xfig_plot--initialize_plot'', ``xfig_plot--wcs'', ``xfig_plot--errorbars'' 2.44. xfig_plot.plot Usage xfig_plot.plot ([x,] y); % or xfig_plot.plot (x, y, [dx,] dy); Qualifiers % qualifiers to initialize the first plot only, see xfig_plot--initialize_plot % qualifiers to specifiy the world coordinate system, see xfig_plot--wcs % qualifiers for lines (defaults for error bars and symbols): ; color=strval: color of lines symbols and error bars ; width=intval: thickness of lines and error bars ; depth=intval: Xfig depth ; line=intval: line style for lines and error bars ; forward_arrow: see xfig_create_arrow (default: NULL) ; backward_arrow: see xfig_create_arrow (default: NULL) % qualifiers for error bars: see xfig_plot--errorbars % qualifiers for symbols: ; sym=strval: symbol, see xfig_plot_get_symbol_names ; symcolor=strval: color of symbols (default: color qualifier) ; size=val: symbol point size ; fill[=intval]: area fill style (default: 20, if set; otherwise -1) ; fillcolor=strval: color for filled symbols ; symlinestyle=intval: line style to draw symbols ; symwidth=intval: thickness of symbol lines (default: width qualifier) ; symdepth=intval: Xfig depth of symbols (default: depth qualifier) Description If no x values are given, x = [1:length(y)] is assumed. If a symbol is specified, no lines are drawn unless the line qualifier is also specified. See Also ``xfig_plot--initialize_plot'', ``xfig_plot--wcs'', ``xfig_plot--errorbars'' 2.45. xfig_plot.plot_pict Usage xfig_plot.plot_pict (String_Type imgfile); Qualifiers ; depth: Xfig depth % qualifiers to initialize the first plot only, see xfig_plot--initialize_plot See Also ``xfig_plot.plot_png'' 2.46. xfig_plot.plot_png Synopsis Add a png file to a plot, scaling it to the window Usage xfig_plot.plot_png (String_Type pngfile); % or xfig_plot.plot_png (Array_Type image); Qualifiers ; depth: Xfig depth % qualifiers to initialize the first plot only, see xfig_plot--initialize_plot ; cmap: name of the color map used by png_gray_to_rgb Description The image from pngfile is drawn in the plot region. If a two-dimensional array image is passed to .plot_png, it is converted to a png file in the temporary directory, using the png_gray_to_rgb function and possibly a color map. All other qualifiers are forwarded to png_gray_to_rgb. See Also ``xfig_plot_new_png'', ``xfig_plot.plot_pict'', ``xfig_set_tmp_dir'', ``png_gray_to_rgb'' 2.47. xfig_plot.shade_region Synopsis Add a filled rectangle or polygon to the plot Usage xfig_plot.shade_region (x[], y[]); % or xfig_plot.shade_region (xmin, xmax, ymin, ymax); Qualifiers % qualifiers to initialize the first plot only see xfig_plot--initialize_plot % qualifiers to specifiy the world coordinate system see xfig_plot--wcs ; line: line style ; width: line thickness ; color: line color ; fillcolor: fill color (default: color) ; fill: area fill style (default: 20) ; depth: Xfig depth of shaded region See Also ``xfig_plot--initialize_plot'', ``xfig_plot--wcs'' 2.48. xfig_plot.title Synopsis Add a title to a plot Usage xfig_plot.title (String_Type title); % or xfig_plot.title (XFig_Object title); Description The title is created from the string with the xfig_new_text function using all applied qualifiers. If title is no string, it is assumed to be an already properly formatted xfig object. The title is centered above the plot area. Any previously existing title object is removed. 2.49. xfig_plot.world Synopsis define a plot's world coordinate system Usage xfig_plot.world (Double_Type xdata[], ydata[]); % or xfig_plot.world (Double_Type x0, x1, y0, y1); Qualifiers ; xlog: use a logarithmic x-axis ; ylog: use a logarithmic y-axis ; loglog: use logarithmic axes ; padx: fraction of xrange to be padded on both sides (default: 0.05 or 0) ; pady: fraction of yrange to be padded on both sides (default: 0.05 or 0) See Also ``xfig_plot.world1'', ``xfig_plot.world2'' 2.50. xfig_plot.world1 Synopsis define a plot's first world coordinate system See Also ``xfig_plot.world'' 2.51. xfig_plot.world2 Synopsis define a plot's second world coordinate system Qualifiers ; xticlabels: flag whether (1) or not (0) to draw ticlabels on x2axis (default: 1) ; yticlabels: flag whether (1) or not (0) to draw ticlabels on y2axis (default: 1) See Also ``xfig_plot.world'' 2.52. xfig_plot.x1axis Usage xfig_plot.x1axis([; qualifiers]); Description This method allows for the configuration of the first x-axis via qualifiers -- see xfig_plot.axis for further information. See Also ``xfig_plot.axis'' 2.53. xfig_plot.x2axis Usage xfig_plot.x2axis([; qualifiers]); Description This method allows for the configuration of the second x-axis via qualifiers -- see xfig_plot.axis for further information. See Also ``xfig_plot.axis'' 2.54. xfig_plot.x2label Synopsis Add a label for the second x-axis to a plot Usage xfig_plot.x2label (String_Type x2label); Description The x2label is created from the string with the xfig_new_text function using all applied qualifiers. See Also ``xfig_new_text'' 2.55. xfig_plot.xaxis Usage xfig_plot.xaxis([; qualifiers]); Qualifiers ; ticlabels1: overwrites the ticlabels qualifier for the x1axis ; ticlabels2: overwrites the ticlabels qualifier for the x2axis Description This method allows for the configuration of both x-axes via qualifiers -- see xfig_plot.axis for further information. See Also ``xfig_plot.axis'' 2.56. xfig_plot.xfig_coords Usage (Double_Type xXfig, yXfig) = xfig_plot.xfig_coords (Double_Type x, y); % or Double_Type xXfig = xfig_plot.xfig_coords (Double_Type x, ); % or Double_Type yXfig = xfig_plot.xfig_coords (, Double_Type y); Qualifiers % qualifiers to specify the world coordinate system, See Also ``xfig_plot--wcs'' 2.57. xfig_plot.xlabel Synopsis Add an x-axis label to a plot Usage xfig_plot.xlabel (String_Type xlabel); Description The x-label is created from the string with the xfig_new_text function using all applied qualifiers. See Also ``xfig_new_text'' 2.58. xfig_plot.xylabel Usage xfig_plot.xylabel (Double_Type x, y, String_Type text[, dx, dy]); Qualifiers % qualifiers to specifiy the world coordinate system, see xfig_plot--wcs See Also ``xfig_plot_text'', ``xfig_plot--wcs'' 2.59. xfig_plot.y1axis Usage xfig_plot.y1axis([; qualifiers]); Description This method allows for the configuration of the first y-axis via qualifiers -- see xfig_plot.axis for further information. See Also ``xfig_plot.axis'' 2.60. xfig_plot.y2axis Usage xfig_plot.y2axis([; qualifiers]); Description This method allows for the configuration of the second y-axis via qualifiers -- see xfig_plot.axis for further information. See Also ``xfig_plot.axis'' 2.61. xfig_plot.y2label Synopsis Add a label for the second y-axis to a plot Usage xfig_plot.y2label (String_Type y2label); Description The y2label is created from the string with the xfig_new_text function using all applied qualifiers. See Also ``xfig_new_text'' 2.62. xfig_plot.yaxis Usage xfig_plot.yaxis([; qualifiers]); Qualifiers ; ticlabels1: overwrites the ticlabels qualifier for the y1axis ; ticlabels2: overwrites the ticlabels qualifier for the y2axis Description This method allows for the configuration of both y-axes via qualifiers -- see xfig_plot.axis for further information. See Also ``xfig_plot.axis'' 2.63. xfig_plot.ylabel Synopsis Add a y-axis label to a plot Usage xfig_plot.ylabel (String_Type ylabel); Description The ylabel is created from the string with the xfig_new_text function using all applied qualifiers. See Also ``xfig_new_text'' 2.64. xfig_plot_add_symbol Synopsis Add a plot symbol Usage xfig_plot_add_symbol (String_Type name, Ref_Type funct) Description This function may be used to add a new plot symbol of the specified name. The funct parameter specifies a function to be called to create the symbol. It will be called with a single parameter: a value representing the scale size of the symbol in fig units. The function must return two arrays representing the X and Y coordinates of the polygons that represent the symbol. The center of the object is taken to be (0,0). If more than one polygon is required to represent the object, an array of arrays may be returned. 2.65. xfig_plot_add_transform Usage xfig_plot_add_transform (String_Type name, Ref_Type &wcs_func, &wcs_invfunc, Any_Type client_data); Qualifiers ; xmin: (default: -inf) ; xmax: (default: +inf) ; ticfun: (default: &generic_compute_tics) Description wcs_func (wcs_invfunc) is a function of two arguments: the world (plot) coordinate and some client data. It has to return the correspondig plot (world) coordinate. The qualifier ticfun may reference a function that takes 4 arguments: xmin, xmax, maxtics, and client_data. It is supposed to return two arrays of major and minor tic marks. 2.66. xfig_plot_get_symbol_names Usage String_Type[] xfig_plot_get_symbol_names () See Also ``xfig_plot.plot'' 2.67. xfig_plot_new Synopsis Create a new plot object Usage w = xfig_plot_new ( [Int_Type width, Int_Type height] ); Description This function creates a new plot object of the specified width and height. If the width and height parameters are not given, defaults will be used. The width and height values specify the size of the plotting area and do not include the space for tic marks and labels. The following qualifiers configure all axes' tic labels at once: Qualifiers ; ticlabel_style: tic label font style, see xfig_make_font ; ticlabel_color: tic label font color, see xfig_make_font ; ticlabel_size: tic label font size, see xfig_make_font Example w = xfig_plot_new (); See Also ``xfig_plot_define_world'', ``xfig_render_object'' 2.68. xfig_plot_new_png Synopsis Create a new plot window for a png file Usage w = xfig_plot_new_png (file) Qualifiers ; depth: Xfig depth See Also ``xfig_plot_new'', ``xfig_plot.plot_png'', ``xfig_plot.plot_pict'' 2.69. xfig_plot_text Synopsis Add text to the plot Usage xfig_plot_text (w, text, x, y [,dx, dy]) w: plot object x, y: world coordinates dx, dy: justification Description This function creates a text object at the specified location on the plot. By default, the text will be centered on the specified world coordinates. The justification parameters dx and dy may be used to specify the justifcation of the text. See the documentation for xfig_plot_add_object for more information. Example xfig_plot_text (w, "$cos(\omega t)$"R, 3.2, 6.0, -0.5, 0); will left justify the text at the position (3.2,6.0). See Also ``xfig_plot_add_object'', ``xfig_new_text'' 2.70. xfig_render_object Synopsis Render an object to a device Usage xfig_render_object (obj, device) Description This function renders the specified object to a specified device. If the device parameter is a string, then a device will be opened with the specified name. See Also ``xfig_create_file'', ``xfig_close_file'' 2.71. xfig_set_eye Synopsis Define the point from which the projection of 3d space is seen Usage xfig_set_eye (Double_Type dist, theta, phi [, roll]); Description dist - distance of the eye from the focus theta - polar angle from the z-axis (in degrees) phi - azimuthal angle in the x-y- plane (in degrees) roll - roll angle (in degrees) See Also ``xfig_get_eye'', ``xfig_get_eye_roll'', ``xfig_set_eye_roll'', ``xfig_set_focus'' 2.72. xfig_set_eye_roll Synopsis Set the roll angle under which the projection of 3d space is seen Usage xfig_get_eye_roll (Double_Type roll); Description The roll angle is measured in degrees. See Also ``xfig_get_eye_roll'', ``xfig_set_eye'', ``xfig_set_focus'' 2.73. xfig_set_focus Synopsis Define the focus point of the projection of 3d space Usage xfig_set_focus (Vector_Type X); See Also ``xfig_get_focus'', ``xfig_set_eye'' 2.74. xfig_set_font_style Synopsis Set the default font style for LaTeX Usage xfig_set_font_style (String_Type style); Description Unless changed, the default font style is "\bf\boldmath"R. See Also ``xfig_make_font'', ``xfig_new_text'', ``xfig_add_latex_package'' 2.75. xfig_set_latex_preamble Usage xfig_set_latex_preamble (String_Type preamble) See Also ``xfig_get_latex_preamble'' 2.76. xfig_set_output_driver Synopsis Associate an output driver to a file extension Usage xfig_set_output_driver (String_Type ext, String_Type cmd) Description This may may be used to define the command that runs to created the specified output format (dictated by the extension) from the corresponding .fig file. The ext parameter specifies the filename extension and cmd is the shell command that will be used to generate the file. The cmd may contain the following format descriptors that will be replaced by the corresponding objects before being passed to the shell: %I Input .fig file %O Output file %B basename of the file %P This will resolve to -z %G This will resolve to -g The %P specifier will only be expanded if the "papersize" qualifier is given when rendering the output; otherwise it will be ignored. The %G specifier will be expanded when the "background" qualifier is given when rendering the output; otherwise it is ignored. Not all output devices support setting a background color. Example The default driver for postscript output is given by: xfig_set_output_driver ("ps", "fig2dev -L ps -c %P %I %O"); The ps2ps command may result in a smaller file size at a slight cost of resolution. It may be used as follows: xfig_set_output_driver ("ps", "fig2dev -L ps -c %I %B-tmp.ps" + ";ps2ps %B-tmp.ps %O; rm -f %B-tmp.ps"); See Also ``xfig_set_paper_size'' 2.77. xfig_set_verbose Synopsis Control the level of chattiness Usage xfig_set_verbose(Integer_Type level); Description This function may be used to control the verbosity level of the xfig functions that display informational messages. Notes It is not always possible to control the verbosity level of external programs. For the LaTeX/eps interface, if the level is 0, then only the running command will be displayed and any output will be redirected to /dev/null. Otherwise if level > 0, then the output will not be redirected. 2.78. xfig_timetics Usage xfig_timetics(tmin, tmax [;qualifiers]) Description This function may be used to construct nice tic-labels for the time interval specified by the tmin and tmax variables. By default, these values represent the number of seconds since the POSIX epoch 1970-01-01T00:00:00Z. The format of the tic-labels may be controlled by qualifiers. This function returns a structure with the following fields: tmin The value of the tmin parameter tmax The value of the tmax parameter major An array of major tic positions minor An array of minor tic positions ticlabels An array of ticlabels correponding to the major tic positions The field names of this structure were chosen to correspond to the qualifiers accepted by the plot axis methods. Qualifiers ; localtime: Construct tic labels using localtime ; timetotm=&func: Use func to convert a time value to a tm structure ; tmtotime=&func: Use func to convert a tm structure to a time value ; nodates[=0|1]: Turn on or off date (YYYY-MM-DD) labels ; dateformat=VAL: strftime format for date labels (default: "%Y-%m-%d" ; timeformat=VAL: strftime format for time labels (default:"%H:%M:%S" The default is to format the time as UTC using the gmtime and timegm functions. If the localtime qualifier is given, the localtime and mktime functions will be used. The timetotm and tmtotime qualifiers may be used to specify the functions to be used convert to and from tm structures. The default (no qualifiers) corresponds to using timetotm=&gmtime and tmtotime=timegm. Example tmax = _time(); % Current time tmin = tmax - 100*86400; % 100 days prior tinfo = xfig_timetics (tmin, tmax; localtime, maxtics=6); t = [tmin:tmax:#1024]; y = sin(2*PI/(5*86400)*(t-tmin)); % 5 day period w = xfig_plot_new(); w.plot (t, y; color="blue"); w.x1axis (;;tinfo); w.render ("/tmp/example.pdf"); Note that the structure returned by the xfig_timetics was passed as a structure of qualifiers to the x1axis method. slxfig-pre0.2.0-138/doc/tm/0002755000175000000620000000000011653730343014037 5ustar johnstaffslxfig-pre0.2.0-138/doc/tm/Makefile0000644000175000000620000000567211653730343015507 0ustar johnstaff# -*- sh -*- # # To create the SGML files, you will need to install a recent version of # the the tmexpand. See # for more information. # TMEXPAND = tmexpand TM2HLP = $(TMEXPAND) -Mslhlp SL2TM = tm-strip TMSORT = tm-sort MODULE = slxfig AUTOGEN_TM = $(MODULE)funs.tm MODULE_DEPS = $(AUTOGEN_TM) TXT_FILES = $(MODULE).txt SGML_FILES = $(MODULE).sgml HTML_FILES = $(MODULE).html TEX_FILES = $(MODULE).tex PS_FILES = $(MODULE).ps PDF_FILES = $(MODULE).pdf HLP_FILE = $(MODULE).hlp HLP_FILES = $(HLP_FILE) gcontour.hlp vector.hlp SGML2LATEX = sgml2latex -p letter -o tex SGML2HTML = sgml2html SGML2TXT = sgml2txt -f LATEX = latex PDFLATEX = pdflatex TEXTDIR = ../text PSDIR = ../ps HTMLDIR = ../html SGMLDIR = ../sgml PDFDIR = ../pdf HELPDIR = ../help SUBDIRS = $(TEXTDIR) $(HTMLDIR) $(PSDIR) $(SGMLDIR) $(PDFDIR) $(HELPDIR) SRCDIR = `pwd` text-files: $(TXT_FILES) $(HLP_FILES) all: $(SGML_FILES) $(HTML_FILES) $(TEX_FILES) $(TXT_FILES) $(AUTOGEN_TM): ../../src/xfig/*.sl $(SL2TM) $+ > $@ $(TMSORT) $@ -rm -f $@.BAK #----- SGML Files ----------------------------------------------------------- $(MODULE).sgml : $(MODULE).tm $(MODULE_DEPS) $(TMEXPAND) $(MODULE).tm $(MODULE).sgml #----- HTML Files ----------------------------------------------------------- $(MODULE).html : $(MODULE).sgml $(SGML2HTML) $(MODULE).sgml #----- TeX Files ------------------------------------------------------------ $(MODULE).tex : $(MODULE).sgml $(SGML2LATEX) $(MODULE).sgml jed -script ./fixtex.sl $(MODULE).tex #----- PDF Files ----------------------------------------------------------- $(MODULE).pdf : $(MODULE).tex $(MAKE) texclean $(PDFLATEX) $(MODULE).tex $(PDFLATEX) $(MODULE).tex $(PDFLATEX) $(MODULE).tex #----- PS Files ----------------------------------------------------------- $(MODULE).ps : $(MODULE).tex texclean $(LATEX) $(MODULE).tex $(LATEX) $(MODULE).tex $(LATEX) $(MODULE).tex dvips -o $(MODULE).ps $(MODULE).dvi #----- Text Files ----------------------------------------------------------- $(MODULE).txt: $(MODULE).sgml $(SGML2TXT) $(MODULE).sgml #---------------------------------------------------------------------------- help-files: $(HLP_FILES) $(HLP_FILE): $(AUTOGEN_TM) $(TM2HLP) $< $(HLP_FILE) gcontour.hlp: ../../src/gcontour.sl $(SL2TM) $+ | $(TM2HLP) - $@ vector.hlp: ../../src/vector.sl $(SL2TM) $+ | $(TM2HLP) - $@ texclean: -rm -f *.dvi *.log *.aux *.toc *.out clean: texclean -rm -f *~ rtl/*.BAK rtl/*~ *.tmp *-error distclean: clean -rm -f *.html *.ps $(HLP_FILES) $(TXT_FILES) $(TEX_FILES) $(SGML_FILES) $(PDF_FILES) $(AUTOGEN_TM) install-txt: $(TXT_FILES) -mv $(TXT_FILES) ../text install-help: $(HLP_FILES) -mkdir -p $(HELPDIR) -mv $(HLP_FILES) $(HELPDIR) install-all: all install-help install-txt $(PS_FILES) $(PDF_FILES) -mkdir -p $(HTMLDIR) $(PSDIR) $(SGMLDIR) $(PDFDIR) -mv *.html $(HTMLDIR) -mv $(PS_FILES) ../ps -mv $(SGML_FILES) ../sgml -mv $(PDF_FILES) ../pdf install: install-txt install-help slxfig-pre0.2.0-138/doc/tm/slxfig.tm0000644000175000000620000000723411653730343015701 0ustar johnstaff#% -*- mode: tm; mode: fold -*- #%{{{Macros #i linuxdoc.tm #d it#1 $1 #d slang \bf{S-lang} #d exmp#1 \tt{$1} #d var#1 \tt{$1} #d ivar#1 \tt{$1} #d ifun#1 \tt{$1} #d cvar#1 \tt{$1} #d cfun#1 \tt{$1} #d svar#1 \tt{$1} #d sfun#1 \tt{$1} #d icon#1 \tt{$1} #d chapter#1 $1

#d preface #d tag#1 $1 #d function#1 \sect{$1\label{$1}} #d variable#1 \sect{$1\label{$1}} #d function_sect#1 \sect{$1} #d begin_constant_sect#1 \sect{$1} #d constant#1 $1 #d end_constant_sect #d synopsis#1 Synopsis $1 #d keywords#1 Keywords $1 #d usage#1 Usage $1 #d altusage#1 \__newline__{}% or \__newline__{}$1 #d description Description #d example Example #d notes Notes #d qualifiers Qualifiers #d qualifier#2:3 ; \tt{$1}: $2 \ifarg{$3}{(default: \tt{$3})} #d seealso#1 See Also \linuxdoc_list_to_ref{$1} #d done

#d -1 -1 #d 0 0 #d 1 1 #d 2 2 #d 3 3 #d 4 4 #d 5 5 #d 6 6 #d 7 7 #d 8 8 #d 9 9 #d NULL NULL #d file#1 $1 #d documentstyle book #%}}} #d module#1 \tt{$1} \linuxdoc \begin{\documentstyle} \title SLxfig Reference \author John E. Davis, with numerous contributions from Manfred Hanke \date \__today__ \toc \chapter{Introduction} \href{http://jedsoft.org/fun/slxfig/}{SLxfig} is a \href{http://www.jedsoft.org/slang/}{S-Lang} package that produces plots, drawings, etc in a variety of formats (.ps, .eps, .png, .jpeg,...). It accomplishes this via S-Lang functions that automatically run \href{http://www.xfig.org/}{Xfig's fig2dev} and LaTeX to produce the desired output format. See the \href{http://jedsoft.org/fun/slxfig/examples.html}{examples page} for some sample publication-quality plots and the code that produced them. \sect{History} In October of 2003 I was asked to give a talk at a workshop on modeling pileup in the Chandra CCDs and was told that it should be an electronic presentation using, for example, powerpoint. I installed the OpenOffice version of powerpoint and started working on the presentation. After about 30 minutes of frustration, I turned to xfig, which is a very flexible and simple to use drawing program familiar to many scientists and engineers. Using xfig, I proceeded to draw several grids representing the CCD pixels. At some point, I wanted to go back and change the orientation of some of the grids such as changing vertical lines to diagonal ones. Unfortunately, this would require recreating the grids, which would take time. But what if I was not happy with the new orientation and wanted to try another one? Clearly, a manual approach was not going to work. So I started to look for an automated approach to xfig. I searched the web and found the specification of the xfig file format and proceeded to write a S-Lang script to automatically generate the appropriate .fig file from a mathematical description of the object as coded in S-Lang. SLxfig was born. The following set of SLxfig-generated figures, which shows two perspectives of a pair photons interacting in the CCD, illustrates the solution to the orientation problem described above. \href{http://jedsoft.org/fun/slxfig/2photon_a.png}{Figure 1}, \href{http://jedsoft.org/fun/slxfig/2photon_b.png}{Figure 2} See \href{http://jedsoft.org/fun/slxfig/pileup2008.pdf}{the updated version of the pileup-presentation} for more examples of SLxfig generated drawings and plots. \chapter{Function Reference} #i slxfigfuns.tm \end{\documentstyle} slxfig-pre0.2.0-138/doc/tm/fixtex.sl0000644000175000000620000000450511325613443015705 0ustar johnstaff#!/usr/bin/env jed-script private variable Version = "0.3.2-0"; if (__argc != 2) { message ("Version $Version Usage: ./fixtex.sl "$); quit_jed (); } variable file = __argv[1]; () = read_file (file); % Patch up the >,< signs bob (); replace ("$<$", "<"); replace ("$>$", ">"); % It appears that sgml2tex screws up _for in section titles, producing \_{for}. replace ("ion\\_{", "ion{\\_"); % Make the first chapter a preface bob (); if (bol_fsearch ("\\chapter{Preface}")) { push_spot (); push_mark (); go_right (8); insert ("*"); % \chapter{ --> \chapter*{ () = bol_fsearch ("\\chapter{"); push_spot (); insert("\\tableofcontents\n"); eol (); insert ("\n\\pagenumbering{arabic}"); pop_spot (); narrow (); bob (); replace ("\\section{", "\\section*{"); widen (); if (bol_bsearch ("\\tableofcontents")) delete_line (); pop_spot (); if (bol_bsearch ("\\maketitle")) insert ("\\pagenumbering{roman}\n"); } static define fixup_urldefs () { % pdflatex cannot grok urldef bob (); while (bol_fsearch("\\urldef{") and ffind ("\\url{")) { variable line = line_as_string (); bol (); insert ("\\ifpdf\n"); deln (7); insert ("\\newcommand"); push_mark (); ()=ffind ("}"); variable macro = bufsubstr (); () = ffind ("\\url"); go_left (1); trim (); insert("{"); % pdflatex cannot grok # in urls. Nuke em. if (ffind ("#")) { del_eol (); insert ("}"); } eol (); insert ("}\n\\else\n"); insert (line); newline (); insert ("\\fi\n"); } } static define remove_repeated_urls () { variable name, url; variable names = Assoc_Type[Int_Type, 0]; while (bol_fsearch ("{\\em ")) { go_right (4); skip_white (); push_mark (); () = ffind ("}"); !if (looking_at ("} {\\tt ")) { pop_mark(0); continue; } name = bufsubstr (); if (names[name]) { go_right(1); push_mark (); () = ffind ("}"); go_right(1); del_region (); } else { names[name] = 1; go_right(1); () = ffind ("}"); go_right (1); } % Now remove empty lines inserted by the broken sgml2latex program. skip_white (); !if (eolp ()) continue; go_right(1); skip_white (); if (eolp ()) del (); } } fixup_urldefs (); remove_repeated_urls (); save_buffer (); quit_jed ();