gdl-0.9.4/0000775000175000017500000000000012221570132010715 5ustar marcmarcgdl-0.9.4/NEWS0000664000175000017500000010403712173613745011437 0ustar marcmarc0.6: initial release 0.6.1: made GDL compile with g++ 3.3 (datatypes.hpp) 0.6.2: fixed bug with # and ## operator (basic_op.cpp) added -I.. cpp option (Makefile.am) 0.7: added graphic support (PLOT, WINDOW, WDELETE, SET_PLOT, WSET) some small bug fixes. 0.7.1: added 64 bit integer support (LONG64, ULONG64) added python support (PYTHON function and procedure) completed type functions for all types (ULONG, UINT, ...) completed INDGEN and INTARR functions for all types New library routines: SYSTIME, LEGENDRE, MACHAR, FFT, TVLCT, MAX, MIN, TOTAL, ARRAY_EQUAL, CATCH, ON_ERROR Library routines written in GDL (check out *.pro files not starting with test_) several bugfixes: conversion between BYTE and STRING. GOTO within IF statement. Memory leakage concatenating struct arrays. 0.7.2: Bugfix: dereferenced pointers are now passed by reference 0.8: added netCDF support. several new library routines. support for .COMPILE command. Improved formatted and unformatted output. Improved configure script. Extended and cleaned up the API for library routines (envt.hpp) Fixed: GOTO,undefined_label made GDL crash. Several other bugfixes. 0.8.1: Updated the configuration files (automake). 0.8.2: added HDF support. added support for several image file formats. changed the code and configuration files to make GDL build also on Mac OS X. bug fix for TRANSPOSE function. 0.8.3: now netCDF and HDF can be used together (there were linker errors in 0.8.2). updated some obsolete commands in configure.in more complete HDF support. added DEFSYSV procedure. addef CONJ and IMAGINARY functions. 0.8.4: introduced _STRICT_EXTRA solved remaining problem of using netCDF and HDF together. HELP now reports variable names correctly. the line continuation operator ($) is now also recognized in interactive mode. Added SORT, UNIQ, SHIFT (1 dim only), STRTOK, FILE_TEST, CD, HISTOGRAM and REFORM function. Added LOADCT, CD and TV procedure. Basic HDF5 support. 0.8.5: Fixed bug in STRING with PRINT or FORMAT keywords set. Fixed bug in STRMID with 3rd parameter undefined or not given. Added MESSAGE procedure. Added FILE_SEARCH, ARG_PRESENT and EOF functions. Fixed bug in AssignAt functions. Fixed subtle bug concerning arrays() and function() which made GDL not recognize library functions when identifier was used before as array. 0.8.6: Added CONVOL function (very fast). Added EXP function. Added JOURNAL procedure. Completed SHIFT for multiple dimensions. HISTOGRAM now supports REVERSE_INDICES keyword. HELP,/LIB sorts now the output. Made # and ## operators IDL conforming for 1 dimensional arrays. N_ELEMENTS now returns LONG (before ULONG) 0.8.7: Support for GDL_PATH (falls back to IDL_PATH) environment variable. Added EXPAND_PATH, ARRAY_INDICES, REBIN, LEGENDRE, IGAMMA, LNGAMMA, BETA functions. Added OPLOT procedure. Bugfixes for ATAN (with 2 floats), CONVOL (1-dim kernel), MESSAGE (prefix). 0.8.8: Added OBJ_CLASS, OBJ_ISA, N_TAGS, SWAP_ENDIAN, BYTSCL functions. Added PLOTS, XYOUTS (both 2D only), BYTEORDER procedures. Improved FFT. OMIN,OMAX keyword support for HISTOGRAM. Fixed braced reference argument bug. Changed equality checking to compatibility checking for struct array definitions. Added structure compatibility check for assignment to struct arrays. Fixed offset bug for conversion functions (BYTE, FIX, ...). Fixed libfunction returning parameter bug. Fixed AND, OR operator bug. Fixed TVLCT bug. @file now honors !PATH. Changed configure.in to support python on OS X (fink) Added SETENV, STRUCT_ASSIGN pro. Added GETENV, STREGEX, TAG_NAMES functions. Minor adjustments of default output (no FORMAT keyword). Widen struct tag name rules: "!", "!$" and "!TEXT" are allowed. System variables can be named "!$", or "!$TEXT". 0.8.9: Added SPAWN, WAIT procedure. Added FINITE, ROUTINE_INFO, TEMPORARY functions. Added DIST function and TVSCL procedure (as .pro files). !EXCEPT system variable. Changed common block compilation. Allow RETURN as jump label (remove it from reserved words) Allow library functions to return their own parameters if used in a return statement. Allow library functions as l-functions. Fixed assignment to indexed array at one position (insert at) for indices which are 0. Cleaned up Compiler/Interpreter. Added NAN keywords to BYTSCL, MIN, MAX. Added SUBSCRIPT_MIN/MAX keywords to MAX/MIN. Added NTOHL, NTOHS, HTONL, HTONS keywords to BYTEORDER. Added z-buffer device Fixed MOD division by zero for integers. Support for files with main programs. Fixed COMMON and GOTO for interactive use. Added .RUN command True color support for TV (X-device). 0.8.10: Optimization (~10%): Arrayindexing, non-copy constants, Complex (pow, abs). Optimization (>200%): Dedicated ProgNodes for compiled programs Fixed RETURN statement in FOR loops. Made GDL buildable as a python module. .RUN handle files without subroutines. GCC 4.0 compilance. INTERPOLATE function. Fixed eof detection on input. Implemented strided index support. Improved raise to power (^ operator) for integer types. 0.8.11: Added CONTOUR procedure. Added CREATE_STRUCT, RADON, LAGUERRE, STRCMP, GAUSS_PDF, GAUSS_CVF functions. Added STRUCTURES keyword to HELP. Added NAN keyword to TOTAL. Sub-millisecond resolution for SYSTIME function Added !DIR system variable Much faster array indexing. Much faster operators (+-/*^...) Faster FFT (requires FFTW library: http://www.fftw.org/download.html) 0.9: Added HEAP_GC, PRODUCT, FILEPATH, MEDIAN (no filtering), READ_ASCII, PUSHD, POPD, PRINTD, PRIMES, NORM, T_PDF, POLY_2D routines. Support for SAVE and RESTORE through Craig Markwardt's CMSVLIB library. Added SMOOTH and DERIV as external functions. Full support of ON_IOERROR Full support of F77_UNFORMATTED. Support for XDR I/O. Fixed positional index (value and dimension) returned by STREGEX. HELP without parameters and keywords puts out a list of all local variables as well as compiled procedures and functions. Add support for PROCEDURES & FUNCTIONS keywords in HELP Made GDL compile under x86_64 linux. Fixed incompatibility with # operator and one-dim vectors. Speedup for ^ operator for integer types. Speedup (>100x!) for REVERSE_INDICES of HISTOGRAM. Implement INPUT keyword in HISTOGRAM. Support for non-rectangular (x,y 2d arrays) calls to SURFACE and CONTOUR. Support for DICOM files (GDLffDICOM object). INTEGER keyword for TOTAL. Add support for variable-length VMS files. Add support for CHANNEL keyword in TV/TVSCL. Add support for TRUE/CHANNEL keywords in TVRD (X only) Add support for DIMENSION keyword in FFT. Add REGEX keyword support to STRTOK. Add preliminary support for MPI. Add initial support for SOCKET. Preliminary support for map projections. (requires libproj4 from (http://members.verizon.net/~vze2hc4d/proj4/lbp4_050319S.tar.gz) Add initial support for BESELI, BESELJ, BESELK and BESELY but only for integer order due to limitations of GSL Bessel functions Added Erf() [and Errorf() for compatibility], Erfc(), Expint(), Gaussint(). Fixed I/O of Gamma(), Igamma(), LnGamma() and Beta() +-Inf now managed in MIN and MAX (if called with /Nan) NaN and +-Inf now properly managed in PLOT, OPLOT, PLOTS Speedup in PLOT, OPLOT, PLOTS for large data sets (see test_plot_benchmark.pro) Add 6 linestyles (via !p.linestyle or keyword) for PLOT, OPLOT, PLOTS Improved memory management. Improved new implementation of struct arrays. Managment of an history (ASCII) file save in ~/.gdl/history (with memory of previous sessions) Add initial CURSOR, limited but functionnal (know limitations documented in program) and !mouse 0.9rc1: fixing memory leak in FFT when using FFTw lib. fixing FACTORIAL (GDL syntax) add SKIP_LUN (used by Astron Lib.; GDL syntax) add VOIGT() function (in C++) based on Wells' paper. add REAL_PART() function (GDL syntax) add RK4() function (in C++) in CONTOUR: throw when levels= are not ordered, manage NaN and Inf values, add Nlevels= and /Fill Two new projections in MAP_SET: Satellite and Robinson Preliminary version for Width parameter in MEDIAN() initial import for SPL_INIT() and SPL_INTERP() (GDL syntax) 0.9rc2: undocumented BYTSCL accepting three parameters (value,min,max) g++ 4.3 compatibility ignore something like a=(a=a) (so it is allowed even if a is undefined) accept self assignment of undefined variables fixed print, ', ', FORMAT='(A)' Add SUBEXPR keyword support for STREGEX Add S_FUNCTIONS/S_PROCEDURES keywords for ROUTINE_NAMES in MEDIAN(), managing "width" parameter precalculation for (selected) constant parmeter functions. precalculation for constant arrays composed of constant expressions precalculation for constant expressions and constant arrays, a major improvement speedup for constant arrays add FILL and NLEVELS for CONTOUR Initial import of RK4 initial import of codes for function VOIGT initial import of function REAL_PART in GDL syntax allow floats without exponent number like 1e FACTORIAL correcting bug when inputs are Integers; managing arrays Made for READ_ASCII DATA_START independent of HEADER 0.9rc3: interpreter: - corrected GOTO out of loops within outer blocks - corrected array to tag of struct array assignment - $: fixing two segfault conditions when SHELL or HOME env. variables not set - allowing tag names with leading '!' - imroved DataListT an empty procedure call by extimated 40% - detecting change of type of FOR index variable - allowing common blocks outside subroutines library routines: - ATAN: precision fixes (atan(float, float) -> float(atan(double, double))), /PHASE keyword support, array-scalar argument combination support, two-complex-arguments case support - BESEL*: non integer order, X neg, Complex, and better managment of arrays dimensions - BETA: better management of the dimensions of output arrays - BROYDEN: initial import - CALENDAR: initial import - CALDAT: initial import - CD: avoiding segfault on OSX (wordexp() bug) - COMMAND_LINE_ARGS: initial import - CONTOUR: avoiding plplot error messages when filling, fixing segfault when contouring NaNs, smarter contour-level choice, partial labelling support - CREATE_STRUCT: accepting excl. mark as a first char of a tag name - EXIT: fixing segfault if HOME env. var undefined - EXPINT: better management of the dimensions of output arrays - FILE_INFO: initial import - FILE_LINES: no longer calling awk to parse wc output - FILE_SAME: initial import - FILE_SEARCH: support for FULLY_QUALIFY_PATH kw. - FILE_TEST: handling /NOEXPAND_PATH keyword - FFT: Fix /OVERWRITE with non-global parm bug (FFTW), fix auto_ptr bug with DOUBLE - FLUSH: initial import - GET_DRIVE_LIST: initial import - GET_KBRD: reading only one character (setting stdin to non-echo and non-canonical mode) - GET_LOGIN_INFO: initial import - HISTOGRAM: fixing inclusive ranges definition setting OMIN/OMAX type according to the type of input data binsize = (max - min) / (nbins - 1) when NBINS specified with neither MAX nor BINSIZE LOCATION keyword set correctly when HISTOGRAM called with NBINS and without BINSIZE or MAX - HELP: reporting structure data lengths, /MEMORY keyword support - IDL_BASE64: initial import - IGAMMA: better management of the dimensions of output arrays - IMSL_CONSTANT: initial import (using UDUNITS-2) - IMSL_ZEROSYS: initial import - LL_ARC_DISTANCE: initial import - LOCALE_GET: initial import - MAKE_ARRAY: /PTR & /OBJ keywords, /INDEX keyword support for strings - MAKE_ARRAY: keyword name changed from INT to INTEGER - MAX: DIMENSION keyword support - MIN: ditto - MEDIAN: memory leak fix + change DIM into DIMENSION - MEMORY: initial import - MOMENT: MAXMOMENT kw support + update of the documentation header - N_TAGS: rename keyword /LENGTH to /DATA_LENGTH - NCDF_ATTGET: code cleanup + fixes - NCDF_ATTPUT: fixing invalid keyword numbering - NCDF_DIMINQ: accepting long integers as file and dimension ids - NCDF_VARGET: 64-bit fix (SizeT->Dlong for transposed_dim_length[]) reading text data - NCDF_VARGET1: reading text data - NCDF_VARPUT: fixing random behaviour due to type mismatch (size_t -> int), fixing uninitialized variable bug - NEWTON: initial import - OPENW: allowing /APPEND flag for non-existant files - PARSE_URL: initial import - PATH_SEP: now return good type STRING = '/', before STRING = Array[1] - PLOTS: correction for DATA coordinates - PM: initial import - PRINT: handling VMS compatibility syntax; demo: print, "$(F)", 1 - PRINTF: ditto - READ_ASCII: handling both whitespace and tab as delimiter by default; using FILE_LINES instead of spawning wc - READ_XWD: fixing a conditional statement typo - READF: bugfix - allowing reads from standard input (lun 0) - REVERSE: initial import - ROTATE: better error message - SIZE: fixing datatype (sign) conflict in IDL_SIZE structure assignment - SHOWFONT: initial import - SPAWN: fixed segfault when SHELL env. variable not set, undoing bitwise shift in EXIT_STATUS value; demo: spawn, "exit -1", e=i & help, i setting EXIT_STATUS parameter when nParam==0; demo: spawn, exit=i & help, i - SPL_INIT: initial import of C++ version (y0= and yn_1= not ready) - SPL_INTERP: ditto - STRING: handling VMS compatibility syntax; demo: help,string(1,"(G)") - STRSPLIT: will allow 'str' and ['str'] 1D strings - SYSTIME: correction for /JULIAN flag; conflicting keywords message - TV: managing [1,n,m], [n,1,m] and [n,m,1] cases when TRUE=0 - VOIGT: better management of the dimensions of output arrays - XYOUTS: axis thickness fix, DATA coordinates fix configure script: - HDF4/HDF5: linking with SZIP if needed - detecting presence of Python numarray package - printing summary information - support for linux ppc64 - using nc-config (if present) to determine netcdf LIBS/INCLUDES - using Magick++Config (if present) to determine Magick LIBS/INCLUDES - better ncurses/curses check, preventing linking both libraries other: - embedded formatting commands for plotting routines (TEXTOIDL works) - !DTOR & !RADEG values more precise - SVG terminal available via set_plot, 'svg' - misc. minor updates in readme/doc files - several new test routines - input/output: 64-bit OSX fix (xdr_long()/xdr_u_long() argument types) - allowing setting history-file lenght in startup file using !EDIT_INPUT - OpenSolaris compatibility fixes - handling some out-of-memory exceptions - gcc 4.4 compatibility fix - HDF5: v1.8 compatibility fix - widgets: some new functionality - mapping: support for new LIBPROJ4 0.9rc4: in short: --------- - thread pool support using OpenMP (G++ >= 4.2), - enhanced error-reporting (line numbering, message decoration, etc.) - new library routines, including: CPU, CROSSP, GET_SCREEN_SIZE, IMSL_BINOMIALCOEF, IMSL_CONSTANT, IMSL_ZEROPOLY, QUERY_*, WSHOW, WTN (wavelet transform), ... - enhanced HDF5 (15 new routines) and netCDF support - support for GRIB 1/2 file format (read-only, using ECMW GRIB_API) - several new command-line options, support for specifying batch files at command-line - bug-fixes in library routines and the interpreter - new plotting functionalities (contouring on maps, color PostScript output, ...) - enhanced detection of libraries in the configure script - enhanced "make install" and "make check" rules - compatibility fixes for various GCC versions and UNIX flavours in detail: -------------- interpreter: - fixed/enhanced numerous error-reporting related features including: line number tracking, error message "decoration" (prefixes etc.), inclusion of string-representation of error-related values in error messages - fixed STRUCT access of non struct struct member (e. g. a={b:0}&print,a.b.c ) - corrected beahvior of call_fun and call_lfun for RC_ABORT return code, old behavior lead to endless loop at startup in some conditions - fixed wrong handling of CONTINUE under certain conditions in nested loops - support for COMPILE_OPT OBSOLETE & !WARN.OBS_ROUTINES - support for numeric constants in explicit binary format, e.g. a='1010101'b - honouring COMPILE_OPT within $ and EXECUTE library routines: - BROYDEN: fixed behaviour with constant-returning functions - BYTEORDER: support for structures - CHECK_MATH: 2 undocument params and also keep memory of value - CONTOUR: memory-leak fix (thanks to Valgrind), support for the /OVERPLOT keyword, partial support for contouring on maps, more sanity checks for argument types, better filled-contour level-choice mechanism, fixing axis colour - CPU: initial import - CREATE_STRUCT: fixed behaviour with no parameters - CROSSP: initial import - CURSOR: verification if we are in X mode, support for lat/lon query on maps - DEVICE: support for /COLOR, XSIZE and YSIZE for PostScript driver, support for the GET_VISUAL_DEPTH keyword - DIST: runs correctly when called like dist([2,2]) - FFT: sanity check for the rank of argument, preventing bogus memory freeing with dcomplex input - FILE_BASENAME: support for array argument, better handling of empty and space-only strings - FILE_LINES: spawning subprocesses with /NOSHELL keyword to prevent execution of shell startup file - FILE_TEST: stripping the trailing '/' if present - [F,D,L,...]INDGEN: making the values of the resulting array more precise for large arrays (demo: print, (findgen(40000000))[40000000-1]) - GET_SCREEN_SIZE: initial import - GETENV: error message when called with /ENV and a positional parameter - GRIBAPI_*: initial import of GRIB-1/2 file format support using the ECMWF GRIB API - H5F_IS_HDF5, H5_GET_LIBVERSION, H5D_GET_TYPE, H5T_GET_SIZE, H5A_OPEN_NAME, H5A_OPEN_IDX, H5A_GET_NAME, H5A_GET_SPACE, H5A_GET_TYPE, H5A_GET_NUM_ATTRS, H5G_OPEN, H5A_CLOSE, H5T_CLOSE, H5G_CLOSE, H5A_READ: initial import - HELP: corrected output for expressions - HISTOGRAM: correcting binsize definition when max and nbins set, better INPUT-kw-related error message - IMSL_BINOMIALCOEF: initial import - IMSL_ZEROPOLY: initial import (using gsl_poly_complex_solve()) - IMSL_ZEROSYS: fixed behaviour with constant-returning functions - INVERT: fixing a segfault condition with non-global parameter - LA_TRIRED: checking if the first argument is an array - LOADCT: set !D.TABLE_SIZE from 0 to 256 - LOCALE_GET: returning locale of the parent process - N_TAGS: support for LENGTH keyword (currently equal to DATA_LENGTH) - NCDF_ATTGET: outputing byte arrays instead of strings - NCDF_ATTNAME: allowing to specify the global atribute number - NCDF_ATTPUT: support for LENGTH keyword - NCDF_VARGET: fixing a segfault condition - NCDF_VARINQ: fixing failed-assertion condition (dimension(0)) with scalar variables - NCDF_*: fixes in error handling, compatibility with netcd-4 (file handles are now Long instead of Int) - NEWTON: fixed behaviour with constant-returning functions - OPLOT: sanity checks for the rank of arguments - PLOT: adjusting axes when charsize changed, better automatic range selection, sanity checks for the rank of arguments - POINT_LUN: assuring the 2nd par is a global par - POLY_AREA: initial import - PRINT/PRINTF: changed output of trailing newline after empty string output, corrected alignment for all types - RSTRPOS: initial import - READ_TIFF: ignoring errors related to GeoTIFF fields in TIFF files - QUERY_BMP, QUERY_DICOM, QUERY_GIF, QUERY_IMAGE, QUERY_JPEG, QUERY_PICT, QUERY_PNG: QUERY_PPM, QUERY_TIFF: initial import (using Magick++'s ping functionality) - READ_ASCII: printing error message when DATA_START exceeds file length - REVERSE: support for /OVERWRITE keyword - ROUTINE_INFO: support for PARAMETERS keyword - ROUTINE_NAMES: fixed ARG_NAME keyword for values larger than current level, corrected name lookup, proper behaviour with the /STORE kw., fixed support for /FETCH kw. - STREGEX: preventing bogus call to basic_string::substr(-1,...) - STRMID: fixed behaviour for negative values of 3rd parameter - STRPOS: does no longer ignore undefined 3rd parameter - STRSPLIT: fixed probem related with STRTOK bug - STRTOK: fixed output dimensions - SURFACE: memory-leak fix (thanks to Valgrind), more sanity checks for argument types - TVRD: fixed segfault with no window open - WAIT: allowing interruption with control-c - WSHOW: initial import (ICONIC kwrd not implemented yet) - WTN: initial import (using GSL DWT routines) configuration/installation: - installing library .pro files, manpage and basic docs during make install - setting default library-routine search path if GDL_PATH/IDL_PATH not defined - checking if HDF4 was compiled with --disable-netcdf - checking if netCDF installation is usable (HDF4 installation conflict) - configure: checking if netcdfcpp.hpp is usable (conflicting hdf4/netcdf installation issue) - fixes in wxWidgets detection code - support for the Debian naming of the HDF4 libraries from the hdf4-alt packages (compiled with --disable-netcdf) - checking for GSL >=1.7 which is requiered to use both FFT and DWT at the same time other: - adding a manpage - Cygwin compatibility fixes (as of version 1.7.1, Cygwin still needs a patch for rpc and fenv) - adding on_error,2 for all routines implemented in GDL - error reporting for HDF5 support - Strassen algorithm for matrix multiplication (needs manual enabling) - !DEVICE.N_COLORS in now dependant on the actual X-window setting - handling "cannot connect to X-server" via a GDL error message - initial thread pool support using OpenMP - checking if PLplot supports the requested driver (ps, xwin, mem) and informing the user via a GDL error message if not - SVG plots: swithing between svg and svgcairo drivers by checking which drivers are supported by PLplot - support for -quiet and -e command-line options and for specifying batch files at command-line; ignoring numerous license-related options for compatibility - warning the user if MPI changes the working directory of GDL - welcome message changes (informing about the library-routine search path) - more meaningful contnents of the !VERSION structure - GCC 3.4.3, 3.4.4, 4.3.4, and 4.4 compatibility fixes - support for reading ASCII files not ending with newline character - ![X,Y].RANGE support in plotting routines - Allow neg. width for A format code, fixed T,TL,TR format codes - sanity checks in array-returning library routines preventing segfaults when called with invalid arguments - new test-routines: test_dims_of_arrays.pro, test_valgrind.pro, test_check_math.pro, test_get_screen_size.pro, test_nestedloop.pro, test_plotting_misc.pro, test_plotting_ranges.pro, test_grib.pro, test_poly2d.pro, test_wavelet.pro - inclusion of some of the test-routines in the "make check" rule - quick_start_GDL.sh script - making the initial "DECOMPOSED" setting of the X device dependant on the colour depth reported by the X-server 0.9: - FOREACH statement, syntax: FOREACH loopVar,array[,indexVar] DO - member function and procedure calls with '.' e. g.: object.aProcedure - support of negative index ranges. -1 is the last element, -2 the one before the last and so on. E.g.: array[-7:-5] - new widget features incl. WIDGET_DROPLIST - automatic garbage collection - numerous bugfixes (incl. SAVE/RESTORE, WRITEU, ...) - memory leak in FFT when using FFTw lib should be solved - all input types OK in FFT when using GSL FFT - new routines: HIST_2D, INTERPOL, MAP_CONTINENTS, POLYFILL, RESOLVE_ROUTINE, SPHER_HARM, IMSL_ERF - new keywords/calling sequences handled: - DEVICE, /INCHES, GET_SCREEN_SIZE - PRODUCT, /PRESERVE_TYPE, /INTEGER - REBIN: support for specifying new dimensions as an array - TOTAL, /PRESERVE_TYPE - FILE_SEARCH, /FOLD_CASE - STRSPLIT, /preserve_null - new test routines (invoked during "make check") - DIALOG_PICKFILE, based on Zenity, OK on most Linux and OSX - FILE_DELETE, FILE_COPY and FILE_EXPAND_PATH - SPL_INIT: now y0= and yn_1= ready - Compressed files should be well processed now (readf, printf, fstat, point_lun, ...). See test_zip.pro 0.9.1: - fixes/improveents in: CONTOUR, DIALOG_PICKFILE, EXECUTE, EXIT, FIX (TYPE=7 and /PRINT), FFT, FSTAT, HEAP_GC, MOMENT, NCDF_ATTNAME, NCDF_DIMDEF, NCDF_VARID, NCDF_VARPUT, INTERPOL, PLOTS, POINT_LUN (64-bit addressing), POLYFILL (support for LINE_FILL, SPACING, LINESTYLE, ORIENTATION and THICK), PRINT, PRINTF, SAVE/RESTORE, SPL_INIT (mem leak), STRSPLIT, SURFACE (added AX,AZ), WAIT, XYOUTS (support for the WIDTH kw), DEVICE (WINDOW_STATE kw) - other improvements: fixed reading of (big) compressed files, decomposed colours with PostScript, gdlffdicom update (v20100309), new test routines, improved cmake configuration (still experimental), fixed behaviour with non-comma locale-defined decimal separators - early draft of GDL User's & Developer's guide: source files in doc/udg, current pdf version at: http://gnudatalanguage.sf.net/gdl.pdf - Python bridge: Numarray -> NumPy transition (several known bugs still exist) - the .STEP command - new routines: CALL_EXTERNAL (by Christoph Fuch), DIALOG_MESSAGE, ROBERTS, SWAP_ENDIAN_INPLACE, CORRELATE 0.9.2: - tremendous speed improvements: Indexing, subroutine calls, operators (especially for scalar values in conjunction with OpenMP), ... - UNIT keyword for SPAWN (thanks to a patch by Greg Huey) - fixed ASSOC var indexing with a variable - new routines: FILE_MKDIR, FILE_WHICH (patch by H Xu), IDL_VALIDNAME (by Rene Preusker), SCOPE_VARFETCH, SEM_CREATE, SEM_LOCK, SEM_RELEASE, SEM_DELETE (SEM_* routines by Mateusz Turcza), - fixes/enhancements in: BETA, CONTOUR, CORRELATE, DIALOG_PICKFILE, EXPINT, HDF_OPEN, H5F_OPEN, HDF_SD_START, IGAMMA, IMSL_CONSTANT, INTERPOL, LOADCT, NCDF_CONTROL, NCDF_OPEN, ROUTINE_NAMES, TV, TVRD, XYOUTS (!P.MULTI vs. !P.POSITION, ORIENTATION with logscales), INTERPOLATE (the MISSING kw) - fixes in STREGEX, STRPOS, STRSPLIT - non-Encapsulated PostScript support along with XSIZE, YSIZE, XOFFSET, YOFFSET, PORTRAIT, LANDSCAPE and SCALE_FACTOR settings support for PostScript output (requires pslib - http://pslib.sourceforge.net/ and makes advantage of PLplot fixes introduced in PLplot 5.9.9) - memory leak fix (bug introduced in the previous version) - various testsuite & docs updates (incl. docs and examples for CALL_EXTERNAL) - fix in WordExp() when filename argument contain whitespaces (useful in various cases, including OPENR/W, FILE_MKDIR, ...) [AC 2012/01/04: not finished :( - !version.os now in lower case for Linux and Darwin 0.9.3: - activities on speed improvements continuing - Initial import of STRMATCH() - Initial import of USERSYM - SCOPE_VARFETCH (only LEVEL keyword supported) - keyword /NaN for HISTOGRAM - Initial import of LUDC, LUSOL and DETERM, OK now only for DOUBLE - Initial import of ROT, CONGRID and BILINEAR - Initial import of TV for PS output - fix in RANDOMN/RANDOMU (Binomial OK, conflicting keywords detected ...) - Initial import for QROMB(), QSIMP() (based on QROMB) and QROMO() - Initial import for TRISOL() - fix in ERASE for background color (preparing Coyote lib. support) - Initial import of STANDARDIZE and HIST_EQUAL - improvment in MAGICK related codes, especially MAGICK_PING (pb with ImageMagick (IM) in Ubuntu 12.04; GraphicsMagick can also be used instead of IM) - FZ_ROOTS: initial import (same way than IMSL_ZEROPOLY using gsl_poly_complex_solve(), only real coefs. for input poly) - FX_ROOT: initial import. in c++ - keyword DIM in MOMENT(), MEAN(), STDDEV(), VARIANCE(), SKEWNESS(), KURTOSIS() (requested DIM and other improvments) - keyword SIGN in FINITE - support for empty arrays and !NULL system variable - promotion of FOR loop index variable type - various improvments on READ_JPEG, READ_PNG, WRITE_JPEG, WRITE_PNG - keyword ICONIC in WSHOW - keyword ISOTROPIC in PLOT, CONTOUR - new widget features incl. WIDGET_LIST and CW_GROUP - various fix in FFT: DIM keyword, memory leak when using GSL - support for some overloaded operators (_overloadIsTrue, _overloadPlus, _overloadMinus, _overloadBracketsLeftSide, _overloadBracketsRightSide, _overloadEQ, _overloadNE) - support for .SKIP [NSteps] command 0.9.4: - when compiled with Eigen3 library, significant speed improvement in MATRIX_MULTIPLY() (and # operators), especially on multi-cores Basic loading managment included (if some core are busy). - LIST and HASH are fully supported even left-side struct access is possible e. g.: GDL> h = HASH('key',{tag1:1}) & h['key'].tag1 = 3 this even works with all (derived) GDL_OBJECTs: In this case (a variable set to) !NULL is passed as the OBJREF parameter to the OBJECT::_OVERLOADBRACKETSLEFTSIDE member procedure, it must in turn set this OBJREF parameter (the variable) to a POINTER to the heap variable to access. - .RESET_SESSION and .FULL_RESET_SESSION commands - CHOLSOL/CHOLDC and LA_CHOLSOL/LA_CHOLDC using Eigen3 (sub-optimal) - large change in various graphic/plotting keywords: - PLOT, OPLOT: All keywords supported except Z and T3D, Correct handling of log/DATA/NORMAL/DEVICE coordinates and CLIPPING. - PSYMs shapes now identical to IDL's. - PLOTS: idem as above, plus /CONTINUE - XYOUTS: idem as above, one-argument support (XYOUTS,"string"). Enhancement wrt. reference program: color,size,angle,etc of text are vectors. - CONTOUR: Support of all options except ZVALUE, ZAXIS,CELL_FILL, C_ANNOTATIONS, CLOSED, DOWNHILL, IRREGULAR, TRIANGULATION,PATH_*** Correct implementation of Z, [X,Y], i.e., contours may be skewed, rotated, etc depending on X and Y. Better than IDL: - a new ZLOG option makes log contours as well. - C_ORIENTATION, C_SPACING are also vectors. - log axes give better results - good contouring of Not-A-Number values in Z and MIN_VALUE/MAX_VALUE - CLIPPING ok. - Automatic limits in some cases still different from IDL. - AXIS and boxes in plots: all [XYZ]TICK[***] options supported except TICKV and a few TICKFORMAT specifics. - CURSOR: full support for CURSOR command, which is interruptible by control-c and has all the options. - Added cursor-related functions TVCRS and command EMPTY. - Added DEVICE options CURSOR_CROSSHAIR, CURSOR_STANDARD, CURSOR_ORIGINAL and GET/SET_GRAPHICS_FUNCTION (GXoR, GXand, etc). - Disabled by default the focus in the X11 graphics windows as IDL does and repositioned WINDOWS by default to top-right of screen. gdl-0.9.4/COPYING0000664000175000017500000003543311602351360011762 0ustar marcmarc GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 gdl-0.9.4/TODO0000664000175000017500000001045211234327536011422 0ustar marcmarc Last update by Alain on 30 July 2009 Updated by Alain on 28 March 2008 This file contains: -- a ToDo list of missing commands -- a ToDo list related to system variables -- a ToDo list of missing Functions and Procedures -- a ToDo list of incomplete Functions and Procedures, missing keywords and limited/buggy functionnalities in existing func/pro -- some comments -- a DONE list containing info for future troubles/needs ToDo list of missing commands (not exhaustive, most requested) .rnew .skip .reset_session ToDo list related to system variables !ERROR, !ERR and !ERROR_STATE are not properly set by all library functions !EDIT_INPUT, preferences IDL_EDIT_INPUT, IDL_RBUF_PERSIST and IDL_RBUF_SIZE. ToDo list of Functions and Procedures * WMENU function Category: user interface Langage: GDL, later may be in C++ with widgets ! Difficulty: easy Contact: Alain Comments: undocumented feature coming from the old IDL versions (before 4.0). A draft exists, substiting the X11 interface by a console one. ToDo list of incomplete Function/Procedure, missing keywords ... * ON_ERROR and CATCH procedures Category: system Langage: C++ Difficulty: unknow Contact: Marc Comments: ON_ERROR and CATCH are not fully implemented (GDL recognizes them, but does not perform any action, ie. in case of error, the data is not used). * HELP Category: system Langage: C++ Difficulty: unknow Contact: Comments: some useful keywords are not handle * PLOT, OPLOT, PLOTS, CONTOUR, SURFACE, AXIS, XYOUTS Category: display Langage: C++ Difficulty: parts are obvious, other may be impossible with plplot lib! Contact: Alain Comments: some useful keywords are not handle * USERSYM Category: display Langage: C++ (linked to plplot library Difficulty: may be impossible with plplot lib! Contact: Joel or Alain Comments: * TVRD : keyword !order Category: display Langage: C++ (in devicex.hpp) Difficulty: unknow. Contact: Alain Comments: to be complete for !order keyword (managed in TV). A priori, the method p->Rotate(7) cannot be used on Byte arrays. * LA_ serie (based on the LAPACK routines) Category: numeric Langage: a priori C++ Difficulty: some existing algo, not under GPL ?? Contact: Comments: different personns have asked ... It is better to implement it in C/C++ because it is computer intensif Comments; About recently added Pro/Functions I move here some important procedures and functions which have been recently added; because they are important, they need to extensively tested. * MEDIAN: implementation of parameter "width" was done in summer 2008 Category: numeric Langage: C++ Difficulty: very difficult Contact: Alain Comments: codes in C/C++ in public domain or under GPL available, "interfaces" missing. Please make biblio before writing it, it is not obvious. Availability/efficienty of algo depend on data type !! It is better to implement it in C/C++ because it is computer intensif. --> Not sure all the cases have been tested. Please report tests and problems. * SPLINE serie (SPL_INIT, SPL_INTERP) Category: numeric Langage: C++ Difficulty: existing algo in NR, not under GPL. Contact: Alain Comments: A working version in GDL syntax has been put in CVS under src/pro It is better to implement it in C/C++ because it is computer intensif. * INVERT function : some exceptions Category: numeric Langage: C++ (in gsl_fun.cpp) Difficulty: easy. Contact: Alain Comments: the last exceptions shjould have been cleaned (input size, no-square matrix, string conversion should work). Very easy but could be time consuming if extensive tests. See currents tests in testsuite/test_invert_matrix.pro DONE and revisited * BESELI/BESELJ/BESELK Category: numeric Langage: C++ (in math_fun_ac.cpp) Difficulty: unknow. Contact: Alain Comments: 1/ some details need to be fix when the arrays are not commensurable. It is highly probable that other functions do suffer from the same problems. Some have been corrected (the GAMMA/BETA family) and can be used as template. 2/ since mid-2008 (?) GSL does include non integer Besel functions ... The Besel family has been revisted during summer 2009. Non integer orders have been added. Boundaries tests should be OK. Clean processing of input arrays dimensionning was take into account, with consequence on other functions like VOIGT, BETA ... (see examples in testsuite/test_MathFunctionsDim.pro and also bugs in IDL) gdl-0.9.4/CMakeLists.txt0000664000175000017500000007315412221567704013502 0ustar marcmarc# # copyright : (c) 2010 Maxime Lenoir and Alain Coulais # # 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. # # tested with 2.4 and doesn't seem to run. # SA: 2.6 supports simplified if constructs, e.g. endif() cmake_minimum_required(VERSION 2.6 FATAL_ERROR) project(GDL) # X.X.X CVS becomes release X.X.X+1 set(VERSION "0.9.4") enable_testing() include(CheckIncludeFile) include(CheckIncludeFileCXX) include(CheckLibraryExists) include(CheckFunctionExists) include(CheckSymbolExists) include(CheckCSourceRuns) include(FindPkgConfig) include(FindPackageHandleStandardArgs) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/CMakeModules) #### Default cached values set(PYTHON_MODULE OFF CACHE BOOL "Build GDL as a Python module ?") set(X11 ON CACHE BOOL "Enable X11 ?") set(X11DIR "" CACHE PATH "Specify X11 directory tree") set(READLINE ON CACHE BOOL "Enable GNU Readline ?") set(READLINEDIR "" CACHE PATH "Specify the GNU readline directory tree") set(OLDPLPLOT OFF CACHE BOOL "Enable old plplot ?") set(PLPLOTDIR "" CACHE PATH "Specify the plplot directory tree") set(GSLDIR "" CACHE PATH "Specify the GSL directory tree") set(ZLIBDIR "" CACHE PATH "specify the Zlib directory tree") set(WXWIDGETS ON CACHE BOOL "Enable WxWidgets ?") set(WXWIDGETSDIR "" CACHE PATH "Specify WxWidgets directory tree") set(UDUNITS OFF CACHE BOOL "Enable UDUNITS-2 ?") set(UDUNITSDIR "" CACHE PATH "Specify the UDUNITS-2 directory tree") set(EIGEN3 ON CACHE BOOL "Enable Eigen3 ?") set(EIGEN3DIR "" CACHE PATH "Specify the Eigen3 directory tree") set(PSLIB ON CACHE BOOL "Enable pslib ?") set(PSLIBDIR "" CACHE PATH "Specify the pslib directory tree") set(GRIB OFF CACHE BOOL "Enable Grib ?") set(GRIBDIR "" CACHE PATH "Specifiy the GRIB directory tree") set(MAGICK ON CACHE BOOL "Enable ImageMagick ?") set(MAGICKDIR "" CACHE PATH "Specifiy the ImageMagick directory tree") # GraphicsMagick is a good alternative to ImageMagick set(GRAPHICSMAGICK ON CACHE BOOL "Enable GraphicsMagick ?") set(GRAPHICSMAGICKDIR "" CACHE PATH "Specify the GraphicsMagick directory tree") set(NETCDF ON CACHE BOOL "Enable NetCDF ?") set(NETCDFDIR "" CACHE PATH "Specifiy the netCDF directory tree") set(HDF ON CACHE BOOL "Enable Hdf ?") set(HDFDIR "" CACHE PATH "Specifiy the HDF directory tree") set(HDF5 ON CACHE BOOL "Enable Hdf5 ?") set(HDF5DIR "" CACHE PATH "Specifiy the HDF5 directory tree") set(FFTW ON CACHE BOOL "Enable FFTW ?") set(FFTWDIR "" CACHE PATH "Specifiy the FFTW directory tree") set(LIBPROJ4 OFF CACHE BOOL "Enable LIBPROJ4 ?") set(LIBPROJ4DIR "" CACHE PATH "Specifiy the LIBPROJ4 directory tree") set(MPICH OFF CACHE BOOL "Enable MPICH ?") set(MPICHDIR "" CACHE PATH "Specify the MPICH (experimental) directory tree") set(PYTHON ON CACHE BOOL "Enable Python ?") set(PYTHONDIR "" CACHE PATH "Specifiy the use Python directory tree") set(PYTHONVERSION "" CACHE STRING "Specify the Python version to use") set(GSHHS OFF CACHE BOOL "Enable GSHHS ?") set(GSHHSDIR "" CACHE PATH "Specifiy the GSHHS directory tree") set(NCURSESDIR "" CACHE PATH "Specify the ncurses (or curses) directory tree") set(OPENMP ON CACHE BOOL "Enable OpenMP ?") # Third party libraries set(JASPERDIR "" CACHE PATH "Specify the JasPer directory tree") set(JPEGDIR "" CACHE PATH "Specify the JPEG directory tree") set(SZIPDIR "" CACHE PATH "Specify the SZip directory tree") set(GDL_DATA_DIR "/share/gnudatalanguage" CACHE PATH "Choose data install directory relative to CMAKE_INSTALL_PREFIX") # check for 64-bit OS if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) set(HAVE_64BIT_OS 1) endif(${CMAKE_SIZEOF_VOID_P} EQUAL 8) #### check headers and libraries # dl check_library_exists(dl dlopen "" HAVE_DL) if(HAVE_DL) set(LIBRARIES ${LIBRARIES} dl) endif(HAVE_DL) # malloc stats check_function_exists(malloc_zone_statistics HAVE_MALLOC_ZONE_STATISTICS) check_function_exists(sbrk HAVE_SBRK) check_function_exists(mallinfo HAVE_MALLINFO) # mallocs check_include_file(malloc.h HAVE_MALLOC_H) check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H) # locale check_include_file(locale.h HAVE_LOCALE_H) # std includes.. check_include_file(stdint.h HAVE_STDINT_H) check_include_file(stdlib.h HAVE_STDLIB_H) check_include_file(string.h HAVE_STRING_H) check_include_file(strings.h HAVE_STRINGS_H) check_include_file(sys/stat.h HAVE_SYS_STAT_H) check_include_file(sys/types.h HAVE_SYS_TYPES_H) check_include_file(unistd.h HAVE_UNISTD_H) check_include_file(ext/stdio_filebuf.h HAVE_EXT_STDIO_FILEBUF_H) # dlfcn.h check_include_file(dlfcn.h HAVE_DLFCN_H) # inttypes.h check_include_file(inttypes.h HAVE_INTTYPES_H) # nexttoward check_library_exists(m nexttoward "" HAVE_NEXTTOWARD) # mpi check_include_file(mpi.h HAVE_MPI_H) # SA: whithout it compilation of antlr fails if there's a conflicting # version of antlr in system-wide directories include_directories(src) # Ncurses MANDATORY # -DNCURSESDIR=DIR set(CMAKE_PREFIX_PATH ${NCURSESDIR}) set(CURSES_NEED_NCURSES TRUE) find_package(Curses QUIET COMPONENTS initscr) mark_as_advanced(CURSES_CURSES_H_PATH CURSES_FORM_LIBRARY CURSES_HAVE_CURSES_H) if(CURSES_FOUND) set(HAVE_LIBNCURSES 1) set(LIBRARIES ${LIBRARIES} ${CURSES_LIBRARIES}) include_directories(${CURSES_INCLUDE_DIR}) else(CURSES_FOUND) # search for curses set(CURSES_NEED_NCURSES FALSE) find_package(Curses COMPONENTS initscr) set(HAVE_LIBCURSES ${CURSES_FOUND}) if(CURSES_FOUND) set(LIBRARIES ${LIBRARIES} ${CURSES_LIBRARIES}) include_directories(${CURSES_INCLUDE_DIR}) else(CURSES_FOUND) message(FATAL_ERROR "(N)Curses was not found.\n" "Use -DNCURSESDIR=DIR to specify the (n)curses directory tree.") endif(CURSES_FOUND) endif(CURSES_FOUND) # Readline # -DREADLINE=ON|OFF # -DREADLINEDIR=DIR if(READLINE) # readline needs (n)curses set(CMAKE_PREFIX_PATH ${READLINEDIR}) find_package(Readline QUIET) set(HAVE_LIBREADLINE ${READLINE_FOUND}) if(READLINE_FOUND) set(CMAKE_REQUIRED_LIBRARIES ${CURSES_LIBRARIES}) check_library_exists("${READLINE_LIBRARIES}" rl_get_screen_size "" RL_GET_SCREEN_SIZE) if(NOT RL_GET_SCREEN_SIZE) message(STATUS "WARNING: Older GNU readline without rl_get_screen_size was found.\n" "For resized terminals the size might not be updated correctly.\n" "If this is a problem please install a recent version of readline.") endif(NOT RL_GET_SCREEN_SIZE) set(LIBRARIES ${LIBRARIES} ${READLINE_LIBRARIES}) include_directories(${READLINE_INCLUDE_DIR}) set(CMAKE_REQUIRED_LIBRARIES) else(READLINE_FOUND) message(FATAL_ERROR "GNU readline was not found.\n" "Use -DREADLINEDIR=no to explicitely disable it.\n" "(suitable Debian/Ubuntu package: libreadline5-dev)\n" "(suitable Fedora package: readline-devel)") endif(READLINE_FOUND) endif(READLINE) # zlib MANDATORY # -DZLIBDIR=DIR set(CMAKE_PREFIX_PATH ${ZLIBDIR}) find_package(ZLIB QUIET) set(HAVE_LIBZ ${ZLIB_FOUND}) if(ZLIB_FOUND) set(LIBRARIES ${LIBRARIES} ${ZLIB_LIBRARIES}) include_directories(${ZLIB_INCLUDE_DIR}) else(ZLIB_FOUND) message(FATAL_ERROR "ZLib library is required but was not found.\n" "Use -DZLIBDIR=DIR to specify the zlib directory tree.\n" "(suitable Debian/Ubuntu package: zlib1g-dev)\n" "(suitable Fedora package: zlib-devel)") endif(ZLIB_FOUND) # openmp # -DOPENMP=ON|OFF if(OPENMP) find_package(OpenMP QUIET) if(OPENMP_FOUND) add_definitions(${OpenMP_CXX_FLAGS}) if(WIN32 AND NOT CYGWIN) set(LIBRARIES ${LIBRARIES} vcomp) else(WIN32 AND NOT CYGWIN) set(LIBRARIES ${LIBRARIES} ${OpenMP_CXX_FLAGS}) endif(WIN32 AND NOT CYGWIN) endif(OPENMP_FOUND) endif(OPENMP) # GSL MANDATORY # -DGSLDIR=DIR set(CMAKE_PREFIX_PATH ${GSLDIR}) find_package(GSL QUIET) set(HAVE_LIBGSL ${GSL_FOUND}) set(HAVE_LIBGSLCBLAS ${GSL_FOUND}) if(GSL_FOUND) set(LIBRARIES ${LIBRARIES} ${GSL_LIBRARIES}) include_directories(${GSL_INCLUDE_DIR}) else(GSL_FOUND) message(FATAL_ERROR "Gnu Scientific library (1.7 or higher) and libgslcblas are mandatory.\n" "Use -DGSLDIR=DIR to specify the gsl directory tree.\n" "(suitable Debian/Ubuntu package: libgsl0-dev)\n" "(suitable Fedora package: gsl-devel)") endif(GSL_FOUND) if(WIN32 AND NOT CYGWIN) set(CMAKE_PREFIX_PATH ${XDRDIR}) find_package(xdr) set(HAVE_LIBXDR ${XDR_FOUND}) if(XDR_FOUND) set(LIBRARIES ${LIBRARIES} ${XDR_LIBRARIES}) include_directories(${XDR_INCLUDE_DIR}) else(XDR_FOUND) message(FATAL_ERROR "bsd-xdr library is required but was not found.\n" "Use -DXDRDIR=DIR to specify the bsd-xdr directory tree.") endif(XDR_FOUND) set(CMAKE_PREFIX_PATH ${PCREDIR}) find_package(pcre) set(HAVE_LIBPCRE ${PCRE_FOUND}) if(PCRE_FOUND) set(LIBRARIES ${LIBRARIES} ${PCRE_LIBRARIES}) include_directories(${PCRE_INCLUDE_DIR}) else(PCRE_FOUND) message(FATAL_ERROR "pcre library is required but was not found.\n" "Use -DPCREDIR=DIR to specify the pcre directory tree.") endif(PCRE_FOUND) LINK_LIBRARIES(shlwapi) endif(WIN32 AND NOT CYGWIN) # PLplot MANDATORY # -DOLDPLPLOT=ON|OFF # -DPLPLOTDIR=DIR set(HAVE_OLDPLPLOT ${OLDPLPLOT}) set(CMAKE_PREFIX_PATH ${PLPLOTDIR}) find_package(Plplot QUIET) set(HAVE_LIBPLPLOTCXXD ${PLPLOT_FOUND}) if(PLPLOT_FOUND) set(LIBRARIES ${LIBRARIES} ${PLPLOT_LIBRARIES}) include_directories(${PLPLOT_INCLUDE_DIR}) else(PLPLOT_FOUND) message(FATAL_ERROR "plplot library is required but was not found.\n" "Use -DPLPLOTDIR=DIR to specify the plplot directory tree.\n" "(suitable Debian/Ubuntu packages: libplplot-dev, [plplot9-driver-xwin])" "(suitable Fedora package: plplot-devel)") endif(PLPLOT_FOUND) if(PLPLOT_FOUND) check_library_exists("${PLPLOT_LIBRARIES}" c_plslabelfunc "" HAVE_PLPLOT_SLABELFUNC) if(HAVE_PLPLOT_SLABELFUNC) set(HAVE_PLPLOT_SLABELFUNC 1) else(HAVE_PLPLOT_SLABELFUNC) message(STATUS "warning, due to old plplot library, [XYZ]TICKFORMAT option for plot axis will not be supported.\n" "you should upgrade to plplot version > 5.9.6") endif(HAVE_PLPLOT_SLABELFUNC) check_library_exists("${PLPLOT_LIBRARIES}" plstrl "" PLPLOT_PRIVATE_NOT_HIDDEN) if(PLPLOT_PRIVATE_NOT_HIDDEN) set(PLPLOT_PRIVATE_NOT_HIDDEN 1) else(PLPLOT_PRIVATE_NOT_HIDDEN) message(STATUS "Using a plplot library without private functions - workarounds will be used.") endif(PLPLOT_PRIVATE_NOT_HIDDEN) check_library_exists("${PLPLOT_LIBRARIES}" c_pllegend "" PLPLOT_HAS_LEGEND) if(PLPLOT_HAS_LEGEND) set(PLPLOT_HAS_LEGEND 1) else(PLPLOT_HAS_LEGEND) message(STATUS "Your plplot lib is too old for some gdl functions, please upgrade.") endif(PLPLOT_HAS_LEGEND) endif(PLPLOT_FOUND) # GRAPHICSMAGICK is an alternative to the classical ImageMagick Lib. # # -DGRAPHICSMAGICK=ON|OFF # -DGRAPHICSMAGICKDIR=DIR if(GRAPHICSMAGICK) if (MAGICK_FOUND) message("We prefer to use GraphicsMagick than ImageMagick") set(MAGICK off) endif(MAGICK_FOUND) set(CMAKE_PREFIX_PATH ${GRAPHICSMAGICKDIR}) find_package(GraphicsMagick QUIET) set(USE_MAGICK ${GRAPHICSMAGICK_FOUND}) if(GRAPHICSMAGICK_FOUND) include_directories(${GRAPHICSMAGICK_INCLUDE_DIR}) set(LIBRARIES ${LIBRARIES} ${GRAPHICSMAGICK_LIBRARIES}) else(GRAPHICSMAGICK_FOUND) message( STATUS "GRAPHICSMAGICK is strongly suggested but was not found. Use -DGRAPHICSMAGICKDIR=DIR to specify the GraphicsMagick directory tree. Use -DGRAPHICSMAGICK=OFF to not use it. (suitable Fedora package: GraphicsMagick-c++-devel Debian/Ubuntu package: libgraphicsmagick++1-devel)\n") message( STATUS "Looking for ImageMagick") endif(GRAPHICSMAGICK_FOUND) endif(GRAPHICSMAGICK) if(GRAPHICSMAGICK_FOUND) set(MAGICK OFF) endif(GRAPHICSMAGICK_FOUND) if(MAGICK) # support Magick check_library_exists("${PLPLOT_LIBRARIES}" plGetDrvDir "" HAVE_PLGETDRVDIR) if(HAVE_PLGETDRVDIR) message(STATUS "WARNING: Dynamic drivers have to be disabled in plplot.\n" "To make plplot work with ImageMagick:\n" "use -DENABLE_DYNDRIVERS=OFF cmake option when compiling plplot or\n" "use -DMAGICK=OFF here to not use ImageMagick in GDL.") endif(HAVE_PLGETDRVDIR) endif(MAGICK) # wxWdigets # -DWXWIDGET=ON|OFF # -DWXWIDGETDIR=DIR if(WXWIDGETS) set(CMAKE_PREFIX_PATH ${WXWIDGETSDIR}) find_package(wxWidgets QUIET) set(HAVE_LIBWXWIDGETS ${wxWidgets_FOUND}) if(wxWidgets_FOUND) set(LIBRARIES ${LIBRARIES} ${wxWidgets_LIBRARIES}) set(LINK_DIRECTORIES ${LINK_DIRECTORIES} ${wxWidgets_LIBRARY_DIRS}) foreach(WXDEF ${wxWidgets_DEFINITIONS}) add_definitions(-D${WXDEF}) endforeach(WXDEF ${wxWidgets_DEFINITIONS}) include_directories(${wxWidgets_INCLUDE_DIRS}) else(wxWidgets_FOUND) message(FATAL_ERROR "wxWidgets are required but were not found.\n" "Use -DWXWIDGETSDIR=DIR to specify the wxWidgets directory tree.\n" "Use -DWXWIDGETS=OFF to not use it.\n" "(suitable Debian/Ubuntu package: libwxgtk2.8-dev)\n" "(suitable Fedora package: wxGTK-devel)") endif(wxWidgets_FOUND) endif(WXWIDGETS) # Magick # -DMAGICK=ON|OFF # -DMAGICKDIR=DIR if(MAGICK) set(CMAKE_PREFIX_PATH ${MAGICKDIR}) find_package(ImageMagick QUIET COMPONENTS Magick++ MagickWand MagickCore) mark_as_advanced(ImageMagick_EXECUTABLE_DIR ImageMagick_Magick++_INCLUDE_DIR ImageMagick_Magick++_LIBRARY ImageMagick_MagickCore_INCLUDE_DIR ImageMagick_MagickCore_LIBRARY ImageMagick_MagickWand_INCLUDE_DIR ImageMagick_MagickWand_LIBRARY) set(USE_MAGICK ${ImageMagick_FOUND}) if(ImageMagick_FOUND) find_program(MAGICKXXCONFIG Magick++-config) if(MAGICKXXCONFIG) execute_process(COMMAND ${MAGICKXXCONFIG} "--libs" OUTPUT_VARIABLE MAGICKXXCONFIGLIBS OUTPUT_STRIP_TRAILING_WHITESPACE) set(LIBRARIES ${LIBRARIES} ${MAGICKXXCONFIGLIBS}) else(MAGICKXXCONFIG) message(FATAL_ERROR "ImageMagick is required but was not found (Magick++-config).\n" "Use -DMAGICKDIR=DIR to specify the ImageMagick directory.\n" "Use -DMAGICK=OFF to not use it.\n" "(suitable Debian/Ubuntu package: libmagick++-dev)\n" "(suitable Fedora package: ImageMagick-c++-devel)") endif(MAGICKXXCONFIG) set(LIBRARIES ${LIBRARIES} ${ImageMagick_LIBRARIES}) include_directories(${ImageMagick_INCLUDE_DIRS}) set(MAGICK_LIBRARIES ${ImageMagick_LIBRARIES}) else(ImageMagick_FOUND) message(FATAL_ERROR "ImageMagick is required but was not found.\n" "Use -DMAGICKDIR=DIR to specify the ImageMagick directory.\n" "Use -DMAGICK=OFF to not use it.\n" "(suitable Debian/Ubuntu package: libmagick++-dev)\n" "(suitable Fedora package: ImageMagick-c++-devel)") endif(ImageMagick_FOUND) endif(MAGICK) # netCDF # -DNETCDF=ON|OFF # -DNETCDFDIR=DIR if(NETCDF) set(CMAKE_PREFIX_PATH ${NETCDFDIR}) find_package(NetCDF QUIET) if(NETCDF_FOUND) set(CMAKE_REQUIRED_INCLUDES ${NETCDF_INCLUDE_DIRS}) check_include_file_cxx(netcdf.h HAVE_NETCDF_H) if(HAVE_NETCDF_H) set(LIBRARIES ${LIBRARIES} ${NETCDF_LIBRARIES}) set(LINK_DIRECTORIES ${LINK_DIRECTORIES} ${NETCDF_LIBRARY_DIRS}) include_directories(${NETCDF_INCLUDE_DIRS}) set(USE_NETCDF 1) else(HAVE_NETCDF_H) message(FATAL_ERROR "NetCDF installation seems not to be usable.\n" "This suggests a conflicting netCDF-HDF4 installation e.g.\n" "- Uninstalling HDF4 after installation of NetCDF.\n" "- Installing NetCDF before HDF4.") endif(HAVE_NETCDF_H) set(CMAKE_REQUIRED_INCLUDES) else(NETCDF_FOUND) message(FATAL_ERROR "NetCDF version 3.5.1 or later is required but was not found.\n" "Use -DNETCDFDIR=DIR to specify the netcdf directory tree.\n" "Use -DNETCDF=OFF to not use it.\n" "(suitable Debian/Ubuntu package: libnetcdf-dev)\n" "(suitable Fedora package: netcdf-devel)") endif(NETCDF_FOUND) endif(NETCDF) # hdf4 # -DHDF=ON|OFF # -DHDFDIR=DIR if(HDF) set(CMAKE_PREFIX_PATH ${HDFDIR} ${JPEGDIR} ${SZIPDIR}) find_package(HDF QUIET) set(USE_HDF ${HDF_FOUND}) if(HDF_FOUND) if(NETCDF) set(CMAKE_REQUIRED_LIBRARIES ${HDF_EXTRA_LIBRARIES}) check_library_exists("${HDF_LIBRARIES}" sd_nccreate "" SD_NCCREATE) if(NOT SD_NCCREATE) message(FATAL_ERROR "HDF4 needs to be configured with the --disable-netcdf option " "in order to be used with the original netCDF library.") endif(NOT SD_NCCREATE) set(CMAKE_REQUIRED_LIBRARIES) endif(NETCDF) set(HDF_LIBRARIES ${HDF_LIBRARIES} ${HDF_EXTRA_LIBRARIES}) set(LIBRARIES ${LIBRARIES} ${HDF_LIBRARIES}) include_directories(${HDF_INCLUDE_DIR}) else(HDF_FOUND) message(FATAL_ERROR "HDF4 libraries were not found.\n" "Use -DHDFDIR=DIR to specify the HDF directory tree.\n" "Use -DHDF=OFF to not use it.\n" "(suitable Debian/Ubuntu package: libhdf4-alt-dev)\n" "You can use -DJPEGDIR=DIR to specify the JPEG directory tree. " "You can also use -DSZIPDIR=DIR to specify SZip directory tree if " "HDF was compiled with SZip support.") endif(HDF_FOUND) endif(HDF) # hdf5 # -DHDF5=ON|OFF # -DHDF5DIR=DIR if(HDF5) set(CMAKE_PREFIX_PATH ${HDF5DIR} ${SZIPDIR}) find_package(HDF5 QUIET) set(USE_HDF5 ${HDF5_FOUND}) if(HDF5_FOUND) set(LIBRARIES ${LIBRARIES} ${HDF5_LIBRARIES}) include_directories(${HDF5_INCLUDE_DIRS}) find_package(MPI QUIET) if(MPI_FOUND) include_directories(${MPI_INCLUDE_PATH}) set(LIBRARIES ${LIBRARIES} ${MPI_LIBRARIES}) endif(MPI_FOUND) else(HDF5_FOUND) message(FATAL_ERROR "HDF version 5 is required but was not found.\n" "Use -DHDF5DIR=DIR to specify the HDF5 directory tree.\n" "Use -DHDF5=OFF to not use it.\n" "(suitable Debian/Ubuntu package: libhdf5-serial-dev)\n" "(suitable Fedora package: hdf-devel)") endif(HDF5_FOUND) endif(HDF5) # fftw # -DFFTW=ON|OFF # -DFFTWDIR=DIR if(FFTW) set(CMAKE_PREFIX_PATH ${FFTWDIR}) find_package(FFTW QUIET) set(USE_FFTW ${FFTW_FOUND}) if(FFTW_FOUND) set(LIBRARIES ${LIBRARIES} ${FFTW_LIBRARIES}) include_directories(${FFTW_INCLUDE_DIR}) else(FFTW_FOUND) message(FATAL_ERROR "FFTW3 is required but was not found.\n" "Use -DFFTWDIR=DIR to specify the FFTW directory tree.\n" "Use -DFFTW=OFF to not use it.\n" "(suitable Debian/Ubuntu package: libfftw3-dev)\n "(suitable Fedora package: fftw-devel)"") endif(FFTW_FOUND) endif(FFTW) # libproj4 # -DLIBPROJ4=ON|OFF # -DLIBPROJ4DIR=DIR if(LIBPROJ4) set(CMAKE_PREFIX_PATH ${LIBPROJ4DIR}) find_package(Libproj4 QUIET) if(LIBPROJ4_FOUND) set(CMAKE_REQUIRED_LIBRARIES ${LIBPROJ4_LIBRARIES} ${GSL_LIBRARIES} m) check_library_exists("${LIBPROJ4_LIBRARIES}" proj_init "" USE_LIBPROJ4_NEW) if(USE_LIBPROJ4_NEW) set(USE_LIBPROJ4 1) else(USE_LIBPROJ4_NEW) check_library_exists("${LIBPROJ4_LIBRARIES}" pj_init "" USE_LIBPROJ4) if(NOT USE_LIBPROJ4) message(FATAL_ERROR "Libproj4 is required but was not found.\n" "Use -DLIBPROJ4DIR=DIR to specify the Libproj4 directory tree.\n" "Use -DLIBPRJ4=OFF to not use it.") endif(NOT USE_LIBPROJ4) endif(USE_LIBPROJ4_NEW) include_directories(${LIBPROJ4_INCLUDE_DIR}) set(LIBRARIES ${LIBRARIES} ${LIBPROJ4_LIBRARIES}) set(CMAKE_REQUIRED_LIBRARIES) else(LIBPROJ4_FOUND) message(FATAL_ERROR "Libproj4 is required but was not found.\n" "Use -DLIBPROJ4DIR=DIR to specify the Libproj4 directory tree.\n" "Use -DLIBPRJ4=OFF to not use it.") endif(LIBPROJ4_FOUND) endif(LIBPROJ4) # mpich (experimental) # -DMPICH=ON|OFF # -DMPICHDIR=DIR if(MPICH) set(CMAKE_PREFIX_PATH ${MPICHDIR}) find_package(MPI QUIET) set(USE_MPI ${MPI_FOUND}) if(MPI_FOUND) include_directories(${MPI_INCLUDE_PATH}) set(LIBRARIES ${LIBRARIES} ${MPI_LIBRARIES}) else(MPI_FOUND) message(FATAL_ERROR "MPICH is required but was not found.\n" "Use -DMPICHDIR=DIR to specify the MPICH directory tree.\n" "Use -DMPICH=OFF to not use it.") endif(MPI_FOUND) endif(MPICH) # python # -DPYTHON=ON|OFF # -DPYTHON_MODULE # -DPYTHONDIR=DIR # -DPYTHONVERSION=VERSION if(PYTHON OR PYTHON_MODULE) if(PYTHON) set(PYTHONMSG "Use -DPYTHON=OFF to disable Python support.\n") endif(PYTHON) if(PYTHON_MODULE) set(PYTHON_MODULEMSG "Use -DPYTHON_MODULE=OFF to disable Python module.\n") endif(PYTHON_MODULE) if(PYTHONDIR) find_library(PYTHONLIBS NAMES python${PYTHONVERSION} PATHS ${PYTHONDIR} PATH_SUFFIXES lib lib/python${PYTHONVERSION}/config NO_DEFAULT_PATH NO_CMAKE_PATH ) string(COMPARE NOTEQUAL "${PYTHONLIBS}" "PYTHONLIBS-NOTFOUND" PYTHONLIBS_FOUND) if (NOT PYTHONLIBS_FOUND) message(FATAL_ERROR "Python libraries not found in ${PYTHONDIR}.") else() set(PYTHON_LIBRARIES "${PYTHONLIBS}") message("-- Found Python libs: ${PYTHONLIBS}") endif() find_path(PYTHON_INCLUDE_DIRS NAMES Python.h PATHS ${PYTHONDIR} PATH_SUFFIXES include include/python${PYTHONVERSION} NO_DEFAULT_PATH NO_CMAKE_PATH ) string(COMPARE NOTEQUAL "${PYTHONLIBS}" "PYTHON_INCLUDE_DIRS-NOTFOUND" PYTHONHEADERS_FOUND) if (PYTHONHEADERS_FOUND) message("-- Found Python headers: ${PYTHON_INCLUDE_DIRS}") set(PYTHON_INCLUDES "${PYTHON_INCLUDE_DIRS}") else() message(FATAL_ERROR "Python headers not found in ${PYTHONDIR}.") endif() find_program(PYTHON_EXECUTABLE NAMES python${PYTHONVERSION} PATHS ${PYTHONDIR} PATH_SUFFIXES bin NO_DEFAULT_PATH NO_CMAKE_PATH) string(COMPARE NOTEQUAL "${PYTHON_EXECUTABLE}" "PYTHON_EXECUTABLE-NOTFOUND" PYTHON_EXECUTABLE_FOUND) if(NOT PYTHON_EXECUTABLE_FOUND) message(FATAL_ERROR "Python executable not found in ${PYTHONDIR}.") else() message("-- Found Python executable: ${PYTHON_EXECUTABLE}") endif() else() if(PYTHONVERSION) set(PythonLibs_FIND_VERSION ${PYTHONVERSION}) else() set(PythonLibs_FIND_VERSION 2) endif() find_package(PythonLibs) include(FindPythonInterp) endif() set(USE_PYTHON ${PYTHONLIBS_FOUND}) if(PYTHONLIBS_FOUND) find_package(Numpy QUIET) if(NOT PYTHON_NUMPY_FOUND) message(FATAL_ERROR "Python numpy package was not found.\n" "${PYTHONMSG} ${PYTHON_MODULEMSG}") endif(NOT PYTHON_NUMPY_FOUND) set(LIBRARIES ${LIBRARIES} ${PYTHON_LIBRARIES}) include_directories(${PYTHON_INCLUDE_DIRS} ${PYTHON_NUMPY_INCLUDE_DIR}) else(PYTHONLIBS_FOUND) message(FATAL_ERROR "Python is required but was not found.\n" "Use -DPYTHONDIR=DIR to specify the Python directory tree.\n" "Use -DPYTHONVERSION=VERSION to help searching for the right version.\n" "(suitable Debian/Ubuntu package: python-dev)\n" "(suitable Fedora package: python-devel)\n" "${PYTHONMSG} ${PYTHON_MODULEMSG}") endif(PYTHONLIBS_FOUND) endif(PYTHON OR PYTHON_MODULE) # udunits # -DUDUNITS=ON|OFF # -DUDUNITSDIR=DIR if(UDUNITS) set(CMAKE_PREFIX_PATH ${UDUNITSDIR}) find_package(Udunits QUIET) set(USE_UDUNITS ${UDUNITS_FOUND}) if(UDUNITS_FOUND) set(LIBRARIES ${LIBRARIES} ${UDUNITS_LIBRARIES}) include_directories(${UDUNITS_INCLUDE_DIR}) else(UDUNITS_FOUND) message(FATAL_ERROR "UDUNITS-2 is required but was not found.\n" "Use -DUDUNITSDIR=DIR to specify the Udunits directory tree.\n" "Use -DUDUNITS=OFF to not use it.\n" "(suitable Debian/Ubuntu package: libudunits2-dev)\n" "(suitable Fedora package: udunits2-devel)") endif(UDUNITS_FOUND) endif(UDUNITS) # eigen3 # -DEIGEN3=ON|OFF # -DEIGEN3DIR=DIR if(EIGEN3) set(CMAKE_PREFIX_PATH ${EIGEN3DIR}) find_package(Eigen3 QUIET) set(USE_EIGEN ${EIGEN3_FOUND}) if(EIGEN3_FOUND) include_directories(${EIGEN3_INCLUDE_DIR}) else(EIGEN3_FOUND) message(FATAL_ERROR "EIGEN3 is required but was not found.\n" "Use -DEIGEN3DIR=DIR to specify the Eigen3 directory tree.\n" "Use -DEIGEN3=OFF to not use it.\n" "(suitable Fedora package: eigen3-devel)") endif(EIGEN3_FOUND) endif(EIGEN3) # pslib # -DPSLIB=ON|OFF # -DPSLIBDIR=DIR if(PSLIB) set(CMAKE_PREFIX_PATH ${PSLIBDIR}) find_package(libps QUIET) set(USE_PSLIB ${LIBPS_FOUND}) if(LIBPS_FOUND) set(LIBRARIES ${LIBRARIES} ${LIBPS_LIBRARIES}) set(LINK_DIRECTORIES ${LINK_DIRECTORIES} ${LIBPS_LIBRARY_DIRS}) include_directories(${LIBPS_INCLUDE_DIRS}) else(LIBPS_FOUND) message(FATAL_ERROR "pslib is required but was not found.\n" "Use -DPSLIBDIR=DIR to specify the pslib directory tree.\n" "Use -DPSLIB=OFF to not use it.\n" "(suitable Debian/Ubuntu package: pslib-dev)\n" "(suitable Fedora package: pslib-devel)") endif(LIBPS_FOUND) endif(PSLIB) # grib # -DGRIB=ON|OFF # -DGRIBDIR=DIR if(GRIB) set(CMAKE_PREFIX_PATH ${GRIBDIR} ${JASPERDIR} ${JPEGDIR}) find_package(Grib QUIET) set(USE_GRIB ${GRIB_FOUND}) if(GRIB_FOUND) set(LIBRARIES ${LIBRARIES} ${GRIB_LIBRARIES}) include_directories(${GRIB_INCLUDE_DIR}) else(GRIB_FOUND) message(FATAL_ERROR "GRIB is required but was not found.\n" "Use -DGRIBDIR=DIR to specify the GRIB directory tree.\n" "Use -DGRIB=OFF to not use it.\n" "Use -DJASPERDIR=DIR and|or -DJPEGDIR=DIR to specify " "the directory trees of JasPer and openJPEG libraries.\n" "(suitable Debian/Ubuntu package: libgrib-api-dev)\n" "(suitable Fedora package: grib_api-devel)") endif(GRIB_FOUND) endif(GRIB) # gshhs # -DGSHHS=ON|OFF # -DGSHHSDIR=DIR if(GSHHS) set(CMAKE_PREFIX_PATH ${GSHHSDIR}) find_path(GSHHS_INCLUDE_DIR gshhs.h) mark_as_advanced(GSHHS_INCLUDE_DIR) set(USE_GSHHS ${GSHHS_INCLUDE_DIR}) if(USE_GSHHS) include_directories(${GSHHS_INCLUDE_DIR}) else(USE_GSHHS) message(FATAL_ERROR "GSHHS is required but gshhs.h was not found.\n" "Use -DGSSHSDIR=DIR to specify the GSHHS directory tree.\n" "Use -DGSHHS=OFF to not use it.") endif(USE_GSHHS) endif(GSHHS) # X11 if(X11) set(CMAKE_PREFIX_PATH ${X11DIR}) find_package(X11 QUIET) set(HAVE_X ${X11_FOUND}) if(X11_FOUND) set(LIBRARIES ${LIBRARIES} ${X11_LIBRARIES}) include_directories(${X11_INCLUDE_DIR}) else(X11_FOUND) message(FATAL_ERROR "X11 is required but was not found.\n" "Use -DX11DIR=DIR to specify the X11 directory tree.\n" "Use -DX11=OFF to not use it.") endif(X11_FOUND) endif(X11) add_subdirectory(src) if(NOT PYTHON_MODULE) add_subdirectory(testsuite) endif(NOT PYTHON_MODULE) install(FILES ${CMAKE_SOURCE_DIR}/AUTHORS ${CMAKE_SOURCE_DIR}/README DESTINATION ${CMAKE_INSTALL_PREFIX}/${GDL_DATA_DIR}) install(FILES ${CMAKE_SOURCE_DIR}/doc/gdl.1 DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1) # substitute variables in configure.h.cmake and move it to configure.h configure_file(${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h) # create a link src/gdl -> ${BUILD}/.../gdl # for windows, just copy the file if(NOT PYTHON_MODULE) get_target_property(GDLLOCATION gdl LOCATION) if(WIN32) add_custom_target(copy_gdl ALL ${CMAKE_COMMAND} -E copy ${GDLLOCATION} ${CMAKE_SOURCE_DIR}/src/gdl DEPENDS gdl) else(WIN32) add_custom_target(symlink_gdl ALL ${CMAKE_COMMAND} -E create_symlink ${GDLLOCATION} ${CMAKE_SOURCE_DIR}/src/gdl DEPENDS gdl) endif(WIN32) endif(NOT PYTHON_MODULE) # display macro macro(MODULE MOD NAME) if(${MOD}) message("${NAME} ON ${${MOD}_LIBRARIES}") else(${MOD}) message("${NAME} OFF") endif(${MOD}) endmacro(MODULE) # python if(PYTHON_MODULE) set(BUILDTYPE "Python Module") else(PYTHON_MODULE) set(BUILDTYPE "Standalone") endif(PYTHON_MODULE) # IF(NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." FORCE) ENDIF(NOT CMAKE_BUILD_TYPE) if(WIN32 AND NOT CYGWIN) SET(MACHINE_ARCH ${MSVC_C_ARCHITECTURE_ID}) IF(NOT MACHINE_ARCH) SET(MACHINE_ARCH ${MSVC_CXX_ARCHITECTURE_ID}) ENDIF(NOT MACHINE_ARCH) set_target_properties(gdl PROPERTIES LINK_FLAGS "/machine:${MACHINE_ARCH}") endif(WIN32 AND NOT CYGWIN) # AC, 12-oct-2011, solved by Marc # set_target_properties(gdl PROPERTIES LINK_FLAGS "-Wl,-z,muldefs") # set_target_properties(gdl PROPERTIES LINK_FLAGS "-z muldefs") # if(CMAKE_BUILD_TYPE STREQUAL None OR NOT CMAKE_BUILD_TYPE) set(FLAGS ${CMAKE_CXX_FLAGS}) elseif(CMAKE_BUILD_TYPE STREQUAL Debug) set(FLAGS ${CMAKE_CXX_FLAGS_DEBUG}) elseif(CMAKE_BUILD_TYPE STREQUAL Release) set(FLAGS ${CMAKE_CXX_FLAGS_RELEASE}) elseif(CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo) set(FLAGS ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}) elseif(CMAKE_BUILD_TYPE STREQUAL MinSizeRel) set(FLAGS ${CMAKE_CXX_FLAGS_MINSIZEREL}) endif(CMAKE_BUILD_TYPE STREQUAL None OR NOT CMAKE_BUILD_TYPE) message(STATUS "Summary GDL - GNU DATA LANGUAGE [${BUILDTYPE}] System ${CMAKE_HOST_SYSTEM} Files generated ${CMAKE_GENERATOR} GDL output ${GDLLOCATION} Installation prefix ${CMAKE_INSTALL_PREFIX} C++ compiler ${CMAKE_CXX_COMPILER} ${FLAGS}") message("") message(STATUS "Options") if(OPENMP AND OPENMP_FOUND) message("OpenMP support ON ${OpenMP_CXX_FLAGS}") else(OPENMP AND OPENMP_FOUND) message("OpenMP support OFF") endif(OPENMP AND OPENMP_FOUND) set(WXWIDGETS_LIBRARIES ${wxWidgets_LIBRARIES}) module(WXWIDGETS "WxWidgets ") module(MAGICK "ImageMagick") module(NETCDF "NetCDF ") module(HDF "HDF4 ") module(HDF5 "HDF5 ") module(FFTW "FFTW ") module(LIBPROJ4 "Libproj4 ") set(MPICH_LIBRARIES ${MPI_LIBRARIES}) module(MPICH "MPICH ") module(PYTHON "Python ") module(UDUNITS "UDUNITS-2 ") module(EIGEN3 "EIGEN3 ") module(GRAPHICSMAGICK "GRAPHICSMAGICK") module(GRIB "GRIB ") set(GSHHS_LIBRARIES ${GSHHS_INCLUDE_DIR}) module(GSHHS "GSHHS ") module(PSLIB "pslib ") module(X11 "Xlib ") message("") message(STATUS "Mandatory modules") set(PLPLOT ON) set(READLINE ON) set(GSL ON) set(ZLIB ON) set(CURSES ON) module(PLPLOT "Plplot ") module(OLDPLPLOT "Old Plplot ") module(READLINE "Readline ") module(GSL "GSL ") module(ZLIB "Zlib ") module(CURSES "Ncurses ") message("") gdl-0.9.4/templates/0000775000175000017500000000000012221570137012720 5ustar marcmarcgdl-0.9.4/templates/h0000664000175000017500000000174210156065335013102 0ustar marcmarc/*************************************************************************** $FILENAME$ - description ------------------- begin : $DATE$ copyright : (C) $YEAR$ by $AUTHOR$ email : $EMAIL$ ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ gdl-0.9.4/templates/cpp0000664000175000017500000000174210156065335013435 0ustar marcmarc/*************************************************************************** $FILENAME$ - description ------------------- begin : $DATE$ copyright : (C) $YEAR$ by $AUTHOR$ email : $EMAIL$ ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ gdl-0.9.4/Doxyfile0000664000175000017500000002264010517153361012436 0ustar marcmarc# Doxyfile 1.4.1-KDevelop #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- PROJECT_NAME = gdl.kdevelop PROJECT_NUMBER = 0.9 OUTPUT_DIRECTORY = CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English USE_WINDOWS_ENCODING = NO BRIEF_MEMBER_DESC = YES REPEAT_BRIEF = YES ABBREVIATE_BRIEF = "The $name class" \ "The $name widget" \ "The $name file" \ is \ provides \ specifies \ contains \ represents \ a \ an \ the ALWAYS_DETAILED_SEC = NO INLINE_INHERITED_MEMB = NO FULL_PATH_NAMES = NO STRIP_FROM_PATH = /usr/local/gdl/ STRIP_FROM_INC_PATH = SHORT_NAMES = NO JAVADOC_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO DETAILS_AT_TOP = NO INHERIT_DOCS = YES DISTRIBUTE_GROUP_DOC = NO TAB_SIZE = 8 ALIASES = OPTIMIZE_OUTPUT_FOR_C = NO OPTIMIZE_OUTPUT_JAVA = NO SUBGROUPING = YES #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- EXTRACT_ALL = NO EXTRACT_PRIVATE = NO EXTRACT_STATIC = NO EXTRACT_LOCAL_CLASSES = YES EXTRACT_LOCAL_METHODS = NO HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_CLASSES = NO HIDE_FRIEND_COMPOUNDS = NO HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = NO CASE_SENSE_NAMES = YES HIDE_SCOPE_NAMES = NO SHOW_INCLUDE_FILES = YES INLINE_INFO = YES SORT_MEMBER_DOCS = YES SORT_BRIEF_DOCS = NO SORT_BY_SCOPE_NAME = NO GENERATE_TODOLIST = YES GENERATE_TESTLIST = YES GENERATE_BUGLIST = YES GENERATE_DEPRECATEDLIST= YES ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 30 SHOW_USED_FILES = YES SHOW_DIRECTORIES = YES FILE_VERSION_FILTER = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- QUIET = NO WARNINGS = YES WARN_IF_UNDOCUMENTED = YES WARN_IF_DOC_ERROR = YES WARN_NO_PARAMDOC = NO WARN_FORMAT = "$file:$line: $text" WARN_LOGFILE = #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- INPUT = /usr/local/gdl FILE_PATTERNS = *.c \ *.cc \ *.cxx \ *.cpp \ *.c++ \ *.java \ *.ii \ *.ixx \ *.ipp \ *.i++ \ *.inl \ *.h \ *.hh \ *.hxx \ *.hpp \ *.h++ \ *.idl \ *.odl \ *.cs \ *.php \ *.php3 \ *.inc \ *.C \ *.H \ *.tlh \ *.diff \ *.patch \ *.moc \ *.xpm \ *.dox RECURSIVE = YES EXCLUDE = EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = EXAMPLE_PATH = EXAMPLE_PATTERNS = * EXAMPLE_RECURSIVE = NO IMAGE_PATH = INPUT_FILTER = FILTER_PATTERNS = FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- SOURCE_BROWSER = NO INLINE_SOURCES = NO STRIP_CODE_COMMENTS = YES REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = NO COLS_IN_ALPHA_INDEX = 5 IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = html HTML_FILE_EXTENSION = .html HTML_HEADER = HTML_FOOTER = HTML_STYLESHEET = HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = NO CHM_FILE = HHC_LOCATION = GENERATE_CHI = NO BINARY_TOC = NO TOC_EXPAND = NO DISABLE_INDEX = NO ENUM_VALUES_PER_LINE = 4 GENERATE_TREEVIEW = NO TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- GENERATE_LATEX = YES LATEX_OUTPUT = latex LATEX_CMD_NAME = latex MAKEINDEX_CMD_NAME = makeindex COMPACT_LATEX = NO PAPER_TYPE = a4wide EXTRA_PACKAGES = LATEX_HEADER = PDF_HYPERLINKS = NO USE_PDFLATEX = NO LATEX_BATCHMODE = NO LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- GENERATE_RTF = NO RTF_OUTPUT = rtf COMPACT_RTF = NO RTF_HYPERLINKS = NO RTF_STYLESHEET_FILE = RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- GENERATE_MAN = NO MAN_OUTPUT = man MAN_EXTENSION = .3 MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- GENERATE_XML = NO XML_OUTPUT = xml XML_SCHEMA = XML_DTD = XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- GENERATE_PERLMOD = NO PERLMOD_LATEX = NO PERLMOD_PRETTY = YES PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- ENABLE_PREPROCESSING = YES MACRO_EXPANSION = NO EXPAND_ONLY_PREDEF = NO SEARCH_INCLUDES = YES INCLUDE_PATH = INCLUDE_FILE_PATTERNS = PREDEFINED = EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- TAGFILES = GENERATE_TAGFILE = ALLEXTERNALS = NO EXTERNAL_GROUPS = YES PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- CLASS_DIAGRAMS = YES HIDE_UNDOC_RELATIONS = YES HAVE_DOT = NO CLASS_GRAPH = YES COLLABORATION_GRAPH = YES GROUP_GRAPHS = YES UML_LOOK = NO TEMPLATE_RELATIONS = NO INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = YES CALL_GRAPH = NO GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES DOT_IMAGE_FORMAT = png DOT_PATH = DOTFILE_DIRS = MAX_DOT_GRAPH_WIDTH = 1024 MAX_DOT_GRAPH_HEIGHT = 1024 MAX_DOT_GRAPH_DEPTH = 1000 DOT_TRANSPARENT = NO DOT_MULTI_TARGETS = NO GENERATE_LEGEND = YES DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- SEARCHENGINE = NO gdl-0.9.4/AUTHORS0000664000175000017500000000125012046335730011773 0ustar marcmarcProject founder: Marc Schellens Contributors: Joel Gales Christopher Lee Gaurav Khanna Peter Messmer Pierre Chanial Justin Bronn Médéric Boquien Alain Coulais (tests, bugs) Sylwester Arabas Gilles Duvert ... see doc/udg/chapters/credits.tex for a more complete list gdl-0.9.4/gdl.kdevelop0000664000175000017500000002325211353235554013235 0ustar marcmarc Marc Schellens m_schellens@users.sourceforge.net 0.9 KDevAutoProject C++ C++ Code . false Python gdl src/gdl debug true /home/marc/gdl/debug/src/gdl false executable / true /home/marc/gdl/debug/src true false false optimized kdevgccoptions kdevgppoptions kdevg77options -O2 -DNDEBUG -msse3 -mfpmath=sse,387 --enable-debug=full --with-netcdf=no --with-python=no --with-hdf=no --with-hdf5=no --with-plplot=/usr --with-python=no --disable-python_module --with-wxWidgets=no --with-Magick=yes --enable-oldplplot --with-readlinedir=yes --with-hdf=yes --with-hdf5=yes --with-plplotdir=/usr/local --with-python=yes --disable-python_module --with-netcdf=no --disable-oldplplot --with-openmp=no --with-libproj4=no --with-mpich=/usr/lib/mpich --with-wxWidgets=yes --with-Magick=yes debug kdevgccoptions kdevgppoptions kdevg77options -O0 -g3 --with-python=yes --with-hdf=no --with-hdf5=no --with-netcdf=/usr/local --disable-python_module default -pg kdevgccoptions kdevgppoptions kdevg77options -O3 -g3 -DNDEBUG true 2 false 0 true ada ada_bugs_gcc bash bash_bugs clanlib w3c-dom-level2-html fortran_bugs_gcc gnome1 gnustep gtk gtk_bugs haskell haskell_bugs_ghc java_bugs_gcc java_bugs_sun kde2book opengl pascal_bugs_fp php php_bugs perl perl_bugs python python_bugs qt-kdev3 ruby ruby_bugs sdl w3c-svg sw w3c-uaag10 wxwindows_bugs Guide to the Qt Translation Tools Qt Assistant Manual Qt Designer Manual Qt Reference Documentation qmake User Guide KDE Libraries (Doxygen) html/ html/ false false *.o,*.lo,CVS false false .hpp .cpp true true true false true true true 250 400 250 false 0 true true false std=_GLIBCXX_STD;__gnu_cxx=std true false false false true true true false .; false false set m_,_ theValue true true false 3 /usr/share/qt3 3 EmbeddedKDevDesigner false true Vertical true true true false true true 10 true true true true -C /home/marc/gdl/tags gdl-0.9.4/INSTALL0000664000175000017500000002337712104234621011762 0ustar marcmarcQUICK INSTALLATION: =================== (If you encounter any problems, please read on further, also have a look at the REQUIREMENTS section in the README file.) * unpack the tarball under any directory (tar xfvz gdl-VERION.tar.gz) * change to the new subdirectory gdl-VERSION * type "./configure" (use './configure --help' for a list of options) * type "make" (use 'make -j N' to run N parallel processes) * optionally type "make check" to test the build * type "make install" to deploy GDL binary (gdl), libraries, manpage, etc See INSTALL.CMake on instructions how to configure GDL using CMake. If you know IDL, you should feel very familiar with GDL. A list of command-line options is available both in the manpage and after typing "gdl --help". Some GDL test files are in the gdl/testsuite subdirectory (test_*.pro) Note: When compiling you might get some warnings: "datatype.cpp: comparison is always false due to limited range of data type" That's OK. Please see the comment in datatypes.cpp near the warning for an explanation. If you have an old Plplot version (before 5.9.0) you must say it using --enable-oldplplot If you are compiling GDL source from the repository (i.e. not a release), and not using CMake, first you have to generate the "configure" script and other related files by invoking "autoreconf -i". BUILDING GDL AS A PYTHON MODULE: ================================ to build the GDL python module, configure must be run with the --enable-python_module option (i.e. if you wish to use the GDL standalone version *and* use GDL from within python, you need to build (configure/make) it twice. For python standards, the installation procedure is quite 'unconventional' but simple: You need to run configure with the --enable-python_module option. All other options are the same: [OS X note: Due to some incompatibilities, on OS X you might have to recreate the configure script (this is if the building of libantlr aborts with an error message): alocal && automake && autoconf ] ./configure --enable-python_module make The result is a dynamic library file "libgdl.so.0.0.0" ("libgdl.0.0.0.dylib" on OS X) in the "src/.libs" subdir. Copy these library into your python site-packages (e.g. /usr/lib/python2.3/site-packages) directory as GDL.so (same name on OS X) (note the capital letters) and you are done. See PYTHON.txt for further information. OPTIONS TO CONFIGURE SCRIPT: ============================ Apart form the further down mentioned options, the following options can be used: --enable-python_module build the GDL python module instead of the standalone program (default). See above. --enable-python_version=VERSION# the configure script tries to automatically determine which python version is actually used. With this option the version can be expicitely set (e.g. --enable-python_version=2.6). --with-ncursesdir=DIR to specify the ncurses (or curses) directory tree --with-readlinedir=DIR to specify the GNU readline directory tree --with-libzdir=DIR to specify the Zlib directory tree --with-openmp=no to disable the OpenMP support (e.g. for GCC <4.2) --with-gsldir=DIR to specify the GSL directory tree --with-plplotdir=DIR to specify the plplot directory tree --enable-oldplplot to specify that you have an older than 5.9.0 plplot lib. --with-Magick=DIR to specify the ImageMagick directory tree --with-Magick=no to not use ImageMagick --with-netcdf=DIR to specify the netcdf directory tree --with-netcdf=no to not use netcdf --with-fftw=DIR to specify the FFTW directory tree --with-fftw=no to not use FFTW --with-eigen=DIR to specify the Eigen3 directory tree ... and so on for: wxWidgets, hdf, hdf5, fftw, libproj4, python, udunits, grib, GSHHS, and others - see README file for details (REQUIREMENTS section). For example, if you have python installed in /usr/local, use ./configure --with-python=/usr/local Basic Installation Instructions =============================== The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, a file `config.cache' that saves the results of its tests to speed up reconfiguring, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.in' is used to create `configure' by a program called `autoconf'. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of `autoconf'. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. You can give `configure' initial values for variables by setting them in the environment. Using a Bourne-compatible shell, you can do that on the command line like this: CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure Or on systems that have the `env' program, you can do it like this: env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not supports the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' can not figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it can not guess the host type, give it the `--host=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name with three fields: CPU-COMPANY-SYSTEM See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are building compiler tools for cross-compiling, you can also use the `--target=TYPE' option to select the type of system they will produce code for and the `--build=TYPE' option to select the type of system on which you are compiling the package. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Operation Controls ================== `configure' recognizes the following options to control how it operates. `--cache-file=FILE' Use and save the results of the tests in FILE instead of `./config.cache'. Set FILE to `/dev/null' to disable caching, for debugging `configure'. `--help' Print a summary of the options to `configure', and exit. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `--version' Print the version of Autoconf used to generate the `configure' script, and exit. `configure' also accepts some other, not widely useful, options. gdl-0.9.4/README0000664000175000017500000003345312221053543011607 0ustar marcmarc GDL - GNU Data Language ======================= A free IDL (Interactive Data Language) compatible incremental compiler (capable of running programs written in IDL/GDL). IDL is a registered trademark of ITT Visual Information Solutions (see: http://www.ittvis.com). HOMEPAGE: ========= http://gnudatalanguage.sourceforge.net FEATURES: ========= Full syntax compatibility with IDL up to version 7.1 (for 8.0 and later see below). All IDL language elements up to IDL version 7.1 are supported, including: Pointer, objects, structs, arrays, system variables, common blocks, assoc variables, all operators, all datatypes, _EXTRA, _STRICT_EXTRA and _REF_EXTRA keywords... Supported IDL 8.0 language elements: FOREACH loop negative array indices garbage collection pointers and objects call methods on an object using "." (e. g. object.aMemberProcedure,arg1) empty arrays and !NULL system variable automatic promotion of FOR loop variable types LIST and HASH types Not yet supported: simplified property access on objects (e. g. object.aProperty = value & print,object.aProperty) GUI support (widgets) is now officially provided (not complete yet). The file input output system is fully implemented including full support of F77_UNFORMATTED. (Exception: For formatted I/O the C() sub-codes are not supported yet) netCDF files are fully supported. HDF4 files are supported. Basic support for HDF5 files. DICOM files are supported via the GDLffDICOM object (http://idl.barnett.id.au/idl-projects) (files in the src/pro/dicom subdirectory). Overall more than 400 library routines are implemented. For a list enter HELP,/LIB at the command prompt and look for library routines written in GDL in the src/pro subdirectory. Graphical output is almost completely implemented (no object-graphics). The PLOT, OPLOT, PLOTS, XYOUTS, SURFACE, CONTOUR and TV commands (along with WINDOW, WDELETE, SET_PLOT, WSET, TVLCT, LOADCT) are working (most keywords, !P system variable tags and multi-plots are supported) for X windows, z-buffer and postscript output. GDL has an interface to python. Python can be embedded into GDL and GDL can be compiled as a python module. See the file PYTHON.txt for details. For the thread pool OpenMP is utilized if the compiler supports it. REQUIREMENTS: ============= In short: Mandatory libraries: plplot http://plplot.sourceforge.net/source/index.html gsl http://www.gnu.org/software/gsl readline http://ftp.gnu.org/pub/gnu/readline/readline-4.3.tar.gz zlib http://www.zlib.net/ Optional libraries: Eigen http://eigen.tuxfamily.org ImageMagick http://www.imagemagick.org/www/download.html netCDF *) ftp://ftp.unidata.ucar.edu/pub/netcdf HDF4 *) ftp://ftp.ncsa.uiuc.edu/HDF/HDF/HDF_Current HDF5 ftp://ftp.ncsa.uiuc.edu/HDF/HDF5/current FFTW http://www.fftw.org/download.html python http://www.python.org libproj4 (consult the MAP_INSTALL file) UDUNITS-2 http://www.unidata.ucar.edu/software/udunits/ GRIB API http://www.ecmwf.int/products/data/software/grib_api.html GSHHS (consult the MAP_INSTALL file) wxWidgets http://www.wxwidgets.org/ pslib http://pslib.sourceforge.net/ Only with python: numpy http://numpy.scipy.org/ *) please see below for potential problems using netCDF and HDF4 NOTE: If you install the libraries as precompiled packages rather than compiling them from sources, please note that depending on your distribution, you may need development packages as well. Examples are (for Fedora): plplot-devel ImageMagick-devel ImageMagick-c++-devel Since version 0.9 GDL compiles Craig Markwardt's CMSVLIB. If installed, the SAVE and RESTORE commands (data only) are available through wrapper routines. You get CMSVLIB here: http://cow.physics.wisc.edu/~craigm/idl/down/cmsvlib.tar.gz You must add yourself the CMSVLIB path in the GDL_PATH. CMSVLIB provides a test suite: please run CMSV_TEST. At least g++ 3.2 (or a similar C++ standard conforming compiler) is needed for compiling GDL. Note that due to problems with static casts g++ 3.3.1 does NOT compile GDL, but 3.3.2 and 3.4.1 work fine again. GDL compiles under Mac OS X (10.2, 10.3) with g++ 3.3 . The GNU readline library 4.3 is needed (actually GDL should compile without, but its very inconvenient to use that way, furthermore proper event handling for graphic windows requires readline). You can get it at: http://ftp.gnu.org/pub/gnu/readline/readline-4.3.tar.gz For the graphics support of GDL, the plplot library version 5.9 is necessary. PLplot >= 5.9.9 is recommended. See below if you have an older version of plplot. To download plplot please look here: http://plplot.sourceforge.net/source/index.html If you have plplot older than 5.9.0 use the configure option --enable-oldplplot With this option, plplot down to 5.3 should work. A possible problem was reported: On opening more than one window, plplot causes a segmentation fault if GDL is compiled with ImageMagick. This happens if plplot uses dynamic drivers. The current solution is to disable dynamic drivers for plplot (-DENABLE_DYNDRIVERS=OFF option for cmake). Current ubuntu/debian distributions are using dynamic drivers, so plplot needs to be compiled from source there. Furthermore you need the GNU Scientific Library (GSL). Please see file HACKING if you want to write functions extending GDL (i. e. add a library subroutine) which use GSL for proper handling of GSL obects in GDL. (Minimal version is 1.7, which is now checked via "gsl.m4". Note that version 1.1.1 was reported to NOT work with GDL) You find it at: http://www.gnu.org/software/gsl The Eigen library version 3.1 or later is highly recommended for a performance boost. To be found at: http://eigen.tuxfamily.org GDL supports GUI (widget) programming (thanks to Joel Gales) using the wxWidgets library. It is required by default. If you don't want to use it, use --with-wxWidgets=no wxWidgets can be obtained from: http://www.wxwidgets.org/downloads Only some WIDGET_... functions are implemented so far (use HELP,/LIB for an overview). The HDF4 format is (not completely yet) supported (thanks to Joel Gales). If you want to use it, you need the HDF library (here HDF always means version 4). Note that if you plan to use netCDF also, it might be necessary to install HDF4 before netCDF due to same named but different header files which are overwritten by the HDF4 version otherwise. HDF4 is required by default. If you don't want to use it, use --with-hdf=no Note that HDF in turn needs other libraries. Check out the homepage for more information: http://hdf.ncsa.uiuc.edu/ The HDF library can be downloaded from: ftp://ftp.ncsa.uiuc.edu/HDF/HDF/HDF_Current Basic support for HDF5 is now provided (thanks to Peter Messmer). If you want to use it, you need the HDF5 library. It is required by default. If you don't want to use it, use --with-hdf5=no Note that HDF5 in turn needs other libraries. Check out the homepage for more information: http://hdf.ncsa.uiuc.edu/HDF5 The HDF5 library can be downloaded from: ftp://ftp.ncsa.uiuc.edu/HDF/HDF5/current The netCDF format is fully supported (thanks to Christopher Lee). If you want to use netCDF, you need the netCDF library (even if HDF4 is used, the netCDF library is needed, as the HDF library does not contain all needed netCDF functions. Note that it might be necessary to install netCDF after HDF4 due to same named, but different header files. If the header files of HDF4 and netCDF are in different directories make sure, that the directory containing netCDF's version gets searched first, ie. put an explicit path for netCDF even if it is in the default include path, eg: --with-netcdf=/usr) netCDF is used by default. If you don't want to use it, use --with-netcdf=no as a command line option to 'configure'. netCDF is available from: ftp://ftp.unidata.ucar.edu/pub/netcdf From the HDF4 INSTALL file: To use the HDF/MFHDF libraries (libdf.a, libmfhdf.a) with the original netCDF library (libnetcdf.a), the HDF4 distribution must be configured with the --disable-netcdf configuration flag. This will rename the HDF version of the C interface (ncxxx) of the HDF4 netCDF APIs to sd_ncxxx and will disable the HDF4 NC Fortran interfaces to avoid name clashes with the original netCDF C and Fortran APIs from libnetcdf.a. In order to read and write images in several formats (e.g. JPEG, PNG), GDL uses ImageMagick. It is required by default. If you don't want to use it, use --with-Magick=no ImageMagick can be obtained from: http://www.imagemagick.org/www/download.html The FFTW library is (optionally) used for the FFT function. It is available at: http://www.fftw.org/download.html It is NOT used by default. If you want to use it, use --with-fftw=DIR as a command line option to 'configure', where DIR denotes the directory into which FFTW was installed ('/lib' is appended for the library, '/include' for the include files). Using FFTW results in an about double as fast FFT function. Take care that you have to compile the "normal" and the "single" version of the library (resp. libfftw3.a and libfftw3f.a). First one is the default. You have to activate the single flag (./configure --enable-single) when recompiling FFTw3. Please also notice that the test when runnig GDL configure "checking for fftw_malloc in -lfftw3... yes" will failed if libfftw3f.a is missing. As mentionned in the log. of ./configure, if FFTw is not used, the default (GSL) fft routine is used instead. GDL contains now a preliminary support to MAP projection, using the libproj4 http://members.verizon.net/~vze2hc4d/proj4/ library. Please see MAP_INSTALL file. It is NOT used by default. If you want to use it, use --with-libproj4=DIR GDL has an interface to python (see http://www.python.org). GDL can be used as a python module and python can be used from within GDL. See INSTALL for details on how to build each version. As so far there are only two example GDL extensions written in python its use is optional for now but required by default. If you don't want to use it, use --with-python=no as a command line option to 'configure'. If you want to use it you need python and the python package Numpy. (http://numpy.scipy.org/). The GDL configure script will determine the installed python version automatically. For this the python executable must be installed. The python version can be explictely set with --enable-python_version=VERSION# (eg. --enable-python_version=2.3). Note: For embedding python as it is done by GDL, the python dynamic library is needed which is *not* build by default. You need to run 'configure' for python with the '--enable-shared' option. Please see the python README file for details. For nice graphical output the python package matplotlib (http://matplotlib.sourceforge.net) is used in one of the examples. See the file PYTHON.txt for more details. GDL supports unit converion in IMSL_CONSTANT using the UDUNITS-2 library (http://www.unidata.ucar.edu/software/udunits/) If you want to use it, use --with-udunits=DIR GDL supports the GRIB file format - see README_GRIB (optional) GDL uses GSHHS to implement MAP_CONTINENTS - see MAP_INSTALL (optional) GDL uses pslib for fine-tuning PostScript output. (optional) GDL uses Eigen for fast matrix multiplication. (optional) The simpliest way to compile with it is to copy all the header files under sub-directory src/Eigen. Another solution is to provide full path to the include files (e.g. --with-eigen=/home/toto/Eigen3.1.4/include/eigen3/ in that case Eigen would have been prepared using: cmake . -DCMAKE_INSTALL_PREFIX=/home/toto/Eigen3.1.4/ ) GDL 0.9 was developed using ANTLR 2.7.6, but unless you want to change the grammar (*.g files) you don't need ANTLR. All relevant ANTLR files are included in the package. For more information on ANTRL see: http://www.antlr.org GDL is currently developed using KDevelop 3.5.5 under the GNU/Linux distribution Kubuntu. The KDevelop project file is included in the tarball, so if you have KDevelop you should be able to use it with GDL seamlessly. INSTALLATION: ============= Please see the INSTALL file for details. For an alternative installation using CMake see INSATLL.CMake . For french readers, please have a look to http://aramis.obspm.fr/~coulais/IDL_et_GDL/memo_GDL0.8.11.html which explain how to install GDL and most libraries from scratch and without being root. CONTRIBUTIONS: ============== GDL 0.9 is actively developed, but due to the vast amount of subroutines to implement still in beta state as of December 2010. Even though it can already be used for several tasks, there are many things to be done. Bug reports, feedback in general and interested people who would like to join this project are welcome. Extensions to GDL can be made in C++, GDL or python. Urgent things to do are: Library functions and procedures, Porting GDL to other platforms, Completing the graphical output system, Testing and test routines written in GDL, Implementing GUI library functions. HACKING: ======== please see file HACKING for details. There you find also information about LINKIMAGE. CONTACT: ======== Comments are welcome. Let me know what you use GDL for. Or if you don't, why not. Which functionality are you missing/would appreciate most for comming versions. Please use for bug reports, complaints, suggestions and comments the trackers on the project summary page (http://sourceforge.net/projects/gnudatalanguage) LICENSE: ======== 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. (It should be included in this package in the file COPYING ) gdl-0.9.4/Makefile.am0000664000175000017500000000036711330574523012767 0ustar marcmarc# not a GNU package. You can remove this line, if # have all needed files, that a GNU package needs # AUTOMAKE_OPTIONS = foreign 1.4 SUBDIRS = src testsuite doc basicdocdir = $(GDLDATADIR) basicdoc_DATA = AUTHORS README EXTRA_DIST = prolib_DATA gdl-0.9.4/MAP_INSTALL0000664000175000017500000000655411364122263012462 0ustar marcmarc=========================================================================== To provide map projections support your first need to make sure the libproj4 library is installed. The source code for this can be found at: http://home.comcast.net/~gevenden56/proj/ (http://home.comcast.net/~gevenden56/proj/libproj4.3_20081120.tar.bz2) The "--with-libproj4=DIR" switch in configure can be used give the location of this library. The following additional PRO files must be acquired and placed in the appropriate directories: map_grid.pro map_horizon.pro map_image.pro map_patch.pro map_point_valid.pro map_proj_image.pro map_proj_info.pro map_proj_init_commonblock.pro map_proj_init_common.pro map_proj_init.pro map_set.pro map_struct_append.pro These files can be found by entering the following URL into your web browser: http://idlastro.gsfc.nasa.gov/cgi-bin/idllibsrch?keyword=map_ clicking on the appropriate file and saving it to your computer. They can be placed in any directory within you GDL path. =========================================================================== MAP_CONTINENTS is implemented in GDL using the GSHHS (Global Self-consistent, Hierarchical, High-resolution Shoreline Database) available under the GNU GPL. To provide support for MAP_CONTINENTS the database files and one header file (gshhs.h) need to be downloaded e.g. from: ftp://ftp.soest.hawaii.edu/pwessel/gshhs The header file for the 2.0 dataset is in the gshhs_1.12_src.zip file. The datafiles (*.b) are in the gshhs_2.0.tbz file. When compiling GDL, the --with-gshhs option must be given (not enabled by default), optionally with an argument pointing to the GSHHS installation prefix: --with-gshhs : searches gshhs.h in the default include path of the compiler --with-gshhs=/usr/local : searches for /usr/local/include/gshhs.h GDL searches for the GSHHS datafiles (gshhs_f.b, gshhs_l.b, etc...) in the $GDLDATADIR/../gshhs/ directory (we need a better solution - FIXME!) Reference: Wessel, P. and Smith, W.H.F., 1996. A global, self-consistent, hierarchical, high-resolution shoreline database. J. Geophys. Res., 101(B4): 8741--8743. =========================================================================== The following projections are at least partially supported (numbers defined in the map_sep.pro file itself): Stereographic Projection: (1) Orthographic Projection: (2) Lambert Conformal Conic: (3) Lambert Equal Area Conic: (4) Gnomonic: (5) Azimuthal Equidistant: (6) Satellite: (7) (add 28/07/2008) Cylindrical Equidistant: (8) Mercator: (9) Aitoff: (12) Robinson: (17) (add 28/07/2008) NOTE: Map projection support in GDL is a work in progress. There are BUGS!! These will be fixed as time permits. Additional projections will also be added in the same manner. Bug reports and projection requests are appreciated. Joel Gales PS (by AC): a demo ("test_map.pro") is now available in the testsuite/. If not in the PATH, you must provide the root of the path to the database files (if file "plow.dat" is here /opt/GDL/lib_GDL_0.9/resource/maps/low/plow.dat --> you must provide /opt/GDL/lib_GDL_0.9/ to "test_map" or you can call it via "test_map, dir='/opt/GDL/lib_GDL_0.9/') This demo has been succesfully tested on Linux x86_32 and x86_64. Please reports BUG with as simple as possible code giving it ! gdl-0.9.4/config.h.cmake0000664000175000017500000000346712145260435013433 0ustar marcmarc#ifndef __CONFIG_H__ #define __CONFIG_H__ #define EXEC_PREFIX "@CMAKE_INSTALL_PREFIX@" #define GDLDATADIR "@CMAKE_INSTALL_PREFIX@@GDL_DATA_DIR@" #define VERSION "@VERSION@" #cmakedefine HAVE_X 1 #cmakedefine HAVE_64BIT_OS 1 #cmakedefine HAVE_DLFCN_H 1 #cmakedefine HAVE_GSHHS_H 1 #cmakedefine HAVE_INTTYPES_H 1 #cmakedefine HAVE_LIBCURSES 1 #cmakedefine HAVE_LIBGSL 1 #cmakedefine HAVE_LIBGSLCBLAS 1 #cmakedefine HAVE_LIBNCURSES 1 #cmakedefine HAVE_LIBPLPLOTCXXD 1 #cmakedefine HAVE_LIBREADLINE 1 #cmakedefine HAVE_LIBWXWIDGETS 1 #cmakedefine HAVE_LIBZ 1 #cmakedefine HAVE_LOCALE_H 1 #cmakedefine HAVE_SBRK 1 #cmakedefine HAVE_MALLINFO 1 #cmakedefine HAVE_MALLOC_H 1 #cmakedefine HAVE_MALLOC_MALLOC_H 1 #cmakedefine HAVE_MALLOC_ZONE_STATISTICS 1 #cmakedefine HAVE_MEMORY_H 1 #cmakedefine HAVE_NEXTTOWARD 1 #cmakedefine HAVE_OLDPLPLOT 1 #cmakedefine HAVE_PLPLOT_SLABELFUNC 1 #cmakedefine PLPLOT_PRIVATE_NOT_HIDDEN 1 #cmakedefine PLPLOT_HAS_LEGEND #ifndef HAVE_STDINT_H #cmakedefine HAVE_STDINT_H 1 #endif #ifndef HAVE_STDLIB_H #cmakedefine HAVE_STDLIB_H 1 #endif #ifndef HAVE_STRINGS_H #cmakedefine HAVE_STRINGS_H 1 #endif #ifndef HAVE_STRING_H #cmakedefine HAVE_STRING_H 1 #endif #ifndef HAVE_SYS_STAT_H #cmakedefine HAVE_SYS_STAT_H 1 #endif #ifndef HAVE_SYS_TYPES_H #cmakedefine HAVE_SYS_TYPES_H 1 #endif #ifndef HAVE_UNISTD_H #cmakedefine HAVE_UNISTD_H 1 #endif #cmakedefine OLD_DARWIN #cmakedefine PYTHON_MODULE 1 #cmakedefine RL_GET_SCREEN_SIZE 1 #cmakedefine STDC_HEADERS 1 #cmakedefine USE_FFTW 1 #cmakedefine USE_GRIB 1 #cmakedefine USE_GSHHS 1 #cmakedefine USE_HDF 1 #cmakedefine USE_HDF5 1 #cmakedefine USE_LIBPROJ4 1 #cmakedefine USE_LIBPROJ4_NEW 1 #cmakedefine USE_MAGICK 1 #cmakedefine USE_MPI 1 #cmakedefine USE_NETCDF 1 #cmakedefine USE_PYTHON 1 #cmakedefine USE_UDUNITS 1 #cmakedefine USE_PSLIB 1 #cmakedefine USE_EIGEN 1 #endif gdl-0.9.4/ChangeLog0000664000175000017500000146655012221053543012512 0ustar marcmarcGDL 0.9.4: 2013-09-26 m_schellens * src/prognode.cpp, src/prognodeexpr.cpp, src/basic_fun.cpp, src/envt.hpp: fixed return by reference for return of local variables * src/basic_fun.cpp, src/dcompiler.cpp, src/newprognode.cpp, src/prognode.cpp, src/prognode.hpp: fixed reference parameters with ++ -- r+ 2013-09-25 m_schellens * src/prognode.cpp, src/prognode_lexpr.cpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp: trinary operator optimizations * src/pro/str_sep.pro: working STR_SEP * src/pro/factorial.pro, src/GDLInterpreter.hpp, src/envt.cpp, src/envt.hpp, src/gdlarray.hpp, src/gdlc.i.g, src/prognode.cpp: ref check function return value * src/basic_fun.cpp, src/prognode.cpp: fixed ParameterDirect (wrong return reference set) * testsuite/test_suite.pro, src/GDLTreeParser.cpp, src/gdlc.i.g, src/gdlc.tree.g, src/prognode.cpp, src/prognode_lexpr.cpp, src/prognodeexpr.cpp, src/GDLInterpreter.cpp: fixed pass by reference for functions as parameters 2013-09-24 slayoo * doc/www/faq.php: updating FAQ entry on CATCH 2013-09-24 gilles-duvert * src/math_utl.cpp: functions machar_[s,d] must not be optimized by clever compilers such as icc -- will then loop forever... Perhaps should be revised... * src/math_fun_jmg.cpp: permits to compile with icc 2013-09-24 m_schellens * src/envt.cpp, src/gsl_fun.cpp, src/prognode.cpp, src/widget.cpp: fixed widget.cpp * src/GDLTreeParser.cpp, src/envt.cpp, src/envt.hpp, src/gdlc.i.g, src/gdlc.tree.g, src/overload.cpp, src/prognode.cpp, src/prognodeexpr.cpp, src/GDLInterpreter.cpp: sync 2013-09-23 m_schellens * src/envt.hpp, src/gdlc.i.g, src/gsl_fun.cpp, src/list.cpp, src/math_fun_gm.cpp, src/overload.cpp, src/prognode.cpp, src/typedefs.hpp, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/basic_fun.cpp, src/basic_fun_cl.cpp, src/basic_fun_jmg.cpp, src/basic_pro.cpp, src/datalistt.hpp, src/dvar.cpp: small optimizations 2013-09-23 alaingdl * src/initsysvar.cpp: correcting typo in "initsysvar.cpp" * src/initsysvar.cpp, src/objects.cpp: removing a comment; adding a "bluid_date" in !GDL 2013-09-23 m_schellens * src/dstructdesc.hpp, src/envt.cpp, src/envt.hpp, src/list.cpp, src/list.hpp, src/overload.cpp: Made LIST HEAP_GC friendly 2013-09-22 m_schellens * src/basic_fun_jmg.cpp: small changes relating to OVERWRITE keywords * src/basic_fun.cpp, src/basic_fun_jmg.cpp, src/gsl_fun.cpp, src/libinit.cpp: Fixes for changed API for library functions: left-return values must be explicitely set * src/fftw.cpp, src/gsl_fun.cpp, src/libinit_jmg.cpp, src/basic_fun.cpp, src/envt.cpp, src/prognodeexpr.cpp: fixed regression test_bug_3152899 * src/default_io.cpp, src/devicex.hpp, src/dinterpreter.cpp, src/dstructgdl.hpp, src/envt.cpp, src/envt.hpp, src/gdlarray.hpp, src/gdlc.i.g, src/gsl_fun.cpp, src/hdf5_fun.cpp, src/io.cpp, src/libinit.cpp, src/libinit_ac.cpp, src/libinit_cl.cpp, src/libinit_gm.cpp, src/libinit_jmg.cpp, src/libinit_mes.cpp, src/libinit_ng.cpp, src/list.cpp, src/math_fun_gm.cpp, src/math_fun_jmg.cpp, src/math_fun_ng.cpp, src/math_utl.cpp, src/ncdf_var_cl.cpp, src/overload.cpp, src/plotting.cpp, src/plotting_map_proj.cpp, src/prognode.cpp, src/prognode_lexpr.cpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp, src/widget.cpp, src/GDLInterpreter.hpp, src/assocdata.cpp, src/assocdata.hpp, src/basic_fun.cpp, src/basic_fun_cl.cpp, src/basic_fun_jmg.cpp, src/basic_op.cpp, src/basic_pro.cpp, src/basic_pro_jmg.cpp, src/GDLInterpreter.cpp: Changed API for library functions: left-return values must be explicitely set 2013-09-20 gilles-duvert * src/gsl_matrix.cpp: apparently the permutation order 's' is not used here. * src/plotting_cursor.cpp: variable "idata" was used before its value was set... 2013-09-19 alaingdl * testsuite/test_bug_3104326.pro: revisiting this test to check 3 important points when Execution is halted (line number in file, path to the file, name of the pro/func) * src/basic_pro.cpp, src/libinit.cpp: adding (obsolete) keyword /All_Keys to HELP procedure, with few useful examples. 2013-09-17 gilles-duvert * src/getas.cpp, src/hash.cpp, src/hash.hpp, src/list.hpp, src/matrix_cholesky.cpp, src/overload.cpp: added linefeed at end of file -- was generating warnings for some compilers. * src/gsl_fun.cpp: patch to stop ekopath's 'pathcc' compiler error. * src/math_fun_gm.cpp, src/plotting_contour.cpp, src/plotting_shade_surf.cpp, src/plotting_surface.cpp, src/antlr/ASTFactory.hpp: support for ekopath's 'pathcc' compiler * src/plotting.cpp, src/plotting_convert_coord.cpp, src/plotting_plots.cpp, src/plotting_xyouts.cpp: removed simple nan-test that apparently is 'optimized' by compilers 2013-09-17 m_schellens * src/assocdata.cpp, src/assocdata.hpp, src/basic_pro.cpp: fixed bug #557 * src/arrayindex.hpp, src/arrayindexlistt.hpp, src/basic_fun.cpp, src/list.cpp, src/GDLInterpreter.cpp: fixed bug emerging from test_bug_3300626 2013-09-17 alaingdl * src/gdlgstream.hpp: fixing warning format in a "fprintf" * src/dstructgdl.cpp, src/envt.cpp: continuing cleaning code using CLang options (here dangling Else) * src/file.cpp: continuing cleaning code using CLang options (here 2x dangling Else) * src/dpro.cpp: continuing cleaning code using CLang options (here dangling Else) * src/datatypesref.cpp: continuing cleaning code using CLang options (here 2x dangling Else) * src/basic_fun_jmg.cpp, src/arrayindex.cpp: continuing cleaning code using CLang options (here dangling Else) * src/datatypes.cpp: continuing cleaning code using CLang options (here 2x dangling Else) * src/gdlgstream.hpp: CLang complains here due to [-Wlogical-op-parentheses] * src/list.cpp, src/str.cpp, src/read.cpp: continuing cleaning code using CLang options (here dangling Else) 2013-09-16 alaingdl * src/gsl_fun.cpp: "dangling else", thanks to CLang warnings. * src/gsl_fun.cpp: fixing trivial warning coming from CLang default compilation. * src/GDLInterpreter.hpp, src/devicex.hpp, src/plotting_windows.cpp, src/widget.cpp: starting fixing obvious bugs (= instead ==) or "dangling else", thanks to CLang warnings. 2013-09-16 m_schellens * src/list.cpp: fixed LIST with negative LENGTH KW 2013-09-10 gilles-duvert * src/basic_pro.cpp: option LAST_MESSAGE for HELP now correctly supports the presence of the OUTPUT keyword 2013-09-07 gilles-duvert * src/basic_pro.cpp: Corrected positive year dates that were wrong by 1 day. Note that Julian date does not vary between 5 and 15 October 1582 (correct behaviour). 2013-09-04 gilles-duvert * src/plotting.cpp: solves bug #565 2013-08-30 alaingdl * src/pro/calendar.pro: fixing a (old) input conversion error (bug #218) in CALENDAR. * testsuite/Makefile.am, testsuite/test_array_equal.pro, testsuite/test_netcdf.pro: initial import of "test_array_equal.pro" (some basic test cases for ARRAY_EQUAL were wrong) and "test_netcdf.pro", a to-be-finished merging of various tests cases for NetCDF format. * src/basic_fun.cpp: correction a bug in ARRAY_EQUAL when one of the inputs arrays is an array with only one element: ARRAY_EQUAL(1,[1,1]) is True, ARRAY_EQUAL([1],[1,1]) is False !! Test cases to be put in the testsuite. * src/envt.cpp: in "envt.cpp", GetParDefined() should throw when the variable is undefined OR explicitly equal to !Null * testsuite/test_strsplit.pro: Adding few tests cases in TEST_STRSPLIT related to Length= keyword. A bug related to ARRAY_EQUAL() was also corrected. * src/ncdf_var_cl.cpp: Correcting bug #524 NCDF_VARGET fails for string array, thanks to Harald. (test case to be add in testsuite/) 2013-08-29 gilles-duvert * src/plotting_windows.cpp, src/devicex.hpp: Adds support for preference values GDL_GR_[WIN or X]_WIDTH, HEIGHT and QSCREEN. To be used as their *DL equivalents in the environment. 2013-08-26 gilles-duvert * src/plotting_contour.cpp: solves bug #561 ( contour desperately stuck ) 2013-08-26 alaingdl * src/plotting_contour.cpp: clarifying logic in CONTOUR inputs to avoid crashing without x/y and /irregular 2013-08-22 alaingdl * src/datatypes.cpp: I revert this change in CONVOL input types, because it is not compilable with "old" GCC (4.3, 4.4). Looking for a more partable version. 2013-08-11 alaingdl * testsuite/test_idl_validname.pro: new test cases in "test_idl_validname.pro" * src/pro/idl_validname.pro: three improvments in pro IDL_VALIDNAME: 1/ input as list of string OK, 2/ thanks to patch 66, better managment of 3 special chars: $, ! and \, 3/ "!" at first place and /convert_all is well managed. 2013-08-05 alaingdl * src/datatypes.cpp: in CONVOL(), allowing Ulong and Ulong64 (work by Nodar K.). 2013-08-04 alaingdl * src/basic_pro_jmg.cpp: In CALL_EXTERNAL C code, removing fixed defaultAlign = 16 (Eigen Case). This is problematic for structures on 32b linux. * src/basic_pro_jmg.cpp: for CALL_EXTERNAL, pbs running "test_ce.pro" : applying patch 69 from Orion, plus an extra test for string. Now all tests but "struct" OK ! 2013-08-03 gilles-duvert * src/ofmt.cpp: c++ code ready for C() format. Needs separate work on antlr code... 2013-08-02 gilles-duvert * src/gdlgstream.hpp: corrected wrong orientation of XOUTS characters when axes are inverted * src/plotting.cpp: corrected wrong orientation of symbols when axes are inverted * src/plotting_xyouts.cpp: corrected wrong orientation of XOUTS characters when axes are inverted 2013-08-01 gilles-duvert * src/basic_pro_jmg.cpp: solves bug #559 however reason why the string pointer was corrupted to begin with is unclear for me. 2013-07-31 gilles-duvert * testsuite/test_strsplit.pro: test for bug #554 and others related to use of LENGTH Keyword * src/pro/strsplit.pro: should solve bug #554 and other related to use of LENGTH Keyword * src/matrix_cholesky.cpp: should solve bug #555 2013-07-26 m_schellens * src/basic_op.cpp, src/datatypes.cpp, src/hash.cpp, src/hash.hpp, src/list.cpp, src/list.hpp, src/overload.cpp, src/prognode.cpp: IsTrue for LIST and HASH 2013-07-26 gilles-duvert * src/plotting.cpp: cosmetic changes after patch #68 * src/plotting_contour.cpp, src/plotting_shade_surf.cpp, src/plotting_surface.cpp, src/plotting_plot.cpp: applied patch #68 * src/pro/oploterr.pro: behaviour of oploterr should be to clip errorbars... 2013-07-26 m_schellens * src/math_fun.cpp, src/pythongdl.cpp: fix for python module 2013-07-25 gilles-duvert * src/pro/delvar.pro: implements delvar as a procedure using code from old version of delvarx.pro (under BSD license) 2013-07-25 m_schellens * src/math_fun.cpp, src/basic_fun.cpp, src/datatypes.hpp, src/dpro.cpp, src/dpro.hpp, src/dstructgdl.hpp, src/typedefs.hpp: sync * src/envt.hpp, src/extrat.cpp, src/hash.cpp, src/math_fun_jmg.cpp, src/typedefs.hpp, src/basic_fun.cpp, src/basic_fun_jmg.cpp, src/basic_pro.cpp, src/dcommon.hpp, src/dpro.hpp, src/dstructdesc.hpp, src/dstructgdl.cpp, src/dstructgdl.hpp, src/dvar.hpp, src/envt.cpp: replaced deque by vector where possible 2013-07-24 gilles-duvert * src/pro/ploterr.pro: trick to plot errorbars waaay faster using nan-separated values in arrays. * src/pro/oploterr.pro: introduced simple oploterr version as in idl. 2013-07-24 m_schellens * src/prognode_lexpr.cpp, src/prognodeexpr.cpp, src/pro/strsplit.pro: fixed STRSPLIT * src/basic_fun.cpp, src/datatypesref.cpp, src/hash.cpp: some fixed for HASH * src/dinterpreter.cpp, src/hash.cpp: sync 2013-07-23 m_schellens * src/hash.cpp, src/list.cpp, NEWS, src/dinterpreter.cpp, src/prognode.hpp, src/prognode_lexpr.cpp, src/prognodeexpr.cpp: dot access for GDL_OBJECTs (left and right-side) 2013-07-22 alaingdl * src/basic_pro.cpp: adding working TRANSFER_COUNT keyword for READU/WRITEU, this is used in a procedure (BLKSHIFT) in the AstroLib (work by Nodar K.) * src/libinit.cpp: in RESTORE, we need to have obsolete keyword (without effect) for CMSVlib. 2013-07-21 m_schellens * NEWS, src/GDLInterpreter.hpp, src/basic_op.cpp, src/hash.cpp, src/overload.cpp: HASH complete 2013-07-19 m_schellens * src/hash.cpp, src/hash.hpp, src/overload.cpp: sync 2013-07-18 m_schellens * NEWS, src/basic_pro.cpp, src/hash.cpp, src/list.cpp, src/list.hpp: HASH::HASH___OverloadPlus (no structs yet) 2013-07-18 alaingdl * NEWS: initial import of CHOLSOL/CHOLDC and LA_CHOLSOL/LA_CHOLDC using Eigen3 (Work by Nodar K.) * src/matrix_cholesky.hpp, src/CMakeLists.txt, src/Makefile.am, src/datatypes.cpp, src/gsl_fun.hpp, src/libinit_jmg.cpp, src/matrix_cholesky.cpp: Initial import of CHOLSOL/CHOLDC and LA_CHOLSOL/LA_CHOLDC using Eigen3. This is not optimal because Eigen3 does not separate the steps, then computations are done 2 times. Work by Nodar K. Also temporary change in CONVOL to help compiling on older GCC compilers. 2013-07-18 m_schellens * src/gdlc.i.g, src/hash.cpp, src/hash.hpp, src/list.cpp, src/objects.cpp, src/objects.hpp, src/overload.cpp, src/prognode.cpp, src/GDLInterpreter.hpp, src/basegdl.hpp, src/datatypesref.cpp: HASH: ToStruct, Keys, Values, HasKey 2013-07-18 alaingdl * src/basic_fun.cpp, src/basic_fun.hpp, src/libinit.cpp: back to a working version for the CVS, due to files related to changes in CONVOL 2013-07-17 m_schellens * src/basegdl.hpp, src/basic_fun.cpp, src/datatypes.hpp, src/hash.cpp, src/hash.hpp, src/libinit.cpp, src/list.cpp, src/overload.cpp: HASH::REMOVE (pre-alpha) 2013-07-17 alaingdl * src/convol.hpp, src/libinit.cpp: CONVOL: one file forgotten, one typo in new calling name * src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/convol.cpp, src/datatypes.cpp, src/libinit.cpp, src/nullgdl.cpp, src/nullgdl.hpp: two new keywords managed inside CONVOL(): BIAS and NORMALIZE (see request in bug report 542). Work by Nodar K. 2013-07-17 m_schellens * src/gdlarray.hpp, src/hash.cpp, src/hash.hpp, src/list.cpp, src/objects.cpp, src/overload.cpp: HASH::_OverloadBracketsRightSide 2013-07-17 alaingdl * src/pro/write_png.pro: correcting bug 553 (good order for 2D image and R,G,B keywords) 2013-07-16 m_schellens * src/basic_pro.cpp, src/hash.cpp: fixed HELP output for arrays * src/basic_fun.hpp, src/basic_pro.cpp, src/datatypes.cpp, src/datatypesref.cpp, src/default_io.cpp, src/hash.cpp, src/hash.hpp, src/libinit.cpp, src/list.hpp: HASH (still alpha) 2013-07-15 m_schellens * src/nullgdl.hpp, src/objects.cpp, src/overload.cpp, src/prognode.cpp, src/basegdl.cpp, src/basegdl.hpp, src/basic_pro.cpp, src/datatypes.cpp, src/datatypes.hpp, src/hash.cpp, src/nullgdl.cpp: hash (pre-alpha) * src/prognodeexpr.cpp: fixed test_bug_3152829 2013-07-15 alaingdl * testsuite/CMakeLists.txt: including Orion' patch to catch when the test case fully crashes GDL. 2013-07-15 m_schellens * src/hash.cpp: sync * src/CMakeLists.txt, src/Makefile.am, src/hash.cpp, src/hash.hpp: add files for HASH 2013-07-13 m_schellens * NEWS: Full support of LIST * src/datatypesref.cpp: Fixed LIST::NewIx * src/GDLInterpreter.cpp, src/basic_pro.cpp, src/default_io.cpp, src/gdlc.i.g, src/list.cpp, src/list.hpp, src/prognode_lexpr.cpp: HELP and PRINT support for LIST * src/list.cpp, src/list.hpp, src/overload.cpp: full support for LIST except for PRINT and HELP * src/basic_fun.cpp, src/basic_op.cpp, src/basic_op_add.cpp, src/basic_op_sub.cpp, src/basic_pro.cpp, src/datatypes.cpp, src/envt.cpp, src/envt.hpp, src/list.cpp, src/list.hpp, src/overload.cpp, src/prognode_lexpr.cpp, src/prognodeexpr.cpp: added operations for LIST 2013-07-12 m_schellens * src/list.cpp, src/list.hpp, src/overload.cpp: LIST::REMOVE and LIST::REVERSE procedures 2013-07-12 alaingdl * src/Makefile.am: 4 missing files in "Makefile.am" for the "configure" way (OK on Debian stable) 2013-07-11 m_schellens * src/envt.cpp, src/envt.hpp, src/list.cpp, src/objects.hpp: Correct cleanup for LIST 2013-07-10 m_schellens * src/list.cpp, src/overload.cpp: ADD::REMOVE (still alpha) * src/basic_fun.cpp, src/list.cpp, src/list.hpp, src/overload.cpp: LIST::REMOVE (alpha version) 2013-07-09 m_schellens * src/list.cpp, src/list.hpp: add * src/CMakeLists.txt, src/GDLInterpreter.hpp, src/basic_fun.cpp, src/basic_pro.hpp, src/gdlc.i.g, src/overload.cpp, src/dpro.hpp, src/envt.cpp, src/envt.hpp, src/overload.hpp, src/specializations.hpp, src/datalistt.hpp, src/datatypes.cpp, src/datatypes.hpp, src/datatypesref.cpp, src/dpro.cpp: LIST::ADD 2013-07-08 alaingdl * src/dinterpreter.cpp: switching back the default history to 200: convenient, and similar behavior on the other side ;-) * src/gsl_fun.cpp: In QROMB and QROMO, better managment of keyword EPS=, thanks to patch 67. At the same time, correcting a long living bug in the order of parameters when calling GSL function : gsl_integration_qag(). Please report pbs !! 2013-07-05 alaingdl * testsuite/test_bug_3057520.pro, testsuite/test_bug_3275334.pro: just giving a message before exiting. 2013-07-04 m_schellens * src/envt.cpp, src/gdlarray.hpp, src/gdlc.i.g, src/objects.cpp, src/overload.cpp, src/GDLInterpreter.cpp, src/arrayindex.cpp, src/arrayindex.hpp, src/arrayindexlistnoassoct.hpp, src/arrayindexlistt.hpp, src/basic_fun.cpp, src/basic_pro_jmg.cpp: LIST (function and right[]) 2013-07-03 m_schellens * src/envt.hpp, src/gdlc.i.g, src/libinit.cpp, src/prognode.cpp, src/prognodeexpr.cpp, src/typedefs.hpp, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/basic_fun.cpp, src/basic_pro.cpp, src/deviceps.hpp, src/envt.cpp: fixed TEST_PS_DECOMPOSED 2013-07-02 alaingdl * testsuite/test_ce.pro, testsuite/test_python_module_0.pro, testsuite/test_python_module_1.pro: the field "!system.os_name" is now always in Lower Case. 2013-07-01 m_schellens * src/GDLInterpreter.cpp, src/arrayindex.cpp, src/arrayindexlistnoassoct.hpp, src/arrayindexlistt.hpp, src/basic_fun.cpp, src/basic_fun.hpp, src/envt.hpp, src/gdlc.i.g, src/libinit.cpp, src/objects.cpp, src/overload.cpp, src/prognode.cpp, src/prognode_lexpr.cpp, src/prognodeexpr.cpp: fixed a = ptr_new(1) & *a= reform(*a, /over) & *a= reform(*a, /over) bug 2013-07-01 alaingdl * src/str.cpp: Work by Nodar K. One more attempt to better processing of space(s) within WordExp(). This time, names with multi consecutives spaces should be well managed. * src/file.cpp, src/file.hpp, src/libinit.cpp: import of internal C++ versions of FILE_BASENAME() and FILE_DIRNAME(), with a better management of (some) special chars. (e.g. see bug 550). * src/basic_pro.cpp: removing useless comment ! * src/pro/Makefile.am, src/pro/file_basename.pro, src/pro/file_basename_old.pro, src/pro/file_dirname.pro, src/pro/file_dirname_old.pro: moving into obsoleting names the two functions file_basename.pro file_dirname.pro to be substitute to C++ versions. 2013-06-29 m_schellens * src/datalistt.hpp, src/envt.hpp, src/libinit_cl.cpp, src/libinit_jmg.cpp, src/prognode.cpp: some more small optimizations * src/arrayindexlistnoassoct.hpp, src/arrayindexlistt.hpp, src/gdlc.i.g, src/prognode_lexpr.cpp, src/GDLInterpreter.cpp: some optimizations * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/dpro.hpp, src/envt.hpp, src/gdlc.g, src/gdlc.i.g, src/prognode.cpp, src/prognode.hpp, src/prognode_lexpr.cpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp: several optimizations 2013-06-26 gilles-duvert * src/FMTOut.cpp, src/FMTOut.hpp, src/FMTOutTokenTypes.hpp, src/FMTOutTokenTypes.txt, src/assocdata.hpp, src/basegdl.cpp, src/basegdl.hpp, src/datatypes.hpp, src/format.out.g, src/nullgdl.cpp, src/nullgdl.hpp, src/ofmt.cpp, src/specializations.hpp: first steps to support calendar format C(). * src/libinit.cpp: added CHANNEL as unsupported option for plot routines (was not present). Needs however to be fully supported. 2013-06-26 m_schellens * src/FMTTokenTypes.txt, src/basic_fun_jmg.cpp, src/cformat.g, src/libinit_mes.cpp, src/print.cpp, src/pro/str_sep.pro, src/CFMTLexer.cpp, src/CFMTLexer.hpp, src/CFMTTokenTypes.hpp, src/CFMTTokenTypes.txt, src/FMTIn.cpp, src/FMTIn.hpp, src/FMTInTokenTypes.hpp, src/FMTInTokenTypes.txt, src/FMTLexer.cpp, src/FMTOut.cpp, src/FMTOut.hpp, src/FMTOutTokenTypes.hpp, src/FMTOutTokenTypes.txt, src/FMTParser.cpp, src/FMTParser.hpp, src/FMTTokenTypes.hpp: fixed cformat issue (uncommented 'ALL') 2013-06-26 alaingdl * src/libinit.cpp: forgot to update helpKeys (re-ordered and also /path_cache and /help added) * src/basic_pro.cpp: in HELP, adding keywords /Path_cache and /help in JULDAY, full management of 3 to 6 inputs params. * src/envt.cpp, src/envt.hpp: /bin/bash: q: command not found (only available now in HELP pro and Besel functions !) 2013-06-24 m_schellens * src/envt.cpp, src/envt.hpp: FreeListT for EnvUDT * src/envt.cpp, src/envt.hpp, src/extrat.cpp, src/gsl_fun.cpp, src/math_fun.cpp, src/read.cpp, src/basic_fun.cpp, src/basic_pro.cpp, src/datatypes.cpp, src/datatypesref.cpp, src/dstructdesc.cpp: removed dynamic_cast<>s * src/gsl_fun.cpp: fixed bug #548 (HISTOGRAM,OMAX=value with BYTE) 2013-06-23 m_schellens * src/arrayindexlistnoassoct.hpp, src/gdlexception.cpp, src/gdlexception.hpp, src/prognode_lexpr.cpp, src/prognodeexpr.cpp: made ARRAYEXPR node distinugish between indexee and index error. Needed for ARRAYEXPR_FCALL resolving. 2013-06-22 m_schellens * src/prognodeexpr.cpp: changed order to try in ARRAYEXPR_FCALL nodes 2013-06-21 m_schellens * src/basic_fun.cpp, src/datatypes.cpp, src/datatypes.hpp, src/pro/smooth.pro, src/typedefs.hpp: memory management optimization 2013-06-18 gilles-duvert * src/basic_pro.cpp, src/basic_pro.hpp, src/libinit.cpp: Added JULDAY! 2013-06-17 m_schellens * src/assocdata.cpp, src/assocdata.hpp, src/datatypes.cpp, src/datatypes.hpp: sync * src/basic_pro.cpp, src/typedefs.hpp: cleanup * src/basic_pro_jmg.cpp, src/dstructdesc.hpp, src/gsl_fun.cpp, src/typedefs.hpp: fixed memeory leak in call_external 2013-06-14 alaingdl * src/file.cpp, src/str.cpp: trying to improve WordExp(), work by Nodar K. 2013-06-13 m_schellens * src/math_fun.cpp, src/ncdf_att_cl.cpp, src/fftw.cpp, src/gsl_matrix.cpp: fixed bug with wrong sizeof(long - should be Dlong) * src/basic_fun_cl.cpp: fixed mismatched new[] delete (removed the allocation) 2013-06-12 m_schellens * src/CFMTTokenTypes.hpp, src/CFMTTokenTypes.txt, src/FMTIn.cpp, src/FMTIn.hpp, src/FMTInTokenTypes.hpp, src/FMTInTokenTypes.txt, src/FMTLexer.cpp, src/FMTLexer.hpp, src/FMTOut.cpp, src/FMTOut.hpp, src/FMTOutTokenTypes.hpp, src/FMTOutTokenTypes.txt, src/FMTParser.cpp, src/FMTParser.hpp, src/FMTTokenTypes.hpp, src/FMTTokenTypes.txt, src/cformat.g, src/format.g, NEWS, src/CFMTLexer.cpp, src/CFMTLexer.hpp: fixed C string grammar (still not implemented) 2013-06-12 gilles-duvert * src/plotting.cpp, src/plotting.hpp: handle X11 window resizes better, writes [XYZ].REGION, uses !P.REGION etc. * src/plotting_plot.cpp: plot knows about !P.NSUM 2013-06-12 alaingdl * src/plotting.cpp: trying to manage !P.region when !P.position is equivalent to unset. 2013-06-11 m_schellens * NEWS, src/GDLInterpreter.hpp, src/arrayindex.hpp, src/dinterpreter.cpp, src/dinterpreter.hpp, src/gdl.cpp, src/gdlc.i.g, src/gdlexception.cpp, src/objects.cpp: Added .RESET_SESSION and .FULL_RESET_SESSION commands * src/dinterpreter.cpp, src/dinterpreter.hpp, src/gdlc.g, src/gdlc.i.g, src/graphics.cpp, src/objects.cpp, src/objects.hpp, src/GDLInterpreter.hpp, src/GDLLexer.cpp, src/GDLParser.cpp, src/arrayindex.hpp, src/dcommon.cpp: .RESET command (not complete yet); Fixed bug with ARRAYEXPR_FCALL and more than 8 parameters 2013-06-11 alaingdl * src/basic_fun_cl.cpp: fixing a small memory leak in SYSTIME() (Nodar) 2013-06-10 gilles-duvert * src/plotting.cpp: oops, small ticks were not small anymore... 2013-06-10 alaingdl * configure.in: updating the Configure way with new capabilities ralted to plplot. 2013-06-09 gilles-duvert * src/plotting.cpp: removed a memory loss * src/gdlgstream.hpp, src/gdlgstream.cpp: change in TranslateFormatCodes to avoid Valgrind complaining. previous version would return the c_str() of a std::string created in the function. Apparently the std::string is deleted on return, and the c_str() was pointing to a deallocated memory. Current version manages the string on the caller side. 2013-06-08 gilles-duvert * src/plotting_shade_surf.cpp: better defaults for shading lightsource. plplot's shading is definitely not very efficient, alas. * src/devicex.hpp: should solve bug 535 2013-06-07 gilles-duvert * src/plotting.cpp, src/plotting_axis.cpp: variant of gdlAxis to handle special case of AXIS command (to have correct ticklengths) * src/plotting_plots.cpp: bug in use of !P.T3D and 3 parameters * src/plotting.hpp, src/plotting_contour.cpp, src/plotting_oplot.cpp, src/plotting_plot.cpp, src/plotting_polyfill.cpp, src/plotting_shade_surf.cpp, src/plotting_surface.cpp, src/plotting_xyouts.cpp: support for use of !P.T3D * src/gshhs.cpp: temporarily solves ticket 474. A severe rewriting is needed to handle all the special projection cases especially for contour filling (poles, projection limits but also map levels: ponds in inslands in lakes in continents...) 2013-06-07 alaingdl * CMakeLists.txt: Better management of GM and IM: when GM available, using it. If GM not available, if IM available, using IM. The selection of IM or GM if both presents should still be possible (-DGRAPHICSMAGICK=off). Tested on CentOS and OSX. Patch by Nodar K. with Alain C. * CMakeModules/FindImageMagick.cmake: change in the file provided by CMake to support local install of IM (tested on CentOs and OSX) 2013-06-06 alaingdl * src/objects.cpp: fixing warning when computing Thread Numbers (NK) 2013-06-03 m_schellens * src/magick_cl.cpp: fixed memory leak in magick_write 2013-06-03 alaingdl * src/gdl.cpp, src/objects.cpp: when not compiled with Eigen3, must add in these 2 files. * src/plotting.cpp: needed on OSX with gcc 4.2.1 2013-06-01 m_schellens * src/basic_fun.cpp, src/gdlgstream.hpp: bugfix: replaced Guard with ArrayGuard 2013-05-31 gilles-duvert * src/math_fun_jmg.cpp, src/math_fun_jmg.hpp: solves last bug on poly_2d #3613920 2013-05-30 alaingdl * src/basic_pro.cpp, src/gdl.cpp, src/objects.cpp, src/objects.hpp: On muticores with non null load, performances are strongly dependant to a pertinent choice of OMP_NUM_THREADS value. A mechanism is proposed to estimate a optimal value for the number of Threads, is applied at startup time and propagated into !cpu.TPOOL_NTHREADS (work by Nodar K.) 2013-05-30 gilles-duvert * src/plotting_windows.cpp: annotations * src/plotting_cursor.cpp: correct warping of pointer (command tvcrs) * src/gdlxstream.cpp: erase was not properly erasing window when subpages were present. Also, correct warping of pointer (command tvcrs) * src/gdlxstream.cpp, src/gdlgstream.hpp, src/gdlxstream.hpp, src/plotting.hpp: uses pixmap double-buffering provided by plplot to speed up operations with X11 windows. to be tested. could solve bug 3612116, also. 2013-05-29 alaingdl * src/basic_pro.cpp: in pro CPU, restore= and /reset are exclusive. 2013-05-26 gilles-duvert * src/plotting_shade_surf.cpp, src/plotting_surface.cpp, src/plotting_contour.cpp: solves bug #3613926 by removing unfortunate optimization 2013-05-25 gilles-duvert * src/plotting_surface.cpp, src/plotting_shade_surf.cpp: handles correctly combinations of min/max_values and zrange. 2013-05-24 gilles-duvert * src/plotting_contour.cpp: better handling of 1 contour and associated c_color vector * src/gsl_fun.cpp, src/interp_multid.h, testsuite/test_congrid.pro: solves bug #3612274! 2013-05-21 gilles-duvert * src/basic_pro.cpp, src/libinit.cpp: Support for MESSAGE, /REISSUE_LAST and corresponding HELP, /LAST_MESSAGE (used in, e.g., CoyoteGraphics library) * src/gdlgstream.hpp: change to enable compiling gdl on old plplot versions while a new feature depending on the presence of the 'pllegend' function has been added. 2013-05-18 cokhavim * src/gdlgstream.hpp: In gdlGetmmStringLength moved legend position to avoid showing up in postscripts * src/deviceps.hpp: Added improvements for encapsulated postscripts * src/gdlgstream.cpp: GetGeometry outpus incorrect dimensions for PS device * src/plotting.cpp: Increased default top margin slightly to accomodate subscripts and superscripts 2013-05-17 alaingdl * src/Makefile.am: Missing new filename "plotting_shade_surf.cpp" in src/Makefile.am 2013-05-16 gilles-duvert * config.h.cmake, CMakeLists.txt: change to enable compiling gdl on old plplot versions while a new feature depending on the presence of the 'pllegend' function has been added. * src/deviceps.hpp, src/devicesvg.hpp, src/devicex.hpp: due to popluar demand ;^), reinstalled colormap initialisation for colormap#1 in device[ps,x,svg]. * src/plotting.cpp: Patch for Bug item #3613383, 2013-05-16 alaingdl * src/basic_fun.cpp: removing extra "cout <<" * src/basic_fun.cpp, src/libinit.cpp: Initial managment of /source keyword in ROUTINE_INFO() [bug report 3612842]. Not ready when no parameter provided (in that case, all compiled procedures or functions name/path informations must returned) 2013-05-16 gilles-duvert * src/devicex.hpp, src/plotting_windows.cpp: when opening several windows whose position are not given, dispatch them at the 4 corners of display in sequence. handy and mimics the (default) 'Tile' of IDL_GR_WIN_LAYOUT preference (such external preferences not being part of gdl yet) * src/plotting_xyouts.cpp: removed unnecessary warning 2013-05-16 alaingdl * src/gsl_fun.cpp: managing /Double keyword for INVERT() (patch by Nodar K.) 2013-05-15 gilles-duvert * CMakeLists.txt, config.h.cmake, src/gdlgstream.hpp, src/plotting_xyouts.cpp: Solves problems related to variable string lengths in XYOUTS (Hersey chars are not monospaced): if the plplot shared library contains the private function plstrl(), it is used. If not, (Ubuntu, debian) implemented a workaround by using a feature of pllegend(). Needs a full recompilation (after removing CMakeCache.txt and config.h). * doc/udg/README.txt: added infos about absent style files seemingly needed on my distro. 2013-05-14 alaingdl * src/pro/dialog_pickfile.pro: in gnome3, we need to tell to Zenity the current path :( 2013-05-13 gilles-duvert * src/plotting_xyouts.cpp: returned string width in option width= of xyouts is inexact since glyphs have a variable spacing. Added a warning about this. Since using plplot's private headers is not permitted (use of plstrl()) , one could consider adding the functionality to plplot (i.e., that plstrl() be public) or get access to a copy of the current PLStream structure and use its information. 2013-05-12 gilles-duvert * src/plotting.cpp: test patch: changed axis labelling to be clearer and more similar to original layout (exponents no more at end of axis etc). * src/plotting.hpp: removed some private structs from plotting.hpp to plotting.cpp 2013-05-10 gilles-duvert * src/plotting_polyfill.cpp, src/CMakeLists.txt, src/libinit.cpp, src/plotting.cpp, src/plotting.hpp, src/plotting_axis.cpp, src/plotting_contour.cpp, src/plotting_convert_coord.cpp, src/plotting_erase.cpp, src/plotting_oplot.cpp, src/plotting_plot.cpp, src/plotting_plots.cpp, src/plotting_surface.cpp, src/plotting_xyouts.cpp: Added almost full support for 3D plots in CONTOUR,PLOT,PLOTS,OPLOT,XYOUTS,SURFACE,SHADE_SURF,CONVERT_COORD,T3D,SCALE3,POLYFILL,SET_SHADING,AXIS(not complete). Still lacking 3D support:TV,TVSCL enabled /IRREGULAR for CONTOUR. * src/deviceps.hpp, src/devicesvg.hpp, src/devicex.hpp: removed colormap initialisation in device[ps,x,svg] since it seems to slow the display and does not appear to be needed. * src/plotting_windows.cpp: give window creation in "wset,0" same properties as a normal window (except backingStore) * src/plotting_shade_surf.cpp: adding shade_surf 2013-05-08 gilles-duvert * testsuite/CMakeLists.txt: Applied Orion's patch #3606092. Solves indeed the hangups of 'make check' when using CMake. 2013-05-07 m_schellens * CMakeLists.txt, CMakeModules/FindNetCDF.cmake, configure.in, src/ncdf_att_cl.cpp, src/ncdf_cl.hpp, src/ncdf_dim_cl.cpp, src/ncdf_var_cl.cpp: applied patch ID: 3608649 * src/basic_fun.cpp, src/datatypes.cpp, src/gsl_fun.cpp, src/math_fun_ac.cpp, src/math_fun_gm.cpp, src/math_fun_jmg.cpp, src/plotting.cpp, src/plotting_plot.cpp, src/plotting_polyfill.cpp: applied patch ID: 3612678 (with some mods) * src/antlr/LLkParser.cpp, src/gdlc.g: added some comments * src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/antlr/LLkParser.cpp, src/gdlc.g, testsuite/test_suite.pro: fixed deref for arrayexpr_mfcall (bug tracker ID: 3612104) 2013-05-06 gilles-duvert * src/deviceps.hpp: Added Joanna's patches #3612688 while reverting some code back to before rev.1.37 ( since forcing background erase in gdlpsstream.cpp rev. 1.7 was not a good solution to bug #361189) -- now we seem to have both PS and EPS color/bw landscape/portrait outputs generally quite good, * src/plotting_misc.cpp: Previous patch (inverting !P.COLOR and !P.BACKGROUND values when device=PS) had side effects. * src/gdlgstream.hpp, src/gdlpsstream.cpp, src/gdlpsstream.hpp: Reverted last patch (1.6) -- forcing background erase was not a good solution. 2013-05-06 m_schellens * src/pro/read_ascii.pro: fixed DATA_START for READ_ASCII * src/libinit_cl.cpp: added missing KLISTEND 2013-04-30 gilles-duvert * src/plotting_misc.cpp: Joanna Patch item #3611949. thanks. * src/deviceps.hpp, src/gdlpsstream.cpp, src/gdlpsstream.hpp, src/gdlgstream.hpp: Should solve Bug #3611897. By forcing background to erase the PS plot, one can have the correct background even on the first page. Note that now PS behave exactly as X, i.e., PS has also the option DECOMPOSED and color tables varies accordingly. 2013-04-29 alaingdl * src/deviceps.hpp: patch 3611949 by Joanna to restore Horizontal/Vertical placements in PostScript. * src/deviceps.hpp: better version for bug 3611898. I suspect we can play directly with Lun ... * src/deviceps.hpp: first attempt to solve bug report 3611898. But it is not enough 2013-04-26 alaingdl * src/deviceps.hpp: patch 3611864: two corrections: orientation (value for "sdiori" should be in expressed related to !pi/2) and color. 2013-04-24 alaingdl * CMakeLists.txt: in CMake way, if both packets present, we prefer to use GraphicsMagick than ImageMagick 2013-04-23 alaingdl * CMakeModules/FindGraphicsMagick.cmake, CMakeLists.txt: initial import of patch 3611651 to activate GraphicsMagick instead of ImageMagick in the CMake way. 2013-04-18 alaingdl * src/pro/online_help.pro: in ONLINE_HELP, activating book= and /full_path keywords, used inside HEALPix lib. 2013-04-11 gilles-duvert * src/libinit.cpp: changes related to options accepted now by plotting_surface. * src/plotting_surface.cpp: intermediate version before tackling the T3D transforms. 2013-04-11 alaingdl * testsuite/test_matrix_multiply.pro, testsuite/Makefile.am: new test for matrix multiplication, using matrix with rotation property. Types 14 and 15 are not ready on the GDL side due to INVERT(). May be INVERT has to be rewrite using Eigen3 ? 2013-04-11 gilles-duvert * src/plotting.cpp: solves bug #3610459 2013-04-11 alaingdl * src/pro/diag_matrix.pro: in DIAG_MATRIX(), type for output should be derived from the type of the input vector ! 2013-04-09 gilles-duvert * src/plotting_cursor.cpp: solves bug #3608752 2013-04-07 m_schellens * src/basic_op.cpp, src/datatypes.hpp, src/specializations.hpp: took change of Data_ template back (too early) 2013-04-04 m_schellens * src/dinterpreter.cpp: fixed usage of Guard * src/datatypes.hpp, src/math_fun_ac.cpp: added some clarifiying macros 2013-04-02 m_schellens * src/basegdl.hpp, src/math_fun_ac.cpp, src/prognodeexpr.cpp: refactored complex-double type promotion 2013-03-28 alaingdl * src/pro/matrix_multiply.pro: removing usage of MATMUL() 2013-03-27 m_schellens * src/datatypes.hpp, src/test_template_grouping.cpp: enabled default template parameters 2013-03-26 m_schellens * src/basegdl.hpp, src/basic_op.cpp, src/datatypes.cpp, src/math_fun_ac.cpp, src/prognodeexpr.cpp: eigen3 with matrix operator working * src/assocdata.hpp, src/basegdl.cpp, src/basegdl.hpp, src/basic_op.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dstructgdl.cpp, src/dstructgdl.hpp, src/libinit_ac.cpp, src/math_fun_ac.cpp, src/math_fun_ac.hpp, src/nullgdl.cpp, src/nullgdl.hpp, src/specializations.hpp: depoyed eigen3 for matrix operator (still buggy) 2013-03-25 m_schellens * src/GDLTreeParserTokenTypes.txt, src/arrayindex.hpp, src/assocdata.hpp, src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/basic_pro.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dstructgdl.cpp, src/dstructgdl.hpp, src/gdlc.i.g, src/nullgdl.cpp, src/nullgdl.hpp, src/specializations.hpp, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLLexer.hpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp: test overload funtion with template 2013-03-25 opoplawski * CMakeLists.txt: Make cmake look for python 2 or PYTHONVERSION if specified * testsuite/test_ce.pro: Make test_ce.pro look in current directory for libtest_ce.so for cmake builds 2013-03-25 m_schellens * src/datatypes.cpp, src/datatypes.hpp, src/plotting_oplot.cpp, src/plotting_plot.cpp, src/plotting_surface.cpp, src/prognode.cpp, src/typedefs.hpp, src/typetraits.hpp: fixed usage of Guard (replaced usage of operator=) 2013-03-25 alaingdl * src/datatypes.hpp: commenting c++11 line apparently not need/used now 2013-03-22 m_schellens * src/datatypes.hpp: commented out c++11 stuff * src/deviceps.hpp, src/devicex.hpp, src/dinterpreter.cpp, src/envt.cpp, src/envt.hpp, src/fftw.cpp, src/gdlarray.hpp, src/gdlc.i.g, src/gdlwidget.cpp, src/gsl_fun.cpp, src/gsl_matrix.cpp, src/magick_cl.cpp, src/math_fun.cpp, src/math_fun_ac.cpp, src/math_fun_gm.cpp, src/math_fun_jmg.cpp, src/ncdf_cl.cpp, src/ncdf_var_cl.cpp, src/newprognode.cpp, src/plotting.cpp, src/plotting_contour.cpp, src/plotting_convert_coord.cpp, src/plotting_oplot.cpp, src/plotting_plot.cpp, src/plotting_plots.cpp, src/plotting_polyfill.cpp, src/plotting_surface.cpp, src/plotting_xyouts.cpp, src/print.cpp, src/prognode.cpp, src/prognode.hpp, src/prognode_lexpr.cpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp, src/pythongdl.cpp, src/read.cpp, src/typedefs.hpp, src/widget.cpp, CMakeLists.txt, src/GDLInterpreter.cpp, src/accessdesc.hpp, src/arrayindex.cpp, src/arrayindex.hpp, src/arrayindexlistnoassoct.hpp, src/arrayindexlistt.hpp, src/basic_fun.cpp, src/basic_fun_cl.cpp, src/basic_fun_jmg.cpp, src/basic_pro.cpp, src/datatypes.cpp, src/datatypes.hpp, src/datatypesref.cpp, src/dcompiler.cpp: replaced obsoleted std::auto_ptr with Guard 2013-03-21 m_schellens * src/basic_op.cpp, src/basic_op_add.cpp, src/basic_op_div.cpp, src/basic_op_mult.cpp, src/basic_op_new.cpp, src/basic_op_sub.cpp, src/datatypes.cpp, src/dstructgdl.cpp: moved DStructGDL invalid functions 2013-03-21 alaingdl * testsuite/test_bytscl.pro: initial of "test_bytscl.pro", not finished and not included in automatic test suite. We do have a problem when using /nan in BYTSCL() ... 2013-03-20 gilles-duvert * src/libinit_jmg.cpp, src/math_fun_jmg.cpp, src/math_fun_jmg.hpp: Preparation for all (?) gridding-related functions that can (easily?) be added using QHULL Library which is also a dependency (optional) of plplot. * src/basic_fun.cpp: patched incorrect behaviour for TOP > 255. Possibly caused problems in (related) tvscl, hist_equal. 2013-03-19 m_schellens * src/basegdl.hpp, src/basic_op.cpp, src/datatypes.cpp, src/dpro.hpp, src/typedefs.hpp, src/typetraits.hpp: added new type trait IS_FLOAT * src/gdlarray.hpp, src/libinit_ac.cpp, src/math_fun_ac.cpp: un-uncommented some GDLArray members * src/gdlarray.hpp: fixed bug in GDLArray's allocation logic 2013-03-18 m_schellens * src/gdlarray.hpp, src/typedefs.hpp, src/typetraits.hpp: restructure and refactoring for easier addition of new types 2013-03-16 m_schellens * src/basic_op_add.cpp, src/basic_pro_jmg.cpp, src/datatypes.cpp, src/datatypes.hpp, src/specializations.hpp, src/typedefs.hpp, src/typetraits.cpp, src/typetraits.hpp, src/basegdl.hpp: refactoring, preparation for new types 2013-03-16 gilles-duvert * src/gdlgstream.cpp: patch should cure bug reported by AC (incorrect behaviour for !P.MULTI=[2,0,0]) 2013-03-14 alaingdl * src/math_fun_ac.cpp: continue being able to compile without Eigen3 2013-03-13 m_schellens * src/math_fun.cpp: deployed eigen3 for SQRT 2013-03-12 m_schellens * src/basic_op_add.cpp: own specialization adding a scalar string to avoid eigen usage * src/envt.hpp: added some const specifiers to ForLoopInfo * src/basic_op_add.cpp: fixed bug with string addition * src/CFMTLexer.cpp, src/cformat.g: applied change suggested by patch tracker ID: 3465879 * src/math_fun.cpp, src/overload.cpp, src/typedefs.hpp, src/basic_fun.cpp, src/basic_op.cpp, src/basic_op_add.cpp, src/basic_op_div.cpp, src/basic_op_mult.cpp, src/basic_op_new.cpp, src/basic_op_sub.cpp, src/basic_pro.cpp, src/convert2.cpp, src/datatypesref.cpp, src/fftw.cpp: introduced OMPInt for OpenMP loop variables * src/basic_op.cpp, src/basic_op_add.cpp, src/basic_op_div.cpp, src/basic_op_mult.cpp, src/basic_op_sub.cpp, src/ncdf_var_cl.cpp: updated some int to string conversions 2013-03-11 m_schellens * src/magick_cl.cpp, src/ncdf_cl.cpp, src/ncdf_var_cl.cpp: updated some int to string conversions 2013-03-10 m_schellens * src/basic_op.cpp, src/basic_op_new.cpp, src/math_fun.cpp: use eigen3 for + - and * * src/basic_op.cpp, src/basic_op_new.cpp, src/math_fun.cpp: use eigen3 for + - and * (incomplete) * src/libinit_ac.cpp, src/math_fun_ac.cpp, src/math_fun_ac.hpp, src/typedefs.hpp: deploy eigen3 noalias() 2013-03-09 gilles-duvert * src/libinit.cpp, src/plotting_device.cpp, src/plotting_windows.cpp: support for "RETAIN" in DEVICE. Will not really do anything useful, though, until some other patch informs plplot of the necessity to redraw the plot. 2013-03-08 m_schellens * src/ofmt.cpp: Fixed binary output format * src/plotting_oplot.cpp, src/arrayindex.hpp, src/basic_op.cpp, src/deviceps.hpp, src/gdlgstream.hpp, src/math_utl.hpp, src/ofmt.cpp, src/overload.cpp, src/plotting.cpp, src/plotting_contour.cpp: applied patch ID: 3606722 * src/math_fun_ac.cpp: sync 2013-03-08 alaingdl * src/math_fun_ac.cpp: in "math_fun_ac.cpp" being able to compile without Eigen3; 2013-03-08 m_schellens * src/math_fun_ac.cpp: refactoring for matmul_fun * src/math_fun_ac.cpp: correct output type for matmul_fun * src/math_fun_ac.cpp: optimization for matmul_fun * src/math_fun_ac.cpp: fix error message 2013-03-07 m_schellens * src/math_fun_ac.cpp: Aligned access in malmul_fun * src/dstructgdl.hpp, src/datatypes.cpp, src/datatypes.hpp, src/typedefs.hpp, src/dstructdesc.hpp, src/includefirst.hpp: alignment for eigne3 (also for structs) * src/datatypes.cpp, src/includefirst.hpp, src/math_fun_ac.cpp, src/math_fun_ac.hpp, src/typedefs.hpp: eigen3 alignment for GDLArray 2013-03-06 gilles-duvert * src/math_fun_ac.cpp: Last and final optimizations: directly address memory location using Map<> object instead of MatrixXX, added GDL_FLOAT case to speed up this last case. 2013-03-06 m_schellens * src/math_fun_ac.cpp: optimizations for MATMUL 2013-03-05 gilles-duvert * src/pro/matrix_multiply.pro: Modified matmul_fun to accept also complex and dcomplex matrices. Modified matrix_multiply accordingly. * src/math_fun_ac.cpp: Modified matmul_fun to accept also complex and dcomplex matrices. Behaviour is now idem idl for Vectors (implicit transposition) Acceleration even better due to Eigen's use of .transpose() and direct copy of arrays with memcpy(). 2013-03-05 alaingdl * src/pro/online_help.pro: is ONLINE_HELP, better management of default browser * src/pro/online_help.pro: details for ONLINE_HELP: trying to use default browser if any; "open" for OSX ... 2013-03-04 m_schellens * src/dinterpreter.cpp: removed: return CC_OK; for ? command :-) * src/dinterpreter.cpp: added: return CC_OK; for ? command 2013-03-04 alaingdl * src/pro/online_help.pro: ONLINE_HELP: correct help header; testing if computing node; managing void "name" input * src/pro/online_help.pro: limited changes in ONLINE_HELP, more to come. * src/dinterpreter.cpp: removing useless comments. * src/dinterpreter.cpp: activating "?" command, calling ONLINE_HELP (e.g.: ?fft) * src/pro/Makefile.am: I forgot to add these 2 files names here ... 2013-03-01 alaingdl * src/pro/doc_library.pro, src/pro/online_help.pro: initial import of DOC_LIBRARY (Feature request 3606434) and ONLINE_HELP procedures. 2013-02-28 m_schellens * src/arrayindexlistnoassoct.hpp, src/basic_fun.cpp, src/basic_op_new.cpp, src/envt.hpp: fixed extra allocation in Data_::PowIntNew. bug tracker ID: 3605947 2013-02-26 alaingdl * src/gsl_fun.cpp: temporary solution for bug report 3602623 related to inaccurary in bins computations for histograms in the GSL, sensitive on 64b versions ... 2013-02-25 alaingdl * src/ncdf_var_cl.cpp: correcting bug 3605899: creating big NetCDF files (> 4 GB). Tested OK on CentOS 5.8 64b by AC. 2013-02-20 alaingdl * testsuite/test_histo.pro: adding "TEST_UNITY_BIN_HISTO" procedure into "test_histo.pro" to trace bug 3602623. Up to now, this bug occurs only on 64b computers, not on 32b, GSL versions chenged nothing. * src/pro/interpol.pro: correcting small regression when testing size of inputs for INTERPOL(/spline) 2013-02-19 alaingdl * CMakeLists.txt, configure.in: for CMake, now default is trying to use Eigen3 if found in default place (/usr/include/eigen3) or if path provided (-DEIGEN3DIR= then checked and found) then same for Configure (--with-eigen3=). Both ways checked with success on U 12.04 with libeigen3-dev. 2013-02-18 alaingdl * src/pro/interpol.pro: correcting INTERPOL() when we have NaN or Inf values in third vector (bug 3602770) * CMakeModules/FindEigen3.cmake: initial input of this file for patch 3603806 (Eigen3 support in CMake) * CMakeLists.txt, config.h.cmake: applying patch 3603806 to have Eigen3 choice in CMake 2013-02-06 gilles-duvert * NEWS: update for summary of GD's recent changes * src/plotting_contour.cpp, src/plotting_plot.cpp: corrected regression: plot,findgen(4),color=0,background=255 would not change background correctly since it is changed only at subpage change, which was called before setting background value. To be checked for the other plotting functions on which i have not yet worked. 2013-02-05 alaingdl * INSTALL, NEWS, README: updating informative files about Eigen lib. usage. * src/libinit_ac.cpp, src/math_fun_ac.cpp, src/pro/matrix_multiply.pro: extension of MATMUL, to exploit /atranspose and /btranspose. Change into z=MATRIX_MULTIPLY() to switch with or without Eigen disponibility. 2013-02-05 m_schellens * src/basic_pro.cpp, src/libinit.cpp: started SOURCE_FILES keyword for HELP 2013-02-04 alaingdl * configure.in: managing Include Path for Eigen is still a work in progress, sorry ... * src/libinit_ac.cpp, src/math_fun_ac.cpp, src/math_fun_ac.hpp, configure.in: initial import of fast matrix multiplication code res=MATMUL(a,b) based on external library Eigen 2013-01-29 alaingdl * testsuite/Makefile.am: new "test_structures.pro" file for test suite 2013-01-29 gilles-duvert * src/devicex.hpp, src/graphics.hpp, src/plotting_windows.cpp: First pass to implement support for RETAIN=0,1,2 in window. Should be revised to fully mimic IDL's behaviour. Difficulty: backing store is noticeably device and OS dependent... 2013-01-29 m_schellens * testsuite/test_structures.pro, src/prognodeexpr.cpp: fixed indexed structure access. Bug tracker ID: 3601949 2013-01-28 alaingdl * testsuite/test_structures.pro: adding a test for internal indexing in structures, to avoid any future regression ... (was bug 3601949) 2013-01-26 gilles-duvert * CMakeLists.txt, config.h.cmake: should permit, through the use of HAS_PLPLOT_SLABELFUNC, to disable the user-format option for labels of axis in plplot, functionality which is at the basis of the support of [XYZ]TICKFORMAT, [XYZ]TICKNAME etc but which has only been introduced in plplot after 5.9.6 (as far as I can guess). 2013-01-25 gilles-duvert * src/plotting.cpp: severe regression corrected: 'x' modifier for plbox() is in plplot > 5.9.7 and does not replace the 't' option, only modifies it. I restore the 't' option (draw labels) and labels should reappear for older plplot versions. 2013-01-23 gilles-duvert * src/gdlxstream.cpp, src/devicex.hpp, src/gdlgstream.hpp, src/gdlxstream.hpp, src/graphics.hpp, src/libinit.cpp, src/plotting.hpp, src/plotting_cursor.cpp, src/plotting_device.cpp, src/plotting_windows.cpp: Added full support for CURSOR command, which is interruptible by control-c (rewrote the plplot's cursor function. Note that cursor as in plplot can be moved by the arrow keys with the modifiers keys as accelerators, useful for fine positioning and absent from idl). Now RDPIX procedure works. Added cursor-related functions TVCRS (for completeness: since PlPlot's X11 window is not fully event-driven the cursor positioning has no visible effect---help welcome), EMPTY (idem), DEVICE options CURSOR_CROSSHAIR, CURSOR_STANDARD, CURSOR_ORIGINAL and GET/SET_GRAPHICS_FUNCTION (GXoR, GXand, etc). Disabled by default the focus in the X11 graphics windows as idl does. * CMakeLists.txt, src/plotting.cpp: Modified plotting.cpp and CMakelists.txt to fix problem of absence of 'plslabelfunc()' in old plplot versions. * src/devicez.hpp: uncommented useful lines! 2013-01-14 m_schellens * src/envt.hpp: made call to member expilcit * src/basic_op.cpp: changed loop var to SizeT in MatrixOp 2013-01-13 alaingdl * src/pro/wmenu.pro, src/pro/zenity_check.pro: typos when improving ZENITY_CHECK() * src/pro/dialog_pickfile.pro, src/pro/wmenu.pro, src/pro/zenity_check.pro: fixing details in DIALOG_PICKFILE, WMENU and ZENITY_CHECK 2013-01-11 m_schellens * src/new.cpp: sync 2013-01-10 gilles-duvert * src/plotting.cpp, src/plotting.hpp: Support for [XYZ]Tickformat with format='an external function' or format='(a valid GDL format)'. The C() time format code and LABEL_DATE() functions have yet to be written for this part to be complete, however. 2013-01-09 m_schellens * src/GDLInterpreter.cpp, src/gdlc.i.g: optimization setting \!ERROR_STATE * src/basic_pro.cpp, src/GDLInterpreter.cpp, src/gdlc.i.g, src/initsysvar.cpp, src/initsysvar.hpp, src/io.cpp: set \!ERROR_STATE 2013-01-08 m_schellens * src/basic_pro.cpp, src/gdlexception.hpp, src/io.cpp, src/gdlc.i.g, src/gdlexception.cpp, src/gdlxstream.cpp, src/GDLInterpreter.cpp, src/accessdesc.hpp, src/allix.cpp, src/arrayindex.cpp, src/arrayindex.hpp, src/arrayindexlistnoassoct.hpp, src/arrayindexlistt.hpp, src/datatypes.cpp: infrastructure for error codes 2013-01-08 alaingdl * doc/www/_news.inc.php: updating last builds (Gentoo, Debian); links. 2013-01-08 gilles-duvert * src/plotting.cpp: oops, DeviceToNorm should not be used, only DeviceTo NormedDevice is consistent with the rest of coordinates transforms unless special cases. 2013-01-08 m_schellens * src/basic_pro.cpp, src/GDLInterpreter.cpp, src/dinterpreter.cpp, src/envt.hpp, src/gdlc.i.g, src/gdlgstream.cpp, src/prognode.cpp: working CATCH 2013-01-08 gilles-duvert * src/plotting.cpp: solves bug 2880540 (plots the non-zero values of a dataset in logscale). 2013-01-07 m_schellens * src/GDLInterpreter.hpp, src/dinterpreter.cpp, src/gdlc.i.g, src/plotting_contour.cpp: refactoring 2013-01-05 gilles-duvert * src/plotting_plot.cpp: solves bug 2880540 (2nd part, plot,[-1,1],/ylog) * src/plotting.cpp: In view of bug 2880540 (solved), it is better for the time to avoid plplot getting loose on crazy coordinates. 2013-01-04 m_schellens * src/GDLInterpreter.hpp, src/accessdesc.hpp, src/dinterpreter.cpp, src/envt.cpp, src/gdlc.i.g, src/prognodeexpr.cpp: refactoring for GDL_OBJECT::Get/SetProperty 2013-01-04 gilles-duvert * src/plotting.cpp: plslabelfunc() and associated "o" option for custom axis labelling is not present until plplot v.5.9.5 I remove the few lines associated with the use of custom labeling with HAVE_PLPLOT_BEFORE_5994, but the labeling will be bad! Users should update their plplot version to the last one. * src/plotting_contour.cpp: removed attempt to record path, should solve problems arising from changes in fill() definition which varies with plplot versions. * src/plotting.cpp: supports request #3389025 in that !P.LINESTYLE works with CONTOUR. (not described in the IDL documentation, but the case nevertheless) 2013-01-03 gilles-duvert * src/gshhs.cpp, src/libinit.cpp, src/libinit_jmg.cpp, src/plotting_cursor.cpp, src/plotting_map_proj.cpp, src/plotting_surface.cpp: miminum set of changes to be compatible with new plotting routines etc. * src/plotting_misc.cpp: code layout changed as in NetBeans for readability. * src/plotting_device.cpp: gets /XSIZE etc options correctly to pass to, e.g., PS device. * src/plotting_plots.cpp: All keywords supported except Z and T3D Provides /CONTINUE Correct handling of log/DATA/NORMAL/DEVICE coordinates CLIP ok. * src/plotting_oplot.cpp: All keywords supported. Correct handling of log/DATA/NORMAL/DEVICE overplots CLIP ok. * src/plotting_polyfill.cpp: miminum changes to be compatible with new plotting.cpp version. Still lacking: IMAGE_COORD, IMAGE_INTERp, PATTERN, TRANSPARENT,T3D,Z. * src/plotting_xyouts.cpp: Support of all options except TEXT_AXES and T3D Better than IDL: ORIENTATION, ALIGNMENT, CHARSIZE, CHARTHICK and COLOR may be vectors. * src/plotting.cpp, src/plotting.hpp: large changes to provide new functionalities and use our overloading of several plplot functions. All symbols now exactly as IDL. * src/plotting_contour.cpp: Support of all options except ZVALUE, ZAXIS,CELL_FILL, C_ANNOTATIONS, CLOSED, DOWNHILL, IRREGULAR, TRIANGULATION,PATH_*** Correct implementation of Z, [X,Y], i.e., contours may be skewed, rotated, etc depending on X and Y. Better than IDL: - a new ZLOG option makes log contours as well. - C_ORIENTATION, C_SPACING are also vectors. - log axes give better results - good contouring of Not-A-Number values in Z and MIN_VALUE/MAX_VALUE - CLIP ok. Automatic limits in some cases still different from idl. * src/plotting_axis.cpp: Support of all 2D options (i.e., all X*** and Y***) Formatting of strings by XTICKFORMAT not yet working. TICKLAYOUT=2 not implemented * src/plotting_plot.cpp: Support of all 2D options except 'FONT' and 'T3D'. All symbols exactly as IDL. Formatting of strings by XTICKFORMAT not yet working. TICKLAYOUT=2 not implemented Automatic limits in some cases still different from idl. * src/graphics.hpp: SetColor() has now 1 arg. * src/gdlgstream.cpp, src/gdlgstream.hpp: overloading of many useful plplot functions to keep track of positions, sizes, etc. Possibly overkill. * src/gdlxstream.cpp: instrumented according to our overloading of several plplot functions. * src/gdlpsstream.hpp: better plplot options management * src/devicesvg.hpp: setup of initial values to satisfy our overloading of several plplot functions. * src/deviceps.hpp: setup of initial values to satisfy our overloading of several plplot functions. workaround for bugs in plplot+pslib drivers. Not entirely convincing though. * src/devicewin.hpp: setup of initial values to satisfy our overloading of several plplot functions. Not tested on windows. * src/devicez.hpp: setup of initial values to satisfy our overloading of several plplot functions. * src/devicex.hpp: defaulted initial position top right of screen. setup of initial values to satisfy our overloading of several plplot functions. * src/initsysvar.cpp: updated clip box values * src/pro/loadct.pro, src/image.cpp, src/image.hpp: command LOADCT supports BOTTOM, NCOLORS, RGB_TABLE, SILENT * src/gdlwidget.cpp: change needed to compile with my g++ 4.4.3 x86_64-manbo-linux-gnu (?) * src/envt.cpp, src/envt.hpp: added KeywordPresent with string instead of id. 2013-01-02 gilles-duvert * CMakeModules/Findlibps.cmake: needed to find libps on some 64 bits architectures 2013-01-02 alaingdl * doc/www/contribute.html, doc/www/credits.html, doc/www/download.html, doc/www/feedback.html, doc/www/home.html, doc/www/index.html, doc/www/menu.html, doc/www/require.html, doc/www/resources.html, doc/www/screenshot.html, doc/www/support.html, doc/www/tdl.html: small changes to be OK with http://validator.w3.org/ * doc/www/_news.inc.php, doc/www/credits.php, doc/www/faq.php, doc/www/menu.html: updating informations: 0.9.3 delivered (news), MSwin version, credit (JBPark) 2012-12-30 m_schellens * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/accessdesc.hpp, src/gdlc.i.g, src/prognodeexpr.cpp: refactorizations GDL 0.9.3: 2012-12-27 m_schellens * CMakeLists.txt, configure.in, src/GDLInterpreter.cpp, src/accessdesc.hpp, src/dstructgdl.cpp, src/gdlc.i.g, src/prognode_lexpr.cpp, src/prognodeexpr.cpp: GDL 0.9.3 2012-12-21 m_schellens * src/gdlc.i.g, src/GDLInterpreter.cpp: replaced dynamic_cast * src/basic_op.cpp, src/basic_op_new.cpp, src/datatypes.hpp, src/overload.cpp, src/prognodeexpr.cpp, src/specializations.hpp: Added _overloadMinus for GDL_OBJECT 2012-12-20 m_schellens * src/math_fun_jmg.cpp: slight improvements for check_math_fun * src/math_fun_jmg.cpp: Fixed CHECK_MATH; bug tracker ID: 3597463 2012-12-19 m_schellens * src/basic_op.cpp, src/basic_op_new.cpp, src/datatypes.hpp, src/dinterpreter.cpp, src/overload.cpp, src/prognodeexpr.cpp, NEWS: completed _overloadPlus * src/datatypes.hpp, src/objects.hpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp, src/specializations.hpp, src/typedefs.hpp, ChangeLog, NEWS, src/basegdl.hpp, src/basic_op.cpp: preparations for _overloadPlus 2012-12-18 m_schellens * src/GDLInterpreter.cpp, src/gdlc.i.g, src/dinterpreter.cpp, src/dinterpreter.hpp, src/objects.hpp: implemented .SKIP command * src/prognodeexpr.cpp, src/GDLTreeParser.cpp, src/gdlc.tree.g, src/prognode_lexpr.cpp: ARRAYEXPR_FCALL ambiguity some minor improvements 2012-12-18 m_schellens * src/GDLInterpreter.cpp, src/gdlc.i.g, src/dinterpreter.cpp, src/dinterpreter.hpp, src/objects.hpp: implemented .SKIP command * src/prognodeexpr.cpp, src/GDLTreeParser.cpp, src/gdlc.tree.g, src/prognode_lexpr.cpp: ARRAYEXPR_FCALL ambiguity some minor improvements 2012-12-17 m_schellens * src/GDLTreeParser.cpp, src/gdlc.tree.g, src/newprognode.cpp, src/prognode.hpp, src/prognode_lexpr.cpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp: Fixed ARRAYEXPR_FCALL ambiguity * src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/gdlc.g, src/gdlc.tree.g, src/newprognode.cpp, src/prognodeexpr.hpp, src/GDLInterpreter.cpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLParser.cpp: in progress: ARRAYEXPR_FCALL ambiguity 2012-12-17 alaingdl * src/plotting_plot.cpp: Being able managning Log. plots with negative values only (bug report 3595172). Please notice PLplot is not able to manage "xtick/ytick" in plbox() when "l" option activated. 2012-12-13 m_schellens * src/GDLInterpreter.hpp, src/GDLParser.cpp, src/assocdata.hpp, src/basegdl.hpp, src/basic_op.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dstructgdl.hpp, src/gdlc.g, src/gdlc.i.g, src/overload.cpp, src/prognode.hpp, src/prognode_lexpr.cpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp, src/specializations.hpp, src/typedefs.hpp: Added _overloadEQ and _overloadNE 2012-12-11 m_schellens * src/overload.cpp: A bit cleanup * src/allix.hpp, src/arrayindex.cpp, src/arrayindex.hpp, src/arrayindexlistt.hpp, src/basic_pro.cpp, src/dimension.hpp, src/envt.hpp, src/overload.cpp: Completed GDL_OBJECT::_overloadBracketsRightSide 2012-12-10 m_schellens * src/nullgdl.cpp, src/prognode_lexpr.cpp, src/prognodeexpr.cpp: Changed some warning messages * src/arrayindexlistt.hpp, src/overload.cpp, src/prognode_lexpr.cpp, src/prognodeexpr.cpp, src/typedefs.hpp: Corrections for bracketsLeftSideOverload. Prepared bracketsRightSideOverload. * src/dpro.cpp, src/dpro.hpp, src/overload.cpp: Changed DPro::AddPar(...) for prettier definition of internal UD subroutines * src/basic_fun.cpp, src/default_io.cpp, src/dpro.hpp, src/envt.cpp, src/envt.hpp, src/overload.cpp, src/prognode_lexpr.cpp: Added internal GDL_OBJECT::_overloadBracketsLeftSide procedure. * src/GDLInterpreter.cpp, src/gdlc.i.g, src/prognode.hpp, src/prognode_lexpr.cpp: avoid copy or rvalue for call of internal GDL_Object::_overloadBracketsLeftSide 2012-12-09 m_schellens * src/GDLInterpreter.cpp, src/gdlc.i.g, src/prognode_lexpr.cpp: Completed implementation of GDL_Object::_overloadBracketsLeftSide * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLTreeParser.cpp, src/datatypes.cpp, src/dcompiler.cpp, src/dnode.hpp, src/envt.cpp, src/gdlc.i.g, src/gdlc.tree.g, src/newprognode.cpp, src/print_tree.cpp, src/prognode_lexpr.cpp, src/prognodeexpr.hpp: fixed constant array generation for array indices (compiled already from GDLTreeParser) * src/arrayindex.cpp, src/arrayindex.hpp, src/arrayindexlistnoassoct.hpp, src/arrayindexlistt.hpp: InitAsOverloadIndex member functions for ArrayIndexList... classes 2012-12-08 m_schellens * testsuite/test_stregex.pro, src/arrayindex.cpp, src/arrayindex.hpp: OverloadIndexNew member functions for [C]ArrayIndex... classes * src/GDLTreeParser.cpp, src/arrayindex.hpp, src/arrayindexlistnoassoct.hpp, src/arrayindexlistt.hpp, src/dcompiler.cpp, src/gdlc.i.g, src/gdlc.tree.g, src/prognode_lexpr.cpp, src/prognodeexpr.cpp, testsuite/test_suite.pro, src/GDLInterpreter.cpp: fixed (recently changed (for overload)) array indexing * src/dnode.hpp, src/gdlc.i.g, src/gdlc.tree.g, src/prognode.cpp, src/prognode.hpp, src/prognode_lexpr.cpp, src/prognodeexpr.hpp, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLTreeParser.cpp, src/arrayindex.hpp, src/arrayindexlistnoassoct.hpp, src/basic_pro.cpp, src/datatypes.cpp, src/datatypesref.cpp, src/dcompiler.cpp, src/dcompiler.hpp, src/dinterpreter.cpp: Preparation of array indices (CArrayIndex...) for object overload indexing (keep original types of indices accessible) 2012-12-07 alaingdl * src/basic_fun.cpp: revisited MEDIAN code for dim= keyword. (TEST_NANS_IN_SORT_AND_MEDIAN and TEST_MINMAX both OK) 2012-12-06 m_schellens * src/ofmt.cpp, src/overload.cpp: fixed binary output for LONG64 * src/overload.cpp, src/GDLInterpreter.cpp, src/dpro.hpp, src/dstructdesc.hpp, src/gdlc.i.g, src/objects.cpp, src/overload.hpp, src/prognode.cpp, src/prognode.hpp: full implementation of GDL_OBJECT::_overloadIsTrue function 2012-12-05 m_schellens * src/typedefs.hpp: removed debug setting * src/gsl_fun.cpp, src/typedefs.hpp: proper return value conversion for GDL function used by QROMB * src/dpro.cpp, src/gsl_fun.cpp: fixed memory leak in QROMB function. Bug tracker ID: 3592762 * src/GDLInterpreter.hpp, src/dpro.cpp, src/dpro.hpp, src/gdlc.i.g, src/overload.cpp, src/prognode.cpp, src/prognode.hpp: Implemented WRAPPED_FUN/PRONode (call c++ functions as GDL subroutines) 2012-12-04 m_schellens * src/print_tree.cpp, src/basic_pro.cpp, src/dpro.cpp, src/dpro.hpp, src/libinit.cpp, src/print_tree.hpp: fixed print_tree for circular ProgNodeP trees * src/dinterpreter.cpp, src/dpro.cpp: disabled debug output for CVS * src/dinterpreter.cpp, src/dpro.cpp, src/prognode.hpp: Fixed: BREAK when loop is last statement in subroutine 2012-12-02 m_schellens * src/datatypes.cpp, src/nullgdl.hpp: rename IsNULL function * src/GDLInterpreter.hpp, src/basic_pro_jmg.cpp, src/datatypes.cpp, src/dinterpreter.cpp, src/envt.cpp, src/envt.hpp, src/gdlc.i.g, src/gsl_fun.cpp, src/math_fun_ng.cpp, src/nullgdl.cpp, src/nullgdl.hpp, src/specializations.hpp, src/widget.cpp: implemented _overloadIsTrue 2012-12-01 m_schellens * src/GDLParser.cpp, src/gdlc.g, src/objects.cpp, src/objects.hpp, src/prognode.cpp: made GDL_OBJECT's name a constant 2012-11-30 m_schellens * src/prognode.cpp, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/dcompiler.cpp, src/dstructdesc.cpp, src/dstructdesc.hpp, src/gdlc.g, src/gdlexception.cpp, src/objects.cpp, src/overload.cpp, src/overload.hpp: full infrastructure for operator overloading (not depoyed yet) 2012-11-29 m_schellens * src/prognodeexpr.cpp, src/topython.cpp, src/typetraits.cpp, src/CMakeLists.txt, src/Makefile.am, src/accessdesc.hpp, src/assocdata.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/basic_fun_cl.cpp, src/basic_fun_jmg.cpp, src/basic_pro.cpp, src/basic_pro_jmg.cpp, src/convert2.cpp, src/datatypes.cpp, src/dstructdesc.cpp, src/dstructdesc.hpp, src/envt.cpp, src/envt.hpp, src/gdlexception.cpp, src/libinit.cpp, src/math_fun.cpp, src/math_fun_jmg.cpp, src/ncdf_var_cl.cpp, src/nullgdl.cpp, src/objects.cpp, src/overload.cpp, src/overload.hpp: operator overloading (only basic definitions - not supported yet) 2012-11-28 alaingdl * src/basic_pro.cpp, src/libinit.cpp, src/objects.cpp: Initial (unfinished) import of keyword /pref in HELP * src/preferences.hpp, src/Makefile.am, src/preferences.cpp: very preliminary (and not working) import of a way to process external text files for setting variables like GDL_GR_X_HEIGHT (ToDo: SET_PREF/GET_PREF) 2012-11-27 alaingdl * src/gdl.cpp, doc/gdl.1: preparing ingesting external preference file (gdl -pref=/path/to/PrefFile) 2012-11-26 alaingdl * src/pro/zenity_check.pro: setting !zenity.version to -1 when no Zenity found. Used in WMENU() 2012-11-25 alaingdl * src/pro/save.pro: extending SAVE from 30 params to 100. Only limited tests done ... 2012-11-21 alaingdl * configure.in: applying patch from Debian (0.9.2-4 fix-muldefs) * doc/gdl.1: applying patch from Debian 0.9.2-4 (hyphen-used-as-minus-sign and one typo) 2012-11-21 m_schellens * src/io.cpp, src/io.hpp, src/objects.cpp: Fixed GET_LUN bug (TEST_GET_LUN) 2012-11-20 m_schellens * src/objects.cpp: added some struct descriptors (commented out) 2012-11-20 alaingdl * src/libinit.cpp: in DEVICE, warning keyword TRUE_COLOR (for compatibility with Pluto 4.0 code) * src/devicex.hpp: typo: removing double declaration * src/devicex.hpp: desactivating useless debuging "cout << " * src/plotting_device.cpp: missing WordExp() when writing SVG or PS files. * src/magick_cl.cpp: missing WordExp() in MagickPing and MagickWrite; now we can query and write in ~/ directory ! 2012-11-19 alaingdl * src/pro/Makefile.am, src/pro/wmenu.pro: initial import of WMENU(), with a Zenity based version (working) and a text-based version (to be verified ASAP) 2012-11-16 alaingdl * src/pro/dialog_message.pro: correcting compatibility issues with old zenity versions in DIALOG_MESSAGE 2012-11-15 alaingdl * src/pro/dialog_message.pro, testsuite/test_dialog_message.pro: finishing refinements in DIALOG_MESSAGE and related test cases in TEST_DIALOG_MESSAGE 2012-11-15 m_schellens * src/basic_fun.cpp, src/basic_fun_jmg.cpp, src/basic_fun_jmg.hpp, src/libinit_jmg.cpp, src/prognodeexpr.cpp: fixed ROUTINE_NAMES,/FETCH (lead to crash in cmsvlib) 2012-11-15 alaingdl * src/pro/dialog_message.pro, src/pro/zenity_check.pro: revised DIALOG_MESSAGE but not fully finished; new !zenity structure to be faster and with less redundant messages when using obsolete zenity code * testsuite/test_dialog_message.pro: initial import of TEST_DIALOG_MESSAGE, interactive tests case for revisited DIALOG_MESSAG. 2012-11-14 alaingdl * src/pro/Makefile.am: stupid typo in new function name :( * src/pro/dialog_pickfile.pro: updating DIALOG_PICKFILE: large part of code moved into ZENITY_CHECK() * src/pro/dialog_message.pro: updating DIALOG_MESSAGE: large part of code moved into ZENITY_CHECK() * src/pro/Makefile.am, src/pro/zenity_check.pro: creating ZENITY_CHECK(), a function checking the availability of "zenity" in the path and also checks the version. This code was common in DIALOG_PICKFILE and DIALOG_MESSAGE and this should help for future maintenance and extensions 2012-11-13 alaingdl * src/pro/restore.pro: in RESTORE, fixing feature request 3581835 and various tricks around filename 2012-11-13 m_schellens * src/antlr/LLkParser.cpp, src/antlr/Parser.cpp, src/antlr/Parser.hpp: sync 2012-11-12 alaingdl * config.h.cmake: tuning HAVE_PLPLOT_BEFORE_5994 to have success on more than Debian ;-) * configure.in, src/plotting_xyouts.cpp: tuning HAVE_PLPLOT_BEFORE_5994 to have success on latest Debian too ;-) 2012-11-12 m_schellens * src/GDLInterpreter.cpp, src/gdlc.i.g: Line numbers in IF statements; bug tracker ID: 3579702 * testsuite/test_suite.pro, src/GDLParser.cpp, src/gdlc.g: parser error with: tmp=cos(str.data(0).value); bug tracker ID: 3579499 * src/prognodeexpr.cpp, src/typedefs.hpp: Fixed segfault with undefined variable; bug tracker ID: 3585392 2012-11-10 alaingdl * CMakeLists.txt: first attempt managing recent plplot lib. with CMake ... * src/plotting_xyouts.cpp: typo in plotting_xyouts.cpp 2012-11-09 alaingdl * src/plotting_xyouts.cpp, configure.in: trying to manage hidden symbols in recent Debian plplot 5.9.9-4 in XYOUTS; patch 3575295 from Joanna 2012-11-07 slayoo * configure.in: removing color-tests from configure.in - it causes problems, and the autotools-based install is anyhow going to be obsoleted soon... 2012-11-07 alaingdl * doc/www/resources.php: updating ADASS refs * doc/www/credits.php: adding my 2 students this summer 2012 * src/antlr/LLkParser.cpp: desactiviating verbose mode in interpretor "trace" ! 2012-11-07 slayoo * gsl.m4: removing the gsl.m4 file * src/antlr/Makefile.in, src/pro/Makefile.in, src/pro/dicom/Makefile.in, testsuite/Makefile.in, depcomp, doc/Makefile.in, install-sh, ltmain.sh, missing, mkinstalldirs, src/Makefile.in, INSTALL, Makefile.cvs, Makefile.in, aclocal.m4, config.guess, config.h.in, config.sub, configure: removing autotools-generated files from the repository * AUTHORS, doc/udg/chapters/credits.tex, doc/www/credits.php: adding Gilles to the author lists 2012-11-06 m_schellens * src/antlr/LLkParser.cpp, src/GDLParser.cpp, src/gdlc.g: nicer tracing 2012-10-29 gilles-duvert * src/interp_multid.h: Solved bug keyword "Missing" not working for upper side in 1D INTERPOLATE. The range for interpolation was deemed valid including the upper boundary, when in IDL thid is not the case. 2012-10-18 alaingdl * src/pro/str_sep.pro, testsuite/test_str_sep.pro: improvment of STR_SEP, should be OK for Separator with more than one element. Unfinished for pecular cases with one element. * testsuite/test_str_sep.pro: adding news cases failing with current STR_SEP code (to be updated soon ;-) * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_get_lun.pro: inclusion of "test_get_lun.pro" in the "make check" test suite. Currently, this test fails. 2012-10-12 m_schellens * src/basic_pro.cpp, src/basic_pro.hpp, src/libinit.cpp: HEAP_FREE initial version 2012-10-10 alaingdl * testsuite/test_deriv.pro, src/pro/deriv.pro: continuing cleaning DERIV() 2012-10-09 m_schellens * HACKING, src/deviceps.hpp, src/gshhs.cpp, src/typedefs.hpp: renamed GSLGuard to GDLGuard; redefined FILEGuard 2012-10-09 alaingdl * testsuite/test_qromo.pro, src/gsl_fun.cpp: improving QROMO when diverging at one of the boundaries: switch from QAG to QAGS. General case not ready, but testsuite improved ... * src/pro/deriv.pro: better behavior, we desactivate extra checks ... 2012-10-08 alaingdl * src/typedefs.hpp: missing for Ubuntu OS ... * src/gsl_fun.cpp: in QROMO, allowing paired sizes for inputs [1][N] or [N][1] should give [N] 2012-10-05 m_schellens * src/gsl_fun.cpp, src/typedefs.hpp: Fixed several memory leaks 2012-10-04 m_schellens * src/deviceps.hpp, src/gshhs.cpp, src/gsl_fun.cpp, src/gsl_matrix.cpp, src/math_fun.cpp, src/typedefs.hpp, CMakeModules/Findlibps.cmake: removed LIBPS_LIBRARY_DIRS from CMake pslib stuff; added exception savety 2012-10-03 alaingdl * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_nans_in_sort_and_median.pro: Why this important test on MEDIAN() and SORT() with NaN wasn't in the automatic test suite ? We do have a serious problem ! * testsuite/test_random.pro, testsuite/test_wait.pro: typos: STOP forgot in "test_random"; wait is unaccurate on Suse :( 2012-10-02 m_schellens * src/CFMTLexer.cpp, src/CFMTLexer.hpp, src/CFMTTokenTypes.hpp, src/CFMTTokenTypes.txt, src/FMTIn.cpp, src/FMTIn.hpp, src/FMTInTokenTypes.hpp, src/FMTInTokenTypes.txt, src/FMTLexer.cpp, src/FMTLexer.hpp, src/FMTParser.cpp, src/FMTParser.hpp, src/FMTTokenTypes.hpp, src/FMTTokenTypes.txt, src/FMTOut.cpp, src/FMTOut.hpp, src/FMTOutTokenTypes.hpp, src/FMTOutTokenTypes.txt, src/format.out.g: Fixed : format code; Bug ID: 3572473 * src/basic_fun.cpp, src/envt.cpp, src/envt.hpp, src/typedefs.hpp: Fixed SCOPE_VARFETCH; Bug tracker ID: 3573558 * src/basegdl.hpp: include xdr.h for windows, rpc.h otherwise * src/read.cpp: fixed READ; bug tracker ID: 3573790 2012-10-02 alaingdl * src/basegdl.hpp: reverting change in "basegdl.hpp" (bug 3573468) for #include (we cannot compile on OSX with #include ) * src/gsl_fun.cpp: two problems in RANDOM: checking when amplitude for Binonial is below 1; removing regression introduced mid-july when "seed" is not set outside. * testsuite/test_random.pro: improvment in "test_random.pro": being less sensitive for small amp. in Binomial; introducing new basic tests to check very basic regressions ... * testsuite/test_wait.pro: relaxing tol. error for TEST_WAIT 2012-10-01 alaingdl * testsuite/test_scope_varfetch.pro: following bug report 3573558: extended test cases for SCOPE_VARFETCH * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_ptrarr.pro: initial import of "test_ptrarr.pro", related to bug report 3573202 2012-10-01 m_schellens * src/arrayindexlistnoassoct.hpp: Fixed salar array indexing (return scalar if all indices are scalar); bug tracker ID: 3573202 2012-09-28 alaingdl * src/gtdhelper.cpp, src/gtdhelper.hpp: initial import of 2 missing files for compilation under MSwin. * CMakeModules/FindPCRE.cmake, CMakeModules/FindXdr.cmake: initial import of 2 missing CMake-related files for compilation under MSwin: FindPCRE.cmake FindXdr.cmake 2012-09-20 alaingdl * testsuite/test_fft_dim.pro: deeper test cases for DIM keyword in FFT * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_systime.pro, testsuite/test_wait.pro: 3 new tests in automatic "make check". * testsuite/test_call_function.pro, testsuite/test_call_procedure.pro: following idea in bug report 3569697, improved tests (on keyword values too) for CALL_FUNCTION and CALL_PROCEDURE 2012-09-19 m_schellens * testsuite/test_call_function.pro, testsuite/test_call_procedure.pro, configure: sync * src/GDLInterpreter.cpp, src/gdlc.i.g: New GDL_... type codes for ANTLR files * src/GDLInterpreter.cpp, src/GDLInterpreterTokenTypes.hpp, src/GDLLexer.cpp, src/GDLTokenTypes.hpp, src/GDLTreeParserTokenTypes.hpp, src/envt.cpp, src/extrat.cpp, src/extrat.hpp: Fixed keyword handling for CALL_FUNCTION and CALL_PROCEDURE (when calling user defined subroutines) * src/extrat.cpp: Fixed behaviour of _EXTRA (bug tracker ID: 3568388) 2012-09-18 alaingdl * src/basic_op.cpp: better accuracy in Modulo with Double * src/file.cpp, src/file.hpp, src/libinit.cpp: recovering FILE_SEARCH for non MSwin OS * src/basic_pro.cpp, src/basic_pro.hpp, src/libinit.cpp: recovering SPAWN capability under non-MSwin OS 2012-09-18 m_schellens * src/math_fun_gm.cpp, src/math_fun_jmg.cpp, src/math_fun_ng.cpp, src/nullgdl.cpp, src/ofmt.cpp, src/plotting.cpp, src/plotting_contour.cpp, src/plotting_map_proj.cpp, src/plotting_plot.cpp, src/plotting_plots.cpp, src/plotting_polyfill.cpp, src/plotting_windows.cpp, src/read.cpp, src/semshm.cpp, src/sigfpehandler.cpp, src/sigfpehandler.hpp, src/str.cpp, CMakeLists.txt, src/CMakeLists.txt, src/arrayindex.cpp, src/arrayindex.hpp, src/arrayindexlistnoassoct.hpp, src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/basic_fun_cl.cpp, src/basic_pro.cpp, src/basic_pro.hpp, src/basic_pro_jmg.cpp, src/basic_pro_jmg.hpp, src/color.cpp, src/convert2.cpp, src/datatypes.cpp, src/datatypes.hpp, src/default_io.cpp, src/deviceps.hpp, src/devicewin.hpp, src/devicez.hpp, src/dinterpreter.cpp, src/dinterpreter.hpp, src/dnode.cpp, src/file.cpp, src/file.hpp, src/gdl.cpp, src/gdlgstream.hpp, src/gdljournal.cpp, src/gdlpsstream.hpp, src/gdlwidget.hpp, src/gdlwinstream.hpp, src/graphics.cpp, src/grib.cpp, src/gsl_fun.cpp, src/includefirst.hpp, src/initsysvar.cpp, src/io.cpp, src/io.hpp, src/libinit.cpp, src/math_fun.cpp, src/math_fun_ac.cpp: applied patches 2 and 3 from tracker ID 3568748 (windows compatibility) * HACKING: remarks on exception save programming * src/math_fun_ng.cpp, src/prognode_lexpr.cpp, src/allix.cpp: sync 2012-09-18 alaingdl * testsuite/test_extra_keywords.pro: new file TEST_EXTRA_KEYWORD to test whether the _extra keywords are well managed. 2012-09-18 m_schellens * src/dll/two.cpp, src/arrayindexlistt.hpp, src/assocdata.cpp, src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/basic_fun_cl.cpp, src/basic_fun_jmg.cpp, src/basic_op.cpp, src/basic_op_new.cpp, src/basic_pro.cpp, src/basic_pro_jmg.cpp, src/convert2.cpp, src/datatypes.cpp, src/datatypesref.cpp, src/default_io.cpp, src/devicex.hpp, src/dstructdesc.cpp, src/dstructgdl.cpp, src/dstructgdl.hpp, src/envt.cpp, src/envt.hpp, src/extrat.cpp, src/extrat.hpp, src/fftw.cpp, src/gdlpython.cpp, src/gdlxstream.cpp, src/gsl_fun.cpp, src/gsl_matrix.cpp, src/hdf_fun.cpp, src/magick_cl.cpp, src/math_fun.cpp, src/math_fun_ac.cpp, src/math_fun_gm.cpp, src/math_fun_jmg.cpp, src/math_fun_ng.cpp, src/math_utl.cpp, src/math_utl.hpp, src/ncdf_att_cl.cpp, src/ncdf_cl.cpp, src/ncdf_dim_cl.cpp, src/ncdf_var_cl.cpp, src/nullgdl.cpp, src/ofmt.cpp, src/plotting.cpp, src/plotting_contour.cpp, src/plotting_convert_coord.cpp, src/plotting_map_proj.cpp, src/plotting_plots.cpp, src/plotting_polyfill.cpp, src/plotting_surface.cpp, src/plotting_windows.cpp, src/plotting_xyouts.cpp, src/print.cpp, src/prognode.cpp, src/prognode.hpp, src/prognodeexpr.cpp, src/pythongdl.cpp, src/read.cpp, src/strassenmatrix.hpp, src/topython.cpp, src/typedefs.hpp, src/typetraits.cpp, src/widget.cpp, src/FMTIn.cpp, src/FMTInTokenTypes.hpp, src/FMTLexer.cpp, src/FMTOut.cpp, src/FMTOutTokenTypes.hpp, src/FMTParser.cpp, src/FMTTokenTypes.hpp, src/GDLInterpreter.cpp, src/GDLInterpreterTokenTypes.hpp, src/GDLLexer.cpp, src/GDLTokenTypes.hpp, src/GDLTreeParserTokenTypes.hpp, src/accessdesc.hpp, src/arrayindex.cpp, src/arrayindex.hpp, src/arrayindexlistnoassoct.hpp: applied patch 1 from tracker ID: 3568748 (rename GDL types to GDL_...) 2012-09-18 alaingdl * testsuite/test_call_function.pro, testsuite/test_call_procedure.pro: adding more explicit messages when problems encoutered runnning TEST_CALL_FUNCTION and TEST_CALL_PROCEDURE * testsuite/test_call_procedure.pro: adding explicit messages when problems encoutered 2012-09-16 alaingdl * src/plotting.cpp: applying patch 3567803 by S. Hony for histogram plot. 2012-09-14 alaingdl * CMakeModules/FindNetCDF.cmake, CMakeModules/Findlibps.cmake, CMakeLists.txt: including patch 3538449 for CMake way (better way to find external libs. NetCDF and LibPS) * src/gdlwidget.cpp, src/gdlwidget.hpp, src/libinit_jmg.cpp, src/objects.cpp, src/widget.cpp, src/widget.hpp, NEWS: applying patch 3567344: new widgets WIDGET_LIST and CW_GROUP 2012-09-13 m_schellens * src/read.cpp: skip till end of line when reading multiple parameters with READF 2012-09-13 alaingdl * src/gsl_fun.cpp: fixing general case in FFT() when using GSL way only 2012-09-12 m_schellens * src/gsl_fun.cpp: fixed memeory leak in random_template 2012-09-12 alaingdl * testsuite/test_fft.pro, testsuite/test_fft_dim.pro: test cases for FFT, unfinished :( 2012-09-11 m_schellens * src/basegdl.hpp, src/basic_fun.cpp, src/envt.cpp, src/extrat.cpp, src/gsl_fun.cpp, src/nullgdl.cpp, src/nullgdl.hpp: fixed several memory leaks in fft_template (gsl fft version) 2012-09-09 alaingdl * testsuite/test_fft.pro, src/gsl_fun.cpp: FFT in the GSL way was not OK when input was in double * NEWS, src/gsl_fun.cpp: sorry, I put the wrong version for corrected FFT using GSL ... 2012-09-07 slayoo * src/convert2.cpp: fixing overzealous error-reporting in convert2.cpp version 1.30 - see bug no. 3565657 (thanks Gilles) 2012-09-07 alaingdl * src/gsl_fun.cpp: various changes for FFT(): should work for DIMENSION keyword and when FFTw is not used. More test cases especially when DIM is used are needed. * src/envt.cpp: EnvT::KeywordSet() (in "envt.cpp") must behave as KEYWORD_SET() in "basic_fun.cpp". 2012-09-07 gilles-duvert * testsuite/test_bug_3483402.pro: add test_bug_3483402.pro , closes the corresponding ticket. * testsuite/Makefile.am: added testsuite/test_bug_3483402.pro 2012-09-05 gilles-duvert * src/plotting.cpp: box aspect correct with /ISOTROPIC and /[X|Y]LOG * src/plotting_oplot.cpp: Should solve bug #3563928. 2012-09-04 gilles-duvert * src/plotting.cpp: Modified support for '/ISOTROPIC' in graphic commands to align boxes more in the IDL style. * src/libinit.cpp, src/plotting.cpp, src/plotting.hpp, src/plotting_contour.cpp, src/plotting_oplot.cpp, src/plotting_plot.cpp, src/plotting_surface.cpp: Support for '/ISOTROPIC' in graphic commands. 2012-08-30 alaingdl * src/basic_fun.cpp, src/libinit.cpp: adding keyword /Double in function COMPLEX() 2012-08-18 slayoo * src/convert2.cpp, src/dnode.cpp, testsuite/Makefile.am, testsuite/test_bug_3559291.pro: fixing bug no. 3559291 (float('1.5D-1') != 0.15) 2012-08-17 alaingdl * configure.in: sorry for not updated the main "configure.in" including src/pro/envi/Makefile 2012-08-16 alaingdl * src/devicex.hpp, src/gdlgstream.hpp, src/gdlxstream.cpp, src/gdlxstream.hpp, src/libinit.cpp, src/plotting_windows.cpp, NEWS: Initial import of keyword ICONIC in WSHOW. The SHOW param. is not efficient ? Help welcome to fix the sub-window value when iconifying. 2012-08-14 alaingdl * src/pro/read_bmp.pro, src/pro/read_gif.pro, src/pro/read_image.pro, src/pro/read_jpeg.pro, src/pro/read_pict.pro, src/pro/read_png.pro, src/pro/read_tiff.pro, src/pro/read_xwd.pro, src/pro/strmatch.pro, src/pro/strsplit.pro: Since now GDL enforces scalar type in FOR loop, we have to take care with STRLEN when the input is a one element array. All the READ_(images) procedures don't really checked whether we try to read back more than one and only one file * src/pro/Makefile.am, src/pro/Makefile.in: fixing details in MakefileS related to new Envi sub-dir. 2012-08-13 alaingdl * src/pro/image_statistics.pro: adding Labeled keyword to the IMAGE_STATISTICS procedure, thanks to Sixy6e 2012-08-12 alaingdl * NEWS, src/pro/Makefile.am, src/pro/Makefile.in, src/pro/STATUS, src/pro/UrgentNeed.txt, src/pro/rot.pro: initial import of ROT, calling internal POLY_2D code * NEWS: few updates in NEWS 2012-08-11 alaingdl * src/pro/write_jpeg.pro, src/pro/write_png.pro: revisiting buggy WRITE_JPEG and WRITE_PNG: gray images can now be stored, but not via best pure Gray type; Order was activated for missing cases in WRITE_PNG (tested on Saturn.jpg for WRITE_JPEG and WRITE_PNG, color and Gray) 2012-08-02 gilles-duvert * src/pro/mean.pro: patched MEAN so it continues to work with non-arrays. 2012-08-02 m_schellens * src/basegdl.cpp, src/basegdl.hpp, src/datatypes.cpp, src/datatypes.hpp, src/prognode.cpp, src/specializations.hpp, NEWS, README: Promotion of FOR loop index variable type 2012-07-25 m_schellens * src/basic_fun.cpp, src/prognodeexpr.cpp: Improved SCOPE_VARFETCH * src/basic_fun.cpp, src/basic_fun.hpp, src/basic_fun_jmg.cpp, src/basic_fun_jmg.hpp, src/datatypes.cpp, src/libinit.cpp, src/libinit_jmg.cpp, src/prognodeexpr.cpp: Fixed SCOPE_VARFETCH 2012-07-24 alaingdl * src/pro/interpol.pro: detail of test version in INTERPOL, sorry * src/pro/Makefile.am, src/pro/Makefile.in, src/pro/interpol.pro: since "scope_varfetch.pro" was removed from src/pro/, we need to removed it in the Makefile.(am/in) 2012-07-24 slayoo * src/pro/scope_varfetch.pro: removing GDL-written version of scope_varfetch from the repository 2012-07-24 m_schellens * NEWS: Update NEWS * src/gdlc.tree.g, src/libinit_jmg.cpp, src/prognode.hpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp, src/basic_fun_jmg.cpp, src/basic_fun_jmg.hpp, configure: Working trinary operator for undefined l-values. SCOPE_VARFETCH (only LEVEL keyword). 2012-07-23 m_schellens * src/prognode.cpp, src/prognode.hpp, src/prognodeexpr.cpp: trinary operator redefined, working for r-values only. L-value support to be done * src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/Makefile.in, src/datatypes.cpp, src/datatypesref.cpp, src/dcompiler.cpp, src/dcompiler.hpp, src/gdl.cpp, src/gdlc.tree.g, src/gsl_fun.cpp, src/gsl_matrix.cpp, src/libinit.cpp, src/math_fun.cpp, src/math_fun_jmg.cpp, src/prognodeexpr.cpp, HACKING, NEWS, README, configure.in: Proper error handling for GSL. Some minor corrections. 2012-07-22 m_schellens * src/nullgdl.cpp, src/nullgdl.hpp: add files for \!NULL 2012-07-21 m_schellens * src/CMakeLists.txt, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/Makefile.am, src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/basic_pro.cpp, src/basic_pro_jmg.cpp, src/datalistt.hpp, src/datatypes.cpp, src/default_io.cpp, src/dnode.cpp, src/dvar.cpp, src/envt.cpp, src/extrat.hpp, src/gdlc.g, src/gdlc.tree.g, src/gdlwidget.cpp, src/grib.cpp, src/gsl_fun.cpp, src/gsl_matrix.cpp, src/hdf_pro.cpp, src/initsysvar.cpp, src/libinit.cpp, src/ncdf_att_cl.cpp, src/ncdf_cl.cpp, src/ncdf_dim_cl.cpp, src/ncdf_var_cl.cpp, src/plotting_misc.cpp, src/prognode.cpp, src/prognode.hpp, src/prognode_lexpr.cpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp, src/pythongdl.cpp, src/typedefs.hpp, src/typetraits.cpp, src/widget.cpp: \!NULL sysvar (full support). Proper error handling for GSL functions (set up framework + partial implementation) 2012-07-18 m_schellens * src/arrayindexlistnoassoct.hpp, src/arrayindexlistt.hpp: Fixed array indexing with negative scalars (introduced in last commit) 2012-07-17 m_schellens * src/pythongdl.cpp: Fixed compile error when compiled as python module. * src/GDLTreeParser.cpp, src/arrayindexlistnoassoct.hpp, src/arrayindexlistt.hpp, src/basegdl.hpp, src/dcompiler.cpp, src/dimension.hpp, src/gdlc.tree.g, src/prognode.cpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp: Fixed lvaue handling for parameters with trinary operator. Fixed return of scalar/single element array for array indexing. 2012-07-16 m_schellens * src/gdlc.i.g, src/GDLInterpreter.cpp, src/envt.cpp, src/envt.hpp, src/extrat.cpp, src/extrat.hpp: Fixed keyword parameters to CALL_FUNCTION and CALL_PROCEDURE 2012-07-14 alaingdl * testsuite/test_moment.pro: is this way, can work with GDL, new 8 and old IDL versions * src/gsl_fun.cpp: typo ... * src/gsl_fun.cpp, src/pro/moment.pro, testsuite/test_moment.pro: validity of Dimension keyword is now tested ASAP in MOMENT(); visual tests for this keyword; a cout less in FZ_ROOTS ... 2012-07-14 m_schellens * src/GDLInterpreter.cpp, src/arrayindex.hpp, src/gdlc.i.g: fixed bug with array indexing in lhs dot expressions 2012-07-13 alaingdl * NEWS: news in NEWS ! * src/pro/kurtosis.pro, src/pro/mean.pro, src/pro/moment.pro, src/pro/skewness.pro, src/pro/stddev.pro, src/pro/variance.pro: updating MEAN(), STDDEV(), VARIANCE(), SKEWNESS(), KURTOSIS() to have Dim= keyword since it is now available via the MOMENT() function. (Tests needed :( 2012-07-11 m_schellens * src/dinterpreter.cpp: Fixed proper handling of _retTree in stopped subroutines 2012-07-11 alaingdl * testsuite/test_strsplit.pro: adding 4 new test cases into TEST_STRSPLIT * src/pro/strsplit.pro: STRSPLIT(): a detail in a test ... * src/pro/strsplit.pro: in STRSPLIT(), we must return strarr even with single element except for '' ! 2012-07-10 m_schellens * src/arrayindexlistnoassoct.hpp, src/convert2.cpp, src/datatypes.cpp: fixed bug when copying byte to string array element, COPY_BYTE_AS_INT behaviour in Convert2 was changed 2012-07-05 alaingdl * src/gsl_fun.cpp, testsuite/test_fft_dim.pro: FFT( dim= ) should worked now. Test using TEST_FFT_DIM, improvment welcome ! * testsuite/test_fx_root.pro, src/gsl_fun.cpp: improvments in FX_ROOT(): when x_i is a root, short-cut; pure complex code in do-loop. Revisited TEST_FX_ROOT, comparison with NEWTON in simple cases. * testsuite/test_dicom.pro: limited extension of TEST_DICOM, cannot reproduce bug 3150207, but "new" bug when this test called with /version * src/gsl_fun.cpp: in FX_ROOT, when result is a real, return a real ... 2012-07-04 alaingdl * src/pro/file_lines.pro: correcting bugs 3175753 and 3189065 for FILE_LINES(); now FILE_LINES() can manage input files list; but still having pbs when files name prefixed or suffixed by white spaces ... (due to known hard bug 3439079 in WordExp() in "str.cpp") 2012-07-02 m_schellens * src/envt.cpp, src/envt.hpp, src/gsl_fun.cpp: Fixed keyword support for CALL_FUNCTION/PROCEDURE 2012-07-02 gilles-duvert * src/gdlwidget.cpp: compilation with gcc 4.4.3 (linux) was complaining about a possible confusion on this call: gdlwidget.cpp: In constructor 'GDLWidgetDropList::GDLWidgetDropList(WidgetIDT, BaseGDL*, BaseGDL*, DString, DLong, DLong)': gdlwidget.cpp:629: error: call of overloaded 'wxString(wxCStrData, wxMBConvStrictUTF8&)' is ambiguous /usr/local/include/wx-2.9/wx/string.h:1309: note: candidates are: wxString::wxString(const wchar_t*, const wxMBConv&) /usr/local/include/wx-2.9/wx/string.h:1296: note: wxString::wxString(const unsigned char*, const wxMBConv&) /usr/local/include/wx-2.9/wx/string.h:1283: note: wxString::wxString(const char*, const wxMBConv&) Solved by forcing type const wchar_t*, proceed with fingers crossed. 2012-06-29 alaingdl * testsuite/test_call_function.pro, testsuite/test_call_procedure.pro: adding keyword in call to CALL_FUNCTION and CALL_PROCEDURE. Both fail today :( 2012-06-28 alaingdl * src/math_fun_jmg.cpp: not clear if my pragma give better times in FINITE() ! * testsuite/test_finite.pro, src/math_fun_jmg.cpp: correcting bug into FINITE(, sign=) [various OS don't behave the same]. should be OK on INT related and FLOAT related types, not ready for complex. Extending "test_finite". 2012-06-28 m_schellens * src/pro/Makefile.in, src/pro/dicom/Makefile.in, testsuite/Makefile.in, doc/Makefile.in, src/CMakeLists.txt, src/Makefile.in, src/antlr/Makefile.in, src/basic_fun.cpp, src/basic_fun_jmg.cpp, src/fftw.cpp, Makefile.in, configure: Fixed direct function call via CALL_FUNCTION 2012-06-28 slayoo * src/plotting_surface.cpp: switching from plmesh to plstream::mesh in plotting_surface() 2012-06-28 alaingdl * NEWS: now FX_ROOT() in GDL, coded in c++ by B. Laurent. 2012-06-27 alaingdl * src/gsl_fun.cpp: quiet work inside FX_ROOT(). check on p0 (3 elmnts) not finished. * testsuite/test_fx_root.pro: test for FX_ROOT() : one new test on roots values * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_3441031.pro, testsuite/test_call_function.pro, testsuite/test_call_procedure.pro, testsuite/test_execute.pro: 1/ adding 2 new tests : "test_call_procedure', "test_call_function" (now failing on intrinsic functions), 2/ extending "test_execute", moving "test_bug_3441031" inside "test_execute". 3/ adding "test_call_procedure', "test_call_function", "test_fx_root", "test_fz_roots" in Makefile 4/ removing "test_bug_3441031" from Makefile 2012-06-27 slayoo * src/plot3d_nr.cpp, src/Makefile.am, src/Makefile.in, src/plotting_surface.cpp: removing plot3d_nr.cpp (thanks to Joel for providing instructions) 2012-06-27 alaingdl * testsuite/test_fx_root.pro: initial import of TEST_FX_ROOT * src/gsl_fun.cpp, src/gsl_fun.hpp, src/libinit_ac.cpp: initial import of C++ version of FX_ROOT() 2012-06-20 alaingdl * NEWS, testsuite/Makefile.am, testsuite/Makefile.in: details (update NEWS !) * src/math_fun_jmg.cpp, src/libinit_jmg.cpp: adding SIGN Keyword in FINITE ... (M. Pinter) * src/plotting_oplot.cpp: correcting a bug detected in OPLOT via "test_healpix.pro" * testsuite/test_moment.pro: for old idl version, no DIM in MOMENT ... * testsuite/test_finite.pro, testsuite/test_moment.pro: initial import of TEST_FINITE, including new SIGN keyword tests. 2012-06-19 alaingdl * testsuite/test_moment.pro, testsuite/test_qromo.pro: fixing details in test cases QROMO and MOMENT. 2012-06-16 alaingdl * NEWS: details in what we changed * src/gsl_fun.cpp: correcting code ... isfinite instead lot of tests ... * src/pro/moment.pro, testsuite/test_moment.pro: revisited MOMENT (new keywords, esp. DIM !) * testsuite/test_qromo.pro: update test cases for QROMO (we should now cover all the cases) * src/gsl_fun.cpp: revised version of QROMO by M. Pinter. Should cover all the cases. Good managment of NaN/Inf ... * testsuite/test_fz_roots.pro: tests cases for FZ_ROOTS (preliminary version, errors accumulation not managed !) * src/gsl_fun.cpp, src/gsl_fun.hpp, src/libinit_ac.cpp, NEWS: initial import of FZ_ROOTS, but works only for input polynomials with real coefs. We used the same code in the GSL than the IMSL_ZEROPOLY code ... 2012-06-12 alaingdl * src/pro/tvscl.pro: we decided to overcome NaN problems in TVSCL. 2012-05-25 alaingdl * src/pro/read_png.pro: with a fake extra INTERNAL_READ_PNG, pro and func do work transparently. * src/pro/hist_equal.pro, src/libinit.cpp: adding quiet /COMPILE_FULL_FILE in RESOLVE_ROUTINE; typo corrected in HIST_EQUAL. 2012-05-22 alaingdl * src/pro/hist_equal.pro, testsuite/test_hist_equal.pro: initial import of HIST_EQUAL; associated test suite. 2012-05-16 alaingdl * src/pro/standardize.pro: fixing the sign pb in STANDARDIZE 2012-05-14 alaingdl * testsuite/test_standardize.pro, testsuite/test_zip.pro: details in tests ... * src/pro/hist_equal.pro: fake temporary file (sync. with SF to do) * src/pro/Makefile.am, src/pro/Makefile.in, src/pro/STATUS: I forgot to update Makefile.am in src/pro with new files HIST_EQUAL and STANDARDIZE * testsuite/test_zip.pro: revised TEST_ZIP because "stat" options are various ... 2012-05-12 alaingdl * testsuite/Makefile.am, testsuite/Makefile.in: adding "test_standardize" in testsuite * testsuite/test_standardize.pro, src/pro/standardize.pro, NEWS: initial import of STANDARDIZE and related test file 2012-05-10 alaingdl * configure.in: Only in classic "configure" way, you can choice between ImageMagick (--with-Magick, default) or GraphicsMagick (--with-GraphicsMagick, off by default, if you used it, please desactivate IM via : --without-Magick). Both ways should give same results on PNG and JPEG. * src/magick_cl.cpp: QUERY_IMAGE should now be OK for ALL JPEG and PNG, please report problems, with link to images giving problems ! * configure.in: adding --with-GraphicsMagick=DIR as an alternative to ImageMagick. Tested on Ubuntu 10.04 with success. * testsuite/test_read_standard_images.pro, src/magick_cl.cpp: extended test suite for PNG and JPEG formats. Useful comments in magick wrapper for later work ... 2012-05-08 alaingdl * doc/www/_news.inc.php, src/pro/smooth.pro, testsuite/test_smooth.pro: SMOOTH: revised faster algo for 2D smooth; test_smooth.pro updated too. 2012-04-30 alaingdl * doc/www/_news.inc.php, doc/www/resources.php: correcting broken links to ADASS 2011 paper 2012-04-13 gilles-duvert * INSTALL: Reverted to version 1.21 by Slayoo + a small addendum on libtool problems that I encounter often... * testsuite/test_random.pro: more precise "verbose" mode. test fails randomly, which is normal with random numbers ;^)) * testsuite/test_congrid.pro: test fails on byte arrays, but this is due to the conversion from double to byte by gdl basics, not by interpolate. This shoudl be investigated separately. I've changed the byte arrays to double by default, keeping byte as an option 2012-04-13 alaingdl * src/interp_multid.h: adding a missing file for revised version of INTERPOLATE 2012-04-13 gilles-duvert * src/gsl_fun.cpp, src/libinit_jmg.cpp: I more or less rewrote INTERPOLATE to support all documented (and some undocumented) features. I added a gsl-like handling of multi-D interpolation (which could be ported easily to gsl), but gsl does not have the same parametric cubic convolution as we want, and does not know about missing values, hence the necessity to overload its basic methods and structures. I added the /NEAREST_NEIGHBOUR option in the list of INTERPOLATE options since it makes for a very simple CONGRID procedure, and could be possibly of use elsewhere. * src/pro/congrid.pro: supports all options now that interpolate has the /nearest_neighbour option. * src/basic_fun.cpp: small typo 2012-03-20 gilles-duvert * src/extrat.cpp: It looks to me that if a kw is in the "warnkey" list it should be considered as valid kw for the "_STRICT_EXTRA" kw passing mechanism. * src/libinit.cpp: added several keywords to the "warnKey" list of axis, surface and contour. These keywords are to be really supported at some point but it is possible to ignore thme and still have correct outputs, in particular with procedures like the coyotegraphics where *all* the possible keywords are used, even with default values. 2012-03-17 alaingdl * src/devicex.hpp: TVRD: beeing able to manage x0, y0, Nx, Ny parameters; no check made :( maybe mirroring effect pending 2012-03-15 alaingdl * src/devicex.hpp, src/pro/loadct.pro: better managment for color tables in LOADCT (good resultS around Coyote lib.) 2012-03-13 alaingdl * src/plotting_erase.cpp: ERASE: working version for Decompose == 0 or 1 * src/libinit.cpp, src/plotting_erase.cpp, NEWS: color keyword or parameter for ERASE (maybe not OK when not in /decomposed). Now default !p.background is also take into account. Preparing support for Coyote Lib. 2012-03-06 alaingdl * testsuite/test_image_statistics.pro: easy switch introducing fake error in this script. 2012-03-05 gilles-duvert * src/plotting.cpp, src/plotting.hpp, src/plotting_oplot.cpp, src/plotting_plot.cpp, src/plotting_plots.cpp: Corrected regression introduced in previous version: while that version was correctly supporting the MIN_VALUE and MAX_VALUE keywords for PLOT and OPLOT when they were present, it was forcing these values even in the absence of the keywords, and even worse, for the PLOTS command. 2012-03-05 alaingdl * testsuite/test_interpol.pro, src/pro/interpol.pro: bug corrected in INTERPOL; better testsuite for this function. 2012-02-28 alaingdl * src/pro/findex.pro, src/pro/interpol.pro: INTERPOL.pro: temporary solution for bug 3495104. Not the final answer ... 2012-02-21 alaingdl * testsuite/test_bug_3441031.pro: no blocking version of the test. This test was generating a crash before mid-Nov. 2011. 2012-02-21 slayoo * testsuite/test_bug_3152892.pro: commiting a forgotten file 2012-02-20 slayoo * testsuite/test_bug_3488003.pro, testsuite/Makefile.am: adding test routine for bug no. 3488003 * doc/www/_news.inc.php: website update (Ubutnu package) 2012-02-20 m_schellens * src/arrayindexlistnoassoct.hpp, src/arrayindexlistt.hpp: fixed an indexing issue (bug ID 3488003) * src/Makefile.in, src/gdlwidget.cpp, src/math_fun_jmg.cpp, src/widget.cpp, testsuite/Makefile.in, configure: corrected EXECUTE like calls to fit new stack handling 2012-02-19 slayoo * CMakeLists.txt, configure.in: adding a warning about the planned move from Autotools to CMake to configure.in 2012-02-16 gilles-duvert * src/devicex.hpp: solves bug 3477639 * src/devicex.hpp: solves bug 3485528 and possibly 3434849. 2012-02-15 alaingdl * src/pro/write_image.pro: initial version of WRITE_IMAGE * src/pro/write_image.pro, src/pro/Makefile.am, src/pro/Makefile.in, src/pro/read_image.pro, src/pro/read_png.pro: initial import of READ_IMAGE(). WRITE_IMAGE to be add later. 2012-02-13 alaingdl * testsuite/test_ludc_lusol.pro: in LUDC and LUSOL, we can now testing Float and Double. * src/gsl_matrix.cpp, src/libinit_ac.cpp: for DETERM, LUDL, LUSOL, extension to "any" input types (not only double). Details may not be fully fixed (exception catching, keywords ...) Help welcome. 2012-02-10 alaingdl * testsuite/test_congrid.pro: adding a self consistant test (which is not working now !) 2012-02-08 slayoo * CMakeLists.txt, configure.in: adding Fedora package name hints to CMakeLists.txt and configure.in 2012-02-07 alaingdl * src/pro/read_jpeg.pro: typo ... * src/pro/read_jpeg.pro, src/pro/read_png.pro: testing agreement of formats before efective reading * src/pro/read_jpeg.pro, src/pro/read_png.pro, src/magick_cl.cpp: improved reading of JPEG (gray + colors) and PNG files (1,2,3 & 4 channels) * src/plotting_misc.cpp: when TVLCT applyed, we have to upgrade the color table (check OK on X) 2012-02-06 alaingdl * testsuite/test_read_standard_images.pro: more reliable behavior * testsuite/test_tvlct.pro: direct switch into TrueColor mode * testsuite/test_read_standard_images.pro, testsuite/test_tvlct.pro: initial import of two tests : reading 2 JPEG and 4 PNG as basic cases; verifying TVLCT is working ... 2012-02-03 alaingdl * src/gsl_matrix.cpp, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_trisol.pro, NEWS: better version for TRISOL (any input types); TEST_TRISOL self-consistant. * testsuite/test_congrid.pro: in such a way, can be tested on both ways ... * src/devicex.hpp, src/plotting_windows.cpp: correcting Window, xpos= , ypos= (bug 3482821) 2012-02-02 alaingdl * src/gsl_matrix.cpp, src/gsl_matrix.hpp, src/libinit_ac.cpp: initial import of a working draft for TRISOL only for inputs in Double. To be extend to any types. * src/pro/read_png.pro: coorecting order when reading PNG. Tested on various files with success. 2012-01-30 gilles-duvert * src/plotting_oplot.cpp, src/plotting_plot.cpp, src/plotting_plots.cpp: Silently takes care of different sizes in X and Y dimensions for PLOT, PLOTS and OPLOT. test, e.g.: plot,findgen(1000),findgen(100)*5,/POL oplot,findgen(1000),findgen(10)*5,/POL,psym=4 2012-01-28 alaingdl * src/plotting.cpp: {X|Y}range keyword in type double should be managed ... * src/pro/read_jpeg.pro: correction in READ_JPEG when GrayScale, bug report 3471918 2012-01-27 alaingdl * src/pro/Makefile.am: in src/pro/Makefile.am, *.pro list must be alphabeticaly ordered 2012-01-27 gilles-duvert * src/plotting.cpp, src/plotting.hpp, src/plotting_axis.cpp: Better support of the Log options (and values in CRANGE). PLOTS can now plot outside box in DATA mode. Cursor give correct data values even in log plots. valmin, valmax are handled at plot level, not at box limits. passes all the graphic tests. Removed temporarily support for 'clip" , to be continued. axis: changes only to follow changes in a function call arguments. * src/plotting_contour.cpp, src/plotting_cursor.cpp, src/plotting_oplot.cpp, src/plotting_plot.cpp, src/plotting_plots.cpp, src/plotting_polyfill.cpp, src/plotting_surface.cpp, src/plotting_xyouts.cpp: Better support of the Log options (and values in CRANGE). PLOTS can now plot outside box in DATA mode. Cursor give correct data values even in log plots. valmin, valmax are handled at plot level, not at box limits. passes all the graphic tests. Removed temporarily support for 'clip" , to be continued. Polyfill and surface: changes only to follow changes in a function call arguments. 2012-01-26 gilles-duvert * src/gdlxstream.cpp: It seems to me that this small patch mimics better the *DL behaviour and its doc (?) * testsuite/test_plotting_ranges.pro: updated test to sync with new capability, CRANGE OK in /YLOG mode 2012-01-25 gilles-duvert * src/plotting.cpp: changed pow(x,10) in pow(10,x) 2012-01-25 alaingdl * src/plotting.cpp: hum, better way to have the !X.type info at the right places for get/set !{xyz}.crange * src/plotting.cpp: small change for !X.CRange (!Y.crange and !Z.crange too !) to manage Log. plots. 2012-01-24 gilles-duvert * INSTALL: Added a comment about how to update aclocal to local version of libtool if there is a problem. Tested on Mandriva Linux, your mileage may vary. 2012-01-24 alaingdl * doc/udg/README.txt: initial import of an HowTo to help compiling the documentation. * src/pro/Makefile.am, src/pro/Makefile.in, src/pro/get_login_info.pro: initial import of GET_LOGIN_INFO * testsuite/test_congrid.pro: TEST_CONGRID now needs ImageMagick, we have to exist if not linked to. * testsuite/test_read_jpeg.pro: missing factor parameter when screen too small * testsuite/test_diag_matrix.pro: initial import of TEST_DIAG_MATRIX. This test is not really self-testing :( * src/pro/Makefile.am, src/pro/Makefile.in, src/pro/diag_matrix.pro, src/pro/la_invert.pro: initial import of DIAG_MATRIX and LA_INVERT (both need by iCosmo) 2012-01-23 m_schellens * src/arrayindex.cpp: fixed assoc var with one index * src/arrayindex.cpp, src/arrayindex.hpp, src/arrayindexlistt.hpp, src/gsl_fun.cpp: fixed assoc var with one index (ArrayIndexListOneT) 2012-01-23 alaingdl * src/plotting_oplot.cpp: same typo in OPLOT * src/plotting_plot.cpp: correcting a typo in PLOT, simplest case broken (plot, indgen(10)) 2012-01-23 gilles-duvert * src/libinit.cpp, src/plotting.cpp, src/plotting.hpp, src/plotting_oplot.cpp, src/plotting_plot.cpp, src/plotting_plots.cpp, src/plotting_xyouts.cpp: Corrected bugs that prevented correct positioning of datapoints (lines, psyms...) with commands PLOTS, XYOUTS and OPLOT when PLOT was done with /[X|Y]LOG. Added support for NSUM=xxx and /POLAR options used in PLOT, OPLOT. Treatment for DATAMIN,DATAMAX and CLIP is not OK however. needs some more changes. Debugged the /NORMAL, /DEVICE and /CONTINUE option of PLOTS. Should be OK even for some (not all) cases when !P.MULTI is not 0. Added SIZE=xxx undocumented option as a replacement for CHARSIZE for the XYOUTS command (support for several legacy procedures). * testsuite/test_poly2d.pro: changed missing value to 128 to better show the influence of the "missing=xxx" keyword. Also, serves as test of my ability to commit patches... 2012-01-22 alaingdl * NEWS, src/gsl_fun.cpp, src/libinit_ac.cpp, testsuite/test_qromo.pro: small improvments in QROMO (but not finished at all) * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_qromb.pro, testsuite/test_qromo.pro: initial import of TEST_QROMB and TEST_QROMO. To be expanded ... 2012-01-21 alaingdl * src/gsl_fun.cpp: NEWTON mus accepted "singleton" too; temporary change in QROMO for ]a,b[ range (to be generalize ASAP) 2012-01-20 alaingdl * src/gsl_fun.cpp, src/gsl_fun.hpp, src/libinit_ac.cpp: QROMO: initial import of limited version only for range [a,+inf]; help welcome. * src/gsl_fun.cpp: QROMB: better managment of inputs (vectors, matrix); IDL doc. is wrong for that ([1],[8]) return [8], not [1] 2012-01-12 alaingdl * NEWS: update * src/libinit_ac.cpp: introducing QSIMP, using QROMB ... * src/gsl_fun.cpp: managing arrays in QROMB 2012-01-10 alaingdl * NEWS, src/gsl_fun.cpp, src/gsl_fun.hpp, src/libinit_ac.cpp: initial import for QROMB, not ready for arrays. 2012-01-07 m_schellens * src/arrayindex.hpp, src/arrayindex.cpp: Fixed bug ID 3464519 2012-01-05 alaingdl * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_random.pro: initial import of TEST_RANDOM, very basic tests to check consistancy of basic computations (gamma and binomial cases) * NEWS: details in NEWS ... * src/gsl_fun.cpp: in RANDOM(N/U): now, Binomial keyword works; serious rewriting; conflicting keywords detected. 2012-01-04 alaingdl * src/gsl_fun.cpp: in RANDOM(U/N), better managment of GAMMA values (exit if <= 0.; put to 1 if 0.0 < Gamma < 1.0) 2012-01-03 slayoo * src/deviceps.hpp: TV/PostScript: plplot compatibility fix * doc/udg/examples/obj_class_1/obj_class_1.out.txt, doc/udg/routines/appleman.pro.tex, doc/udg/examples/call_external_0/call_external_0.pro, doc/udg/examples/file_lines_0/file_lines_0.out.txt, doc/udg/examples/h5_get_libversion_0/h5_get_libversion_0.out.txt, doc/udg/diag/broken-references, doc/udg/chapters/credits.tex, doc/udg/gdl.tex, doc/udg/makeall: doc/udg update 2012-01-03 alaingdl * CMakeLists.txt: correcting typo in CMakeLists.txt 2012-01-02 slayoo * CMakeLists.txt, CMakeModules/FindNumpy.cmake: CMake: working version of PYTHONDIR and PYTHONVERSION support * doc/gdl.1: manpage updae * src/deviceps.hpp, src/dinterpreter.cpp, src/gdlgstream.hpp, src/libinit_jmg.cpp, src/pro/appleman.pro, src/typedefs.hpp: misc cleanups 2012-01-02 alaingdl * src/gdlgstream.hpp: correcting bug introduced by Sylwester to have X11 plots ... 2011-12-31 slayoo * config.h.cmake: fixing CMake support for PSlib 2011-12-30 alaingdl * src/math_fun_jmg.cpp: removing comment in POLY_2D * src/math_fun_jmg.cpp, src/math_fun_jmg.hpp: managing keyword Missing for POLY_2D [patch from G. Duvert] (see TEST_POLY2D_NEW in testsuite/test_poly2d.pro). When no missing value, case of <> [sic] is still pending ... * testsuite/test_get_kbrd.pro: hum, I forgot to manage "wait" keyword in third case ... * testsuite/test_get_kbrd.pro: initial import of TEST_GET_KBRD. 3 main cases are tested. * src/basic_fun.cpp: in GET_KBRD(), better managment of GET_KBRD(0) (see testsuite/test_get_kbrd.pro) [should be retest on OSX] * src/pro/identity.pro: in IDENTITY, bug corrected when N=1 * src/pro/appleman.pro: small changes, one in order to have return of the array without internal TV * testsuite/test_congrid.pro, testsuite/test_postscript.pro, testsuite/test_ps_decomposed.pro: various minor bugs corrections and few extensions (TEST_POSTSCRIPT_APPLEMAN ;-) 2011-12-29 slayoo * src/deviceps.hpp: PostScript: fixing a memory leak in TV 2011-12-28 slayoo * src/deviceps.hpp, src/devicez.hpp, src/graphics.cpp: TV: a draft of PostScript support (tracker items 3460150 and 3110007) * src/gdlgstream.hpp, src/gdlpsstream.hpp: gdlpsstream.hpp: correcting typo (ps-ttf -> psttf) * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_3453775.pro: adding a test for bug no. 3453775 * doc/www/resources.php: doc/www: adding a link in the resources section 2011-12-27 slayoo * doc/www/images/Colourise.css, doc/www/_header.inc.php, doc/www/_news.inc.php: doc/www: website update 2011-12-21 alaingdl * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_congrid.pro: initial import of TEST_CONGRID. maybe not needed in "make check" as long as we don't have null test * src/pro/Makefile.am, src/pro/Makefile.in, src/pro/bilinear.pro, src/pro/congrid.pro, NEWS: initial import of CONGRID and BILINEAR (both in GDL syntax, in src/pro), thanks to G. Duvert 2011-12-16 alaingdl * src/gsl_fun.cpp: a bug corrected in INTERPOLATE (patch by G. Duvert); we still do not have a good testsuite for INTERPOLATE. 2011-12-15 alaingdl * testsuite/test_poly2d.pro: revisiting TEST_POLY2D. more simple way to show few problems in POLY_2D 2011-12-14 m_schellens * src/basic_fun_jmg.cpp: Adapt ROUTINE_NAMES to new callstack layout 2011-12-13 alaingdl * src/CMakeLists.txt, src/gsl_matrix.hpp: adding new files (gsl_matrix.hpp and gsl_matrix.cpp) in CMakeLists.txt 2011-12-13 m_schellens * src/prognode.cpp, src/prognode.hpp: Fixed break with breakTarget == NULL. Bug ID 3454317 2011-12-09 alaingdl * NEWS, src/gsl_matrix.cpp, src/gsl_matrix.hpp, src/libinit_ac.cpp: initial import of DETERM(), only for type DOUBLE (help welcome) * src/gsl_matrix.cpp, NEWS: alignment bug in LUDC * testsuite/test_ludc_lusol.pro: details in TEST_LUDC_LUSOL * testsuite/Makefile.am, testsuite/test_ludc_lusol.pro: typo corrected in TEST_LUDC_LUSOL * src/Makefile.am, src/Makefile.in, src/gsl_matrix.cpp, src/gsl_matrix.hpp, src/libinit_ac.cpp: initial import of C++ LUDC and LUSOL (based on GDL). Work BUT only on DOUBLE ... Help needed. * src/pro/Makefile.am, src/pro/Makefile.in, src/pro/ludc.pro: removing the fake LUDC, to be remplace by a draft of LUDC/LUSOL pair in C++ * testsuite/test_ludc_lusol.pro: initial import for TEST_LUDC_LUSOL tests (very preliminary). * src/plotting.cpp: patch by G. Duvert correcting in USERSYM behavior of !P.CHARSIZE, !P.SYMSIZE, /CHARSIZE= and /SYMSIZE= 2011-12-08 m_schellens * src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dstructgdl.cpp, src/dstructgdl.hpp, src/specializations.hpp, src/typedefs.hpp: Fixed SHIFT(a,0). Bug ID 3453775 2011-12-07 m_schellens * src/envt.cpp: Fixed EnvBaseT::Caller() 2011-12-06 alaingdl * NEWS: upgrade of NEWS * src/gsl_fun.cpp, src/libinit_jmg.cpp: new keyword /nan added to HISTOGRAM. It is not fully finished/tested but working in basic cases. * testsuite/test_histo.pro: upgrade of TEST_HISTO for to be introduced new keyword /Nan 2011-12-05 m_schellens * src/basic_fun.cpp, src/prognodeexpr.cpp: fixed wrong delete in lib::execute function * src/gdlwidget.cpp: corrected callstack handling 2011-12-05 alaingdl * src/pro/Makefile.am, src/pro/Makefile.in: missing two new files (READ_GIF and WRITE_GIF) in Makefile* 2011-12-03 m_schellens * src/GDLInterpreter.hpp, src/basic_fun.cpp, src/envt.hpp, src/gdlc.i.g, src/print.cpp, src/prognodeexpr.cpp: EnvStackT now with EnvUDT instead EnvBaseT * src/basic_pro.cpp, src/envt.cpp, src/envt.hpp, src/gsl_fun.cpp, src/prognode.cpp, src/prognodeexpr.cpp, src/basic_fun.cpp: EnvT for library functions is no longer pushed onto the call stack. Fix for random_fun binominalKey 2011-11-30 alaingdl * src/gsl_fun.cpp: code like RANDOMN(seed,10, BINOMIAL=[3,.5]) is wrong ... (should return int-like values) * src/pro/read_gif.pro, src/pro/write_gif.pro: initial inclusion of READ_GIF and WRITE_GIF. Very limited functionalities but OK to read and write GIF derivated from testsuite/Saturn.jpg (256 colors) * src/pro/read_jpeg.pro: typo in READ_JPEG 2011-11-30 m_schellens * src/basic_fun.cpp, src/gdlc.i.g, src/str.cpp, src/str.hpp: Faster STRUPCASE and STRLOWCASE 2011-11-29 alaingdl * testsuite/test_str_functions.pro: testing also /reverse_offset in STRMID (test is not perfect) * src/libinit.cpp: reverting typo in "libinit.cpp" for keyword /rever in STRMID() 2011-11-28 alaingdl * src/plotting.cpp, testsuite/test_usersym.pro: correcting bug related to USERSYM: beeing able to manage 1 or 2 points only on plot 2011-11-25 m_schellens * src/gdlc.i.g, src/GDLInterpreter.cpp: sync 2011-11-25 slayoo * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_3441031.pro: adding test_bug_3441031.pro 2011-11-25 m_schellens * src/GDLInterpreter.cpp, src/prognodeexpr.cpp, src/arrayindexlistnoassoct.hpp, src/gdlc.i.g, src/libinit.cpp: Fixed bug ID 3441031 2011-11-24 m_schellens * src/basic_fun.cpp: insert some assert macros * src/math_fun.cpp: optimization for IMAGINARY and CONJ * src/basic_fun.cpp, src/basic_fun.hpp, src/envt.hpp, src/libinit.cpp, src/math_fun.cpp, src/math_fun.hpp: direct call for several functions * src/libinit.cpp, src/math_fun.cpp, src/math_fun.hpp: direct call EXP function 2011-11-22 alaingdl * src/pro/usersym.pro: since a working C++ code for USERSYM was added today, the fake "usersym.pro" can be removed ! * src/pro/Makefile.am, src/pro/Makefile.in: STRMATCH was added in CVS, USERSYM was moved as a C++ code. * src/initsysvar.cpp, src/initsysvar.hpp, src/libinit.cpp, src/plotting.cpp, src/plotting.hpp, src/plotting_oplot.cpp: initial import for USERSYM procedure, thanks to a contribution by Gilles Duvert 2011-11-22 slayoo * src/pro/strmatch.pro, testsuite/test_strmatch.pro: STRMATCH: yet another improvement * src/pro/strmatch.pro, testsuite/test_strmatch.pro: STRMATCH: improvement * src/pro/strmatch.pro, testsuite/Makefile.am, testsuite/test_strmatch.pro: STRMATCH: initial import 2011-11-20 m_schellens * src/str.cpp: removed escaping of space in WordExp function * src/devicex.hpp: fixed bug ID 3438651 2011-11-18 m_schellens * src/basic_fun.cpp, src/basic_fun.hpp, src/libinit.cpp, src/math_fun.cpp, src/math_fun.hpp: direct call API for more library functions * src/objects.cpp, src/str.cpp: changed WordExp: esc only non escaped blanks * src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dpro.cpp, src/dpro.hpp, src/libinit.cpp, src/math_fun.cpp, src/math_fun.hpp, src/prognodeexpr.cpp: faster ALOG ALOG10 N_ELEMENTS 2011-11-16 alaingdl * testsuite/test_mpfit.pro: managing multiple occurences in TEST_MPFIT 2011-11-16 slayoo * doc/www/faq.php: doc/www: a new faq item * src/gshhs.cpp: MAP_CONTINENTS: fixing argument number check * doc/www/resources.php: doc/www: resources.php: adding a link to Alain's ADASS XXI talk * doc/www/_news.inc.php: doc/www: news updates 2011-11-16 alaingdl * src/pro/Makefile.am, src/pro/Makefile.in: fixing files list in Makefile* * testsuite/test_file_copy.pro, testsuite/test_file_delete.pro: limited updates preparing next better tests ... * src/pro/usersym.pro: initial import of a fake USERSYM to avoid stopping codes just because we don't know how to write USERSYM * src/pro/read_ascii.pro, src/pro/read_jpeg.pro, src/pro/read_png.pro, src/pro/read_xwd.pro: better managment when we try to read a directory when a real file is expected. * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test-read_ascii.pro, testsuite/test_image_statistics.pro: initial import of TEST_IMAGE_STATISTICS; correction in TEST-READ_ASCII to be able to go to the end. 2011-11-15 m_schellens * src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/dpro.cpp, src/dpro.hpp, src/envt.cpp, src/envt.hpp, src/gdlc.g, src/gdlc.tree.g, src/libinit.cpp, src/math_fun.cpp, src/math_fun.hpp, src/newprognode.cpp, src/prognode.cpp, src/prognode.hpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp: direct calls for lib functions 2011-11-15 slayoo * doc/www/_news.inc.php: www: typo fix 2011-11-15 m_schellens * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/basic_fun.cpp, src/gdlc.g, src/gdlc.tree.g, src/newprognode.cpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp: FCALL_N_ELEMENTSNode 2011-11-15 alaingdl * src/pro/image_statistics.pro: hum, we need to use /double ... * src/pro/image_statistics.pro: type conversion for 3 outputs of IMAGE_STATISTICS 2011-11-15 slayoo * doc/www/_news.inc.php: www: Macports port news (0.9.2) 2011-11-14 slayoo * doc/www/_news.inc.php: www: ArchLinux package news (0.9.2) 2011-11-14 alaingdl * src/pro/Makefile.am, src/pro/Makefile.in: adding IMAGE_STATISTICS.pro in Makefile files 2011-11-14 m_schellens * src/getas.cpp: com,ented out typename * src/getas.cpp: add file * src/arrayindex.cpp, src/arrayindexlistnoassoct.hpp, src/arrayindexlistt.hpp, src/convert2.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dstructgdl.hpp, src/newprognode.cpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp: faster 2D indexing 2011-11-13 slayoo * doc/www/_news.inc.php: www: Fedora 0.9.2 package info * doc/www/_news.inc.php: www: FreeBSD 0.9.2 port info 2011-11-12 slayoo * doc/www/_header.inc.php, doc/www/faq.php: www: adding FAQ page 2011-11-10 alaingdl * src/pro/image_statistics.pro: initial import of IAMGE_STATISTICS procedure, coded in GDL syntax. 4 keywords are missing 2011-11-09 alaingdl * testsuite/test_read_jpeg.pro: adding a call to READ_JPEG, /Gray * src/pro/read_jpeg.pro: /Gray should work now in READ_JPEG (tested on testsuite/Saturn.jpg) * src/magick_cl.cpp: MAGICK_QUANTIZE don't need 2 mandatory arg.; small code factoring; order changed for lisibility 2011-11-09 slayoo * doc/www/_news.inc.php: www: news about 0.9.2 release and ADASS XXI 2011-11-09 m_schellens * CMakeLists.txt, configure, configure.in: GDL 0.9.2 CVS GDL 0.9.2: 2011-11-08 m_schellens * configure, configure.in, src/typedefs.hpp, ChangeLog, NEWS, src/str.cpp: release 2011-11-08 alaingdl * NEWS: details in NEWS * src/initsysvar.cpp: in !version, OS must be in lower case for Linux and Darwin ... 2011-11-07 m_schellens * src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/arrayindex.cpp, src/arrayindexlistnoassoct.hpp, src/envt.cpp, src/gdlc.g, src/gdlc.i.g, src/gdlc.tree.g, src/newprognode.cpp, src/prognode.cpp, src/prognode.hpp, src/prognodeexpr.cpp, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp: optimized parameter passing * src/prognodeexpr.cpp: fix bug 3300626 * src/arrayindex.hpp, src/arrayindexlistt.hpp: sync * src/CMakeLists.txt, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLTreeParser.cpp, src/Makefile.am, src/Makefile.in, src/arrayindex.cpp, src/arrayindexlistnoassoct.hpp, src/arrayindexlistt.hpp, src/basic_pro.cpp, src/dnode.cpp, src/dnode.hpp, src/gdlc.i.g, src/gdlc.tree.g, src/prognode.cpp, src/prognode.hpp, src/prognode_lexpr.cpp, src/prognodeexpr.cpp: add file 2011-11-06 m_schellens * src/basic_fun.cpp: Fixed STREGEX * src/arrayindex.hpp, src/envt.cpp: re-fix bug 3300626 2011-11-06 alaingdl * CMakeLists.txt: version 0.9.2 in CMake way ;-) * src/devicex.hpp: correcting bug 3433502 in TV 2011-11-05 m_schellens * src/arrayindex.cpp, src/arrayindex.hpp, src/arrayindexlistt.hpp, src/basegdl.cpp, src/basegdl.hpp, src/datatypes.cpp, src/datatypes.hpp, src/dstructgdl.cpp, src/dstructgdl.hpp, src/envt.cpp, src/envt.hpp, src/prognode.cpp, src/typedefs.hpp: bug fixes * src/GDLInterpreter.cpp, src/arrayindex.cpp, src/arrayindex.hpp, src/arrayindexlistt.hpp, src/basic_fun.cpp, src/datalistt.hpp, src/dstructgdl.cpp, src/dstructgdl.hpp, src/envt.cpp, src/envt.hpp, src/gdlc.i.g, src/prognode.cpp, src/prognode.hpp: removal of ArrayIndexT::Index() 2011-11-04 m_schellens * src/GDLInterpreter.cpp, src/GDLTreeParser.cpp, src/dnode.hpp, src/gdlc.i.g, src/gdlc.tree.g, src/prognode.hpp: implemented check for number of arguments to subroutines (TEST_DERIV bug) 2011-11-03 m_schellens * src/basic_op.cpp, src/basic_op_new.cpp, src/sigfpehandler.cpp: fixed error handling at division by 0 2011-11-03 slayoo * doc/www/resources.php: www: adding a link to Mark Pipers website to resources.php * doc/www/_header.inc.php: ITT -> Exelis in website header 2011-11-03 m_schellens * src/arrayindex.hpp, src/arrayindexlistt.hpp, src/datatypes.cpp, src/prognode_lexpr.cpp: optimization for Index with single element 2011-11-02 alaingdl * src/pro/idl_validname.pro: we subsitute to the current limited version of IDL_VALIDNAME() a version provided by Hon Xu * testsuite/test_idl_validname.pro: before running TEST_IDL_VALIDNAME, we need to be sure STREGEX is working. * testsuite/Makefile.am, testsuite/Makefile.in: adding two files (test_idl_validname.pro and test_stregex.pro) in Makefile.am in order to be run ... * testsuite/test_idl_validname.pro: one more case ($) in "test_idl_validname.pro" 2011-11-02 m_schellens * src/basic_op.cpp, src/basic_op_new.cpp, src/envt.cpp, src/envt.hpp, src/gdlc.i.g, src/prognodeexpr.cpp: optimization for scalar division and modulo * src/prognode.cpp, src/prognodeexpr.cpp, src/GDLInterpreter.cpp, src/gdlc.i.g, src/prognode.hpp, src/prognode_lexpr.cpp, src/prognodeexpr.hpp: cleanup * ltmain.sh, src/GDLInterpreter.cpp, src/GDLTreeParser.cpp, src/gdlc.i.g, src/gdlc.tree.g, src/prognodeexpr.cpp, src/prognodeexpr.hpp: fix make build system 2011-11-01 m_schellens * doc/Makefile.in, src/Makefile.in, src/antlr/Makefile.in, src/pro/Makefile.in, src/pro/dicom/Makefile.in, testsuite/Makefile.in, Makefile.in, aclocal.m4, configure: fix make build system * src/gdlc.i.g, src/prognodeexpr.cpp, src/prognodeexpr.hpp, src/GDLInterpreter.cpp: fixed bug around lib_function_call * src/GDLInterpreter.cpp, src/gdlc.i.g, src/newprognode.cpp, src/prognode.cpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp: sync 2011-10-31 m_schellens * src/GDLInterpreter.cpp, src/gdlc.i.g, src/prognode.cpp, src/prognode.hpp, src/prognodeexpr.cpp: new Eval functions replacing calls in GDLInterpreter * src/CMakeLists.txt, src/GDLInterpreter.cpp, src/Makefile.am, src/gdlc.i.g, src/prognode.cpp, src/prognode.hpp, src/prognode_lexpr.cpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp: Eval for DOTNode 2011-10-31 slayoo * src/magick_cl.cpp: Magick: adding a FIXME-throw in readindexes() * src/deviceps.hpp: PostScript: handling case when getlogin() returns a null pointer (apparently it happens!) * src/deviceps.hpp, NEWS, README: PostScript: making advantage of the change in plspage() introduced in plplot 5.9.9 2011-10-31 m_schellens * src/prognode.hpp, src/prognode_lexpr.cpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/gdlc.i.g, src/newprognode.cpp: replacing parts of gdlc.i.g 2011-10-29 m_schellens * src/GDLInterpreter.cpp, src/gdlc.i.g, src/prognode.cpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp: Removed _retTree setting in Eval functions 2011-10-29 slayoo * src/deviceps.hpp: fixing device,/close behaviour when no plot was created before * src/deviceps.hpp, testsuite/test_ps_decomposed.pro: fixing bug 3428043 (PSlib was changing locale of GDL) 2011-10-29 m_schellens * testsuite/Makefile.am, testsuite/test_ce.pro: undo testsuite changes * testsuite/Makefile.am, testsuite/test_ce.pro, src/GDLInterpreter.cpp, src/gdlc.i.g, src/newprognode.cpp, src/prognode.cpp, src/prognode.hpp: More LEval/Eval functions * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/gdlc.i.g: Interpreter improvements 2011-10-28 alaingdl * CMakeLists.txt, testsuite/test_healpix.pro: option -muldefs no more needed in CMake; update for HealPix tests when PNG not available * testsuite/test_stregex.pro: initial import of TEST_STREGEX, not finished. 2011-10-28 m_schellens * src/basic_fun.cpp: Fixed STREGEX with /EXTRACT * src/GDLLexer.cpp, src/GDLLexer.hpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/arrayindexlistt.hpp, src/datalistt.hpp, src/envt.cpp, src/envt.hpp, src/gdlc.i.g, src/prognode.cpp, src/prognode.hpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp: custom new/delete for Env[UD]T 2011-10-26 m_schellens * src/allix.cpp, src/allix.hpp, src/arrayindex.cpp, src/arrayindexlistt.hpp: introduced ArrayIndexListMultiAllIndexedT * src/allix.cpp, src/allix.hpp, src/arrayindexlistt.hpp, src/prognodeexpr.cpp, config.h.in, configure: Faster sequential indexing 2011-10-25 m_schellens * src/pro/Makefile.in, src/pro/dicom/Makefile.in, testsuite/Makefile.in, doc/Makefile.in, src/Makefile.in, src/antlr/Makefile.in, Makefile.in, aclocal.m4: fix linking * src/arrayindex.hpp, src/envt.hpp, src/typedefs.hpp: inline specialized GDLArray functions 2011-10-25 alaingdl * CMakeLists.txt: typo netDCF / netCDF * testsuite/test_ps_decomposed.pro: now, if bad locale when calling "test_ps_decomposed.pro", problem. 2011-10-24 m_schellens * src/prognode.hpp: inline 2011-10-23 m_schellens * src/antlr/Makefile.in, src/pro/Makefile.in, src/pro/dicom/Makefile.in, testsuite/Makefile.in, doc/Makefile.in, src/Makefile.in, src/allix.cpp, src/arrayindexlistt.hpp, src/basic_fun.cpp, src/envt.hpp, src/typedefs.hpp, Makefile.in, aclocal.m4, configure: Improved indexing. Fixed bug tracker ID 3426399 (\!sysvar.tag crash) 2011-10-20 m_schellens * src/basic_op.cpp: Fixed: OrOpInvS called OrOp (instead of OrOpS) 2011-10-20 alaingdl * src/math_fun_ac.cpp: correcting small bug in X/Y lengths checks for "spl_init_fun(x,y, ...)" 2011-10-20 m_schellens * src/gsl_fun.cpp, src/typedefs.hpp: Fixing bug in BaseGDL* zeropoly(EnvT*) (causing failure in test_zeropoly.pro) 2011-10-19 m_schellens * src/GDLInterpreter.cpp, src/accessdesc.hpp, src/arrayindex.hpp, src/arrayindexlistt.hpp, src/datatypes.cpp, src/gdlc.i.g, src/specializations.hpp: fixed handling of temporary array indices * src/allix.hpp, src/arrayindex.cpp, src/arrayindex.hpp, src/arrayindexlistt.hpp, src/dimension.hpp, src/dvar.hpp: non-copy dim stride 2011-10-18 alaingdl * testsuite/test_healpix.pro: initial import of test for the HealPix Library. Thanks to E. Hivon. * NEWS: news in NEWS 2011-10-18 m_schellens * src/allix.hpp, src/arrayindex.cpp, src/arrayindexlistt.hpp, src/allix.cpp: 2D index optimization * src/arrayindex.cpp, src/arrayindexlistt.hpp, src/basic_fun.cpp, src/datalistt.hpp, src/datatypes.cpp, src/datatypes.hpp, src/envt.cpp, src/prognode.cpp: sync 2011-10-17 m_schellens * src/allix.hpp, src/basic_op_new.cpp: sync * src/convert2.cpp: one element optimization for Convert2 2011-10-17 alaingdl * src/CMakeLists.txt: adding two new files for CMake 2011-10-17 m_schellens * src/Makefile.am, src/Makefile.in, src/allix.cpp, src/arrayindexlistt.hpp: fast indexing with only one variable dimension (e. g. a[1,*]) * src/allix.cpp, src/arrayindex.cpp: sync * src/allix.cpp: add file * src/Makefile.am, src/Makefile.in, src/allix.hpp, src/arrayindex.cpp, src/arrayindexlistt.hpp, src/dimension.hpp: indexing 2011-10-14 m_schellens * src/datatypes.cpp: sync * src/prognodeexpr.cpp: All OpNew functions utilized * src/datatypes.cpp, src/prognodeexpr.cpp: OpNew functions utilized. Faster TRANSPOSE 2D 2011-10-13 m_schellens * src/datatypes.cpp: Fast SHIFT for all dimensions and types * src/datatypes.cpp: fast SHIFT 3D and 4D (STRING only 1D and 2D) * src/datatypes.cpp, src/dstructgdl.cpp, src/typedefs.hpp: Fast SHIFT for 1D and 2D cases * src/datatypes.cpp, src/typedefs.hpp: GDLArray buffer cache 2011-10-12 alaingdl * doc/gdl.1: upgrade of man page, in concordance to new options in main "gdl". * src/gdl.cpp: short and long (-h, --help) ways to call options, we always forgot the good way to call them. No effect on options known by IDL. * src/basic_fun.cpp: improvments in STREGEX, but not finished :( (no test in testsuite; STRMATCH still missing) 2011-10-12 m_schellens * src/basegdl.cpp, src/basegdl.hpp, src/basic_op.cpp, src/basic_op_new.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dstructgdl.hpp, src/prognodeexpr.cpp, src/sigfpehandler.cpp, src/specializations.hpp: 37 new operator functions (not utilized yet) * src/basic_op_new.cpp, src/dimension.hpp, src/prognodeexpr.cpp, src/basegdl.hpp: added file for RetNew operators 2011-10-11 alaingdl * CMakeLists.txt: 1/ now, we mandatory need the "-z muldefs" flag at linking in CMake way. See altenative in CMakeList.txt. 2/ typo PSLIBS --> PSLIB 2011-10-11 m_schellens * src/assocdata.hpp, src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/basic_op.cpp, src/basic_pro.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dimension.hpp, src/dstructgdl.cpp, src/dstructgdl.hpp, src/math_fun_ng.cpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp, src/typedefs.hpp: For Eval(): AddNew, AddSNew and friends. GDLArray optimization * src/allix.hpp, src/arrayindex.cpp, src/arrayindex.hpp, src/arrayindexlistt.hpp, src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/basic_fun_jmg.cpp, src/datalistt.hpp, src/datatypes.cpp, src/dimension.hpp, src/dstructgdl.cpp, src/dstructgdl.hpp, src/gsl_fun.cpp, src/math_fun_jmg.cpp: stride storage for dimension 2011-10-10 m_schellens * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/basegdl.hpp, src/envt.cpp, src/envt.hpp, src/gdlc.i.g: Customized container for FoorLoopInfoT * src/GDLInterpreter.cpp, src/arrayindex.hpp, src/arrayindexlistt.hpp, src/basegdl.hpp, src/datalistt.hpp, src/datatypes.cpp, src/datatypesref.cpp, src/envt.cpp, src/envt.hpp, src/typedefs.hpp: New ExprListT definition 2011-10-08 m_schellens * src/Makefile.am, src/Makefile.in, src/accessdesc.hpp, src/allix.hpp, src/arrayindex.cpp, src/arrayindex.hpp, src/arrayindexlistt.hpp, src/basegdl.cpp, src/basegdl.hpp, src/convert2.cpp, src/datatypes.cpp, src/datatypes.hpp, src/datatypesref.cpp: Sequential indexing. Fixed Convert2(STRING). 2011-10-07 m_schellens * src/arrayindex.hpp, src/basic_op.cpp, src/arrayindex.cpp: optimizations for scalar handling (especially with OpenMP) * src/accessdesc.hpp, src/allix.hpp, src/arrayindex.cpp, src/arrayindex.hpp, src/arrayindexlistt.hpp, src/dimension.hpp: indexing optimizations * src/allix.hpp: add allix.hpp 2011-10-06 m_schellens * src/accessdesc.hpp, src/arrayindex.cpp, src/arrayindex.hpp, src/arrayindexlistt.hpp, src/basegdl.cpp, src/basegdl.hpp, src/basic_pro.cpp, src/datatypes.cpp, src/datatypes.hpp, src/datatypesref.cpp, src/dimension.hpp, src/dstructgdl.cpp, src/gdlc.tree.g, src/typedefs.hpp, src/GDLTreeParser.hpp, src/Makefile.am, src/Makefile.in: more efficient indexing (5x faster for indexed case) 2011-10-04 m_schellens * src/Makefile.am, src/Makefile.in, src/arrayindex.hpp, src/arrayindexlistt.hpp, src/datatypes.cpp, src/typedefs.hpp: indexing speed up 2011-09-29 m_schellens * src/arrayindex.hpp, src/arrayindexlistt.hpp, src/basic_fun.cpp, src/basic_op.cpp, src/basic_pro.cpp, src/convert2.cpp, src/datatypes.cpp, src/fftw.cpp, src/math_fun.cpp, src/strassenmatrix.hpp, src/typedefs.hpp: tracing for OMP calls 2011-09-25 alaingdl * src/math_fun.cpp: bad name for a counter in LAGUERE(), no time to fix 2011-09-25 m_schellens * src/basic_op.cpp, src/convert2.cpp, src/datatypes.cpp, src/magick_cl.cpp, src/math_fun.cpp, src/arrayindex.hpp, src/basic_fun.cpp: Removed usage of OpenMP for all simple copy operations 2011-09-24 m_schellens * src/arrayindex.hpp, src/arrayindexlistt.hpp, src/typedefs.hpp: changed defintion of AllIxT 2011-09-23 m_schellens * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLLexer.hpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/gdlc.g, src/prognode.hpp: Lookup table for NonCopyNode() * src/magick_cl.cpp: fix g++ segfault with -O2 and OpenMP 2011-09-20 m_schellens * src/GDLInterpreter.hpp, src/GDLLexer.hpp, src/GDLParser.cpp, src/GDLParser.hpp, src/basic_pro.cpp, src/dinterpreter.cpp, src/dstructdesc.cpp, src/gdlc.g, src/gdlc.i.g, src/pro/Makefile.in, src/pythongdl.cpp, testsuite/Makefile.in, config.h.in: Made GDL distinguish PRO and FUNCTION when searching for a subroutine (bug tracker ID 3394134) 2011-09-19 slayoo * CMakeLists.txt, INSTALL, NEWS, README, configure.in, doc/udg/chapters/math-func.tex, doc/udg/makeall, doc/www/requirements.php, src/gdlpsstream.cpp, src/gdlpsstream.hpp, src/graphics.hpp, src/initsysvar.cpp, src/initsysvar.hpp, src/libinit.cpp, src/plotting.cpp, src/plotting_contour.cpp, src/plotting_device.cpp, CMakeModules/Findlibps.cmake, src/deviceps.hpp: non-Encapsulated PostScript support along with XSIZE, YSIZE, XOFFSET, YOFFSET, PORTRAIT, LANDSCAPE and SCALE_FACTOR settings support for PostScript output (requires pslib - http://pslib.sourceforge.net/) 2011-09-01 slayoo * testsuite/test_sem.pro: test_sem.pro: uncommenting debug printfs 2011-08-31 m_schellens * src/basic_fun_jmg.cpp: fixed MAKE_ARRAY(/STRING, /INDEX,...) * src/Makefile.in, src/dstructdesc.hpp, src/pro/dicom/Makefile.in, config.h.in: allignment for structs 2011-08-31 alaingdl * testsuite/test_spher_harm.pro: fixing doc.; this code required at least IDL 8.0 on IDL side 2011-08-31 slayoo * testsuite/test_spher_harm.pro: test_spher_harm: making it work with IDL too (epsilon 1e-7 -> 1e-6) 2011-08-30 alaingdl * testsuite/test_spher_harm.pro: hum, stupid typo (duplicate begin ...) * testsuite/Makefile.in, testsuite/image_test.pro, testsuite/test_spher_harm.pro: fixing details in testsuite/ * src/pro/write_bmp.pro, src/pro/write_jpeg.pro, src/pro/write_pict.pro, src/pro/write_png.pro: some cleaning in the WRITE_* procedures, not finished. N_PARAMS() tests not done :( * src/pro/save.pro: details in SAVE * testsuite/image_test.pro: rewriting the "IMAGE_TEST" procedure to be usable, using the "Saturn.jpg" internal file. Some tests in initial version are missing (ToDo) * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_postscript.pro, testsuite/test_systime.pro: 1/ very preliminary test suite for the PostScript output (esp. XOFFSET and YOFFSET keywords are not working now) 2/ initial import of TEST_SYSTIME. The related bug was corrected in "gdl.cpp" by Sylwester. When an external library (e.g. ImageMagick) is compiled with "bad" locale, it may propagate inside GDL (one consequence: breaking SYSTIME(), another bad format in "printf"). 2011-08-29 slayoo * src/gdl.cpp: adding a note on why setlocale() has to be called after LibInit() * src/gdl.cpp: trying to fix MagickInit-locale conflict * doc/www/resources.php, doc/www/_news.inc.php: website update 2011-08-27 alaingdl * src/pro/write_jpeg.pro: in WRITE_JPEG, changing q*1U to UINT(q) (blocking bug); other "input checks" changes 2011-08-24 slayoo * doc/udg/chapters/cmdline.tex, doc/udg/chapters/credits.tex, doc/udg/chapters/debug.tex, doc/udg/chapters/dynload.tex, doc/udg/chapters/exec.tex, doc/udg/chapters/filesys.tex, doc/udg/chapters/image.tex, doc/udg/chapters/io-ascii.tex, doc/udg/chapters/io-bin.tex, doc/udg/chapters/io-fits.tex, doc/udg/chapters/io-grib.tex, doc/udg/chapters/io-hdf4.tex, doc/udg/chapters/io-hdf5.tex, doc/udg/chapters/io-idlsave.tex, doc/udg/chapters/io-img.tex, doc/udg/chapters/io-netcdf.tex, doc/udg/chapters/io.tex, doc/udg/chapters/math-basic.tex, doc/udg/chapters/math-bits.tex, doc/udg/chapters/math-constants.tex, doc/udg/chapters/math-fourier.tex, doc/udg/chapters/math-func.tex, doc/udg/chapters/math-geom.tex, doc/udg/chapters/math-interpol.tex, doc/udg/chapters/math-la.tex, doc/udg/chapters/math-multiroots.tex, doc/udg/chapters/math-ode.tex, doc/udg/chapters/math-poly.tex, doc/udg/chapters/math-rng.tex, doc/udg/chapters/math-stats.tex, doc/udg/chapters/math-wavelet.tex, doc/udg/chapters/net.tex, doc/udg/chapters/os.tex, doc/udg/chapters/plot-2d.tex, doc/udg/chapters/plot-3d.tex, doc/udg/chapters/plot-colours.tex, doc/udg/chapters/plot-fonts.tex, doc/udg/chapters/plot-map.tex, doc/udg/chapters/plot-misc.tex, doc/udg/chapters/plot-raster.tex, doc/udg/chapters/plot-term.tex, doc/udg/chapters/plot-windows.tex, doc/udg/chapters/python-in-gdl.tex, doc/udg/chapters/python-module.tex, doc/udg/chapters/strings.tex, doc/udg/chapters/syntax-arguments.tex, doc/udg/chapters/syntax-array.tex, doc/udg/chapters/syntax-errhandle.tex, doc/udg/chapters/syntax-flowcon.tex, doc/udg/chapters/syntax-heap.tex, doc/udg/chapters/syntax-help.tex, doc/udg/chapters/syntax-infnans.tex, doc/udg/chapters/syntax-oop.tex, doc/udg/chapters/syntax-ops.tex, doc/udg/chapters/syntax-stru.tex, doc/udg/chapters/syntax-sysvars.tex, doc/udg/chapters/syntax-types.tex, doc/udg/chapters/syntax-udsub.tex, doc/udg/chapters/syntax.tex, doc/udg/chapters/time.tex, doc/udg/chapters/widgets.tex, doc/udg/diag/broken-references, doc/udg/examples/get_login_info_0/get_login_info_0.out.txt, doc/udg/examples/showfont_4/gdl.ps, doc/udg/examples/showfont_7/gdl.ps, doc/udg/gdl.tex: doc/udg update * doc/www/resources.php: doc/www: updating resources.php with links to three other papers mentioning use of GDL 2011-08-22 opoplawski * src/deviceps.hpp, src/devicesvg.hpp, src/devicewin.hpp, src/devicex.hpp, src/devicez.hpp: Make setopt usage conditional on HAVE_OLDPLPLOT * src/deviceps.hpp, src/devicesvg.hpp, src/devicewin.hpp, src/devicex.hpp, src/devicez.hpp: SetOpt() was removed in plplot 5.9.8, use setopt() instead * src/gdlgstream.cpp: Use std::string() in gdlgstream.cpp to avoid ambiguity 2011-08-22 slayoo * src/libinit.cpp: DEVICE: ignoring XOFFSET and YOFFSET 2011-08-20 alaingdl * src/pro/idl_validname.pro: improvment of IDL_VALIDNAME, but not finished * testsuite/test_idl_validname.pro: initial import of test for IDL_VALIDNAME (not finished) * src/initsysvar.cpp: initial import of a EPOCH field in the !GDL structure * src/basic_fun.cpp: in STRCMP(), 2 bugs corrected when 2 arrays of string are provided. 2011-08-19 alaingdl * testsuite/test_file_which.pro, src/pro/file_which.pro: fixing last "/" in FILE_WHICH(), improving the related test file * testsuite/test_bug_3286031.pro, testsuite/test_bug_3376577.pro, testsuite/test_strsplit.pro: cleanup in 3 files in testsuite/ * CMakeModules/FindFFTW.cmake, CMakeModules/FindGSL.cmake, CMakeModules/FindGrib.cmake, CMakeModules/FindHDF.cmake, CMakeModules/FindLibproj4.cmake, CMakeModules/FindNetCDF.cmake, CMakeModules/FindNumpy.cmake, CMakeModules/FindPlplot.cmake, CMakeModules/FindReadline.cmake, CMakeModules/FindUdunits.cmake, CMakeLists.txt: update GDL version in CMakeLists.txt; copyright and GNU GPL licences added to all CMake files in dir. CMakeModules/ * quick_start_GDL.sh: in the script for quick start, preserving GDL_PATH/GDL_STARTUP 2011-08-18 slayoo * src/magick_cl.cpp: MAGICK_READ: fixing alpha channel read 2011-08-18 alaingdl * src/pro/idl_validname.pro: adding two fake keywords in IDL_VALIDNAME (/CONVERT_ALL] [, /CONVERT_SPACES) in order to be able to run End-To-End test of HealPix test program from E. Hivon. * src/pro/read_jpeg.pro: hum, bad if/then/else correction * src/pro/read_png.pro: better inputs checks for READ_PNG * src/pro/query_bmp.pro, src/pro/query_dicom.pro, src/pro/query_gif.pro, src/pro/query_image.pro, src/pro/query_jpeg.pro, src/pro/query_pict.pro, src/pro/query_png.pro, src/pro/query_ppm.pro, src/pro/query_tiff.pro, src/pro/read_jpeg.pro: now, we check we have compiled with ImageMagick support for these pro/functs which are using this external lib. * src/magick_cl.cpp: in MAGICK_OPEN, when filename is non existant, it is better to exist ... 2011-08-17 alaingdl * testsuite/test_interpolate_missing.pro: initial import (at the right place) of this file for testsuite 2011-08-17 slayoo * NEWS: NEWS update * testsuite/Makefile.am, testsuite/Makefile.in, src/gsl_fun.cpp, src/libinit_jmg.cpp: INTERPOLATE: support for the MISSING keyword 2011-08-16 slayoo * src/libinit_cl.cpp, src/magick_cl.cpp: moving fix of bug 3376577 from magick_open info libinit (so magick_create and magick_ping also benefit from it) 2011-08-15 slayoo * src/pro/findex.pro, src/pro/interpol.pro: fixing 3104537 in interpo.pro (patch by boudgdl) * doc/www/resources.php: adding a link to the redbranch blog in the resources section of the website 2011-08-12 alaingdl * doc/www/_news.inc.php: bad formatting news column * doc/www/_news.inc.php, doc/www/index.php, doc/www/requirements.php: few news; typo; details for libs. * src/pro/strsplit.pro: various bugs solved in STRSPLIT * testsuite/test_strsplit.pro: correcting and improving testsuite for STRSPLIT 2011-08-11 slayoo * doc/www/requirements.php: updating TeXtoIDL website address 2011-08-10 slayoo * doc/www/_footer.inc.php, doc/www/credits.php: Website update (incl. change of license for the website content so it is compatible with Wikipedia) * src/magick_cl.cpp: update to the fix of bug 3376577 2011-08-09 slayoo * src/gdlgstream.hpp: commiting changes suggested at https://sourceforge.net/projects/gnudatalanguage/forums/forum/338692/topic/4562373 * src/magick_cl.cpp, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_3376577.pro: fixing bug 3376577 in Magick++ routines (fix by Lorenzo/lclem) * NEWS: NEWS update * src/pro/Makefile.am, src/pro/Makefile.in, src/pro/idl_validname.pro: IDL_VALIDNAME: initial import (by Rene Preusker) 2011-07-11 slayoo * NEWS: NEWS update 2011-07-08 slayoo * doc/www/_header.inc.php: doc/www: new website 2011-07-08 alaingdl * doc/www/credits.php: itypo in Sylwester email 2011-07-08 slayoo * doc/www/_footer.inc.php, doc/www/_header.inc.php, doc/www/_news.inc.php, doc/www/contribute.html, doc/www/credits.html, doc/www/credits.php, doc/www/documentation.php, doc/www/download.html, doc/www/downloads.php, doc/www/feedback.html, doc/www/gdl.css, doc/www/home.html, doc/www/images/Colourise.css, doc/www/images/bg.jpg, doc/www/images/bullet.gif, doc/www/images/footer-top.jpg, doc/www/images/header-search.jpg, doc/www/index.html, doc/www/index.php, doc/www/menu.html, doc/www/require.html, doc/www/requirements.php, doc/www/resources.html, doc/www/resources.php, doc/www/screenshot.html, doc/www/screenshots.php, doc/www/screenshots/make_thumbnails, doc/www/screenshots/screenshot01_thumb.png, doc/www/screenshots/screenshot02_thumb.png, doc/www/screenshots/screenshot03_thumb.png, doc/www/screenshots/screenshot04_thumb.png, doc/www/screenshots/screenshot05_thumb.png, doc/www/screenshots/screenshot06_thumb.png, doc/www/screenshots/screenshot07_thumb.png, doc/www/screenshots/screenshot08_thumb.png, doc/www/screenshots/screenshot09_thumb.png, doc/www/screenshots/screenshot10_thumb.png, doc/www/screenshots/screenshot11_thumb.png, doc/www/screenshots/screenshot12_thumb.png, doc/www/screenshots/screenshot13_thumb.png, doc/www/support.html, doc/www/support.php, doc/www/tdl.html: doc/www: new website * src/gshhs.cpp: plotting: uploading missing files * src/plotting.hpp, src/plotting_axis.cpp, src/plotting_erase.cpp, src/plotting_oplot.cpp, src/plotting_plot.cpp, src/plotting_plots.cpp, src/plotting_polyfill.cpp, src/plotting_surface.cpp, src/plotting_xyouts.cpp: plotting: uploading missing changes 2011-07-07 slayoo * src/libinit.cpp, src/plotting_contour.cpp: CONTOUR: the C_COLORS keyword * AUTHORS, doc/udg/diag/broken-references, doc/udg/gdl.tex, doc/udg/chapters/credits.tex, doc/udg/chapters/semshm.tex: doc/udg update 2011-07-06 slayoo * src/basic_fun.cpp, src/libinit.cpp, testsuite/Makefile.am, testsuite/Makefile.in: fixing bug no. 3151760 2011-07-05 slayoo * src/deviceps.hpp: one compiler warning less * CMakeLists.txt: CMake: fix for supporting SPAWN, UNIT... * src/devicex.hpp: one compiler warning less 2011-07-04 slayoo * src/semshm.cpp: semshm.cpp: include fix * src/CMakeLists.txt: updating CMakeLists.txt - new files * src/io.hpp: io.hpp: fixing include issue 2011-07-03 slayoo * doc/udg/examples/showfont_3/gdl.ps, doc/udg/examples/showfont_4/gdl.ps, doc/udg/examples/showfont_7/gdl.ps, doc/udg/examples/surface_ax/gdl.ps, doc/udg/examples/surface_ax/surface_ax.out.txt, doc/udg/examples/surface_ax/surface_ax.pro, doc/udg/examples/surface_az/gdl.ps, doc/udg/examples/surface_az/surface_az.out.txt, doc/udg/examples/surface_az/surface_az.pro, doc/udg/routines/str-sep.fun.tex, doc/udg/routines/surface.pro.tex, doc/udg/diag/broken-references, doc/udg/examples/dist_0/gdl.ps, doc/udg/examples/file_lines_0/file_lines_0.out.txt, doc/udg/examples/routine_names_s_functions/routine_names_s_functions.out.txt: doc/udg update * src/basic_pro.cpp, src/plotting_contour.cpp, src/plotting_surface.cpp: SURFACE: using AutoIntvAC for xStart etc * testsuite/test_plotting_ranges.pro, src/plotting.cpp, src/plotting.hpp, src/plotting_axis.cpp, src/plotting_contour.cpp, src/plotting_plot.cpp, src/plotting_plots.cpp: CONTOUR: logscale plots when explicitely specifying X/Y values (tracker item no. 3321973) 2011-07-02 slayoo * src/devicex.hpp, src/initsysvar.cpp, src/libinit.cpp, src/plotting.cpp, src/plotting.hpp, src/plotting_contour.cpp, src/plotting_plot.cpp, src/plotting_plots.cpp, src/plotting_surface.cpp, src/plotting_windows.cpp: SURCAFE: updating !Z.CRANGE; !P.T: initial values; default window size as a function of screen resolution (IDL behaviour); PLOTS: towards 3D support * src/semshm.cpp: semaphores: fixing on_exit behaviour (by Mateusz Turcza) 2011-07-01 slayoo * NEWS: NEWS update * testsuite/test_sem.pro: sanitizing test_sem.pro * src/basic_pro.cpp, testsuite/Makefile.am, testsuite/test_sem.pro, src/Makefile.am, src/Makefile.in, src/libinit.cpp, src/semshm.cpp, src/semshm.hpp: SEM_CREATE, SEM_LOCK, SEM_RELEASE, SEM_DELETE: initial import (by Mateusz Turcza) * src/hdf5_fun.cpp, src/hdf_fun.cpp, src/libinit_jmg.cpp, src/ncdf_cl.cpp: filename expansion in NCDF_OPEN, H5F_OPEN, HDF_OPEN & HDF_SD_START (tracker item no. 3164308) 2011-06-29 slayoo * src/basic_fun.cpp, src/envt.cpp, src/envt.hpp, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_3313522.pro: fixing bug 3313522 2011-06-28 slayoo * testsuite/test_bug_3275334.pro: skipping test_bug_3275334.pro when X-server connection not available * src/gshhs.cpp: plotting routines: first step towards code clean-up * NEWS, configure.in, testsuite/Makefile.am, testsuite/test_spawn_unit.pro, src/basic_pro.cpp, src/io.cpp, src/io.hpp, src/libinit.cpp: SPAWN: support for the UNIT keyword (relies on GNU extensions to libstdc++, patch by Greg Huey) * src/ncdf_cl.cpp: NCDF_CONTROL: fixing error message (tracker item no. 3192226) * src/pro/dicom/Makefile.in, src/pro/dicom/gdlffdicom__assoc__define.pro, src/pro/dicom/gdlffdicom__assoc__test.pro, src/pro/dicom/gdlffdicom__define.pro, src/pro/dicom/gdlffdicom__test.pro, src/pro/dicom/gdlffdicom_copy_lun.pro, src/pro/dicom/gdlffdicom_date.pro, src/pro/dicom/gdlffdicom_time.pro, src/pro/dicom/gdlffdicom_trim.pro, COPYING: FSF address update in various files * src/Makefile.am, src/plotting.cpp, src/plotting.hpp, src/plotting_axis.cpp, src/plotting_contour.cpp, src/plotting_cursor.cpp, src/plotting_erase.cpp, src/plotting_misc.cpp, src/plotting_oplot.cpp, src/plotting_plot.cpp, src/plotting_plots.cpp, src/plotting_polyfill.cpp, src/plotting_surface.cpp, src/plotting_xyouts.cpp, src/Makefile.in: plotting routines: first step towards code clean-up 2011-06-18 slayoo * src/pro/UrgentNeed.txt: updating src/pro/UrgentNeed.txt 2011-06-15 alaingdl * src/pro/dialog_pickfile.pro: correcting a bug due to the fact that very long results from Zenity may be cut in several parts (1024 here) and need to be joined. 2011-06-07 alaingdl * testsuite/image_test.pro, testsuite/test-read_ascii.pro, testsuite/test-swap_endian.pro, testsuite/test-total.pro, testsuite/test_erfinv.pro, testsuite/test_plot_linestyle.pro, testsuite/test_suite.pro: 1/ all progs. are changed to Procedures to help compilation tests. 2/ we changed the way isGDL test is done * src/pro/dialog_pickfile.pro: Fixing parentheses around STRPOS 2011-06-06 alaingdl * src/pro/dialog_pickfile.pro: Using ":" as separator for zenity was not the best idea because some ESO FITS are using ":" inside the date format (in the file names); we move to "|" and also prepare a keyword: ZENITY_SEP to have more flexibility. 2011-05-13 slayoo * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_3152899.pro: adding test routine for bug no. 3152899 * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_3300626.pro: adding test routine for bug no. 3300626 * testsuite/test_bug_3147733.pro, testsuite/Makefile.am, testsuite/Makefile.in: adding test routine for bug no. 3147733 * testsuite/test_bug_3290532.pro, testsuite/Makefile.am, testsuite/Makefile.in: adding test_bug_3290532.pro * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_3189072.pro: adding test_bug_3189072.pro * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_3286031.pro: adding test_bug_3286031.pro 2011-05-12 m_schellens * src/arrayindex.hpp, src/arrayindexlistt.hpp: Fixed ASSOC var indexing with a variable. Bug tracker ID 3300626 2011-05-11 m_schellens * src/GDLInterpreter.cpp, src/default_io.cpp, src/gdlc.i.g, src/print.cpp: Fixed bug tracker ID 3290532 and 3286031 2011-05-09 m_schellens * src/envt.hpp, src/fftw.cpp, src/gsl_fun.cpp, src/prognode.cpp: removed EnvT::StealLocalParUndefGlobal function * src/antlr/Makefile.in, src/pro/Makefile.in, testsuite/Makefile.in, src/Makefile.in, src/prognode.cpp: Fixed segfault in ASSIGN_REPLACENode::Run(). See Bug tracker ID 3152899 2011-05-06 slayoo * src/math_fun_gm.cpp, testsuite/Makefile.am, testsuite/test_bug_3298378.pro: fixing bug 3298378 (scalar return values from BETA, IGAMMA and EXPINT) 2011-05-04 slayoo * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_3296360.pro: adding test_bug_3296360.pro * src/typedefs.hpp: fixing bug no. 3296360 * testsuite/test_str_sep.pro: adding test_str_sep.pro 2011-05-02 slayoo * testsuite/Makefile.in, testsuite/Makefile.am, testsuite/test_bug_3275334.pro: adding test_bug_3275334.pro * src/devicex.hpp: TVRD: fixing bug no. 3275334 * testsuite/libtest_ce.cpp: fixing format labels in libtest_ce.cpp * src/gsl_fun.cpp: IMSL_CONSTANT: fixing wrong unit of Gravity * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_clip.pro, testsuite/test_fix.pro, testsuite/test_plotting_ranges.pro, testsuite/test_zzz.pro: testsuit update * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/README, testsuite/test_angles.pro, testsuite/test_bug_3189068.pro, testsuite/test_nans_in_sort_and_median.pro, testsuite/test_zzz.pro, testsuite/try: testsuite update 2011-05-01 slayoo * src/prognode.cpp: fixing memory leak bug no. 3282679 (and probably 3292468) 2011-04-27 slayoo * doc/udg/examples/call_external_0/CMakeLists.txt, doc/udg/examples/call_external_0/call_external_0.out.txt, doc/udg/examples/call_external_0/call_external_0.pro, doc/udg/examples/call_external_0/libexample.c: doc/udg: adding call_external example to the repository * doc/udg/examples/routine_names_0/library.pro, doc/udg/examples/routine_names_0/routine_names_0.out.txt, doc/udg/examples/routine_names_0/routine_names_0.pro, doc/udg/examples/routine_names_arg_name/procedure.pro, doc/udg/examples/routine_names_arg_name/routine_names_arg_name.out.txt, doc/udg/examples/routine_names_arg_name/routine_names_arg_name.pro, doc/udg/examples/routine_names_fetch/routine_names_fetch.out.txt, doc/udg/examples/routine_names_fetch/routine_names_fetch.pro, doc/udg/examples/routine_names_level/func.pro, doc/udg/examples/routine_names_level/routine_names_level.out.txt, doc/udg/examples/routine_names_level/routine_names_level.pro, doc/udg/examples/routine_names_s_functions/routine_names_s_functions.out.txt, doc/udg/examples/routine_names_s_functions/routine_names_s_functions.pro, doc/udg/examples/routine_names_s_procedures/routine_names_s_procedures.out.txt, doc/udg/examples/routine_names_s_procedures/routine_names_s_procedures.pro, doc/udg/examples/routine_names_store/routine_names_store.out.txt, doc/udg/examples/routine_names_store/routine_names_store.pro, doc/udg/examples/routine_names_variables/procedure.pro, doc/udg/examples/routine_names_variables/routine_names_variables.out.txt, doc/udg/examples/routine_names_variables/routine_names_variables.pro: doc/udg: adding routine_names examples to the repository * doc/udg/routines/acos.fun.tex, doc/udg/routines/asin.fun.tex, doc/udg/routines/atan.fun.tex, doc/udg/routines/ceil.fun.tex, doc/udg/routines/complex.fun.tex, doc/udg/routines/conj.fun.tex, doc/udg/routines/cos.fun.tex, doc/udg/routines/cosh.fun.tex, doc/udg/routines/file-mkdir.pro.tex, doc/udg/routines/floor.fun.tex, doc/udg/routines/hist-2d.fun.tex, doc/udg/routines/hist-nd.fun.tex, doc/udg/routines/idl-base64.fun.tex, doc/udg/routines/imaginary.fun.tex, doc/udg/routines/logical-and.fun.tex, doc/udg/routines/logical-or.fun.tex, doc/udg/routines/logical-true.fun.tex, doc/udg/routines/magick-writeindexes.pro.tex, doc/udg/routines/product.fun.tex, doc/udg/routines/ptrarr.fun.tex, doc/udg/routines/round.fun.tex, doc/udg/routines/routine-names.fun.tex, doc/udg/routines/sin.fun.tex, doc/udg/routines/sinh.fun.tex, doc/udg/routines/sqrt.fun.tex, doc/udg/routines/strcompress.fun.tex, doc/udg/routines/strlen.fun.tex, doc/udg/routines/strlowcase.fun.tex, doc/udg/routines/strmid.fun.tex, doc/udg/routines/strpos.fun.tex, doc/udg/routines/strput.pro.tex, doc/udg/routines/strtrim.fun.tex, doc/udg/routines/strupcase.fun.tex, doc/udg/routines/tan.fun.tex, doc/udg/routines/tanh.fun.tex, doc/udg/routines/total.fun.tex: doc/udg: new routine descriptions (mostly only the OpenMP info) * doc/udg/diag/broken-references, doc/udg/gdldoc.sty, doc/udg/makeall: doc/udg: doc scripts/styles/diag update * doc/udg/routines/abs.fun.tex: doc/udg updates: indexing routines which use OpenMP * doc/udg/routines/call-external.fun.tex: doc/udg updates: CALL_EXTERNAL docs * doc/udg/routines/exp.fun.tex, doc/udg/routines/fft.fun.tex, doc/udg/routines/where.fun.tex: doc/udg updates: indexing routines which use OpenMP 2011-04-26 slayoo * configure.in: quick'n'dirty solution to problems with compilation with GRIB when GRIB itself requires libpng (only autotools, not in CMake files) * src/libinit.cpp, src/plotting.hpp, src/plotting_map_proj.cpp: fixing compilation issue without Python 2011-04-18 slayoo * src/basic_fun_jmg.cpp, testsuite/Makefile.am, testsuite/test_bug_3288652.pro: ROUTINE_NAMES: fixing bug 3288652 2011-04-17 slayoo * src/libinit.cpp: PLOT: moving not supported keywords to a warn-list 2011-04-15 slayoo * doc/udg/diag/broken-references, doc/udg/examples/file_basename_2/file_basename_2.out.txt, doc/udg/examples/file_basename_2/file_basename_2.pro, doc/udg/examples/ncdf_exists_0/ncdf_exists_0.pro: doc/udg: various updates * doc/udg/examples/imsl_constant_0/imsl_constant_0.out.txt, doc/udg/examples/imsl_constant_0/imsl_constant_0.pro, doc/udg/routines/imsl-constant.fun.tex, doc/udg/routines/imsl-zeropoly.fun.tex: doc/udg: imcl_constant example 2011-04-14 slayoo * src/CMakeLists.txt, src/Makefile.am: src/Makefile.am: not installing the Python library to default system library location * CMakeModules/FindPythonLibs.cmake: removing FindPythonLibs.cmake 2011-04-12 slayoo * doc/udg/routines/dist.fun.tex, doc/udg/routines/imsl-zeropoly.fun.tex, doc/udg/examples/dist_0/dist_0.out.txt, doc/udg/examples/dist_0/dist_0.pro, doc/udg/examples/dist_0/gdl.ps, doc/udg/examples/imsl_zeropoly_0/gdl.ps, doc/udg/examples/imsl_zeropoly_0/imsl_zeropoly_0.out.txt, doc/udg/examples/imsl_zeropoly_0/imsl_zeropoly_0.pro: doc/udg: new examples (imsl_zeropoly, dist) * src/basic_pro.cpp: CATCH: warning the user just once that it is not implemented * src/file.cpp, src/file.hpp, src/libinit.cpp, src/pro/Makefile.in: FILE_MKDIR: initial import * src/pro/Makefile.am, src/pro/scope_varfetch.pro, testsuite/Makefile.am, testsuite/test_scope_varfetch.pro: SCOPE_VARFETCH: initial import * src/gdlgstream.cpp, src/plotting.cpp, src/plotting.hpp, src/plotting_xyouts.cpp: XYOUTS: handling P.MULTI vs. P.POSITION, support for ORIENTATION with logscales, making ORIENTATION work with arbitrary axis scales * INSTALL.CMake, README, testsuite/README: doc updates * doc/udg/examples/compile_opt_0/compile_opt_0.out.tex, doc/udg/examples/helloworld_2/gdl.ps, doc/udg/examples/loadct_0/gdl.ps, doc/udg/examples/python_fun_0/python_fun_0.out.txt, doc/udg/examples/showfont_11/gdl.ps, doc/udg/examples/showfont_11/showfont_11.out.txt, doc/udg/examples/showfont_11/showfont_11.pro, doc/udg/examples/showfont_12/gdl.ps, doc/udg/examples/showfont_12/showfont_12.out.txt, doc/udg/examples/showfont_12/showfont_12.pro, doc/udg/examples/showfont_13/gdl.ps, doc/udg/examples/showfont_13/showfont_13.out.txt, doc/udg/examples/showfont_13/showfont_13.pro, doc/udg/examples/showfont_14/gdl.ps, doc/udg/examples/showfont_14/showfont_14.out.txt, doc/udg/examples/showfont_14/showfont_14.pro, doc/udg/examples/showfont_15/gdl.ps, doc/udg/examples/showfont_15/showfont_15.out.txt, doc/udg/examples/showfont_15/showfont_15.pro, doc/udg/examples/showfont_16/gdl.ps, doc/udg/examples/showfont_16/showfont_16.out.txt, doc/udg/examples/showfont_16/showfont_16.pro, doc/udg/examples/showfont_17/gdl.ps, doc/udg/examples/showfont_17/showfont_17.out.txt, doc/udg/examples/showfont_17/showfont_17.pro, doc/udg/examples/showfont_18/gdl.ps, doc/udg/examples/showfont_18/showfont_18.out.txt, doc/udg/examples/showfont_18/showfont_18.pro, doc/udg/examples/showfont_20/gdl.ps, doc/udg/examples/showfont_20/showfont_20.out.txt, doc/udg/examples/showfont_20/showfont_20.pro, doc/udg/examples/showfont_3/gdl.ps, doc/udg/examples/showfont_3/showfont_3.out.txt, doc/udg/examples/showfont_3/showfont_3.pro, doc/udg/examples/showfont_4/gdl.ps, doc/udg/examples/showfont_4/showfont_4.out.txt, doc/udg/examples/showfont_4/showfont_4.pro, doc/udg/examples/showfont_5/gdl.ps, doc/udg/examples/showfont_5/showfont_5.out.txt, doc/udg/examples/showfont_5/showfont_5.pro, doc/udg/examples/showfont_6/gdl.ps, doc/udg/examples/showfont_6/showfont_6.out.txt, doc/udg/examples/showfont_6/showfont_6.pro, doc/udg/examples/showfont_7/gdl.ps, doc/udg/examples/showfont_7/showfont_7.out.txt, doc/udg/examples/showfont_7/showfont_7.pro, doc/udg/examples/showfont_8/gdl.ps, doc/udg/examples/showfont_8/showfont_8.out.txt, doc/udg/examples/showfont_8/showfont_8.pro, doc/udg/examples/showfont_9/gdl.ps, doc/udg/examples/showfont_9/showfont_9.out.txt, doc/udg/examples/showfont_9/showfont_9.pro, doc/udg/routines/showfont.pro.tex, doc/udg/chapters/syntax-udsub.tex, doc/udg/diag/broken-references, doc/udg/examples/calendar_0/gdl.ps, doc/udg/examples/colours_0/gdl.ps, doc/udg/examples/colours_1/gdl.ps, doc/udg/makeall, doc/udg/makeclean: doc/udg: various updates including SHOWFONT examples 2011-04-11 slayoo * src/gdlpython.cpp, src/gdlpython.hpp: reverting a previous (working) version of gdlpython.* * src/libinit.cpp, src/plotting_axis.cpp, src/plotting_contour.cpp: XYOUTS: handling XLOG and YLOG keywords * src/plotting.cpp: ignoring !P.MULTI when !POSITION set in PLOT and other plotting routines * src/CMakeLists.txt, src/Makefile.am, src/Makefile.in, src/plotting.cpp, src/plotting_misc.cpp: moving ERASE,SET_PLOT and TVLCT to a separate file (plotting_misc.cpp) * src/CMakeLists.txt, src/Makefile.am, src/Makefile.in, src/plotting.cpp, src/plotting_map_proj.cpp: moving MAP_PROJ_FORWARD and MAP_PROJ_INVERSE to a separate file (plotting_map_proj.cpp) * src/CMakeLists.txt, src/Makefile.am, src/Makefile.in, src/plotting.cpp, src/plotting_convert_coord.cpp: moving CONVERT_COORD to a separate file (plotting_convert_coord.cpp) * src/CMakeLists.txt, src/Makefile.am, src/Makefile.in, src/plotting.cpp, src/plotting_windows.cpp: moving WINDOW,WSET,WSHOW,WDELETE,GET_SCREEN_SIZE to a separate file (plotting_windows.cpp) * src/CMakeLists.txt, src/Makefile.am, src/Makefile.in, src/plotting.cpp, src/plotting_polyfill.cpp: moving POLYFILL to a separate file (plotting_polyfill.cpp) * src/CMakeLists.txt, src/Makefile.am, src/Makefile.in, src/plotting.cpp, src/plotting_xyouts.cpp: moving XYOUTS to a separate file (plotting_xyouts.cpp) * src/CMakeLists.txt, src/Makefile.am, src/Makefile.in, src/plotting.cpp, src/plotting.hpp, src/plotting_plots.cpp: moving PLOTS to a separate file (plotting_plots.cpp) * src/CMakeLists.txt, src/Makefile.am, src/Makefile.in, src/plotting.cpp, src/plotting_axis.cpp: moving AXIS to a separate file (plotting_axis.cpp) * src/CMakeLists.txt, src/Makefile.am, src/Makefile.in, src/plotting.cpp, src/plotting_surface.cpp: moving SURFACE to a separate file (plotting_surface.cpp) * src/CMakeLists.txt, src/Makefile.am, src/Makefile.in, src/plotting.cpp, src/plotting.hpp, src/plotting_contour.cpp: moving CONTOUR to a separate file (plotting_contour.cpp) * src/CMakeLists.txt, src/Makefile.am, src/Makefile.in, src/plotting.cpp, src/plotting_cursor.cpp: moving CURSOR to a separate file (plotting_cursor.cpp) * src/CMakeLists.txt, src/Makefile.am, src/Makefile.in, src/plotting.cpp, src/plotting_device.cpp: moving DEVICE to a separate file (plotting_device.cpp) * src/CMakeLists.txt, src/Makefile.am, src/Makefile.in, src/plotting.cpp, src/plotting_oplot.cpp: moving OPLOT to a separate file (plotting_oplot.cpp) 2011-04-10 slayoo * src/Makefile.in, src/antlr/Makefile.in: Makefile.in update * src/antlr/CMakeLists.txt: cmake: updating antlr/CMakeLists.txt forgotten in one of previous commits * src/libinit.cpp: device: ignoring yet some more font-related keywords * src/pro/Makefile.in: src/pro/Makefile.in update * src/CMakeLists.txt, src/Makefile.am, src/plotting.cpp, src/plotting.hpp, src/plotting_plot.cpp: moving PLOT to a separate file (plotting_plot.cpp) * src/arrayindex.hpp, src/arrayindexlistt.hpp, src/datatypes.cpp, src/dinterpreter.hpp, src/envt.hpp, src/io.hpp: clang compatibility (mostly getting rid of compiler warnings) 2011-04-09 slayoo * doc/udg/examples/compile_opt_0/compile_opt_0.out.txt, doc/udg/examples/helloworld_2/gdl.ps, doc/udg/examples/loadct_0/gdl.ps, doc/udg/gdl.tex, doc/udg/chapters/syntax-compileopt.tex, doc/udg/chapters/testsuite.tex, doc/udg/examples/calendar_0/gdl.ps, doc/udg/examples/colours_0/gdl.ps, doc/udg/examples/colours_1/gdl.ps: doc/udg: various updates... * doc/udg/examples/openr_2/openr_2.pro, doc/udg/examples/query_bmp_0/query_bmp_0.pro, doc/udg/gdl.tex, doc/udg/gdldoc.sty, doc/udg/makeall, doc/udg/makeclean: doc/udg: various updates * doc/udg/examples/compile_opt_0/compile_opt_0.out.tex, doc/udg/examples/compile_opt_0/compile_opt_0.pro, doc/udg/examples/compile_opt_0/example.pro, doc/udg/examples/compile_opt_1/compile_opt_1.out.txt, doc/udg/examples/compile_opt_1/compile_opt_1.pro, doc/udg/examples/compile_opt_1/example.pro: doc/udg: adding two examples for compile_opt * src/basic_pro.cpp: CATCH: warning the user that cathing is not implemented yet * doc/udg/examples/calendar_0/calendar_0.out.txt, doc/udg/examples/colours_0/colours_0.out.txt, doc/udg/examples/colours_1/colours_1.out.txt, doc/udg/examples/correlate_0/correlate_0.out.txt, doc/udg/examples/correlate_1/correlate_1.out.txt, doc/udg/examples/correlate_2/correlate_2.out.txt, doc/udg/examples/execute_0/execute_0.out.txt, doc/udg/examples/exit_0/exit_0.out.txt, doc/udg/examples/exp_0/exp_0.out.txt, doc/udg/examples/fft_1/fft_1.out.txt, doc/udg/examples/file_basename_0/file_basename_0.out.txt, doc/udg/examples/file_basename_1/file_basename_1.out.txt, doc/udg/examples/file_basename_2/file_basename_2.out.txt, doc/udg/examples/file_lines_0/file_lines_0.out.txt, doc/udg/examples/foreach_0/foreach_0.out.txt, doc/udg/examples/foreach_1/foreach_1.out.txt, doc/udg/examples/get_login_info_0/get_login_info_0.out.txt, doc/udg/examples/goto_0/goto_0.out.txt, doc/udg/examples/h5_get_libversion_0/h5_get_libversion_0.out.txt, doc/udg/examples/helloworld_0/helloworld_0.out.txt, doc/udg/examples/helloworld_1/helloworld_1.out.txt, doc/udg/examples/helloworld_2/helloworld_2.out.txt, doc/udg/examples/if_0/if_0.out.txt, doc/udg/examples/if_1/if_1.out.txt, doc/udg/examples/if_2/if_2.out.txt, doc/udg/examples/imsl_binomialcoef_0/imsl_binomialcoef_0.out.txt, doc/udg/examples/imsl_binomialcoef_1/imsl_binomialcoef_1.out.txt, doc/udg/examples/ncdf_exists_0/ncdf_exists_0.out.txt, doc/udg/examples/obj_class_0/obj_class_0.out.txt, doc/udg/examples/obj_class_1/obj_class_1.out.txt, doc/udg/examples/openr_2/openr_2.out.txt, doc/udg/examples/parse_url_0/parse_url_0.out.txt, doc/udg/examples/pm_0/pm_0.out.txt, doc/udg/examples/ptr_free_0/ptr_free_0.out.txt, doc/udg/examples/python_fun_0/python_fun_0.out.txt, doc/udg/examples/query_bmp_0/query_bmp_0.out.txt, doc/udg/examples/scope_0/scope_0.out.txt, doc/udg/examples/string_4/string_4.out.txt, doc/udg/examples/strjoin_0/strjoin_0.out.txt, doc/udg/examples/strjoin_1/strjoin_1.out.txt, doc/udg/examples/abs_0/abs_0.out.txt, doc/udg/examples/strjoin_2/strjoin_2.out.txt: doc/udg: adding text output files for examples into the repository (they are all auto-generted during makeall run but keeping them in the repository can help to track regressions) * doc/udg/examples/obj_new_0/obj_new_0.out.txt, doc/udg/examples/obj_new_0/obj_new_0.pro, doc/udg/examples/obj_new_0/test__define.pro: doc/udg: adding an OBJ_NEW example * doc/udg/examples/loadct_0/listct.pro, doc/udg/examples/loadct_0/loadct_0.out.txt, doc/udg/examples/loadct_0/loadct_0.pro, doc/udg/examples/loadct_1/loadct_1.out.txt, doc/udg/examples/loadct_1/loadct_1.pro: doc/udg: adding LOADCT examples * doc/udg/routines/loadct.pro.tex, doc/udg/routines/obj-new.fun.tex: doc/udg: LOADCT docs with two examples (incl. graphical colour-table list) 2011-04-08 slayoo * testsuite/CMakeLists.txt: cmake/testsuite: cleanup in testsuite/CMakeLists.txt * src/gdlpython.cpp, src/gdlpython.hpp: fixing compilation issue with python * CMakeLists.txt, testsuite/CMakeLists.txt, testsuite/test_ce.pro: cmake: fxing issue with conflicting system-wide antlr headers, testsuite upgrades (list of test routines is now automatically extracted from Makefile.am, the libtest_ce.so and launchtest are now excluded from the all target but built during make-check) 2011-04-05 slayoo * src/libinit.cpp, src/libinit_jmg.cpp, src/widget.cpp, src/widget.hpp, src/gdlpython.cpp: TV: accepting the DEVICE keyword (corresponding to the current default behaviour); including WIDGET_* and PYTHON routines in the library routine list regardless of GDL configuration, and warning the user of missing features if necesarry 2011-04-03 alaingdl * testsuite/test_ce.pro: inline compilation for OSX now OK in "test_ce.pro" 2011-04-01 alaingdl * testsuite/test_ce.pro: improved version of TEST_CE.pro with the hope to have "dynamic" compilation of the lib. 2011-04-01 slayoo * src/pro/loadct.pro: LOADCT: not prompting for an argument when GET_NAMES is set (tracker item no. 3206594) 2011-03-30 slayoo * src/ofmt.hpp, testsuite/Makefile.am, testsuite/test_bug_3244840.pro: fixing bug 3244840 (bogus formatting of float zero after printing a string) * src/pro/Makefile.am, testsuite/Makefile.am, testsuite/test_file_which.pro, src/pro/file_which.pro: FILE_WHICH: initial import (patch by H Xu - xuhdev) * testsuite/test_correlate.pro, src/pro/correlate.pro: CORRELATE: support for the single-argument case * CMakeLists.txt, src/CMakeLists.txt: yet another cmake patch by Orion * CMakeLists.txt: cmake: numarray -> numpy transition (patch by Orion) * CMakeModules/FindNetCDF.cmake: cmake: patch by Orion to get netcdf working with centos 5 * CMakeModules/FindNumpy.cmake: cmake: as suggested by Orion, removing FindPythonLibs.cmake and adding FindNumpy.cmake 2011-03-29 m_schellens * configure.in: Put back CVS label for version string * configure.in, config.h.in, src/pro/Makefile.in, testsuite/Makefile.in: sync for release 2011-03-29 slayoo * NEWS: NEWS update * src/libinit.cpp: DEVICE: ignoring SET_FONT kw * src/libinit.cpp: WSHOW: ignoring ICONIC kw * src/pro/Makefile.am, testsuite/Makefile.am, src/pro/correlate.pro, testsuite/test_correlate.pro: CORRELATE: initial import (still without the single-argument option) 2011-03-28 slayoo * src/libinit.cpp, src/devicex.hpp, src/graphics.hpp, src/plotting.cpp: DEVICE: support for the WINDOW_STATE keyword * CMakeModules/FindNetCDF.cmake: cmake/netcdf fix (tracker item no. 3058299, patch by Orion Poplawski) * CMakeLists.txt: cmake/hdf4 fix (tracker item no. 3058299, patch by Orion Poplawski) * configure.in, src/gsl_fun.cpp: fixing bug no. 3233853 (Udunits-2 include path) * testsuite/Makefile.am, testsuite/test_bug_3199465.pro: adding test_bug_3199465.pro * testsuite/Makefile.am, testsuite/test_bug_3189068.pro: adding test_bug_3189068.pro * NEWS: updating NEWS (0.9.1) 2011-03-22 m_schellens * NEWS, src/gsl_fun.cpp: Included patch for udunits2. Bug tracker ID 3233853 * ChangeLog: Update ChangeLog GDL 0.9.1: 2011-03-18 slayoo * configure, gdl/configure: updating configure to reflect changes in configure.in (tracker item no. 3221630) 2011-03-17 slayoo * gdl/src/gdl.cpp, src/gdl.cpp: fixing behaviour with non-comma locale-defined decimal separators (tracker item no. 3164856) 2011-03-14 m_schellens * gdl/src/GDLInterpreter.cpp, gdl/src/GDLInterpreter.hpp, gdl/src/dinterpreter.cpp, gdl/src/envt.hpp, gdl/src/gdlc.i.g, gdl/src/image.cpp, gdl/src/prognode.cpp, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/dinterpreter.cpp, src/envt.hpp, src/gdlc.i.g, src/image.cpp, src/prognode.cpp: Fixed infinite recursion when struct are referenced but not defined in STRUCTNAME__DEFINE. Bug tracker ID 3189072 2011-03-13 m_schellens * gdl/src/envt.cpp, gdl/src/envt.hpp, src/envt.cpp, src/envt.hpp: Made HEAP_GC consider EnvBaseT::toDestroy list * gdl/src/envt.cpp, gdl/src/io.cpp, gdl/src/io.hpp, src/envt.cpp, src/io.cpp, src/io.hpp: Fixed bug tracker ID 3189068. PRINTF to closed stream segfault * gdl/src/envt.cpp, src/envt.cpp: Fixed bug tracker ID 3199465. HEAP_GC segfault. * gdl/src/GDLInterpreter.cpp, gdl/src/GDLInterpreter.hpp, gdl/src/envt.cpp, gdl/src/envt.hpp, gdl/src/gdlc.i.g, gdl/src/prognode.cpp, gdl/src/prognodeexpr.cpp, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/envt.cpp, src/envt.hpp, src/gdlc.i.g, src/prognode.cpp, src/prognodeexpr.cpp: Fixed bug tracker ID 3152892. Temprorary pointers were garbage collected too early. 2011-03-12 m_schellens * gdl/src/envt.hpp, gdl/src/fftw.cpp, gdl/src/gsl_fun.cpp, src/envt.hpp, src/fftw.cpp, src/gsl_fun.cpp: Bug tracker ID: 3152899 - now input variable is explicitely undefined 2011-03-11 m_schellens * doc/Makefile.in, gdl/doc/Makefile.in, gdl/src/GDLInterpreter.hpp, gdl/src/Makefile.in, gdl/src/antlr/Makefile.in, gdl/src/envt.cpp, gdl/src/fftw.cpp, gdl/src/gdlc.i.g, gdl/src/gsl_fun.cpp, gdl/src/pro/Makefile.in, gdl/src/pro/dicom/Makefile.in, gdl/src/prognode.cpp, gdl/testsuite/Makefile.in, src/GDLInterpreter.hpp, src/Makefile.in, src/antlr/Makefile.in, src/envt.cpp, src/fftw.cpp, src/gdlc.i.g, src/gsl_fun.cpp, src/pro/Makefile.in, src/pro/dicom/Makefile.in, src/prognode.cpp, testsuite/Makefile.in, Makefile.in, aclocal.m4, gdl/Makefile.in, gdl/aclocal.m4: Fixed: FFT: segfault when overwriting a heap variable - Bug tracker ID: 3152899 2011-03-03 slayoo * gdl/doc/udg/examples/execute_0/execute_0.pro, gdl/doc/udg/makeall, gdl/doc/udg/routines/execute.fun.tex: doc/udg updates (EXECUTE + fixes in makeall) 2011-03-03 alaingdl * gdl/src/pro/dialog_message.pro, src/pro/dialog_message.pro: improved version of DIALOG_MESSAGE 2011-03-02 slayoo * gdl/testsuite/test_idl8.pro, testsuite/test_idl8.pro: adding test for a single-element negative array addressing to test_idl8.pro 2011-03-01 slayoo * configure.in, gdl/configure.in, gdl/src/pro/Makefile.am, src/pro/Makefile.am: Debian compatibility fixes in configure.in 2011-03-01 alaingdl * NEWS, gdl/NEWS: I just add ref. to new DIALOG_MESSAGE * gdl/src/pro/dialog_message.pro, src/pro/dialog_message.pro: initial import of DIALOG_MESSAGE, derived from DIALOG_PICKFILE, provided by P. Corona. You must have "zenity" to be able to use this functionality. 2011-02-28 slayoo * gdl/doc/udg/chapters/routine-list.tex, gdl/doc/udg/examples/helloworld_2/helloworld_2.pro, gdl/doc/udg/makeall, gdl/doc/udg/makeclean, gdl/doc/udg/routinelist.pro, gdl/doc/udg/routines/imsl-binomialcoef.fun.tex: doc/udg update: keywords are now listed in alphabetical order; some cosmetic changes and minor fixes 2011-02-27 slayoo * gdl/doc/udg/examples/if_0/if_0.pro, gdl/doc/udg/examples/if_1/if_1.pro, gdl/doc/udg/examples/if_2/if_2.pro, gdl/doc/udg/examples/if_2/replace_with_nans.pro, gdl/doc/udg/examples/imsl_binomialcoef_0/imsl_binomialcoef_0.pro, gdl/doc/udg/examples/imsl_binomialcoef_0/pascal.pro, gdl/doc/udg/examples/imsl_binomialcoef_1/imsl_binomialcoef_1.pro, gdl/doc/udg/examples/ncdf_exists_0/ncdf_exists_0.pro, gdl/doc/udg/examples/obj_class_0/alcoholic_drink__define.pro, gdl/doc/udg/examples/obj_class_0/beer__define.pro, gdl/doc/udg/examples/obj_class_0/drink__define.pro, gdl/doc/udg/examples/obj_class_0/obj_class_0.pro, gdl/doc/udg/examples/obj_class_1/obj_class_1.pro, gdl/doc/udg/examples/openr_2/openr_2.pro, gdl/doc/udg/examples/parse_url_0/parse_url_0.pro, gdl/doc/udg/examples/pm_0/pm_0.pro, gdl/doc/udg/examples/ptr_free_0/ptr_free_0.pro, gdl/doc/udg/examples/python_fun_0/python_fun_0.pro, gdl/doc/udg/examples/query_bmp_0/query_bmp_0.pro, gdl/doc/udg/examples/scope_0/scope_0.pro, gdl/doc/udg/examples/string_4/string_4.pro, gdl/doc/udg/examples/strjoin_0/strjoin_0.pro, gdl/doc/udg/examples/strjoin_1/strjoin_1.pro, gdl/doc/udg/examples/strjoin_2/strjoin_2.pro, gdl/doc/udg/routines/abs.fun.tex, gdl/doc/udg/routines/appleman.pro.tex, gdl/doc/udg/routines/array-indices.fun.tex, gdl/doc/udg/routines/calendar.pro.tex, gdl/doc/udg/routines/call-external.fun.tex, gdl/doc/udg/routines/correlate.fun.tex, gdl/doc/udg/routines/exit.pro.tex, gdl/doc/udg/routines/exp.fun.tex, gdl/doc/udg/routines/fft.fun.tex, gdl/doc/udg/routines/file-basename.fun.tex, gdl/doc/udg/routines/file-lines.fun.tex, gdl/doc/udg/routines/get-login-info.fun.tex, gdl/doc/udg/routines/h5-get-libversion.fun.tex, gdl/doc/udg/routines/imsl-binomialcoef.fun.tex, gdl/doc/udg/routines/linkimage.pro.tex, gdl/doc/udg/routines/ll-arc-distance.fun.tex, gdl/doc/udg/routines/map-continents.pro.tex, gdl/doc/udg/routines/ncdf-exists.fun.tex, gdl/doc/udg/routines/ncdf-varput.pro.tex, gdl/doc/udg/routines/newton.fun.tex, gdl/doc/udg/routines/obj-class.fun.tex, gdl/doc/udg/routines/openr.pro.tex, gdl/doc/udg/routines/parse-url.fun.tex, gdl/doc/udg/routines/pm.pro.tex, gdl/doc/udg/routines/ptr-free.pro.tex, gdl/doc/udg/routines/python.fun.tex, gdl/doc/udg/routines/query-bmp.fun.tex, gdl/doc/udg/routines/string.fun.tex, gdl/doc/udg/routines/strjoin.fun.tex, gdl/doc/udg/routines/where.fun.tex, gdl/doc/udg/chapters/about.tex, gdl/doc/udg/chapters/api.tex, gdl/doc/udg/chapters/coding.tex, gdl/doc/udg/chapters/compile-autotools.tex, gdl/doc/udg/chapters/compile-cmake.tex, gdl/doc/udg/chapters/compilers.tex, gdl/doc/udg/chapters/credits.tex, gdl/doc/udg/chapters/debug.tex, gdl/doc/udg/chapters/dochowto.tex, gdl/doc/udg/chapters/docs.tex, gdl/doc/udg/chapters/feedback.tex, gdl/doc/udg/chapters/internals.tex, gdl/doc/udg/chapters/io-ascii.tex, gdl/doc/udg/chapters/io-csv.tex, gdl/doc/udg/chapters/io-dicom.tex, gdl/doc/udg/chapters/io-grib.tex, gdl/doc/udg/chapters/io-hdf4.tex, gdl/doc/udg/chapters/io-idlsave.tex, gdl/doc/udg/chapters/io-netcdf.tex, gdl/doc/udg/chapters/io.tex, gdl/doc/udg/chapters/license.tex, gdl/doc/udg/chapters/math-basic.tex, gdl/doc/udg/chapters/math-fitting.tex, gdl/doc/udg/chapters/math-fourier.tex, gdl/doc/udg/chapters/math-multiroots.tex, gdl/doc/udg/chapters/math-ode.tex, gdl/doc/udg/chapters/math-rng.tex, gdl/doc/udg/chapters/openmp.tex, gdl/doc/udg/chapters/plot-2d.tex, gdl/doc/udg/chapters/plot-3d.tex, gdl/doc/udg/chapters/plot-colours.tex, gdl/doc/udg/chapters/plot-fonts.tex, gdl/doc/udg/chapters/plot-map.tex, gdl/doc/udg/chapters/python.tex, gdl/doc/udg/chapters/routine-list.tex, gdl/doc/udg/chapters/strings.tex, gdl/doc/udg/chapters/syntax-arguments.tex, gdl/doc/udg/chapters/syntax-array.tex, gdl/doc/udg/chapters/syntax-errhandle.tex, gdl/doc/udg/chapters/syntax-flowcon.tex, gdl/doc/udg/chapters/syntax-oop.tex, gdl/doc/udg/chapters/syntax-scope.tex, gdl/doc/udg/chapters/syntax-types.tex, gdl/doc/udg/chapters/syntax.tex, gdl/doc/udg/chapters/toc.tex, gdl/doc/udg/chapters/widgets.tex, gdl/doc/udg/examples/_post, gdl/doc/udg/examples/_pre, gdl/doc/udg/examples/abs_0/abs_0.pro, gdl/doc/udg/examples/calendar_0/calendar_0.pro, gdl/doc/udg/examples/colours_0/colours_0.pro, gdl/doc/udg/examples/colours_1/colours_1.pro, gdl/doc/udg/examples/correlate_0/correlate_0.pro, gdl/doc/udg/examples/correlate_1/correlate_1.pro, gdl/doc/udg/examples/correlate_2/correlate_2.pro, gdl/doc/udg/examples/exit_0/exit_0.pro, gdl/doc/udg/examples/exp_0/exp_0.pro, gdl/doc/udg/examples/fft_1/fft_1.pro, gdl/doc/udg/examples/fft_1/stddevfft.pro, gdl/doc/udg/examples/fft_1/stddevsum.pro, gdl/doc/udg/examples/file_basename_0/file_basename_0.pro, gdl/doc/udg/examples/file_basename_1/file_basename_1.pro, gdl/doc/udg/examples/file_basename_2/file_basename_2.pro, gdl/doc/udg/examples/file_lines_0/file_lines_0.pro, gdl/doc/udg/examples/foreach_0/foreach_0.pro, gdl/doc/udg/examples/foreach_1/example.pro, gdl/doc/udg/examples/foreach_1/foreach_1.pro, gdl/doc/udg/examples/get_login_info_0/get_login_info_0.pro, gdl/doc/udg/examples/goto_0/example.pro, gdl/doc/udg/examples/goto_0/goto_0.pro, gdl/doc/udg/examples/h5_get_libversion_0/h5_get_libversion_0.pro, gdl/doc/udg/examples/helloworld_0/helloworld_0.pro, gdl/doc/udg/examples/helloworld_1/helloworld_1.pro, gdl/doc/udg/examples/helloworld_2/helloworld_2.pro, gdl/doc/udg/gdl.bib, gdl/doc/udg/gdl.pro, gdl/doc/udg/gdl.tex, gdl/doc/udg/gdldoc.sty, gdl/doc/udg/makeall, gdl/doc/udg/makeclean, gdl/doc/udg/natbib.cfg, gdl/doc/udg/routinefiles.awk, gdl/doc/udg/routinelist.awk, gdl/doc/udg/routinelist.pro: doc/udg: initial import * gdl/src/gdlpsstream.cpp, gdl/src/gdlpsstream.hpp, src/gdlpsstream.cpp, src/gdlpsstream.hpp: PostScript: fixing bogus empty first page bug (tracker item no. 3029064) * configure.in, gdl/configure.in: configure.in: adding hints for Debian/Ubuntu users * gdl/testsuite/checks, testsuite/checks: fixing backslash escape warning * gdl/src/pro/identity.pro, gdl/src/pro/trace.pro, src/pro/identity.pro, src/pro/trace.pro, gdl/src/pro/checks, src/pro/checks: minor fixes in src/pro/ 2011-02-22 alaingdl * gdl/src/basic_fun_jmg.cpp, src/basic_fun_jmg.cpp: correcting a problem in FSTAT(nlun) when "nlun" is not open 2011-01-23 slayoo * doc/www/screenshot.html, doc/www/tdl.html, gdl/doc/www/screenshot.html, gdl/doc/www/tdl.html: fixing two typos in doc/www (reported by Reuben Thomas) 2011-01-19 slayoo * gdl/testsuite/CMakeLists.txt, testsuite/CMakeLists.txt: cmake: update of test-routine list 2011-01-17 slayoo * gdl/src/print.cpp, src/print.cpp, gdl/testsuite/Makefile.am, gdl/testsuite/Makefile.in, gdl/testsuite/test_bug_2876161.pro, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_2876161.pro: PRINT: fixing behaviur with e.g. print,[1],1,[1] (tracker item no. 2876161) 2011-01-16 slayoo * gdl/src/plotting.cpp, src/plotting.cpp: XYOUTS: fixing vertical position of text (moving it half the charsize up) - tracker item no. 2982623 * gdl/src/libinit.cpp, gdl/src/plotting.cpp, gdl/testsuite/Makefile.am, gdl/testsuite/Makefile.in, gdl/testsuite/test_bug_2610174.pro, src/libinit.cpp, src/plotting.cpp, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_2610174.pro: XYOUTS: adding support for the WIDTH keyword (trakcer item no. 2610174) 2011-01-15 slayoo * gdl/src/basic_fun.cpp, gdl/testsuite/Makefile.am, gdl/testsuite/Makefile.in, gdl/testsuite/test_bug_2876150.pro, src/basic_fun.cpp, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_2876150.pro: fixing string(1,"()") (tracker item no. 2876150) * gdl/testsuite/Makefile.am, gdl/testsuite/test_bug_2974380.pro, gdl/testsuite/test_known_bugs.pro, testsuite/Makefile.am, testsuite/test_bug_2974380.pro, testsuite/test_known_bugs.pro: adding test_bug_2974380.pro * gdl/src/ncdf_att_cl.cpp, gdl/testsuite/test_bug_3100945.pro, src/ncdf_att_cl.cpp, testsuite/test_bug_3100945.pro: NCDF_ATTNAME: fixing argument handling (tracker item no. 3100945) 2011-01-14 slayoo * gdl/src/ncdf_cl.cpp, src/ncdf_cl.cpp, gdl/testsuite/Makefile.am, gdl/testsuite/Makefile.in, gdl/testsuite/test_bug_3055720.pro, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_3055720.pro: fixing error message in ncdf_varput (tracker item no. 3055720) * gdl/src/ncdf_dim_cl.cpp, gdl/testsuite/Makefile.am, gdl/testsuite/Makefile.in, gdl/testsuite/test_bug_3057511.pro, gdl/testsuite/test_bug_3057520.pro, gdl/testsuite/test_bug_3061072.pro, src/ncdf_dim_cl.cpp, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_3057511.pro, testsuite/test_bug_3057520.pro, testsuite/test_bug_3061072.pro: NCDF_DIMDEF: requireing dimension size for limited dims (tracker item no. 3057511) * gdl/src/ncdf_var_cl.cpp, src/ncdf_var_cl.cpp, gdl/testsuite/Makefile.am, gdl/testsuite/Makefile.in, gdl/testsuite/test_bug_3057520.pro, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_3057520.pro: NCDF_VARPUT: checking OFFSET kw. dimensions (tracker item no. 3057520) * gdl/src/ncdf_att_cl.cpp, gdl/src/ncdf_cl.cpp, gdl/src/ncdf_var_cl.cpp, gdl/testsuite/Makefile.am, gdl/testsuite/Makefile.in, gdl/testsuite/test_bug_3061072.pro, src/ncdf_att_cl.cpp, src/ncdf_cl.cpp, src/ncdf_var_cl.cpp, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_3061072.pro: proper behaviour with non-existent attributes and variables in NCDF_VARID and NCDF_ATTNAME (tracker item no. 3061072) 2011-01-05 slayoo * gdl/testsuite/Makefile.am, gdl/testsuite/Makefile.in, gdl/testsuite/test_bug_3151760.pro, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_3151760.pro: test_bug_3151760.pro 2011-01-03 slayoo * configure.in, gdl/configure.in: configure.in: trying to be backward compatible (color-tests) * gdl/src/topython.cpp, src/topython.cpp: copying data to Python instead passing a soon-invalid pointer (tracker item no. 3148396) 2011-01-02 slayoo * doc/www/contribute.html, doc/www/require.html, doc/www/screenshot.html, doc/www/screenshots/screenshot13.png, doc/www/screenshots/screenshot13_thumb.png, gdl/doc/www/contribute.html, gdl/doc/www/require.html, gdl/doc/www/screenshot.html, gdl/doc/www/screenshots/screenshot13.png, gdl/doc/www/screenshots/screenshot13_thumb.png: doc/www update (numarray -> Numpy) 2011-01-01 slayoo * README, gdl/README, gdl/src/FMTParser.cpp, gdl/src/format.g, gdl/src/ofmt.cpp, gdl/testsuite/Makefile.am, gdl/testsuite/Makefile.in, gdl/testsuite/test_bug_3147181.pro, src/FMTParser.cpp, src/format.g, src/ofmt.cpp, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_3147181.pro: fixing two formatting bugs: 3147181 & 2555865 2010-12-31 slayoo * gdl/doc/misc/gdlffdicom.html, gdl/doc/misc/gdlffdicom__assoc.html, gdl/src/pro/dicom/Makefile.am, gdl/src/pro/dicom/Makefile.in, gdl/src/pro/dicom/gdlffdicom__assoc__define.pro, gdl/src/pro/dicom/gdlffdicom__assoc__test.pro, gdl/src/pro/dicom/gdlffdicom__assoc_generateuid.pro, gdl/src/pro/dicom/gdlffdicom__define.pro, gdl/src/pro/dicom/gdlffdicom__dictionary.pro, gdl/src/pro/dicom/gdlffdicom__test.pro, gdl/src/pro/dicom/gdlffdicom_copy_lun.pro, gdl/src/pro/dicom/gdlffdicom_date.pro, gdl/src/pro/dicom/gdlffdicom_time.pro, gdl/src/pro/dicom/gdlffdicom_trim.pro, src/pro/dicom/Makefile.am, src/pro/dicom/Makefile.in, src/pro/dicom/gdlffdicom__assoc__define.pro, src/pro/dicom/gdlffdicom__assoc__test.pro, src/pro/dicom/gdlffdicom__assoc_generateuid.pro, src/pro/dicom/gdlffdicom__define.pro, src/pro/dicom/gdlffdicom__dictionary.pro, src/pro/dicom/gdlffdicom__test.pro, src/pro/dicom/gdlffdicom_copy_lun.pro, src/pro/dicom/gdlffdicom_date.pro, src/pro/dicom/gdlffdicom_time.pro, src/pro/dicom/gdlffdicom_trim.pro: updating gdlffdicom to v20100309 (http://idl.barnett.id.au/idl-code/dicom20100309.zip) * gdl/testsuite/test_python.pro, testsuite/test_python.pro: test_python.pro update * gdl/src/gdl.cpp, gdl/src/gdlpython.cpp, gdl/src/gdlpython.hpp, gdl/src/objects.cpp, gdl/src/pythongdl.cpp, gdl/src/topython.cpp, gdl/testsuite/Makefile.am, gdl/testsuite/test_python.pro, gdl/testsuite/test_python_module_1.pro, src/gdl.cpp, src/gdlpython.cpp, src/gdlpython.hpp, src/objects.cpp, src/pythongdl.cpp, src/topython.cpp, testsuite/Makefile.am, testsuite/test_python.pro, testsuite/test_python_module_1.pro, PYTHON.txt, README, configure.in, gdl/PYTHON.txt, gdl/README, gdl/configure.in, gdl/src/datatypes.cpp, gdl/src/datatypesref.cpp, src/datatypes.cpp, src/datatypesref.cpp: numarray -> Numpy transition (based on the patch by Orion Poplawski, the Gentoo GDL patch by Sebastien Fabbro and a helpful post by Ondrej Certik: http://mail.scipy.org/pipermail/numpy-discussion/2009-October/045888.html) 2010-12-29 slayoo * gdl/testsuite/Makefile.am, gdl/testsuite/Makefile.in, gdl/testsuite/test_bug_3091610.pro, gdl/testsuite/test_common.pro, gdl/testsuite/test_python_module_1.pro, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_3091610.pro, testsuite/test_common.pro, testsuite/test_python_module_1.pro: testsuite update * configure.in, gdl/configure.in: fixing Python module compilation on OSX * gdl/src/basic_fun.cpp, src/basic_fun.cpp, gdl/testsuite/Makefile.am, gdl/testsuite/test_python_module_0.pro, gdl/testsuite/test_python_module_1.pro, gdl/testsuite/test_python_module_2.pro, testsuite/Makefile.am, testsuite/test_python_module_0.pro, testsuite/test_python_module_1.pro, testsuite/test_python_module_2.pro: fixing Python module + test_python_module* test routines (tracker item no. 3127190) 2010-12-28 slayoo * gdl/testsuite/Makefile.am, gdl/testsuite/test_bug_2846561.pro, testsuite/Makefile.am, testsuite/test_bug_2846561.pro: adding test_bug_2846561.pro * gdl/testsuite/Makefile.am, gdl/testsuite/test_bug_2555865.pro, testsuite/Makefile.am, testsuite/test_bug_2555865.pro: adding test_bug_2555865.pro * gdl/src/FMTLexer.cpp, gdl/src/FMTOut.cpp, gdl/src/FMTParser.cpp, gdl/src/FMTParser.hpp, gdl/src/assocdata.hpp, gdl/src/basegdl.cpp, gdl/src/basegdl.hpp, gdl/src/convert2.cpp, gdl/src/datatypes.hpp, gdl/src/default_io.cpp, gdl/src/dstructgdl.hpp, gdl/src/fmtnode.hpp, gdl/src/format.g, gdl/src/format.out.g, gdl/src/gdl.cpp, gdl/src/ofmt.cpp, gdl/src/ofmt.hpp, gdl/src/specializations.hpp, gdl/testsuite/Makefile.am, gdl/testsuite/test_bug_1779553.pro, gdl/testsuite/test_bug_3147146.pro, gdl/testsuite/test_deriv.pro, gdl/testsuite/test_dicom.pro, gdl/testsuite/test_grib.pro, gdl/testsuite/test_minmax.pro, gdl/testsuite/test_rk4.pro, gdl/testsuite/try, src/FMTLexer.cpp, src/FMTOut.cpp, src/FMTParser.cpp, src/FMTParser.hpp, src/assocdata.hpp, src/basegdl.cpp, src/basegdl.hpp, src/convert2.cpp, src/datatypes.hpp, src/default_io.cpp, src/dstructgdl.hpp, src/fmtnode.hpp, src/format.g, src/format.out.g, src/gdl.cpp, src/ofmt.cpp, src/ofmt.hpp, src/specializations.hpp, testsuite/Makefile.am, testsuite/test_bug_1779553.pro, testsuite/test_bug_3147146.pro, testsuite/test_deriv.pro, testsuite/test_dicom.pro, testsuite/test_grib.pro, testsuite/test_minmax.pro, testsuite/test_rk4.pro, testsuite/try: zero padding in format strings, testsuite update 2010-12-16 alaingdl * gdl/src/plotting.cpp, src/plotting.cpp: continuing improving XYOUTS, PLOTS and POLYFILL. May have effects on others graphic routines (CONTOUR, SURFACE , ...) * gdl/src/plotting.cpp, src/plotting.cpp: extra factor 1.1111 for Y axis; option /device in XYOUTS and PLOTS (correcting bug 3085586). Maybe new bug for /data introduced but easy to see and solve. 2010-12-06 slayoo * gdl/testsuite/Makefile.am, gdl/testsuite/Makefile.in, testsuite/Makefile.am, testsuite/Makefile.in: adding test_common.pro to the make-check file list 2010-12-04 m_schellens * gdl/src/io.cpp, src/io.cpp: fixed problem with CentOS (missing != operator) 2010-12-03 m_schellens * gdl/src/dinterpreter.cpp, src/dinterpreter.cpp: prevent identical lines being added to history * gdl/src/envt.hpp, gdl/src/io.cpp, gdl/src/io.hpp, src/envt.hpp, src/io.cpp, src/io.hpp, gdl/src/basic_pro_jmg.cpp, gdl/src/envt.cpp, src/basic_pro_jmg.cpp, src/envt.cpp: LONG64 for POINT_LUN (bug tracker ID: 3126348) * gdl/src/dpro.cpp, gdl/src/prognode.hpp, src/dpro.cpp, src/prognode.hpp, gdl/testsuite/Makefile.in, testsuite/Makefile.in: handle empty subroutine tree (NULL) (bug tracker ID: 3079713) 2010-11-30 alaingdl * gdl/testsuite/test_common.pro, testsuite/test_common.pro: initial import of a fast way to check if "common" are OK at compilation level (.r step) 2010-11-29 slayoo * gdl/testsuite/Makefile.am, gdl/testsuite/test_bug_3104326.pro, testsuite/Makefile.am, testsuite/test_bug_3104326.pro: test_bug_3104326.pro * gdl/testsuite/Makefile.am, gdl/testsuite/test_step.pro, testsuite/Makefile.am, testsuite/test_step.pro: test_step.pro * gdl/testsuite/Makefile.am, gdl/testsuite/test_bug_3104209.pro, testsuite/Makefile.am, testsuite/test_bug_3104209.pro: test_bug_3104209.pro * gdl/testsuite/Makefile.am, gdl/testsuite/test_bug_3085858.pro, testsuite/Makefile.am, testsuite/test_bug_3085858.pro: test_bug_3085858.pro * gdl/testsuite/Makefile.am, gdl/testsuite/test_bug_3091599.pro, testsuite/Makefile.am, testsuite/test_bug_3091599.pro: test_bug_3091599.pro 2010-11-28 m_schellens * gdl/src/GDLInterpreter.cpp, gdl/src/GDLInterpreter.hpp, gdl/src/dinterpreter.cpp, gdl/src/dinterpreter.hpp, gdl/src/gdlc.i.g, gdl/src/objects.hpp, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/dinterpreter.cpp, src/dinterpreter.hpp, src/gdlc.i.g, src/objects.hpp: .STEP command * gdl/src/dstructgdl.cpp, src/dstructgdl.cpp: STRUCT: Made single array index access return array[1] (bug tracker ID: 3091599) * gdl/src/arrayindex.hpp, gdl/src/basegdl.cpp, gdl/src/basegdl.hpp, gdl/src/datatypes.cpp, gdl/src/datatypes.hpp, gdl/src/datatypesref.cpp, src/arrayindex.hpp, src/basegdl.cpp, src/basegdl.hpp, src/datatypes.cpp, src/datatypes.hpp, src/datatypesref.cpp: Fixed negative index access * gdl/src/GDLInterpreter.cpp, gdl/src/GDLLexer.hpp, gdl/src/dinterpreter.cpp, gdl/src/gdlc.g, gdl/src/gdlc.i.g, gdl/src/prognode.cpp, src/GDLInterpreter.cpp, src/GDLLexer.hpp, src/dinterpreter.cpp, src/gdlc.g, src/gdlc.i.g, src/prognode.cpp: Fixed line number reporting for the call stack dump 2010-11-25 m_schellens * gdl/src/prognode.cpp, src/prognode.cpp: Clearer error message for CONTINUE outside loops 2010-11-24 m_schellens * configure.in, gdl/configure.in, gdl/src/gdl.cpp, gdl/src/includefirst.hpp, src/gdl.cpp, src/includefirst.hpp: Fixed preprocessor's HAVE_LIBREADLINE handling with python 2010-11-22 slayoo * gdl/testsuite/Makefile.am, gdl/testsuite/test_bug_3081887.pro, gdl/testsuite/test_plotting_ranges.pro, testsuite/Makefile.am, testsuite/test_bug_3081887.pro, testsuite/test_plotting_ranges.pro: testsuite update 2010-11-21 m_schellens * gdl/src/GDLInterpreter.cpp, gdl/src/dinterpreter.cpp, gdl/src/gdlc.i.g, gdl/src/pro/Makefile.in, gdl/testsuite/Makefile.in, src/GDLInterpreter.cpp, src/dinterpreter.cpp, src/gdlc.i.g, src/pro/Makefile.in, testsuite/Makefile.in: fixed _retTree for indexable_expr (bug tracker ID: 3081887) 2010-11-17 slayoo * gdl/src/gdlgstream.cpp, gdl/src/gdlpython.cpp, gdl/src/plot3d_nr.cpp, gdl/src/plotting.cpp, gdl/testsuite/libtest_ce.cpp, gdl/testsuite/test_ce.pro, src/gdlgstream.cpp, src/gdlpython.cpp, src/plot3d_nr.cpp, src/plotting.cpp, testsuite/libtest_ce.cpp, testsuite/test_ce.pro: fixing compiler warnings with GCC 4.4; temporarily commenting out a part of testsuite/libtest_ce.cpp (the rest works) 2010-11-15 slayoo * gdl/src/gdlwidget.cpp, src/gdlwidget.cpp: fixing compatibility with old (2007) libstdc++ (cf. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31005) * INSTALL.CMake, gdl/INSTALL.CMake: INSTALL.CMake: adding info about the Debug mode 2010-11-12 alaingdl * CMakeLists.txt, gdl/CMakeLists.txt: defaut compilation mode with CMake switched to "Release" in order to have good perfs' 2010-11-07 slayoo * gdl/src/basic_pro.cpp, src/basic_pro.cpp: EXIT: fixed segfault when compiled with wxWidgets and no X-server connection available (tracker item no. 2946058, patch by Orion Poplawski) * gdl/src/plotting.cpp, src/plotting.cpp: CONTOUR: better input dimesion check (tracker item no. 3055761) * gdl/src/pro/interpol.pro, gdl/testsuite/Makefile.am, gdl/testsuite/test_bug_3104349.pro, src/pro/interpol.pro, testsuite/Makefile.am, testsuite/test_bug_3104349.pro: INTERPOL: sanity check added (tracker item no. 3104349) 2010-11-06 slayoo * gdl/testsuite/Makefile.am, gdl/testsuite/test_bug_3104214.pro, testsuite/Makefile.am, testsuite/test_bug_3104214.pro, gdl/src/plotting.cpp, src/plotting.cpp: PLOTS vs. logscale fix (tracker item no. 3104214) 2010-10-28 slayoo * gdl/testsuite/libtest_ce.cpp, testsuite/libtest_ce.cpp: libtest_ce.cpp: GCC 4.3.3 (e.g.) compatibility fix 2010-10-27 slayoo * configure.in, gdl/configure.in, gdl/doc/misc/README.call_external, gdl/src/basic_pro_jmg.cpp, gdl/src/basic_pro_jmg.hpp, gdl/src/libinit_jmg.cpp, src/basic_pro_jmg.cpp, src/basic_pro_jmg.hpp, src/libinit_jmg.cpp, gdl/testsuite/Makefile.am, gdl/testsuite/libtest_ce.cpp, gdl/testsuite/test_ce.pro, testsuite/Makefile.am, testsuite/libtest_ce.cpp, testsuite/test_ce.pro: CALL_EXTERNAL: initial import (patch by Christoph Fuchs, tracker item no. 3096214) 2010-10-26 alaingdl * gdl/testsuite/test_mpfit.pro, testsuite/test_mpfit.pro: adding keyword /debug in TEST_MPFIT ... 2010-10-26 slayoo * gdl/src/gshhs.cpp, gdl/src/plotting.cpp, gdl/src/plotting.hpp, src/gshhs.cpp, src/plotting.cpp, src/plotting.hpp, gdl/testsuite/test_clip.pro, testsuite/test_clip.pro: default range (if called before plot) and corrected clipping behaviour in XYOUTS, POLYFILL and PLOTS (patch from Joanna, tracker item no. 3029409) 2010-10-26 alaingdl * gdl/src/pro/restore.pro, gdl/src/pro/save.pro, src/pro/restore.pro, src/pro/save.pro: better messages when CMSV lib. not in the GDL/IDL_PATH * gdl/testsuite/test_get_screen_size.pro, gdl/testsuite/test_mpfit.pro, testsuite/test_get_screen_size.pro, testsuite/test_mpfit.pro: adding details to improve tests and warnings 2010-10-25 m_schellens * gdl/src/dstructgdl.hpp, src/dstructgdl.hpp: Fixed Clear() for tag by tag created structs (bug tracker ID: 3091610) 2010-10-23 slayoo * gdl/src/libinit.cpp, gdl/src/plotting.cpp, src/libinit.cpp, src/plotting.cpp: POLYFILL: support for LINE_FILL, SPACING, LINESTYLE, ORIENTATION and THICK (thanks to Joanna, tracker item no. 3029507) 2010-10-17 slayoo * gdl/testsuite/Makefile.am, gdl/testsuite/Makefile.in, gdl/testsuite/test_ps_decomposed.pro, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_ps_decomposed.pro, gdl/src/deviceps.hpp, src/deviceps.hpp: decomposed colours with PostScript + test routine test_ps_decomposed.pro 2010-10-16 alaingdl * gdl/testsuite/test_strsplit.pro, testsuite/test_strsplit.pro, gdl/src/pro/strsplit.pro, src/pro/strsplit.pro: correcting bugs in STRSPLIT(); updating TEST_STRSPLIT in consequence. 2010-10-14 slayoo * gdl/testsuite/Makefile.am, gdl/testsuite/Makefile.in, gdl/testsuite/test_bug_3054361.pro, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_3054361.pro: testsuite/test_bug_3054361.pro: initial import * gdl/testsuite/Makefile.am, gdl/testsuite/Makefile.in, gdl/testsuite/test_bug_3086851.pro, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_3086851.pro: testsuite/test_bug_3086851.pro: initial import 2010-10-13 alaingdl * gdl/src/pro/strsplit.pro, src/pro/strsplit.pro: STRSPLIT: /REGEX and /PRESERVE_NULL should be compatible (may not work due to the complexity of STRSPLIT(), but "test_strsplit.pro" was OK) * gdl/testsuite/CMakeLists.txt, gdl/testsuite/Makefile.am, gdl/testsuite/Makefile.in, gdl/testsuite/test_moment.pro, testsuite/CMakeLists.txt, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_moment.pro: adding TEST_MOMENT in testsuite * gdl/src/libinit_cl.cpp, gdl/src/ncdf_cl.cpp, gdl/src/ncdf_cl.hpp, src/libinit_cl.cpp, src/ncdf_cl.cpp, src/ncdf_cl.hpp: renaming all occurences of NCDF_EPOCH to CDF_EPOCH * gdl/src/pro/moment.pro, src/pro/moment.pro: correcting bug for Kurtosis in MOMENT() 2010-10-08 alaingdl * gdl/src/libinit_cl.cpp, gdl/src/ncdf_cl.cpp, gdl/src/ncdf_cl.hpp, src/libinit_cl.cpp, src/ncdf_cl.cpp, src/ncdf_cl.hpp: initial import of interface for NCDF_EPOCH, code not working ... 2010-10-01 alaingdl * gdl/testsuite/CMakeLists.txt, gdl/testsuite/Makefile.am, gdl/testsuite/Makefile.in, testsuite/CMakeLists.txt, testsuite/Makefile.am, testsuite/Makefile.in: upgrading list of files used in launchers of test/check * gdl/testsuite/test_mpfit.pro, testsuite/test_mpfit.pro: initial import of TEST_MPFIT, fast test of widely used Lib. MPFIT * gdl/quick_start_GDL.sh, quick_start_GDL.sh: adding the option for keeping current GDL_PATH when running "fast launcher" 2010-09-21 alaingdl * gdl/src/libinit_ac.cpp, gdl/src/math_fun_ac.cpp, gdl/src/math_fun_ac.hpp, src/libinit_ac.cpp, src/math_fun_ac.cpp, src/math_fun_ac.hpp: Initial import of missing functions PREWITT(), SOBEL() and ROBERTS(). Interfaces only, code not finished. 2010-09-20 alaingdl * gdl/src/math_fun_ac.cpp, src/math_fun_ac.cpp: fixing memory leak in SPL_INIT (bug 3070190) * gdl/src/basic_pro_jmg.cpp, src/basic_pro_jmg.cpp: removing useless comment in revisited WAIT 2010-09-16 slayoo * doc/www/resources.html, gdl/doc/www/resources.html: fixed broken link to a relocated bu.edu website 2010-09-15 alaingdl * gdl/src/basic_pro_jmg.cpp, src/basic_pro_jmg.cpp: WAIT: using nanosleep to avoid using 100% of CPU for long waits ... but keeping old code to have accurates small waits ;-) 2010-09-14 m_schellens * NEWS, gdl/NEWS, gdl/src/basic_fun.cpp, src/basic_fun.cpp: Set constant terminal with of 80 for STRING(/PRINT) (bug tracker ID: 3054361) 2010-09-10 slayoo * doc/www/contribute.html, doc/www/download.html, doc/www/home.html, gdl/doc/www/contribute.html, gdl/doc/www/download.html, gdl/doc/www/home.html: doc/www updates corresponding to the 0.9 release 2010-09-09 alaingdl * gdl/src/pro/save.pro, src/pro/save.pro: consequence of change 1.131 in "basic_fun.cpp" when calling EXECUTE, array not allowed now ... * gdl/testsuite/test_known_bugs.pro, testsuite/test_known_bugs.pro: correcting small bug in "test_known_bugs.pro" * CMakeLists.txt, gdl/CMakeLists.txt: upgrading version number (rc4 is over) 2010-09-02 opoplawski * gdl/CMakeModules/FindHDF.cmake: Search hdf sub-directories - finds hdf4 on Fedora * CMake.tar.gz, CMakeLists.txt, INSTALL.CMake, README.CMake, config.h.cmake, gdl/CMake.tar.gz, gdl/CMakeLists.txt, gdl/CMakeModules/FindFFTW.cmake, gdl/CMakeModules/FindGSL.cmake, gdl/CMakeModules/FindGrib.cmake, gdl/CMakeModules/FindHDF.cmake, gdl/CMakeModules/FindLibproj4.cmake, gdl/CMakeModules/FindNetCDF.cmake, gdl/CMakeModules/FindPlplot.cmake, gdl/CMakeModules/FindPythonLibs.cmake, gdl/CMakeModules/FindReadline.cmake, gdl/CMakeModules/FindUdunits.cmake, gdl/INSTALL.CMake, gdl/README.CMake, gdl/config.h.cmake, gdl/src/CMakeLists.txt, gdl/src/antlr/CMakeLists.txt, gdl/testsuite/CMakeLists.txt, src/CMakeLists.txt, src/antlr/CMakeLists.txt, testsuite/CMakeLists.txt: Check in CMake files into tree 2010-08-31 slayoo * gdl/src/basic_fun.cpp, gdl/src/envt.cpp, gdl/src/libinit.cpp, gdl/testsuite/Makefile.am, gdl/testsuite/Makefile.in, gdl/testsuite/test_fixprint.pro, src/basic_fun.cpp, src/envt.cpp, src/libinit.cpp, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_fixprint.pro: FIX: support for TYPE=7 and /PRINT + test routine (test_fixprint.pro) 2010-08-30 alaingdl * CMake.tar.gz, gdl/CMake.tar.gz: Still improving the CMake alternative. Now target (gdl) don't loose PATH to alternative librairies (pb on Debian where we need dedicated Image Magick version). * CMake.tar.gz, gdl/CMake.tar.gz: better managment of alternative path to ImageMagick lib. (need a "by-hand" Image Magick Lib. under Debian to avoid a known pb with Plplot (two seccessive calls to WINDOW will crash, see testsuite/test_known_bugs.pro)) 2010-08-27 slayoo * gdl/src/basic_fun.cpp, gdl/testsuite/Makefile.am, gdl/testsuite/Makefile.in, gdl/testsuite/test_execute.pro, src/basic_fun.cpp, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_execute.pro: EXECUTE: disallowing array arguments for compatibility with IDL 2010-08-26 alaingdl * gdl/src/pro/Makefile.am, gdl/src/pro/Makefile.in, src/pro/Makefile.am, src/pro/Makefile.in: adding new function SWAP_ENDIAN_INPLACE in Makefile.am and Makefile.in * gdl/src/pro/dialog_pickfile.pro, src/pro/dialog_pickfile.pro: missing a ")" in DIALOG_PICKFILE ... * gdl/src/default_io.cpp, gdl/src/file.cpp, src/default_io.cpp, src/file.cpp: default_io: being able to read (big) compressed files file.cpp: for FILE_SEARCH() * gdl/src/pro/swap_endian_inplace.pro, src/pro/swap_endian_inplace.pro: initial import of SWAP_ENDIAN_INPLACE(), derivate work from SWAP_ENDIAN(). This function is needed for the PDS Library (Planetary Data System, http://pds.nasa.gov/) * gdl/src/pro/dialog_pickfile.pro, src/pro/dialog_pickfile.pro: in DIALOG_PICKFILE, typos, and also new keywords: Display_name and Ressource_name * CMake.tar.gz, gdl/CMake.tar.gz: Upgrade of CMake tar (the alternative way to compile GDL) 2010-08-25 alaingdl * gdl/src/plotting.cpp, src/plotting.cpp: preliminary version for AX and AZ keywords in SURFACE 2010-08-25 slayoo * gdl/testsuite/README, gdl/testsuite/test_clip.pro, gdl/testsuite/test_fix.pro, gdl/testsuite/test_nans_in_sort_and_median.pro, gdl/testsuite/test_zzz.pro, testsuite/README, testsuite/test_clip.pro, testsuite/test_fix.pro, testsuite/test_nans_in_sort_and_median.pro, testsuite/test_zzz.pro: skipping known-bug cases in testsuite when not run using the CVS version of gdl 2010-08-25 m_schellens * gdl/src/Makefile.am, gdl/src/Makefile.in, src/Makefile.am, src/Makefile.in, configure.in, gdl/configure.in: Fixed inconsistency * ChangeLog, README, configure.in, gdl/ChangeLog, gdl/README, gdl/configure.in, gdl/src/GDLInterpreter.hpp, gdl/src/gdlc.i.g, gdl/src/gdlwidget.cpp, src/GDLInterpreter.hpp, src/gdlc.i.g, src/gdlwidget.cpp: release GDL 0.9 * CMake.tar.gz, README.CMake, README.GRIB, README_GRIB, gdl/CMake.tar.gz, gdl/README.CMake, gdl/README.GRIB, gdl/README_GRIB: added CMake GDL 0.9: 2010-08-25 m_schellens * CMake.tar.gz, README.CMake, README.GRIB, README_GRIB: added CMake 2010-08-23 m_schellens * src/default_io.cpp, NEWS: Handle test files with CR delimiter 2010-08-18 alaingdl * src/plotting.cpp: in WINDOW, allowing title= no present OR to be converted (1e1 must be converted in 10.000) 2010-08-16 slayoo * src/gdlgstream.cpp: fixing lowercase gamma letter in greek script (reported by lolkje on the SF GDL forum) 2010-08-12 m_schellens * src/newprognode.cpp, src/prognode.cpp, src/prognode.hpp: Implemented optional loop index (or hash value) variable for FOREACH 2010-08-11 m_schellens * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/gdlc.g, src/gdlc.i.g, src/gdlc.tree.g: Added optional loop index (or hash value) variable to FOREACH (not functional yet) 2010-08-05 m_schellens * src/basic_pro.cpp: Changed default behaviour to not assume variable lenght VMS files (see bug tracker ID: 3028279) * src/ncdf_cl.cpp, src/ncdf_var_cl.cpp: Fixed error reporting for netCDF dimension IDs * src/GDLTreeParser.cpp, src/dcompiler.cpp, src/dinterpreter.cpp, src/dpro.cpp, src/gdlc.tree.g: Fixed optimization for self assignment * config.h.in, src/GDLInterpreter.cpp, src/GDLParser.cpp, src/gdlc.i.g: Fixed error message reporting (bug tracker ID: 2999950) 2010-07-27 slayoo * testsuite/test_idl8.pro, testsuite/test_pmulti.pro, testsuite/test_spher_harm.pro, testsuite/test_zeropoly.pro: updating testsuite to match the change in FOREACH syntax * src/GDLParser.cpp, src/gdlc.g: FOREACH: using COMMA instead of OF as in IDL8 (foreach i, arr do ...) 2010-07-25 slayoo * src/CFMTLexer.cpp, src/CFMTLexer.hpp, src/CFMTTokenTypes.hpp, src/CFMTTokenTypes.txt, src/FMTIn.cpp, src/FMTIn.hpp, src/FMTInTokenTypes.hpp, src/FMTInTokenTypes.txt, src/FMTLexer.cpp, src/FMTLexer.hpp, src/FMTOut.cpp, src/FMTOut.hpp, src/FMTOutTokenTypes.hpp, src/FMTOutTokenTypes.txt, src/FMTParser.cpp, src/FMTParser.hpp, src/FMTTokenTypes.hpp, src/FMTTokenTypes.txt, src/basegdl.hpp, src/cformat.g, src/format.g, src/format.in.g, src/format.out.g, src/ofmt.cpp, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_binfmt.pro: binary format codes for PRINT/STRING/READS/... (tracker item no. 3031999) 2010-07-23 slayoo * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_bug_3033108.pro: testsuite/test_bug_3033108.pro: initial import 2010-07-19 slayoo * testsuite/test_clip.pro: test_clip.pro: adding PLOTS and XYOUTS (tracker item no. 3029082) * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_clip.pro: adding test_clip.pro to the testsuite (tracker item no. 3029085) 2010-07-16 alaingdl * src/datatypes.cpp: correcting bug 3030379 in REVERSE when call with odd elements and without /overwrite 2010-06-29 slayoo * src/convert2.cpp: STRING: fixing bug 3022828 * src/gdlgstream.cpp, src/plotting.cpp: SET_PLOT: fixing bug 2913872 2010-06-29 alaingdl * testsuite/test_float2string.pro, testsuite/test_point_lun.pro: initial import of 2 new tests, not added in Makefile.am, not well packeged now ... * testsuite/Makefile.in, testsuite/Makefile.am: sing space between ".pro" and "\" * src/pro/Makefile.in: idem: missing files * src/pro/Makefile.am: adding missing new files. * src/pro/escape_special_char.pro: removing stupid duplication of keyword ! * NEWS: mention of Maxime' work on compressed files * testsuite/test_zip.pro: initial import of a testsuite around /compress keyword ... (Maxime L.) * src/assocdata.cpp, src/basic_fun_jmg.cpp, src/gzstream.hpp, src/io.cpp, src/print.cpp, src/read.cpp: Now, compress files (using gzip) should work (impacts on : readf, printf, seek, point_lun). Fstat outputs: size changed, new compress flag. Work done by Maxime L. 2010-06-29 slayoo * src/ncdf_cl.cpp: NCDF_*: fixing inf. loop in error message, corrected variable ids in error messages 2010-06-29 alaingdl * src/pro/file_copy.pro, src/pro/file_delete.pro: initial import of 2 new functionnalities: FILE_COPY and FILE_DELETE (writtent by Lea N.) * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_file_basename.pro, testsuite/test_file_copy.pro, testsuite/test_file_delete.pro, testsuite/test_file_dirname.pro, testsuite/test_strsplit.pro: initial import of a serie of tests (written by Lea) for new functionnalities: file_copy, file_delete and also corrected/improved codes: file_basename, file_dirname (escaping), strsplit Makefile.am and Makefile.in updated. * src/pro/strsplit.pro: some improvments in STRPLIT() bye Lea, including /preserve_null * src/pro/file_expand_path.pro: initial import of FILE_EXPAND_PATH (by Lea) 2010-06-28 alaingdl * src/pro/escape_special_char.pro: initial import of ESCAPE_SPECIAL_CHAR(), used by some procedures managing Strings ... (e.g.: file_basename.pro, file_dirname.pro, file_delete.pro, file_copy.pro, ...) * src/pro/file_basename.pro, src/pro/file_dirname.pro: Escaping special Chars in FILE_DIRNAME and FILE_BASENAME 2010-06-25 alaingdl * src/file.cpp: correction for "." in FILE_SEARCH (Lea) 2010-06-23 slayoo * src/pro/dialog_pickfile.pro: DIALOG_PICKFILE: referencing Macports instead of Darwinports (the latter is bogus, see: http://trac.macports.org/wiki/DarwinPortsFraud) 2010-06-22 alaingdl * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_file_search.pro: initial import of "test_file_search.pro" (Makefile* upgrade done) * src/file.cpp: Activating the /FOLD_CASE keyword in FILE_SEARCH (code by M. Lenoir) * NEWS: upgrading informations in NEWS (important bugs corrections and new features) * src/pro/dialog_pickfile.pro: URL to Zenity HowTo install on OSX; unifying return to null string when failures. 2010-06-22 slayoo * doc/www/credits.html, doc/www/require.html: doc/www updates (fixed broken links in require.html) 2010-06-22 alaingdl * src/pro/dialog_pickfile.pro: Initial import of DIALOG_PICKFILE(), implementation by Maxime Lenoir. This code is using "zenity" (gdialog is now an alias to zenity). This code should work on most Linux distros (tested on CentOS 5.4, Mandriva 2010, Ubuntu 9.04) and OSX (tested on 10.6.2, after installation of Gnome Package). Keyword "filter" works since Zenity >= 2.23.1 2010-06-21 alaingdl * src/pro/str_sep.pro: correcting obsolete STR_SEP routine using /preverse_null in STRSPLIT; test at the end of the file. 2010-06-15 alaingdl * configure: upgrading "configure" in order to have the HAVE_X working ... * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_readf.pro: Initial import for "test_readf.pro" for testing CR/LF/(CR+LF) readings in ASCII files Makefile.am and Makefile.in in testsuite/ also upgraded * testsuite/test_fft_leak.pro: A /continue was missing in test_fft_leak.pro 2010-06-11 slayoo * configure.in, src/basegdl.hpp, src/basic_fun.cpp, src/deviceps.hpp, src/devicex.hpp, src/dinterpreter.hpp, src/file.cpp, src/gdlgstream.hpp, src/gdlwinstream.hpp, src/gdlxstream.cpp, src/gdlxstream.hpp, src/graphics.cpp, src/math_fun_jmg.hpp, src/plotting.cpp, src/str.cpp: OpenBSD compatibility fixes, making Xlib an optional dependency * src/basic_fun_jmg.cpp, src/objects.cpp: FSTAT: support for large (> 2GB) files (tracker item no. 3014216) 2010-06-09 slayoo * configure.in: configure: simplifying wxWidgets detection - now only wx-config is checked what should help od Fedora 2010-06-08 slayoo * NEWS, src/libinit.cpp, src/math_fun.cpp, src/math_fun.hpp, src/pro/Makefile.am, src/pro/Makefile.in, src/pro/imsl_erf.pro, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_erfinv.pro: IMSL_ERF: initial import + test-routine 2010-06-07 alaingdl * testsuite/test_fft_leak.pro: improvments (allowing not to exist with /no_exit, /force mentionned if Linux ...) * src/gsl_fun.cpp: when using GSL version of FFT, correcting input conversion for three types (now testsuite/test_fft.pro works for GSL only and also FFTw) * testsuite/Makefile.am, testsuite/Makefile.in: adding TEST_FFT_LEAK.pro in "make check" * testsuite/test_fft_leak.pro: initial import of TEST_FFT_LEAK.pro, checking memory leak when using GSL FFT or FFTw libs. * src/fftw.cpp: FFTw: correction of memory leak by Léa, using fftw_destroy_plan(p). See test_fft_leak.pro in testsuite/ 2010-06-05 slayoo * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_get_screen_size.pro, testsuite/test_pmulti.pro: testsuite: adding test_pmulti, skipping test_get_screen_size if no X connection is available * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_nans_in_sort_and_median.pro: adding test_nans_in_sort_and_median.pro (cf. tracker item no. 2985552) * configure.in: configure: compatibility with grib_api 1.9.0 2010-06-04 slayoo * src/basic_pro.cpp: WRITEU: preventing segfault writing to freed/unopened lun (tracker item no. 3007448) * src/gdlwidget.cpp: unicode-wxWidgets compatibility fixes in gdlwidget.cpp (tracker item no. 3005435) * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_memory.pro: adding test_memory.pro * configure.in: configure: fixing auto-detection of FFTW 2010-06-01 alaingdl * src/deviceps.hpp: correcting rounding errors in functions SetXPageSize and SetYPageSize, affecting !D.X_SIZE in postscript mode 2010-05-31 alaingdl * testsuite/Makefile.am, testsuite/Makefile.in: updating Makefile.am and Makefile.in to include "test_spl_init.pro" in testsuite/. Also changing place of "test_get_screen_size" in list (alpha order) * testsuite/test_spl_init.pro: initial import of TEST_SPL_INIT in testsuite/ (by Lea N.) * src/math_fun_ac.cpp: Adding YP0 and YPN_1 keywords to SPL_INIT 2010-05-31 slayoo * NEWS, src/dimension.hpp, src/gsl_fun.cpp, src/gsl_fun.hpp, src/libinit.cpp, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_spher_harm.pro: SPHER_HARM: initial import (using GSL gsl_sf_legendre_sphPlm) + test routine 2010-05-28 slayoo * src/pro/deriv.pro: DERIV: enabling error-reporting via MESSAGE 2010-05-27 jomoga * src/gdlwidget.cpp, src/gdlwidget.hpp, src/widget.cpp: Further widget updates 2010-05-16 m_schellens * testsuite/test_suite.pro, config.h.in, src/GDLInterpreter.cpp, src/datalistt.hpp, src/gdlc.i.g, src/prognode.cpp, src/prognode.hpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp, testsuite/Makefile.am: sync 2010-05-05 m_schellens * src/typedefs.hpp, src/GDLInterpreter.cpp, src/basegdl.hpp, src/gdlc.i.g: enable memstats 2010-05-04 m_schellens * src/GDLInterpreter.cpp, src/dpro.hpp, src/gdlc.i.g, src/newprognode.cpp, src/prognode.cpp, src/prognode.hpp, src/prognodeexpr.cpp, src/typedefs.hpp: fixed FOR loops within $ 2010-05-03 alaingdl * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_get_screen_size.pro, testsuite/test_product.pro: Less messages in TEST_PRODUCT; adding revised TEST_GET_SCREEN_SIZE in "make check" 2010-05-03 m_schellens * src/GDLInterpreter.cpp, src/arrayindex.cpp, src/arrayindex.hpp, src/arrayindexlistt.hpp, src/datatypes.cpp, src/gdlc.i.g, src/newprognode.cpp: add file 2010-05-01 m_schellens * src/GDLInterpreter.hpp, src/Makefile.am, src/Makefile.in, src/assocdata.hpp, src/basegdl.cpp, src/basegdl.hpp, src/basic_fun_cl.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dstructgdl.hpp, src/envt.hpp, src/gdlc.i.g, src/prognode.cpp, src/prognode.hpp, src/prognodeexpr.cpp, src/GDLInterpreter.cpp: removed unnecessary copying in deref, IF, SWITCH, CASE 2010-04-27 m_schellens * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/basegdl.hpp, src/datatypes.cpp, src/gdlc.i.g, src/prognode.cpp, src/prognode.hpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp: interpreter improvements 2010-04-26 slayoo * src/gshhs.cpp, src/plotting.cpp: POLYFILL: mapping support 2010-04-22 slayoo * MAP_INSTALL, src/gshhs.cpp, src/gshhs.hpp, src/libinit.cpp, src/libinit_jmg.cpp: some GSHHS-related cleanups 2010-04-22 alaingdl * src/pro/Makefile.in, src/pro/Makefile.am: forgot to include LUDC.pro in the Makefile.* files :( 2010-04-22 m_schellens * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLTreeParser.cpp, src/Makefile.in, src/assocdata.hpp, src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dinterpreter.cpp, src/dinterpreter.hpp, src/envt.hpp, src/gdlc.i.g, src/gdlc.tree.g, src/math_fun_jmg.cpp, src/prognode.cpp, src/prognode.hpp, src/prognodeexpr.cpp, src/specializations.hpp, src/typedefs.hpp, src/widget.cpp: optimized interpreter 2010-04-21 alaingdl * src/libinit.cpp, src/libinit_jmg.cpp: moving new SA declarations from "libinit.cpp" to "libinit_jmg.cpp" to keep map_* together and protected by the optionnal block for LIBPROJ4 #if defined(USE_LIBPROJ4) * src/pro/ludc.pro: LUDC.pro: initial import of a fake one to be able to run the full time_test3 suite * src/file.cpp: trying to manage "~" in GDL_PATH, also for EXPAND_PATH. No managment of redundant entry (like "."); not sure path expansion always done ... 2010-04-21 slayoo * MAP_INSTALL: adding a hint to the MAP_INSTALL file * NEWS: update of the NEWS file * src/gshhs.cpp, src/gshhs.hpp, src/libinit.cpp, src/plotting.hpp, src/Makefile.am, src/plotting.cpp, INSTALL, MAP_INSTALL, README, configure.in: MAP_CONTINENTS: initial import (a lot needs to be done... but it works; uses GSHHS - a GPL-licensed shoreline database) 2010-04-20 m_schellens * src/basic_op.cpp, src/datatypes.cpp, src/gdlc.i.g, src/prognode.cpp, src/typedefs.hpp: commented out OpenMP usage for mere copy 2010-04-20 slayoo * doc/www/screenshot.html, src/deviceps.hpp, src/grib.cpp, src/grib.hpp, src/libinit.cpp, src/plotting.cpp, src/plotting.hpp, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_device.pro: DEVICE: support for the INCHES kw, updating !D when called with XSIZE, YSIZE; test_device.pro; some other tiny cleanups 2010-04-20 m_schellens * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/gdlc.i.g, src/prognode.cpp: reduced overhead between statements 2010-04-19 m_schellens * src/GDLInterpreter.cpp, src/basic_fun.cpp, src/gdlc.i.g: reduced overhead between statements * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLLexer.hpp, src/GDLParser.hpp, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/basic_fun.cpp, src/basic_pro.cpp, src/dinterpreter.cpp, src/dpro.cpp, src/envt.hpp, src/gdlc.g, src/gdlc.i.g, src/gdlc.tree.g, src/libinit.cpp, src/objects.hpp, src/prognode.cpp, src/prognode.hpp, src/prognodeexpr.cpp, src/str.cpp: Fixed STRMID for 64 bit systems 2010-04-19 jomoga * src/gdlwidget.cpp, src/gdlwidget.hpp, src/libinit_jmg.cpp, src/objects.cpp, src/widget.cpp: Update widget code 2010-04-19 m_schellens * testsuite/Makefile.in, src/prognode.cpp: fixed FOR_STEP handling also negative steps 2010-04-18 m_schellens * src/str.cpp: debug info for STRMID * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/gdlc.i.g, src/prognode.cpp, src/prognode.hpp: interpreter optimizations 2010-04-17 slayoo * configure.in: making the plplot-modules/imagemagick message a warning (instead of an error) 2010-04-17 m_schellens * src/dinterpreter.cpp, src/dpro.cpp, src/dpro.hpp, src/envt.cpp, src/envt.hpp, src/gdlc.g, src/gdlc.i.g, src/math_fun_jmg.cpp, src/prognode.cpp, src/prognode.hpp, src/widget.cpp, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/basic_fun.cpp: changed internal representation of FOR/FOREACH loops 2010-04-16 m_schellens * src/basic_fun.cpp: removed OpenMP usage in STRMID * src/basic_fun.cpp: changed OpenMP options for STRMID 2010-04-16 alaingdl * testsuite/Makefile.am, testsuite/test_str_functions.pro: introduction of TEST_STR_FUNCTIONS in the "make check" testsuite * src/pro/strsplit.pro: updating STRSPLIT, correcting bugs * testsuite/test_str_functions.pro: initial import of TEST_STR_FUNCTIONS, regrouping tests on functions working on STRING, like STRMID, STRSPLIT, ... (to be included in "make check") 2010-04-16 slayoo * doc/www/screenshots/screenshot12.png, doc/www/screenshots/screenshot12_thumb.png, doc/www/screenshot.html: doc/www: adding a new screenshot (by Michal Piadlowski) 2010-04-16 m_schellens * src/basic_fun.cpp: fixed MEDIAN with NaN for floating types (1 dimensional case only) 2010-04-15 m_schellens * src/basic_fun.cpp: fixed SORT for floating types 2010-04-15 alaingdl * src/pro/str_sep.pro, src/pro/strsplit.pro: STR_SEP: rewriting and now managing sep. string with more than only one char STRSPLIT: cleanup and improvments 2010-04-14 m_schellens * src/GDLInterpreter.hpp, src/envt.cpp, src/envt.hpp, src/gdlc.i.g: make CLEANUP call when object is garbage collected 2010-04-14 alaingdl * src/pro/tvscl.pro: in TVSCL, return when input array not given or without elements * testsuite/test_read_jpeg.pro: better managment of big images/small screen (and vertical/horizontal modes) 2010-04-13 m_schellens * src/envt.cpp: fixed reference counting in OBJ_DESTROY 2010-04-12 m_schellens * src/GDLInterpreter.cpp, src/gdlc.i.g: add comment * src/strassenmatrix.hpp: fixed openmp * src/gdljournal.cpp, src/initsysvar.cpp: changed \!GDL sysvar, true GDL version for journal files * src/GDLInterpreter.cpp, src/basic_fun.cpp, src/gdlc.i.g: fixed EXECUTE messaging * src/envt.cpp, src/gsl_fun.cpp, src/hdf_pro.cpp, src/prognode.hpp, src/read.cpp: removed warning * NEWS, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLTreeParser.cpp, src/dcompiler.cpp, src/dinterpreter.cpp, src/gdlc.i.g, src/gdlc.tree.g, src/prognode.cpp, src/prognode.hpp: fixed IF_ELSE * src/dcompiler.cpp, src/dinterpreter.cpp, src/prognode.hpp, src/prognodeexpr.cpp: fixed empty block handling * src/dcompiler.cpp, src/prognode.hpp: fixed IF_ELSE * src/GDLInterpreter.hpp, src/gdlc.i.g: localization info for out of scope message * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/dcompiler.cpp, src/gdlc.g, src/gdlc.i.g, src/prognode.hpp, src/prognodeexpr.cpp: optimized implementation of REPEAT/WHILE loops 2010-04-11 slayoo * src/gsl_fun.cpp, src/libinit_jmg.cpp: cosmetics... 2010-04-11 m_schellens * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLParser.cpp, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/basic_fun_jmg.cpp, src/gdlc.g, src/gdlc.i.g, src/gdlc.tree.g, src/prognode.cpp: implemented special handling for N_ELEMENTS 2010-04-10 m_schellens * src/GDLTreeParser.cpp, src/basic_pro_jmg.cpp, src/envt.cpp, src/gdlc.tree.g, src/prognodeexpr.cpp: fixed error message info * src/envt.cpp: fixed WARNING message * src/read.cpp: Fixed behaviour of READ from cin * src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/dcompiler.cpp, src/dinterpreter.cpp, src/dnode.cpp, src/dnode.hpp, src/dpro.cpp, src/gdlc.g, src/gdlc.i.g, src/gdlc.tree.g, src/prognode.cpp, src/prognode.hpp, src/prognodeexpr.cpp, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp: fixed error message info 2010-04-09 alaingdl * testsuite/test_tv.pro: more tests for TV: positionning and all Colors Tables 2010-04-09 slayoo * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_fix.pro: adding test_fix.pro to the make-check list * src/pro/Makefile.am, src/pro/Makefile.in: reordering file list in src/pro/Makefile.* * src/pro/Makefile.am, src/pro/Makefile.in, src/pro/findex.pro, src/pro/interpol.pro, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_interpol.pro: INTERPOL: initial import (using FINDEX and SPL_INTERP, QUADRATIC and LSQUADRATIC not implemented yet) 2010-04-08 slayoo * src/pro/restore.pro: RESTORE: fixing compatibility with current CMSVLIB version; allowing restoration of more than 30 variables 2010-04-08 alaingdl * testsuite/test_tv.pro: adding TEST_TV_DAMIER in TEST_TV to check whether positionning with TV is OK or not * testsuite/Saturn.jpg, testsuite/test_read_jpeg.pro: reading back a JPEG file and testing TVSCL ... (initial import of Saturn.jpg and test_read_jpeg.pro) 2010-04-08 slayoo * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_idl8.pro: adding test_idl8.pro with short tests of new features: FOREACH statement, negative indices, dot op. for member routine access 2010-04-07 slayoo * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/checks, testsuite/test_zeropoly.pro, testsuite/test_zzz.pro, testsuite/try: testsuite: checking if all .pro files in testsuite are included in the make-check rule, fixing memory leak in test_zeropoly * src/basic_fun.cpp: adding a specialization for DComplexGDL in product_template() (fixes compilation problem with OpenMP enabled) * src/basic_fun.cpp, src/libinit.cpp, testsuite/test_hist_2d.pro: TOTAL/PRODUCT: support for the PRESERVE_TYPE keyword; test_hist_2d.pro: making the tests shorter 2010-04-07 m_schellens * src/antlr/LLkParser.cpp, src/antlr/Parser.cpp, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTreeParser.hpp, src/basic_pro_jmg.cpp, src/basic_pro_jmg.hpp, src/dinterpreter.cpp, src/gdlc.g, src/gdlc.tree.g, src/libinit_jmg.cpp: fixed tag access 2010-04-06 slayoo * testsuite/test_url.pro: test_url: fixing behaviour on terminals with small number of columns 2010-04-06 m_schellens * NEWS: update NEWS * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/arrayindex.hpp, src/basegdl.cpp, src/basegdl.hpp, src/datatypes.cpp, src/datatypes.hpp, src/dstructgdl.hpp, src/gdlc.i.g, src/typedefs.hpp: support negative index ranges -1 is the last element, -2 the one before the last and so on 2010-04-06 alaingdl * testsuite/test_url.pro: try to improve TEST_URL without stopping the "make check" run ... 2010-04-06 m_schellens * NEWS: update NEWS * src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/gdlc.g, src/gdlc.i.g, src/gdlc.tree.g, src/GDLInterpreter.cpp: added FOREACH statement, syntax: FOREACH loopVar OF array DO 2010-04-05 m_schellens * src/dinterpreter.cpp: enabled auto printing of expressions again (was off dor debug) * src/GDLTreeParser.cpp, src/basic_fun.cpp, src/datatypes.cpp, src/gdlc.tree.g, src/prognodeexpr.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/antlr/LLkParser.cpp, src/antlr/Parser.cpp, src/antlr/TreeParser.cpp, src/dinterpreter.cpp, src/dnode.hpp, src/gdlc.g, src/gdlc.i.g, src/prognode.cpp, src/prognode.hpp, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt: allow DOT \(.\) for member function calls 2010-04-02 alaingdl * testsuite/test_known_bugs.pro: Quickly testing known problems 2010-03-31 m_schellens * src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/basic_pro.cpp, src/datatypesref.cpp, src/gdlc.g, src/gdlwidget.cpp, src/GDLInterpreter.cpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, README: fixed reference counting 2010-03-30 slayoo * configure.in: configure: checking if plplot uses dynamic drivers when compiling with ImageMagick * testsuite/test_constants.pro: test_constants.pro: re-enabling some tests which do not need UDUNITS 2010-03-30 alaingdl * testsuite/test_constants.pro, testsuite/test_fft.pro: Reducing amount of un-useful messages for "make check"; desactivating UDUNITS if not available 2010-03-30 slayoo * src/libinit.cpp, src/plotting.cpp, src/plotting.hpp: POLYFILL: initial import (just an early draft) 2010-03-27 m_schellens * src/dinterpreter.cpp, src/libinit_jmg.cpp, src/widget.cpp: added keywords to keyword list for WIDGET_CONTROL * src/math_fun.cpp: improved accuracy of TAN for COMPLEX (by using double precision internally) * src/gdlgstream.cpp, src/gdlgstream.hpp, src/gdlpsstream.cpp, src/gdlpsstream.hpp, src/gdlsvgstream.cpp, src/gdlxstream.cpp, src/gdlxstream.hpp, src/gdlzstream.cpp: working plplot 2010-03-26 m_schellens * src/gdlxstream.cpp, src/gdlgstream.hpp, src/gdlwidget.cpp, src/gdlwidget.hpp, src/gdlxstream.hpp, src/widget.cpp, gdl.kdevelop: fixed plplot issues * gdl.kdevelop, src/devicex.hpp: *** empty log message *** * src/gdlpsstream.hpp, configure, configure.in, gdl.kdevelop, src/datatypes.cpp: made wroking reference counting independent from use of python 2010-03-25 jomoga * src/gdlwidget.cpp, src/gdlwidget.hpp, src/widget.cpp, src/widget.hpp: Added functionality 2010-03-25 m_schellens * gdl.kdevelop: removed debug message 2010-03-24 m_schellens * src/gdlgstream.hpp, configure.in, gdl.kdevelop, configure: removed debug message * src/devicex.hpp, src/gdlgstream.cpp, src/gdlgstream.hpp, src/gdlxstream.cpp, src/gdlxstream.hpp, gdl.kdevelop: sync 2010-03-22 slayoo * testsuite/test_gc.pro, testsuite/Makefile.am, testsuite/Makefile.in: test_gc.pro: initial import 2010-03-20 slayoo * src/plotting.cpp: AXIS: support for the /SAVE keyword 2010-03-16 m_schellens * src/Makefile.am, src/Makefile.in, src/deviceps.hpp, configure, configure.in, gdl.kdevelop: removed ` at end of line 1057 2010-03-16 alaingdl * src/libinit.cpp, src/plotting.cpp: Adding keyword GET_SCREEN_SIZE in DEVICE 2010-03-15 alaingdl * configure, configure.in: Correcting typo in 2 configure files ... 2010-03-15 slayoo * src/sigfpehandler.cpp: sigfpehandler.cpp: adding the system include needed for SIGFPE in GCC 4.3 2010-03-14 m_schellens * src/plotting.cpp: insert checks for sigControlC * src/dcompiler.cpp, src/dinterpreter.cpp, src/gdl.cpp, gdl.kdevelop: catch GDLRetAllException wiht -e 2010-03-13 m_schellens * src/basic_pro.cpp, src/dinterpreter.cpp, src/dinterpreter.hpp: prevent GDL from deleting history file * src/dinterpreter.cpp, src/read.cpp, src/sigfpehandler.cpp: fixed control-C and fpe handling * src/dinterpreter.cpp, src/dinterpreter.hpp, src/io.cpp, src/read.cpp: get input from READ thru readline * src/plotting.cpp, src/envt.hpp: working [XY]RANGE for AXIS * src/GDLInterpreter.hpp, src/convert2.cpp, src/gdlc.i.g: Changed string lenght of string for (unsigned)long to string conversion 2010-03-12 m_schellens * src/GDLInterpreter.hpp, src/gdlc.i.g: reference counting this time without debug messages :-) * src/accessdesc.hpp, src/basic_fun.cpp, src/datatypes.cpp, src/datatypes.hpp: reference counting this time without fail (so far :-) * src/GDLInterpreter.hpp, src/basegdl.hpp, src/datatypes.cpp, src/datatypes.hpp, src/datatypesref.cpp, src/gdlc.i.g, src/objects.hpp: corrections for reference counting (more pemding, but previous version was broken 2010-03-11 m_schellens * src/GDLInterpreter.hpp, src/assocdata.hpp, src/basegdl.hpp, src/datatypes.cpp, src/dstructgdl.cpp, src/dstructgdl.hpp, src/envt.cpp, src/gdlc.i.g: reference counting for structures 2010-03-10 m_schellens * src/datatypes.cpp, src/GDLInterpreter.hpp, src/Makefile.am, src/Makefile.in, src/datatypesref.cpp, src/gdlc.i.g: reference counting for objects and pointer (only prints an info on out of scope, changes nothing) 2010-03-09 m_schellens * src/antlr/RefCount.hpp, src/GDLInterpreter.hpp, src/Makefile.am, src/Makefile.in, src/basic_fun.cpp, src/datatypes.cpp, src/datatypes.hpp, src/datatypesref.cpp, src/gdlc.i.g, src/objects.hpp: reference counting for objects and pointer (only prints an info on out of scope, changes nothing) 2010-03-08 m_schellens * src/io.hpp, src/io.cpp, src/magick_cl.cpp, src/basic_pro.cpp: expand path for ImageMagick-related routines 2010-03-07 m_schellens * src/GDLInterpreter.cpp, src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/basic_op.cpp, src/datatypes.hpp, src/dstructgdl.hpp, src/gdlc.i.g, src/specializations.hpp, src/strassenmatrix.hpp: handle nested ON_ERROR,2 2010-02-26 alaingdl * doc/www/download.html: fixing typo for link 2010-02-23 slayoo * src/plotting.cpp: CONTOUR: support for [x|y]style 2010-02-22 alaingdl * doc/www/screenshot.html: Including Saturn Legend * doc/www/screenshots/screenshot11.png, doc/www/screenshots/screenshot11_thumb.png: Initial import for Saturn page 2010-02-22 slayoo * MAP_INSTALL, README: correcting libproj4 url in README and MAP_INSTALL * src/plotting.cpp: AXIS: support for axes with arbitrary origin (patch from Joanna / cokhavim) 2010-02-20 slayoo * src/libinit.cpp, src/pro/Makefile.am, src/pro/Makefile.in, src/pro/STATUS, src/pro/UrgentNeed.txt, src/pro/hist_2d.pro, src/pro/hist_nd.pro, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_hist_2d.pro, testsuite/test_rebin.pro, src/basic_fun.cpp, src/dpro.cpp: HIST_2D: initial import (using a GPL-licensed HIST_ND) + test routine REBIN: support for specifying new dimensions as an array + test routine dpro.cpp/DLibFunRetNew() - support for specifying warnKeywords TOAL/PRODUCT: ignoring PRESERVE_TYPE keyword (treating as warnKeyword) 2010-02-20 m_schellens * configure.in, src/GDLInterpreter.hpp, src/gdlc.i.g, configure: included suggestion for directly linking dl, see https://sourceforge.net/tracker/?func=detail&aid=2952365&group_id=97659&atid=618683 2010-02-19 m_schellens * src/print.cpp, README, configure, configure.in, gdl.kdevelop: made FORMAT accept (but ignore) an empty format string 2010-02-19 alaingdl * testsuite/test_fft.pro: error in call to EXIT ... * testsuite/test_fft.pro: improved TEST_FFT to test in N dims consitancy of direct then forward FFTs. 2010-02-17 m_schellens * src/math_utl.hpp, doc/www/home.html, configure.in, gdl.kdevelop, configure: use FFTW automatically if found 2010-02-17 slayoo * testsuite/Makefile.am, testsuite/Makefile.in, testsuite/README, testsuite/test_suite.pro: adding test_suite.pro to the make-check rule 2010-02-13 slayoo * INSTALL, README, testsuite/README: initial import of gdl/testsuite/README, minor updates in gdl/README and gdl/INSTALL 2010-02-12 slayoo * src/pythongdl.cpp: pythongdl.cpp: Python >2.4 compatibility (Py_ssize_t) * configure.in, src/antlr/Makefile.am, src/antlr/Makefile.in, src/gdlpython.cpp, src/pythongdl.cpp: not installing libantrl.a during make-install (gdl is statically linked with it), fixing a missing include in pythongdl.cpp, informing about the build type (standalone/Python module) in the post-configure message 2010-02-11 slayoo * src/pro/README.txt, src/math_utl.hpp: GCC 4.5 compatibility (math_utl.hpp); corrected some typos in the src/pro/README.txt file noted by the Debian packager * doc/www/download.html: doc/www: adding info about the Debian GNU/kFreeBSD packages 2010-02-11 alaingdl * testsuite/Makefile.am, testsuite/Makefile.in: upgrading automatic test suite files in directory testsuite/ * testsuite/test_fft.pro: Initial important of "test_fft.pro", a preliminary version of a testsuite for FFT * src/fftw.cpp: Important change in FFT when using FFTw lib. This bug correction is not now propagated in FFT when using GSL (in "gsl_fun.cpp") Please test using "test_fft.pro" * testsuite/test_product.pro: Wider tests for PRODUCT(), including /int, /nan, and dim param. * src/basic_fun.cpp: dding managment of keyword /Integer to PRODUCT function (see test_product.pro) This Keyword is used in current Astron Lib. 2010-02-09 alaingdl * src/libinit.cpp: adding INTEGER keyword in the PRODUCT function 2010-02-08 slayoo * doc/Makefile, testsuite/Makefile, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_product.pro: adding test_product.pro to the make-check rule, removing doc/Makefile and testsuite/Makefile files 2010-02-08 alaingdl * testsuite/test_product.pro: Initial import for TEST_PRODUCT.pro: testing some options of PRODUCT function 2010-02-07 m_schellens * doc/www/credits.html: alphabetic order * src/dinterpreter.cpp: Corrected error reporting for GDLDirectPrint(tm) 2010-02-06 m_schellens * gdl.kdevelop, src/dinterpreter.cpp: command line calculator mode - just type an expression GDL prints it 2010-02-05 m_schellens * src/dnode.cpp: test CVS access 2010-02-03 m_schellens * doc/www/credits.html: rc4 2010-02-02 m_schellens * src/lapack.cpp: add file * src/GDLParser.cpp, src/Makefile.am, src/Makefile.in, src/dnode.cpp, src/dnode.hpp, src/gdlc.g, README, config.h.in, configure: Fixed missing promption of integer constants with DEFINT32 set 2010-02-01 slayoo * configure.in: configure: adding -lrps flag to LIBS for the Cygwin case (patch from Mateusz Turcza) * configure.in: autodetection of OpenMP using AC_CHECK_HEADERS(omp.h) 2010-01-31 slayoo * configure.in: re-enabling autodetection of Ubuntu-style wxWidgets installation; change of GDL version number * src/widget.cpp: fixing widget.cpp after a change in arguments of GDLParser constructor 2010-01-30 slayoo * NEWS: update of the NEWS file (.9rc4 section) 2010-01-30 m_schellens * configure.in, gdl.kdevelop, configure: handling --with-openmp * ChangeLog, NEWS: update NEWS GDL 0.9rc4: 2010-01-30 m_schellens * ChangeLog, Makefile.in, configure, doc/www/credits.html, gdl.kdevelop, src/deviceps.hpp, src/graphics.hpp, src/libinit.cpp, src/plotting.cpp: Applied patch (tracker item 2860573) adding XSIZE, YSIZE, COLOR for PS output to DEVICE (patch from Joanna/cokhavim) 2010-01-29 slayoo * testsuite/Makefile, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_base64.pro, testsuite/test_constants.pro, testsuite/test_nestedloop.pro: testsuite: including test_base64, test_constants and test_nestedloop in the make-check rule * doc/Makefile, doc/Makefile.am, doc/Makefile.in, doc/gdl.1, testsuite/Makefile, testsuite/Makefile.am, testsuite/Makefile.in, testsuite/test_angles.pro, testsuite/test_multiroots.pro, testsuite/test_url.pro, testsuite/test_wavelet.pro, testsuite/test_zeropoly.pro, testsuite/try, Makefile.am, configure.in: including some of the tests from the testsuite in a make-check rule, adding a manpage (+including it in the make-install rule) * src/gdlgstream.hpp: fixing memory leak in GDLGStream::checkPlplotDriver() (thanks Alain/Valgrind) 2010-01-28 m_schellens * src/GDLInterpreter.cpp, src/GDLParser.hpp, src/dinterpreter.cpp, src/dpro.cpp, src/dpro.hpp, src/gdlc.g, src/gdlc.i.g: Fixed some uninitialized value issues detected with valgrind 2010-01-28 slayoo * doc/www/screenshot.html: doc/www: adding screenshots of GDL running on Windows under Cygwin and coLinux * src/file.cpp, src/gsl_fun.cpp, src/plotting.cpp, src/str.cpp: Cygwin and GCC 3.4.4 compatibility fixes (patch by Mateusz Turcza) * src/deviceps.hpp, src/devicesvg.hpp, src/devicewin.hpp, src/devicex.hpp, src/devicez.hpp: helping the compiler to disambiguate plstream->spause() calls and thus fixing compatibility with GCC 3.4.4 (patch by Mateusz Turcza) * README, configure.in: checking for GSL >=1.7 which is requiered to use both FFT and DWT at the same time 2010-01-27 slayoo * doc/www/menu.html, doc/www/screenshot.html, doc/www/screenshot.png: doc/www: update of the screenshots section * src/gsl_fun.cpp, src/gsl_fun.hpp, src/libinit.cpp, testsuite/test_zeropoly.pro: IMSL_ZEROPOLY: initial import (using gsl_poly_complex_solve()) 2010-01-25 m_schellens * src/FMTOut.hpp, src/format.out.g, gdl.kdevelop, src/FMTParser.cpp, src/print.cpp: fixed T,TL,TR format codes 2010-01-23 slayoo * src/ncdf_cl.cpp, src/ncdf_dim_cl.cpp, src/ncdf_var_cl.cpp, src/ncdf_att_cl.cpp: NCDF_*: fixes in error handling, support for LENGTH keyword in NCDF_ATTPUT; allowing to specify the global atribute number in NCDF_ATTNAME; outputing byte arrays instead of strings in NCDF_ATTGET; compatibility with netcd-4 (file handles are now Long instead of Int) * src/fftw.cpp, src/libinit_jmg.cpp: FFT: preventing bogus memory freeing with dcomplex input (tracker item no. 2935682) 2010-01-22 slayoo * doc/www/download.html: doc/www: update of the Download section- adding info about CVS access, links to packaged versions, and a note encouraging to use packages based on current release 2010-01-20 m_schellens * doc/www/support.html, doc/www/tdl.html, doc/www/contribute.html, doc/www/credits.html, doc/www/download.html, doc/www/feedback.html, doc/www/gdl.css, doc/www/home.html, doc/www/index.html, doc/www/menu.html, doc/www/require.html, doc/www/resources.html, doc/www/screenshot.html, doc/www/screenshot.png: Added source of http://gnudatalanguage.sourceforge.net/ to doc/www 2010-01-20 slayoo * testsuite/test_wavelet.pro, src/gsl_fun.cpp, src/gsl_fun.hpp, src/libinit.cpp: WTN: initial import (using GSL DWT routines) + test-routine (test_wavelet.pro) * src/pro/array_indices.pro, src/pro/calendar.pro, src/pro/file_basename.pro, src/pro/file_dirname.pro, src/pro/imsl_zerosys.pro, src/pro/ishft.pro, src/pro/last_item.pro, src/pro/lmgr.pro, src/pro/loadct.pro, src/pro/map_clip_set.pro, src/pro/matrix_multiply.pro, src/pro/path_sep.pro, src/pro/poly.pro, src/pro/poly_area.pro, src/pro/py_plot.pro, src/pro/py_print.pro, src/pro/query_bmp.pro, src/pro/query_dicom.pro, src/pro/query_gif.pro, src/pro/query_image.pro, src/pro/query_jpeg.pro, src/pro/query_pict.pro, src/pro/query_png.pro, src/pro/query_ppm.pro, src/pro/query_tiff.pro, src/pro/read_bmp.pro, src/pro/read_dicom.pro, src/pro/read_jpeg.pro, src/pro/read_pict.pro, src/pro/read_png.pro, src/pro/read_tiff.pro, src/pro/read_xwd.pro, src/pro/restore.pro, src/pro/rstrpos.pro, src/pro/showfont.pro, src/pro/str_sep.pro, src/pro/uniq.pro, src/pro/write_bmp.pro, src/pro/write_jpeg.pro, src/pro/write_pict.pro, src/pro/write_png.pro, src/pro/appleman.pro: adding on_error,2 for routines implemented in GDL 2010-01-18 slayoo * src/magick_cl.cpp: making ImageMagick format decoder warning non fatal (tracker item no 2934374) 2010-01-17 m_schellens * src/GDLParser.cpp, src/gdlc.g: Honor more than one COMPILE_OPT within $ * src/GDLLexer.hpp, src/GDLParser.hpp, src/dinterpreter.cpp, src/envt.hpp, src/gdlc.g: Honor COMPILE_OPT within $ and EXECUTE 2010-01-16 m_schellens * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLLexer.hpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/basic_fun.cpp, src/dcompiler.cpp, src/dinterpreter.cpp, src/dpro.hpp, src/envt.hpp, src/gdlc.g, src/math_fun_jmg.cpp: Honor COMPILE_OPT within $ and EXECUTE * src/devicex.hpp: Fixed segfault caused by TVRD with no window open * gdl.kdevelop, src/datatypes.cpp, src/devicex.hpp: Corrected error message for constant indices 2010-01-16 slayoo * src/dcompiler.cpp, src/gdlexception.cpp, src/gdlexception.hpp: adding a warning about compiling an obsolete routine when it is compiled for the first time, thus changing the behaviour below: GDL> !WARN.OBS_ROUTINES=1 GDL> for i=0, 2 do a=rstrpos(' ',' ') % Compiled module: RSTRPOS. GDL> for i=0, 2 do a=rstrpos(' ',' ') % Routine compiled from an obsolete library: RSTRPOS into: GDL> !WARN.OBS_ROUTINES=1 GDL> for i=0, 2 do a=rstrpos(' ',' ') % Routine compiled from an obsolete library: RSTRPOS % Compiled module: RSTRPOS. GDL> for i=0, 2 do a=rstrpos(' ',' ') % Routine compiled from an obsolete library: RSTRPOS 2010-01-15 slayoo * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt: progagating changes in gdlc.g (previous commit) to gdlc.i.g- and gdlc.tree.g-related GDL*.pp files * src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/gdlc.g, src/GDLLexer.hpp: support for numeric constants in explicit binary format, e.g. a='1010101'b (tracker item no. 2932619) 2010-01-14 slayoo * src/pro/file_lines.pro: FILE_LINES: spawning subprocesses with /NOSHELL keyword to prevent execution of shell startup file (patch by Lucio Baggio, patch-tracker item no. 2932168) 2010-01-10 m_schellens * src/antlr/Makefile.in, src/pro/Makefile.in, src/pro/dicom/Makefile.in, Makefile.in, aclocal.m4, config.h.in, configure, configure.in, gdl.kdevelop, ltmain.sh, src/Makefile.in, src/basic_op.cpp, src/datatypes.cpp, src/default_io.cpp: Fixed line number reporting 2010-01-05 slayoo * configure, configure.in, config.h.in: configure script: support for the Debian naming of the HDF4 libraries from the hdf4-alt packages (compiled with --disable-netcdf) 2010-01-04 slayoo * src/hdf5_fun.cpp: HDF5 1.6 compatibility fix (in error handling) 2010-01-03 slayoo * src/hdf5_fun.cpp, src/hdf5_fun.hpp, src/libinit_mes.cpp: error-handling in HDF5-related routines; initial import of: h5f_is_hdf5_fun, h5_get_libversion_fun, h5d_get_type_fun h5t_get_size_fun, h5a_open_name_fun, h5a_open_idx_fun, h5a_get_name_fun, h5a_get_space_fun, h5a_get_type_fun, h5a_get_num_attrs_fun, h5g_open_fun, h5a_close_pro, h5t_close_pro, h5g_close_pro, h5a_read 2010-01-02 slayoo * src/devicex.hpp, src/plotting.cpp: CONTOUR: fixing colours of axes in CONTOUR (.../forum/338692/topic/3306795); making the initial "DECOMPOSED" setting of the X device dependtant on the colour depth reported by the X-server 2010-01-01 slayoo * src/gdlgstream.hpp, src/libinit.cpp: UINDGEN: correcting the keyword list (indKey -> NULL); gdlgstream.hpp: informing the user that the PLplot warning about too few items on the terminal list can be ignored 2009-12-29 slayoo * src/pro/Makefile.am, src/pro/Makefile.in: adding rstrpos.pro to the make-install list * src/pro/rstrpos.pro, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/basegdl.hpp, src/dcompiler.cpp, src/dcompiler.hpp, src/dinterpreter.cpp, src/dnode.cpp, src/dnode.hpp, src/dpro.cpp, src/dpro.hpp, src/gdlc.g, src/gdlc.tree.g, src/gdlexception.cpp, src/gdlexception.hpp, src/initsysvar.cpp, src/initsysvar.hpp, src/strassenmatrix.hpp, src/GDLLexer.cpp, src/GDLLexer.hpp, src/GDLParser.cpp: support for COMPILE_OPT OBSOLETE; initial import of RSTRPOS (obsolete) 2009-12-26 slayoo * src/pro/Makefile.in, src/pro/dicom/Makefile.in, Makefile.in, aclocal.m4, config.guess, config.sub, configure, configure.in, depcomp, install-sh, missing, mkinstalldirs, src/Makefile.in, src/antlr/Makefile.in: configuration files: disabling the automake maintainer mode by default - configuration files are not regenerated by default even if timestamps suggest this should be done (what happens often after a CVS update) 2009-12-23 slayoo * src/Makefile.in, src/antlr/Makefile.in, src/pro/Makefile.in, src/pro/dicom/Makefile.in, config.h.in, configure, configure.in, aclocal.m4, Makefile.in: after running autoupdate and autoreconf -i * ltmain.sh: after running libtoolize (trying to fix the "X--tag=CXX: command not found" problem) * src/Makefile.am, src/pro/Makefile.am, src/pro/Makefile.in, src/pro/checks: adding poly_area.pro to the make-install list in the src/pro/Makefile.am 2009-12-22 m_schellens * src/strassenmatrix.hpp: improved tolerance for older OpenMP * src/pro/poly_area.pro, src/Makefile.am, src/basic_op.cpp: add file 2009-12-20 slayoo * src/file.cpp, src/gdl.cpp: GCC 4.3.4 compatibility fix (PATH_MAX undefined) * configure, configure.in: configure: handling both single-port (Macports default) and multi-port (Debian default) installations of wxWidgets 2009-12-16 slayoo * Makefile.in, aclocal.m4, config.h.in, configure, configure.in, src/Makefile.in, src/antlr/Makefile.in, src/pro/Makefile.in, src/pro/dicom/Makefile.in: re-enabling autodetection of OpenMP (needs autoconf >=2.63) 2009-12-12 m_schellens * config.h.in, configure, configure.in, gdl.kdevelop, src/strassenmatrix.hpp, Makefile.in, aclocal.m4, ltmain.sh, src/Makefile.in, src/antlr/Makefile.in, src/pro/Makefile.in, src/pro/dicom/Makefile.in: working configuration files 2009-12-12 slayoo * src/dinterpreter.cpp, src/dinterpreter.hpp, src/gdl.cpp, src/magick_cl.cpp: support for specifying batch files at command line, e.g. $gdl script1.pro script2.pro support for the '-e' command-line option - execute a single statement and exit QUERY_*: fix for the empty-argument case 2009-12-12 m_schellens * src/basic_op.cpp, src/strassenmatrix.hpp, gdl.kdevelop, src/Makefile.am, src/Makefile.in: strassen algorithm for matrix multiplication (deactivated) 2009-12-11 slayoo * src/pro/STATUS, src/pro/UrgentNeed.txt: update of src/pro/STATUS and src/pro/UrgentNeed.txt * src/libinit.cpp, src/math_fun.cpp, src/math_fun.hpp: CROSSP: initial import 2009-12-10 slayoo * src/pro/Makefile.in: after running autoreconf * src/pro/Makefile.am, src/pro/query_dicom.pro, src/magick_cl.cpp: QUERY_DICOM: initial import 2009-12-09 slayoo * Makefile.in, aclocal.m4, config.h.in, configure, ltmain.sh, src/Makefile.in, src/antlr/Makefile.in, src/pro/Makefile.in, src/pro/dicom/Makefile.in: after running autoreconf and libtoolize * src/pro/STATUS: (that's a comment for patchset 1026 commited a few minutes ago): - initial import of QUERY_BMP, QUERY_GIF, QUERY_IMAGE, QUERY_JPEG, QUERY_PICT, QUERY_PNG, QUERY_PPM and QUERY_TIFF (using Magick++'s ping functionality) - wxWidgets: - compatibility-fixes allowing compilation both with unicode- and non-unicode wxWidgets - adding some already referenced keywords to the keyword lists in libinit_jmg.cpp - configure script: - using a non-mangled function name in AC_CHECK_LIB (cross-compiler compatibility) - acquireing the wxWidgets library name from wx-config (basename+release, previously hardcoded) - checking if wx-config is callable before trying to link with wxWidgets - allowing indication of the wxWidgets installation prefix (--with-wxWidgets=DIR) * src/pro/Makefile.am, src/pro/Makefile.in, src/pro/checks, src/pro/dicom/Makefile.in, src/pro/query_bmp.pro, src/pro/query_gif.pro, src/pro/query_image.pro, src/pro/query_jpeg.pro, src/pro/query_pict.pro, src/pro/query_png.pro, src/pro/query_ppm.pro, src/pro/query_tiff.pro, configure.in, ltmain.sh, src/Makefile.in, src/antlr/Makefile.in, src/gdlwidget.cpp, src/libinit_cl.cpp, src/libinit_jmg.cpp, src/magick_cl.cpp, src/magick_cl.hpp, aclocal.m4, config.h.in, configure, Makefile.in: gdl 2009-12-06 slayoo * src/plotting.cpp: CONTOUR: reverting to previous (IDL-compatible) contour-level-choice mechanism * src/hdf_fun.cpp: HDF_SD_DIMGETID: correcting double error-message prefixes 2009-12-05 slayoo * src/pro/Makefile.am, src/pro/Makefile.in: fix for the last commit (in src/pro/Makefile.in) * src/Makefile.in, src/antlr/Makefile.in, src/pro/Makefile.am, src/pro/Makefile.in, src/pro/dicom/Makefile.in, config.h.in, configure, configure.in, ltmain.sh, Makefile.in, aclocal.m4: using OpenMP only if the compiler supports it (by means of the AC_OPENMP macro) 2009-11-28 m_schellens * src/gdlgstream.hpp: resolved const char** to/from char** compile error * Makefile.in, aclocal.m4, configure, src/Makefile.in, src/antlr/Makefile.in, src/devicez.hpp, src/gdlgstream.hpp, src/pro/Makefile.in, src/pro/dicom/Makefile.in: fixed z buffer error condition (switched back to previous version, no OpenMP support) 2009-11-27 m_schellens * src/accessdesc.hpp, src/arrayindex.hpp, src/arrayindexlistt.hpp, src/basic_op.cpp, gdl.kdevelop: fixed line number reporting for struct and array expressions 2009-11-27 slayoo * src/magick_cl.cpp, src/gdlgstream.hpp: - fixing random behaviour of GDLGStream::checkPlplotDriver() - cleanup of error mesaages in Magick-related routines (removing double prefixes) 2009-11-25 slayoo * src/devicex.hpp, src/graphics.cpp, src/graphics.hpp, src/libinit.cpp, src/plotting.cpp: - !DEVICE.N_COLORS in now dependant on the actual X-window setting - DEVICE: support for the GET_VISUAL_DEPTH keyword - plotting.cpp : making all variables pointing to SysVar::D() non-static in order to allow the code that uses them to track changes in !D caused for example by set_plot 2009-11-24 jomoga * src/basic_fun.cpp: Change [0] to [s] in (*stringExpr)[s].substr in stregex_fun * testsuite/test_poly2d.pro: Initial import 2009-11-23 slayoo * testsuite/example.grib, testsuite/test_grib.pro: adding the GRIB test files * Makefile.in, README_GRIB, aclocal.m4, config.h.in, configure, configure.in, src/Makefile.am, src/Makefile.in, src/antlr/Makefile.in, src/basic_fun.cpp, src/gdlgstream.hpp, src/gdlxstream.cpp, src/grib.cpp, src/grib.hpp, src/libinit.cpp, src/pro/Makefile.in, src/pro/dicom/Makefile.in: - update in locale_get() reflecting the change in IDL 7.1.1 (now it's returning locale of the parent process, tracker item: 2880186) - initial import of GRIB-1/2 file format support using the ECMWF GRIB API - configure: checking if netcdfcpp.hpp is usable (conflicting hdf4/netcdf installation issue) - configure: moving definition of defaults to the header of configure.in - handling "cannot connect to X-server" (previously plPlot exited GDL, tracker item: 2877007) 2009-11-22 m_schellens * Makefile.in, aclocal.m4, configure, src/Makefile.in, src/antlr/Makefile.in, src/gdlgstream.hpp, src/magick_cl.cpp, src/pro/Makefile.in, src/pro/dicom/Makefile.in: corrected memory allocation * configure, configure.in, gdl.kdevelop, src/accessdesc.hpp, src/basic_pro.cpp, src/basic_pro.hpp, src/initsysvar.cpp, src/initsysvar.hpp, src/io.hpp, src/libinit.cpp, src/objects.cpp, src/objects.hpp: Add CPU procedure 2009-11-21 m_schellens * src/datatypes.cpp, src/basic_fun.cpp, src/basic_pro.cpp, src/devicex.hpp, src/devicez.hpp, src/fftw.cpp, src/magick_cl.cpp, src/typedefs.hpp: enhanced thread pool support using OpenMP 2009-11-20 m_schellens * src/GDLInterpreter.cpp, src/basegdl.hpp, src/convert2.cpp, src/datatypes.cpp, src/gdlc.i.g, src/math_fun.cpp, src/real2int.hpp: enhanced thread pool support using OpenMP 2009-11-18 m_schellens * src/GDLInterpreter.cpp, src/accessdesc.hpp, src/basic_op.cpp, src/basic_pro.cpp, src/datatypes.cpp, src/gdlc.i.g, src/gzstream.hpp, src/initsysvar.cpp, src/initsysvar.hpp, src/io.cpp, src/objects.cpp, src/objects.hpp, gdl.kdevelop: added initial thread pool support using OpenMP 2009-11-17 slayoo * config.h.in, configure, configure.in: removing a netCDF header check from the last commit (does not work with custom INCLUDES path) 2009-11-16 slayoo * src/antlr/Makefile.in, src/pro/Makefile.in, src/pro/dicom/Makefile.in, Makefile.in, README, aclocal.m4, config.h.in, configure, configure.in, src/Makefile.in, src/devicesvg.hpp, src/gdlgstream.hpp, src/gdlsvgstream.hpp: configure: - checking if netCDF installation is usable (HDF4 installation conflict) - checking if HDF4 was compiled with --disable-netcdf (+ README update) plplot: - throwing a GDL exception if plplot lacks requested driver - fixing SVG plotting after previous X-win plots (clearing driver options) - SVG: using svgcairo instead of svg driver if present 2009-11-13 m_schellens * src/basic_pro.cpp, src/basic_pro_jmg.cpp, src/dinterpreter.cpp, src/io.cpp, src/io.hpp: fixed startup file bug 2009-11-11 slayoo * src/basic_fun.cpp: STREGEX: preventing bogus call to basic_string::substr(-1,...) (tracker item no. 2895655) * src/basic_pro_jmg.cpp: POINT_LUN: assuring the 2nd par is a global par 2009-11-09 m_schellens * src/GDLInterpreter.cpp, src/basic_fun.cpp, src/gdlc.i.g, src/gdlexception.hpp: fixed error info for errors during parameter initialization 2009-11-08 m_schellens * src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/datatypes.cpp, src/datatypes.hpp, src/default_io.cpp, src/envt.cpp, src/extrat.cpp, src/gsl_fun.cpp: correct alignment for all types in PRINT and REVERSE(/OVERWRITE) 2009-11-08 slayoo * src/ncdf_var_cl.cpp: NCDF_VARINQ: fixing failed-assertion condition (dimension(0)) with scalar variables 2009-11-07 slayoo * src/basic_pro.cpp, src/envt.cpp, src/gdlexception.cpp, src/gdlexception.hpp: some more error-message decoration cosmetics 2009-11-07 m_schellens * src/GDLInterpreter.hpp, src/GDLParser.cpp, src/GDLTreeParser.cpp, src/dinterpreter.cpp, src/dinterpreter.hpp, src/gdlc.g, src/gdlc.i.g, src/gdlc.tree.g, src/GDLInterpreter.cpp: correct line numbers of error messages in interupted subroutines * src/GDLInterpreter.hpp, src/GDLTreeParser.cpp, src/dinterpreter.cpp, src/dpro.cpp, src/envt.cpp, src/gdlc.i.g, src/gdlc.tree.g: Removed even more inconsistencies in deocration of error messages 2009-11-06 m_schellens * src/basic_fun.cpp, src/dpro.cpp, src/envt.hpp, src/gdlexception.cpp, src/gdlexception.hpp: Removed more inconsistencies in deocration of error messages * src/assocdata.cpp, src/basic_pro.cpp, src/envt.cpp, src/plotting.cpp: Removed inconsistencies in deocration of error messages 2009-11-05 m_schellens * src/dinterpreter.cpp, src/dinterpreter.hpp, src/envt.hpp, src/gdl.cpp, src/gdlexception.cpp, src/gdlexception.hpp, src/objects.cpp, src/objects.hpp: Add calling function's name to text of GDLException by default 2009-11-05 slayoo * src/gdl.cpp: making the -quiet option compatible with -arg and -args 2009-11-05 m_schellens * src/convert2.cpp, src/dinterpreter.cpp, src/envt.cpp, src/envt.hpp, src/gsl_fun.cpp: utilized SetPar() in invert_fun 2009-11-04 slayoo * src/devicex.hpp, src/gdlgstream.hpp, src/gdlxstream.cpp, src/gdlxstream.hpp, src/libinit.cpp, src/plotting.cpp: WSHOW: initial import (ICONIC kwrd not implemented yet) * src/datatypes.cpp, src/gsl_fun.cpp, src/math_fun_jmg.cpp, src/ncdf_att_cl.cpp, src/ncdf_var_cl.cpp: INVERT: fixing a segfault condition with non-global parameter; removing some duplicate prefixes in error messages 2009-11-03 m_schellens * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/basegdl.cpp, src/basegdl.hpp, src/convert2.cpp, src/dinterpreter.cpp, src/envt.cpp, src/envt.hpp, src/gdlc.i.g, src/math_fun.cpp, src/prognode.cpp: added identifier info in several error messages 2009-11-02 m_schellens * src/basic_fun.cpp: Fixed CREATE_STRUCT() (no parameters) 2009-11-01 m_schellens * src/basic_fun_jmg.cpp, src/prognode.cpp, README, ChangeLog: ROUTINE_NAMES * src/datatypes.cpp: More verbose error messages * src/basic_fun_jmg.cpp, src/gdlc.i.g, src/prognode.cpp: Fixed ROUTINE_NAMES(/FETCH) 2009-11-01 slayoo * src/plotting.cpp: CURSOR: support for lat/lon query on maps 2009-11-01 m_schellens * src/basic_fun_jmg.cpp: Fixed ROUTINE_NAMES(/FETCH) * src/Makefile.in, src/antlr/Makefile.in, src/basic_fun.cpp, src/datatypes.cpp, src/pro/Makefile.in, src/pro/dicom/Makefile.in, Makefile.in, aclocal.m4, configure, gdl.kdevelop: Fixed STRSPLIT() 2009-11-01 slayoo * src/gdl.cpp: -quiet command line option 2009-11-01 m_schellens * src/datatypes.cpp: More verbose error messages * src/basic_fun_jmg.cpp, src/gdlc.i.g, src/prognode.cpp: Fixed ROUTINE_NAMES(/FETCH) 2009-11-01 slayoo * src/plotting.cpp: CURSOR: support for lat/lon query on maps 2009-11-01 m_schellens * src/basic_fun_jmg.cpp: Fixed ROUTINE_NAMES(/FETCH) * src/Makefile.in, src/antlr/Makefile.in, src/basic_fun.cpp, src/datatypes.cpp, src/pro/Makefile.in, src/pro/dicom/Makefile.in, Makefile.in, aclocal.m4, configure, gdl.kdevelop: Fixed STRSPLIT() 2009-11-01 slayoo * src/gdl.cpp: -quiet command line option 2009-10-31 slayoo * src/pro/checks: src/pro/checks: making it work under all locales * src/Makefile.in, src/antlr/Makefile.in, src/pro/Makefile.am, src/pro/Makefile.in, src/pro/checks, src/pro/dicom/Makefile.am, src/pro/dicom/Makefile.in, Makefile.in, aclocal.m4, configure, configure.in: fixing and re-enabling make-install rules for .pro files (+ one make-check rule for checking if all .pro files from src/pro will be installed) 2009-10-31 m_schellens * src/envt.hpp, src/basic_pro.cpp, src/envt.cpp: corrected HELP output for expressions 2009-10-31 slayoo * src/gsl_fun.cpp, src/ncdf_var_cl.cpp, testsuite/nc_test.pro: LA_TRIRED: checking if the first argument is an array (tracker item no: 2889764) NCDF_VARGET: fixing a segfault condition (tracker item no: 2878720) nc_test.pro: commenting out catch-dependant checks 2009-10-30 slayoo * src/gdl.cpp, testsuite/test_plotting_ranges.pro: MPI: warning the user if MPI changes the working directory of GDL * src/gsl_fun.cpp, src/plotting.cpp, testsuite/test_histo.pro, testsuite/test_plotting_ranges.pro, src/envt.hpp: PLOT/OPLOT: not accepting scalar arguments FFT: sanity check for the rank of argument CONTOUR/SURFACE: sanity checks for the rank and type of arguments HISTOGRAM: correcting binsize definition when max and nbins set, better INPUT-kw-related error message test_histo.pro: testing binsize selection test_plotting_ranges: initial import (testing axis range selection) envt.hpp: adding GetParNumericArrayDefined() 2009-10-27 m_schellens * src/GDLInterpreter.hpp, src/GDLInterpreterOptimized.cpp, src/GDLInterpreterOptimized.inc, src/Makefile.am, src/Makefile.in, src/gdlc.i.g: removed obsolete files 2009-10-26 m_schellens * src/GDLTreeParser.cpp, src/pro/Makefile.in: deactivate GDL_DEBUG define setting (gdlc.tree.g) 2009-10-26 alaingdl * src/plotting.cpp: Better automatic range in PLOT. NOT propagated in CONTOUR and SURFACE (sorry). LOG case still to do. 2009-10-25 m_schellens * src/envt.cpp, src/pro/Makefile.in, testsuite/test_suite.pro: more verbose info on expression parameters 2009-10-25 alaingdl * testsuite/test_get_screen_size.pro, src/plotting.cpp: in GET_SCREEN_SIZE, param DISPLAY now working 2009-10-25 slayoo * src/plotting.cpp, testsuite/test_plotting_misc.pro: CONTOUR: partial support for contouring on maps (+ some tests in test_plotting_misc.pro) 2009-10-24 medericboquien * src/antlr/CharScanner.hpp: Make GDL compile with gcc 4.4. 2009-10-23 m_schellens * Makefile.in, aclocal.m4, configure, gdl.kdevelop, src/GDLInterpreter.cpp, src/Makefile.in, src/antlr/Makefile.in, src/dinterpreter.cpp, src/gdlc.i.g, src/pro/Makefile.am, src/pro/Makefile.in, src/pro/dicom/Makefile.in: Fixed wrong handling of CONTINUE under certain conditions in nested loops 2009-10-23 slayoo * testsuite/test_nestedloop.pro: adding test_nestedloop.pro to the testsuite 2009-10-21 slayoo * src/pro/dicom/Makefile.am, src/pro/dicom/Makefile.in, src/basic_fun.cpp, src/pro/Makefile.am, src/pro/Makefile.in: fixing EXTRA_DIST value in src/pro/Makefile.am; GETENV: error message when called with /ENV and a positional parameter 2009-10-19 slayoo * Makefile.am, Makefile.in, aclocal.m4, config.h.in, configure, configure.in, src/Makefile.am, src/Makefile.in, src/antlr/Makefile.in, src/gdl.cpp, src/pro/Makefile.am, src/pro/Makefile.in, src/pro/dicom/Makefile.am, src/pro/dicom/Makefile.in: installing library .pro files and basic docs during make install; setting default library-routine search path if GDL_PATH/IDL_PATH not defined; welcome message changes 2009-10-18 alaingdl * NEWS: upgrading NEWS file (creating 0.9rc4 entry) * src/libinit.cpp, src/plotting.cpp, src/plotting.hpp: initial import of GET_SCREEN_SIZE(); in CURSOR, verification if we are in X mode * testsuite/test_get_screen_size.pro: initial import of TEST_GET_SCREEN_SIZE, function to be imported in CVS * testsuite/test_voigt.pro: detail in TEST_VOIGT, restoring !p.multi ... 2009-10-18 slayoo * src/gsl_fun.cpp, src/pro/read_ascii.pro: READ_ASCII: printing error message when DATA_START exceeds file length; IMSL_BINOMIALCOEF: sanity check for number of arguments added 2009-10-18 m_schellens * src/basic_pro.cpp, src/basegdl.cpp, src/basegdl.hpp, src/datatypes.cpp, src/datatypes.hpp, src/dstructdesc.cpp, src/dstructdesc.hpp, src/dstructgdl.hpp, src/mpi.cpp, src/specializations.hpp, src/typetraits.hpp: Fixed BYTEORDER for STRUCT * src/GDLInterpreter.hpp, src/gdlc.i.g, src/print.cpp, src/prognode.cpp: sync 2009-10-17 slayoo * src/gsl_fun.cpp, src/gsl_fun.hpp, src/libinit.cpp, NEWS: IMSL_BINOMIALCOEF: initial import 2009-10-17 m_schellens * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/gdl.cpp, src/gdlc.i.g, src/pro/array_indices.pro: Corrected beahvior of call_fun and call_lfun for RC_ABORT return code. Old behavior lead to endless loop at startup in some conditions. 2009-10-16 m_schellens * src/basic_fun.cpp: Fixed STRMID for missing 3rd parameter * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/gdlc.i.g, src/prognode.hpp: Fixed line tracking for error reporting 2009-10-15 m_schellens * src/initsysvar.cpp: imporved \!VERSION * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLTreeParser.cpp, src/basic_fun_cl.cpp, src/datatypes.cpp, src/dinterpreter.cpp, src/dpro.cpp, src/envt.cpp, src/envt.hpp, src/gdlc.i.g, src/gdlc.tree.g, src/gdlexception.cpp, src/print_tree.cpp, src/specializations.hpp: improved line number tracking for error reporting 2009-10-14 slayoo * src/datatypes.cpp: [F,D,L,...]INDGEN: making the values of the resulting array more precise for large arrays (demo: print, (findgen(40000000))[40000000-1]) 2009-10-14 m_schellens * src/basic_fun_jmg.cpp, src/dinterpreter.cpp, src/envt.cpp: Proper ROUTINE_NAMES(/STORE) 2009-10-13 m_schellens * src/deviceps.hpp, src/pro/loadct.pro: Set \!D.TABLE_SIZE from 0 to 256 2009-10-13 slayoo * testsuite/test_multiroots.pro: update of test_multiroots.pro after the two known bugs were fixed * src/basic_fun.cpp, src/basic_pro_jmg.cpp: GCC 3.4.3 compatibility fixes (WAIT, GET_LOGIN_INFO) 2009-10-12 m_schellens * src/basic_fun.cpp, src/str.cpp: Fixed STRMID for negative values of 3rd parameter * src/print.cpp: Corrected output of trailing newline after empty string output for PRINT (and PRINTF) * src/basic_fun_jmg.cpp: Corrected name lookup in ROUTINE_NAMES * src/FMTIn.cpp, src/FMTIn.hpp, src/FMTInTokenTypes.hpp, src/FMTInTokenTypes.txt, src/FMTOut.cpp, src/FMTOut.hpp, src/FMTOutTokenTypes.hpp, src/FMTOutTokenTypes.txt, src/FMTParser.cpp, src/gsl_fun.cpp: fixed guarding bug within newton_broyden function set 2009-10-11 alaingdl * src/pro/restore.pro: Revert my change in RESTORE 2009-10-10 m_schellens * src/print.cpp: changed output of trailing newline after empty string output for PRINT (and PRINTF) * src/file.cpp: strip of trailing '/' in FILE_TEST * src/basic_fun.cpp: STRPOS does no longer ignore undefined 3rd parameter * src/basic_fun.cpp, src/basic_pro_jmg.cpp, src/dinterpreter.cpp: Corrected wrong error message due to pre-evaluation of constant functions 2009-10-09 m_schellens * src/basic_pro_jmg.cpp: made WAIT control-c interuptible 2009-10-09 slayoo * src/pro/file_basename.pro: FILE_BASENAME: better handling of empty and space-only strings 2009-10-08 m_schellens * src/basic_fun_jmg.cpp: fixed ARG_NAME keyword in ROUTINE_NAMES for values larger than current level * src/accessdesc.hpp: fixed STRUCT access of non struct struct member (e. g. a={b:0}&print,a.b.c ) * src/default_io.cpp: read ASCII file not ending with newline character 2009-10-08 alaingdl * src/pro/restore.pro: correction RESTORE to be OK with last CMSV lib, delivered 09/05/05 * src/basic_fun.cpp, src/libinit.cpp: re-enter the Length Keyword in N_TAGS; we don't know how to distinguish with /data_length 2009-10-07 slayoo * src/plotting.cpp: ![X,Y].RANGE support in plotting routines (patch from Joanna/cokhavim) 2009-10-07 alaingdl * src/pro/dist.pro: DIST, like many others, should run when call like dist([2,2]) * src/libinit_jmg.cpp: add 2 undocument params in CHECK_MATH() and also keep memory of value, but INT error still not managed * testsuite/test_check_math.pro: test suite for CHECK_MATH() * quick_start_GDL.sh: re-import this script to help beginners to quickly starts GDL with paths (now this script complains if not run properly) * quick_start_GDL.sh: temporary removing of this file to change it into 755 mode * src/math_fun_jmg.cpp: add 2 undocument params in CHECK_MATH() and also keep memory of value, but INT error still not managed 2009-10-05 m_schellens * Makefile.in, aclocal.m4, configure, configure.in, gdl.kdevelop, src/FMTLexer.cpp, src/FMTLexer.hpp, src/FMTParser.cpp, src/FMTParser.hpp, src/FMTTokenTypes.hpp, src/FMTTokenTypes.txt, src/Makefile.in, src/antlr/Makefile.in, src/format.g, src/gdlwidget.hpp, src/ofmt.cpp: Allow neg. width for A format code 2009-10-05 slayoo * src/plotting.cpp: PLOT: adjusting axes when charsize changed (patch from Joanna/cokhavim, tracker item no 2859179) * src/libinit.cpp, src/plotting.cpp: CONTOUR: support for the /OVERPLOT keyword (patch from Joanna/cokhavim) 2009-10-02 slayoo * src/basic_fun.cpp, src/dpro.hpp, src/libinit.cpp, src/pro/file_basename.pro: FILE_BASENAME: support for array argument; ROUTINE_INFO: support for PARAMETERS keyword 2009-10-01 alaingdl * quick_start_GDL.sh: A quick start script for beginners, with easy switch for Valgrind ... * testsuite/test_valgrind.pro: quick check of problems in Contour/Surface with Valgrind: to be extended 2009-09-29 alaingdl * src/plotting.cpp: better freeing/delete in Contour/Surface, thanks to Valgrind 2009-09-26 slayoo * configure, testsuite/test_multiroots.pro: fixing common block name conflict (with RK4) in test_mutiroots.pro; running aclocal/autoconf/automake after version number change 2009-09-26 alaingdl * src/basic_fun.cpp: removing comments/debug info in MEDIAN() * testsuite/test_dims_of_arrays.pro, testsuite/test_outofmem.pro: Exemples of bad inputs when creating arrays ... 2009-09-25 alaingdl * configure.in, src/basic_fun.cpp: Better check of Array dims 2009-09-24 slayoo * ChangeLog, NEWS: updating NEWS and Changelog GDL 0.9rc3: 2009-09-11 m_schellens * testsuite/test_suite.pro, src/GDLInterpreter.cpp, src/envt.hpp, src/gdlc.i.g: Corrected GOTO out of loops within outer blocks * src/datatypes.cpp: corrected array to tag of struct array assignment 2009-09-10 slayoo * src/gsl_fun.cpp: IMSL_CONSTANT: gcc 3.3 compatibility fix * src/basic_fun.cpp, src/basic_fun.hpp, src/file.cpp, src/libinit.cpp: FILE_SEARCH: support for FULLY_QUALIFY_PATH kw.; GET_DRIVE_LIST: initial import; DEVICE: ignoring RETAIN kw. 2009-09-09 slayoo * testsuite/test_constants.pro: IMSL_CONSTANT: new test routine (test_constants.pro) * src/Makefile.in, src/antlr/Makefile.in, src/gsl_fun.cpp, src/gsl_fun.hpp, src/libinit.cpp, config.h.in, configure, configure.in, Makefile.in, README, aclocal.m4: - configure/HDF4/HDF5: linking with SZIP if needed (thanks to David Nicholls; previously pointed out in the HDF Group report - http://www.hdfgroup.org/pubs/papers/2009-06_oss_eval.pdf) - HISTOGRAM: using system nexttoward() if available - IMSL_CONSTANT: initial import 2009-09-01 slayoo * src/read.cpp: READF: bugfix - allowing reads from standard input (lun 0) 2009-08-31 slayoo * src/pro/calendar.pro, testsuite/test_histo.pro, src/gsl_fun.cpp: HISTOGRAM: fixing inclusive ranges definition (tracker item no 2846561) + test_histo_basic in test_histo.pro; CALENDAR: always using the C locale (mimicking IDL and avoidin non-printable characters) 2009-08-28 alaingdl * src/pro/spl_init.pro, src/pro/spl_interp.pro: Removing files which have been in fact duplicated then renamed ... * src/pro/spl_init_old.pro, src/pro/spl_interp_old.pro: Renaming the version of SPL_* in GDL syntax to avoid conflits * src/math_fun_ac.cpp, src/math_fun_ac.hpp: Initial import of C++ version of SPL_INIT and SPL_INTERP (y0= and yn_1= not ready) Experimental /help mechanism for Bessel family and SPL_* * src/envt.hpp, src/libinit_ac.cpp: adding e->HELP(*mess, nb_mines) for easy help 2009-08-27 slayoo * src/basic_pro.hpp, src/libinit.cpp, src/print.cpp: PM: initial import 2009-08-26 slayoo * src/base64.hpp, src/basic_fun.cpp, src/basic_fun.hpp, src/gsl_fun.cpp, src/libinit.cpp, src/pro/STATUS, src/pro/imsl_zerosys.pro, testsuite/test_base64.pro: initial import of IDL_BASE64 (+ test routine) and IMSL_ZEROSYS (via NEWTON(..., /HYBRID)) * src/pro/calendar.pro: CALENDAR: initial import 2009-08-23 m_schellens * src/plotting.cpp: applied patches for CONTOUR and XYOUTS from Joanna (cokhavim) * src/antlr/Makefile.in, src/basic_fun.cpp, src/gdlc.i.g, src/gdlc.tree.g, src/GDLInterpreter.cpp, src/GDLTreeParser.cpp, src/Makefile.in, configure, gdl.kdevelop, Makefile.in, README, aclocal.m4: GET_KBRD patch from Fernando Silveira 2009-08-18 slayoo * src/dinterpreter.cpp: fixing two segfault conditions caused by getenv() returning NULL (SHELL and HOME env. variables) 2009-08-15 slayoo * src/basic_fun.cpp, src/basic_fun.hpp, src/basic_fun_jmg.cpp, src/basic_pro.cpp, src/libinit.cpp, src/libinit_jmg.cpp: GET_LOGIN_INFO(): initial import MAKE_ARRAY(): /PTR & /OBJ keywords, /INDEX keyword support for strings HELP: reporting structure data lengths 2009-08-13 slayoo * src/basic_fun.cpp, src/basic_fun.hpp, src/gdl.cpp, src/libinit.cpp: COMMAND_LINE_ARGS(): initial import 2009-08-12 slayoo * src/basic_pro.cpp: SPAWN: fixing segfault when SHELL env. variable not set 2009-08-11 slayoo * src/pro/moment.pro: MOMENT: MAXMOMENT kw support + update of the documentation header 2009-08-09 slayoo * src/plotting.cpp: header-file fix in plotting.cpp (bug introduced in rev. 1.86) * src/initsysvar.cpp, src/libinit.cpp, src/math_fun.cpp, src/math_fun.hpp, testsuite/test_angles.pro: - making !DTOR & !RADEG values more precise - ATAN(): - /PHASE keyword support - array-scalar argument combination support - two-complex-arguments case support - precision fixes (atan(float, float) -> float(atan(double, double))) - LL_ARC_DISTANCE(): initial import - new test-routine for angle-related stuff: ATAN(), LL_ARC_DISTANCE(), !PI, !DPI, !DTOR, !RADEG 2009-08-07 slayoo * config.h.in, configure, configure.in, src/basic_fun.cpp, src/basic_fun.hpp, src/libinit.cpp, testsuite/test_url.pro: PARSE_URL() and LOCALE_GET(): initial import + test routine (test_url.pro) 2009-08-01 slayoo * src/basegdl.hpp, src/gsl_fun.cpp, src/gsl_fun.hpp, src/libinit.cpp, src/plotting.cpp, testsuite/test_multiroots.pro: NEWTON()/BROYDEN() using GSL multiroots: initial import + test routine 2009-07-30 alaingdl * TODO, src/math_fun_ac.cpp, testsuite/test_besel.pro, testsuite/test_tv.pro: BESEL family functions: non integer order, X neg, Complex, and better managment of arrays dimensions 2009-07-29 alaingdl * testsuite/test_besel.pro: do right calls to Bessel K and Y ! 2009-07-28 slayoo * src/pro/read_xwd.pro: READ_XWD: fixing a conditional statement typo (thaen -> then) 2009-07-25 alaingdl * src/math_fun_gm.cpp, src/math_fun_ng.cpp: Better management of the dimensions of output arrays for several mathematical functions, including BETA and VOIGT. Besel family should be corrected too very soon. Please try that with "test_MathFunctionsDim.pro". Behavior is not exactly the same than IDL (here we do the calculus when [1][n]) * testsuite/test_MathFunctionsDim.pro, testsuite/test_minmax.pro: new test for testing Math Functions Dimensions ... 2009-07-23 slayoo * AUTHORS: adding myself to the AUTHORS file 2009-07-22 slayoo * src/deviceps.hpp, src/devicesvg.hpp, src/devicewin.hpp, src/devicex.hpp, src/devicez.hpp, src/gdlsvgstream.cpp, src/gdlsvgstream.hpp, src/basic_pro.cpp: EXIT: fixing segfault if HOME env. var undefined; SVG: fixing end-of-page bahaviour 2009-07-18 slayoo * src/libinit.cpp, src/plotting.cpp, src/gdlsvgstream.hpp: plotting: partial labelling support, treating OVERPLOT as a warnKeyword, error-message cosmetics; SVG: using svg terminal instead of svgcairo 2009-07-17 alaingdl * src/basic_fun.cpp, src/libinit.cpp: bug in N_TAGS(): rename keyword /LENGTH to /DATA_LENGTH * testsuite/test_ntags.pro: adding a new file (test_ntags.pro) in testsuite/ for testing N_TAGS() (written by T. Mermet) 2009-07-16 slayoo * src/ncdf_var_cl.cpp: NCDF_VARGET: 64-bit fix (SizeT->Dlong for transposed_dim_length[]) + some code cleanup 2009-07-15 slayoo * src/ncdf_var_cl.cpp: NCDF_VARPUT: fixing random behaviour due to type mismatch (size_t -> int) of the 5th argument to nc_inq_var() * src/ncdf_att_cl.cpp: NCDF_ATTPUT: fixing invalid keyword numbering 2009-07-03 slayoo * PYTHON.txt, src/datatypes.hpp, src/pro/STATUS, src/pro/UrgentNeed.txt, HACKING: misc. minor updates in readme/doc files, etc 2009-06-30 alaingdl * testsuite/test_minmax.pro: just changing 755 to 644 atributes for this file * src/pro/strsplit.pro: STRSPLIT: will allow 'str' and ['str'] 1D strings 2009-06-26 alaingdl * testsuite/test_voigt.pro: TEST_VOIGT: better messages * src/pro/path_sep.pro: PATH_SEP: now return good type STRING = '/', before STRING = Array[1] 2009-06-21 slayoo * src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dstructgdl.hpp, src/libinit.cpp, src/specializations.hpp, testsuite/test_minmax.pro: MIN/MAX: DIMENSION keyword support; bugfixes in REVERSE and MEDIAN; dimension-slicing test routine (in test_minmax) 2009-06-19 slayoo * src/ncdf_att_cl.cpp, src/ncdf_dim_cl.cpp, src/ncdf_var_cl.cpp: fixes/code-cleanup in NCDF routines (VARPUT, DIMINQ, ATTGET) 2009-06-14 slayoo * src/devicesvg.hpp, src/gdlsvgstream.cpp, src/gdlsvgstream.hpp: adding SVG-terminal files (missing in previous commit) * src/antlr/Makefile.in, src/libinit.cpp, src/ncdf_var_cl.cpp, src/plotting.cpp, src/typedefs.hpp, INSTALL, Makefile.in, configure, configure.in, src/Makefile.am, src/Makefile.in, src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/basic_fun.hpp, src/basic_fun_cl.cpp, src/datatypes.cpp, src/datatypes.hpp, src/devicez.hpp, src/graphics.cpp, src/initsysvar.cpp, src/io.cpp: - REVERSE: initial import - SYSTIME: correction for /JULIAN flag; conflicting keywords message - SVG terminal (via set_plot, 'svg') - switching off HIGHWATER memory accounting using mallinfo() (too slow) - configure: LDFLAGS from Magick++Config; test if adding X library path helps - ROTATE: better error message - NCDF_VARPUT: fixing uninitialized variable bug 2009-06-09 slayoo * configure, configure.in: configure: correcting (again) the check for presence of numarray * configure, configure.in: configure: correcting the check for presence of numarray * src/basic_pro.hpp, src/io.cpp, src/io.hpp, src/libinit.cpp, src/basic_pro.cpp: FLUSH: initial import (patch from Orion Poplawski) * config.guess, config.sub, configure, configure.in, ltmain.sh: after running libtoolize (tracker item no 2770126) 2009-06-07 slayoo * configure, configure.in: configure: detecting numarray, printing summary information * src/default_io.cpp: 64-bit OSX fix (xdr_long()/xdr_u_long() argument types) - patch from Martin Otte * configure.in, configure: support for linux ppc64 (patch from Orion Poplawski) * src/basic_fun.cpp: MEDIAN: memory leak fix + change DIM into DIMENSION (tracker bug id 1805751) 2009-06-06 slayoo * src/basic_fun_jmg.cpp: fixing datatype (sign) conflict in IDL_SIZE structure assignment (SF tracker bug id 2801342) 2009-05-28 slayoo * src/dinterpreter.cpp, src/gdl.cpp, src/pro/STATUS, MAP_INSTALL: setting history-file lenght in startup file using !EDIT_INPUT + updates in MAP_INSTALL and pro/STATUS 2009-05-26 slayoo * src/antlr/Makefile.in, Makefile.in, configure, configure.in, src/Makefile.in: using nc-config (if present) to determine netcdf LIBS/INCLUDES 2009-05-22 slayoo * src/gdlgstream.cpp, src/gdlgstream.hpp, src/pro/showfont.pro: embedded formatting commands + initial import of SHOWFONT 2009-05-20 slayoo * src/dstructgdl.hpp: removal of one static_cast() which was causing gcc warnings 2009-05-17 slayoo * src/basic_pro.cpp, src/basic_pro.hpp, src/libinit.cpp: CALDAT: initial import 2009-05-13 slayoo * src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/basic_fun.hpp, src/basic_pro.cpp, src/libinit.cpp, src/objects.cpp, config.h.in, configure, configure.in: MEMORY(): initial import + HELP,/MEMORY 2009-05-09 jomoga * src/export.hpp: Zero out arrays of necessary 2009-05-02 slayoo * src/file.cpp, src/file.hpp, src/libinit.cpp, src/objects.cpp: FILE_INFO: initial import 2009-04-30 slayoo * configure, configure.in: better ncurses/curses check, preventing linking both libraries * Makefile.in, aclocal.m4, config.h.in, configure, configure.in, src/Makefile.in, src/antlr/Makefile.in, src/basic_fun.cpp, src/datatypes.hpp, src/file.cpp, src/fmtnode.cpp, src/includefirst.hpp: OpenSolaris compatibility fixes 2009-04-28 slayoo * src/file.cpp, src/file.hpp, src/libinit.cpp: FILE_SAME: initial import * src/file.cpp, src/libinit.cpp: FILE_TEST: handling /NOEXPAND_PATH keyword 2009-04-17 slayoo * src/basic_fun.cpp: STRING: segfault fix for the previous revision * src/basic_fun.cpp: STRING: handling VMS compatibility syntax; demo: help,string(1,"(G)") 2009-04-10 slayoo * src/pro/restore.pro: RESTORE: fixing a typo in variable (filename) name 2009-04-06 slayoo * src/print.cpp: PRINT/PRINTF: handling VMS compatibility syntax; demo: print, "$(F)", 1 2009-03-31 jomoga * src/fftw.cpp: Fix /OVERWRITE with non-global parm bug in FFT 2009-03-24 slayoo * src/basic_pro.cpp: SPAWN: undoing bitwise shit in EXIT_STATUS value; demo: spawn, "exit -1", e=i & help, i * src/dinterpreter.cpp: preventing compiler warning due to ignored return value of a call to system() * src/basic_pro.cpp: SPAWN: setting EXIT_STATUS parameter when nParam==0; demo: spawn, exit=i & help, i 2009-03-23 m_schellens * gdl.kdevelop, src/basegdl.hpp, src/basic_fun.cpp, src/basic_fun_cl.cpp, src/basic_fun_jmg.cpp, src/devicex.hpp, src/dimension.hpp, src/envt.cpp, src/envt.hpp, src/gsl_fun.cpp, src/magick_cl.cpp, src/math_fun.cpp, src/math_fun_jmg.cpp, src/plotting.cpp: *** empty log message *** 2009-03-23 slayoo * src/gsl_fun.cpp: HISTOGRAM: setting OMIN/OMAX type according to the type of input data (tracker item no. 2699831) 2009-03-22 slayoo * src/typedefs.hpp, testsuite/test_outofmem.pro: converting bad_alloc exceptions when allocation arrays into GDLExceptions + test_outofmem.pro * src/basic_pro.cpp: OPENW: allowing /APPEND flag for non-existant files (tracker item no 2103871) 2009-03-20 slayoo * testsuite/test_plotting_misc.pro: test routine for various plotting issues 2009-03-19 slayoo * src/plotting.cpp: cosmetic changes to error messages 2009-03-18 slayoo * src/plotting.cpp: recovering changes from rev 1.73 lost in rev 1.76 (Joel: Add support for NORMAL/TO_DEVICE (xy->ll) in CONVERT_COORD) * src/plotting.cpp: XYOUTS: correction for DATA coordinates, demo: !P.MULTI=[0,2,1]&plot,findgen(10)&xyouts,.5,.5,a * src/plotting.cpp: PLOTS: correction for DATA coordinates, demo: !P.MULTI=[0,2,1]&plot,findgen(10)&plots,[0,1],[0,2] * src/gdlgstream.cpp: better default font size for terminals other than X (notably PS) * src/plotting.cpp: CONTOUR: avoiding plplot error messages when filling (shade_max must exceed shade_min) 2009-03-17 m_schellens * src/envt.hpp: gcc 4.4 compatibility (patch from opoplawski) * src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/basic_fun.cpp, src/gdlc.g: allow tag names with leading '\!' 2009-03-17 slayoo * src/ncdf_dim_cl.cpp: NCDF_DIMINQ: accepting long integers as file and dimension ids 2009-03-16 slayoo * src/pro/read_ascii.pro: handling both whitespace and tab as delimiter by default; using FILE_LINES instead of spawning wc * src/basic_fun.cpp: CREATE_STRUCT: accepting excl. mark as a first char of a tag name (tracker item no. 2688389) * src/hdf5_fun.hpp: HDF5 v1.8 compatibility fix (tracker item no. 2680132, help forum thread no. 2988711) 2009-03-15 jomoga * src/objects.cpp, src/gdlwidget.cpp, src/gdlwidget.hpp, src/widget.cpp, src/widget.hpp: Added widget functionality 2009-03-12 jomoga * src/fftw.cpp: Fix auto_ptr bug wite DOUBLE 2009-03-11 slayoo * src/libinit_jmg.cpp: MAKE_ARRAY: keyword name changed from INT to INTEGER * src/gsl_fun.cpp: binsize = (max - min) / (nbins - 1) when NBINS specified with neither MAX nor BINSIZE 2009-03-06 slayoo * src/gsl_fun.cpp: LOCATION keyword set correctly when HISTOGRAM called with NBINS and without BINSIZE or MAX, demo: print, histogram([1.,2.], n=3, l=l) & print, l 2009-03-06 alaingdl * src/devicex.hpp: in TV, managing [1,n,m], [n,1,m] and [n,m,1] cases when TRUE=0 2009-03-05 alaingdl * testsuite/test_tv.pro, INSTALL: testing all permutations for TV 2009-03-03 m_schellens * Makefile.in, aclocal.m4, configure, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/Makefile.am, src/Makefile.in, src/antlr/Makefile.in, src/datalistt.hpp, src/dinterpreter.cpp, src/dpro.cpp, src/dpro.hpp, src/envt.cpp, src/envt.hpp, src/gdlc.g, src/gdlc.i.g, src/gdlc.tree.g, src/prognode.cpp, src/prognode.hpp, src/prognodeexpr.cpp: imroved DataListT an empty procedure call by extimated 40% 2009-02-26 m_schellens * gdl.kdevses: removed gdl.kdevses (storing actual kdevelop session details) from repository * src/GDLTreeParser.hpp, src/datatypes.cpp, src/gdlc.tree.g: detect change of type of FOR index variable 2009-02-23 slayoo * src/Makefile.in, src/antlr/Makefile.in, Makefile.in, aclocal.m4, configure: after running aclocal, automake, autoconf * configure, configure.in: determining ImageMagick flags using Magick++-config (tracker entry no 1963366) 2009-02-21 jomoga * src/math_fun_jmg.cpp, src/math_utl.cpp, src/math_utl.hpp, src/plotting.cpp, MAP_INSTALL, config.h.in, configure, configure.in: Add support for new LIBPROJ4 2009-02-18 slayoo * src/plotting.cpp: fixing segfault when contouring NaNs, e.g.: contour, replicate(!VALUES.F_NAN,3,3) 2009-02-10 slayoo * src/pro/file_lines.pro: no longer calling awk to parse wc output (tracker entry no 1980041) 2009-02-10 alaingdl * TODO, src/pro/file_lines.pro: upgrade of ToDo list; bug in FILE_LINES when last line does not have a LF 2009-02-08 m_schellens * gdl.kdevelop, PYTHON.txt: GDL as a python module tested * gdl.kdevses, src/Makefile.am, src/Makefile.in: made python modulw work (not tested) 2009-02-07 slayoo * src/ncdf_var_cl.cpp: reading text data in NCDF_VARGET/NCDF_VARGET1 (tracker bug no 2109502) 2009-02-04 alaingdl * src/hdf_fun.cpp, src/hdf_pro.cpp: data type change (DLong -> int32) in hdf_* (thanks to Sylvester A.) 2009-01-27 alaingdl * src/str.cpp: bug correction in CD for OSX, thanks to Sylvester A. 2009-01-26 m_schellens * src/GDLTreeParser.cpp, src/basic_fun_jmg.cpp, src/dcompiler.hpp, src/gdlc.tree.g: allow common blocks outside subroutines 2009-01-25 m_schellens * ChangeLog, NEWS, configure, configure.in, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/basic_fun_jmg.cpp, src/dcompiler.cpp, src/dcompiler.hpp, src/gdlc.g, src/gdlc.tree.g, src/prognode.cpp, src/prognode.hpp: allow common blocks outside subroutines GDL 0.9rc2: 2009-01-20 m_schellens * src/prognodeexpr.cpp: Copy sibling nodes for constant REF expressions * src/basic_fun_jmg.cpp, src/hdf_fun.cpp, src/hdf_fun.hpp, src/hdf_pro.cpp, src/hdf_pro.hpp, src/libinit_jmg.cpp, src/prognode.hpp, src/prognodeexpr.cpp: Copy sibling nodes for constant REF_CHECK expressions (e. g. REFORM(INDGEN(100),10,10) 2009-01-19 m_schellens * gdl.kdevses, src/basic_fun.cpp, src/libinit.cpp: undocumented BYTSCL accepting three parameters (value,min,max) from Sylvester Arabas 2009-01-12 jomoga * src/basic_fun_jmg.cpp: Fix seg fault in SIZE when structure undefined 2008-12-09 m_schellens * src/gdlexception.hpp, src/str.hpp, src/typedefs.hpp, src/gdlexception.cpp: changed assert to exception for error diagnostics 2008-12-08 m_schellens * gdl.kdevses, src/basic_fun.cpp, src/basic_fun.hpp, src/libinit.cpp, src/typedefs.hpp: fixed REGEXP with /SUBEXPR 2008-12-01 alaingdl * NEWS, src/pro/spl_init.pro, src/pro/spl_interp.pro: initial import for SPL_INIT() and SPL_INTERP(), GDL syntax; thanks to Ph. Prugniel, Lyon's Obs. 2008-11-27 m_schellens * src/basic_fun.cpp: fixed 64bit incompatibility 2008-11-18 alaingdl * src/plotting.cpp: recovering /fill and details in CONTOUR 2008-11-16 m_schellens * gdl.kdevelop, gdl.kdevses, src/antlr/Parser.cpp, src/antlr/TreeParser.cpp, src/basic_fun.cpp: g++ 4.3 compatibility 2008-11-15 m_schellens * src/ncdf_var_cl.cpp, src/plotting.cpp: from Sylwester Arabas 2008-10-19 m_schellens * src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/gdlc.tree.g: ignore something like a=(a=a) (so it is allowed even if a is undefined) * src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/gdlc.tree.g: accept self assignment of undefined variables 2008-10-13 m_schellens * gdl.kdevelop, gdl.kdevses, src/GDLInterpreter.cpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/gdlc.g: fixed print, ', ', FORMAT='(A)' 2008-09-25 alaingdl * src/pro/matrix_multiply.pro: missing ";" 2008-09-22 jomoga * src/basic_fun.cpp: Add SUBEXPR keyword support for STREGEX * src/basic_fun_jmg.cpp, src/libinit_jmg.cpp: Add S_FUNCTIONS/S_PROCEDURES keywords for ROUTINE_NAMES * src/basic_pro.cpp, src/basic_pro.hpp, src/libinit.cpp: Add stub for RESOLVE_ROUTINE 2008-09-06 jomoga * src/typedefs.hpp: GDLArray buffer default set to scalar size rather than to NULL 2008-08-29 m_schellens * src/gdlexception.cpp, src/libinit.cpp, src/prognode.hpp, src/prognodeexpr.cpp: correct transforming of parameter_def siblings wich are constant expressions 2008-08-29 alaingdl * NEWS, src/basic_fun.cpp: in MEDIAN(), managing "width" parameter (by Nicolas Galmiche) [please report bugs to Alain C.] 2008-08-28 m_schellens * src/prognode.cpp, src/prognodeexpr.cpp: corrected the advancing of the actual node pointer (_t) in struct Eval() functions 2008-08-26 m_schellens * src/GDLTreeParser.cpp, src/dpro.cpp, src/dpro.hpp, src/gdlc.i.g, src/gdlc.tree.g, src/libinit.cpp, src/print_tree.cpp, src/prognode.hpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp, src/GDLInterpreter.cpp, gdl.kdevelop, gdl.kdevses: precalculation for (selected) constant parmeter functions. Optimization of lib function calls 2008-08-17 m_schellens * src/prognodeexpr.cpp, src/prognodeexpr.hpp: precalculation for constant arrays composed of constant expressions * src/prognode.hpp, src/prognodeexpr.cpp, src/prognodeexpr.hpp: precalculation for constant expressions and constant arrays, a major improvement * src/prognodeexpr.cpp, src/prognodeexpr.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/dnode.cpp, src/gdlc.g, src/gdlc.i.g, src/gdlc.tree.g, src/prognode.cpp, src/GDLTreeParser.hpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreter.cpp: speedup for constant arrays 2008-08-16 m_schellens * src/prognodeexpr.cpp: removed duplicate ARRAYDEFNode::Eval() 2008-08-15 m_schellens * src/prognode.cpp, src/prognode.hpp, src/prognodeexpr.cpp, src/typedefs.hpp, src/gdlc.tree.g, src/datatypes.hpp, src/gdlc.i.g, src/GDLInterpreter.hpp, src/basegdl.cpp, src/basegdl.hpp, src/GDLInterpreter.cpp, gdl.kdevelop: made memory deallocation more solid 2008-08-09 m_schellens * gdl.kdevelop, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/dstructgdl.hpp, src/gdlc.i.g, src/prognode.cpp, src/prognode.hpp, src/prognodeexpr.cpp, src/typedefs.hpp: interpreter optimization 2008-08-03 m_schellens * src/prognodeexpr.cpp, src/prognodeexpr.hpp, src/real2int.hpp, src/dpro.hpp, src/gdlc.i.g, src/gdlexception.hpp, src/print_tree.hpp, src/prognode.cpp, src/prognode.hpp, src/Makefile.am, src/Makefile.in, src/convert2.cpp, src/dnode.cpp, src/dnode.hpp, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterOptimized.cpp, src/GDLInterpreterOptimized.inc, gdl.kdevses: fixed conversion of real to unsigned interger types 2008-08-01 alaingdl * MAP_INSTALL: info about 2 news projections (7, 17); mapping is working for x86_64 2008-07-31 alaingdl * NEWS: what's new ?! * testsuite/test_contour_extra.pro: Testing new capabilities in CONTOUR (Levels=, Nlevels= and /FILL) * src/plotting.cpp: add /FILL and Nlevels= to CONTOUR * src/basegdl.hpp: numbering the TYPE value in comments (no effect) * testsuite/test_fix.pro: test for FIX since type 12, 13 and 15 where found broken by Nicolas for negatives values 2008-07-28 alaingdl * testsuite/test_map.pro: 2 new Projections in examples (TEST_MAP) 2008-07-25 m_schellens * src/gdl.cpp, configure.in, configure: more precise version info on startup 2008-07-25 jomoga * src/hdf_pro.cpp: Fix start/count keyword ordering bug in HDF_SD_ADDDATA * src/plotting.cpp: Add support for NORMAL/TO_DEVICE (xy->ll) in CONVERT_COORD * src/math_utl.cpp: Add support for ROBINSON & SATELLITE projections 2008-07-25 alaingdl * src/GDLInterpreterOptimized.cpp: bug correction 2008-07-23 m_schellens * src/GDLInterpreterOptimized.cpp, src/GDLInterpreterOptimized.inc: adding file 2008-07-17 alaingdl * testsuite/test_rk4.pro, NEWS, TODO: Updated NEWS, TODO list, and testsuite/test_rk4.pro * src/math_fun_ng.cpp, src/math_fun_ng.hpp: Initial import of RK4() version by Nicolas Galmiche * testsuite/test_rk4.pro: Testsuite for RK4 based on Nose-Hoover equation (Thanks to S. Arabas) 2008-07-16 m_schellens * src/GDLInterpreter.hpp, src/Makefile.am, src/Makefile.in, src/antlr/Makefile.in, src/gdl.cpp, src/gdlc.i.g, src/GDLInterpreter.cpp, gdl.kdevses, configure, Makefile.in, aclocal.m4: startup message slightly changed 2008-07-07 jomoga * src/libinit_jmg.cpp, src/math_fun_jmg.cpp, src/math_fun_jmg.hpp: Rename RK4 to RK4JMG 2008-06-10 jomoga * src/datalistt.hpp: Add pop_back() to DataListT class * src/libinit_jmg.cpp, src/math_fun_jmg.hpp, src/math_fun_jmg.cpp: Add rk4_fun * src/envt.hpp: add DelEnv() * src/dpro.hpp: Add DelVar() 2008-06-06 alaingdl * src/math_fun_ng.cpp, src/libinit_ng.cpp: for VOIGT(): add forgotten file "src/libinit_ng.cpp"; correction in "src/math_fun_ng.cpp" * src/antlr/Makefile.in, src/Makefile.in, src/Makefile.am, configure, aclocal.m4, Makefile.in: since 3 new files in src/, need to change src/Makefile.am and propagate changes via (aclocal, autoconf & automake) * NEWS: what's new in 0.9rc1 ?! * src/voigt.cpp, src/math_fun_ng.hpp, src/math_fun_ng.cpp, src/libinit.cpp: initial import of codes for function VOIGT() * src/pro/real_part.pro: initial import of function REAL_PART() in GDL syntax * testsuite/test_voigt.pro: initial import of test suite for VOIGT() 2008-05-28 jomoga * src/fftw.cpp: Fix memory leak 2008-05-05 m_schellens * src/basic_pro.cpp, src/gdlc.g, src/gdlc.tree.g, src/GDLTreeParser.cpp, src/GDLLexer.cpp, src/GDLParser.cpp: changes reported to be necessary for g++ 4.3 2008-05-01 m_schellens * src/antlr/CharScanner.hpp, gdl.kdevelop: g++ 4.3 compatibility * testsuite/test_suite.pro, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/Makefile.in, src/antlr/Makefile.in, src/gdlc.g, src/typedefs.hpp, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLLexer.hpp, src/GDLParser.cpp, gdl.kdevelop, gdl.kdevses, configure, Makefile.in, aclocal.m4: allow floats without exponent number like 1e 2008-04-30 alaingdl * src/gdljournal.cpp: for JOURNAL: working gethostname() on Mac OS X and Debian ... 2008-04-17 alaingdl * src/pro/factorial.pro: FACTORIAL(): correcting bug when inputs are Integers; managing arrays * testsuite/test_factorial.pro: Testing the FACTORIAL() function 2008-04-06 m_schellens * src/pro/read_ascii.pro: Made for READ_ASCII DATA_START independent of HEADER * src/Makefile.in, src/Makefile.am: removed double linking of plot3d_nr.cpp * src/basic_pro.cpp, gdl.kdevelop, configure.in, ChangeLog, README, config.h.in, configure: 0.9rc1 GDL 0.9rc1: 2008-04-03 m_schellens * src/plot3d_nr.cpp, gdl.kdevelop, configure.in, configure, config.h.in: sync 2008-04-03 alaingdl * src/pro/skip_lun.pro, testsuite/test_skip_lun.pro: SKIP_LUN: initial import; should work for /lines, don't know if other cases (byte) OK * src/devicex.hpp: TV: improved message when 3D array have wrong size 2008-04-02 alaingdl * src/devicex.hpp: in TV, better handling of input arrays with bad dimensions 2008-03-28 alaingdl * NEWS, TODO: revisiting the TODO list * testsuite/test_widgets.pro: basic tests for Widgets. GDL must have been compiled with lib WXWIDGETS * src/pro/smooth.pro: in SMOOTH(), mananing 0- and 1-elem input and bad type (Struc and String) * testsuite/test_cursor.pro: a small change in TEST_CURSOR * testsuite/test_invert_matrix.pro: improved INVERT() testsuite (and benchmark frame included) 2008-03-27 jomoga * src/math_fun_jmg.cpp: Allow sub-pixel interpolation for translations in POLY_2D 2008-03-26 alaingdl * src/devicex.hpp: managing in TV the ORDER keyword (see also !order) * src/basic_pro.cpp: now compiled and work with and without libREADLINE ! 2008-03-20 alaingdl * testsuite/test_surface_basic.pro, testsuite/test_contour_basic.pro: managing non square cases too ! * src/plotting.cpp: correcting SURFACE (when not square, or x,y provided) 2008-03-19 alaingdl * src/plotting.cpp: details in CURSOR; bugs due to zValT in SURFACE * testsuite/test_surface_basic.pro, testsuite/test_contour_basic.pro: test suite for CONTOUR and SURFACE * testsuite/test_cursor.pro, testsuite/test_get_lun.pro: Testing GET_LUN 2008-03-14 alaingdl * src/plotting.cpp, src/real2int.hpp: Recovering the working CURSOR version ! 2008-03-13 jomoga * src/plotting.cpp: Use transpose in SURFACE for rect case 2008-03-13 m_schellens * src/plot3d_nr.cpp: undo last (accidental) commit for plplot3d_nr.cpp * src/typedefs.hpp, src/plotting.cpp, src/real2int.hpp, src/specializations.hpp, src/datatypes.hpp, src/plot3d_nr.cpp, src/convert2.cpp, src/datatypes.cpp, src/arrayindex.hpp: remove (comment out) GDLarray min() max() 2008-03-12 alaingdl * testsuite/test_byte_conversion.pro: Testing conversion to Byte for large Float and Double ... * src/real2int.hpp, src/convert2.cpp: Float2Byte and Double2Byte need a modulus to work fine 2008-03-12 jomoga * src/plot3d_nr.cpp: Port to plplot-5.9 * src/typedefs.hpp: Fix min()/max() functions 2008-03-12 alaingdl * src/plotting.cpp: Updating CURSOR for RDPIX full compatibility * src/basic_pro_jmg.cpp: Working version of WAIT (see test_wait.pro) * testsuite/test_wait.pro: Testing (new version of) WAIT 2008-03-12 m_schellens * src/real2int.hpp, src/convert2.cpp: fix BYTE function overflow behaviour for real values 2008-03-11 m_schellens * src/plotting.cpp, src/format.out.g, src/gdlgstream.cpp, src/plot3d_nr.cpp, src/Makefile.am, src/Makefile.in, src/devicex.hpp, src/format.g, src/FMTParser.hpp, src/FMTTokenTypes.hpp, src/FMTTokenTypes.txt, src/FMTLexer.cpp, src/FMTLexer.hpp, src/FMTOut.cpp, src/FMTOut.hpp, src/FMTOutTokenTypes.hpp, src/FMTOutTokenTypes.txt, src/FMTParser.cpp, src/FMTIn.cpp, src/FMTIn.hpp, src/FMTInTokenTypes.hpp, src/FMTInTokenTypes.txt, ChangeLog, configure: fix FORMAT="(/)" bug 2008-03-11 alaingdl * src/initsysvar.cpp, src/libinit_jmg.cpp: addinf !ORDER system variable (used in TV, TVSCL and TVRD, needed by RDPIX ...) 2008-03-06 jomoga * src/gdlwidget.cpp, src/gdlwidget.hpp, src/widget.cpp, src/widget.hpp: Add WIDGET_TEXT * src/objects.cpp: Add WIDGET_TEXT structure * src/libinit_jmg.cpp: Add widget routines * src/libinit.cpp: Remove widget routines 2008-03-03 alaingdl * src/gsl_fun.cpp: improvment of INVERT : one element array, checking if square matrix, String ... * src/pro/matrix_multiply.pro: Initial import of MATRIX_MULTIPLY * testsuite/test_invert_matrix.pro: Extensive tests of INVERT() (matrix inversion) 2008-03-01 alaingdl * NEWS, src/plotting.cpp, src/plotting.hpp: Initial import of CURSOR. Some limitations, help welcome ! * testsuite/test_cursor.pro: two basics tests for CURSOR procedure 2008-02-26 alaingdl * src/libinit.cpp: initial import of interface for CURSOR procedure, re-import of RECALL_COMMANDS() * src/initsysvar.cpp, src/initsysvar.hpp: initial import for !mouse (to be used by CURSOR ...) 2008-02-15 jomoga * src/libinit.cpp: Add additional widget keywords * src/gdlwidget.cpp, src/gdlwidget.hpp, src/widget.cpp, src/widget.hpp: Add WIDGET_INFO & WIDGET_EVENT * src/objects.cpp: Add WIDGET_BUTTON structure * src/gdl.cpp: Remove widget initialization * src/basic_pro.cpp: Add widget initialization 2008-02-15 alaingdl * src/basic_pro.cpp, src/basic_pro.hpp: initial input of code for function RECALL_COMMANDS() and equivalent keyword in HELP proc. * src/libinit.cpp: add function RECALL_COMMANDS() and keyword /RECALL in HELP procedure 2008-02-07 alaingdl * src/libinit.cpp: new keywords for PLOT, CONTOUR, ... * testsuite/test_titles.pro: demo suite for title, subtitle, ... and title formatting capabilities (initial import) * testsuite/test_axis.pro: demo of AXIS capabilities (initial import) * testsuite/test_greek_letters.pro: Greek Letters demo (initial import) 2008-02-01 jomoga * configure, configure.in, src/basic_pro.cpp, src/gdl.cpp, src/gdlwidget.cpp, src/gdlwidget.hpp, src/libinit.cpp, src/widget.cpp, src/widget.hpp: (Very) Preliminary implementation of widgets GDL 0.9pre6: 2007-12-21 alaingdl * INSTALL, NEWS, src/basic_pro.cpp, src/dinterpreter.cpp, src/gdljournal.cpp: history file managment (~/.gdl/history) 2007-12-09 m_schellens * src/basic_fun_jmg.cpp, src/objects.cpp: moved definition of IDL_SIZE into InitStructs function (objects.cpp) 2007-12-07 jomoga * src/basic_fun_jmg.cpp: Initialize dims to 0 in SIZE w/STRUCTURE keyword 2007-12-05 jomoga * src/datatypes.cpp: Fix CShift bug 2007-11-08 m_schellens * src/antlr/Makefile.in, src/Makefile.in, src/assocdata.cpp, src/assocdata.hpp, gdl.kdevelop, gdl.kdevses, configure, Makefile.in, aclocal.m4: added missing new/delete operators for ASSOC types 2007-10-27 m_schellens * ChangeLog, NEWS, gdl.kdevses: sync with tagged 2007-10-22 m_schellens * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/gdlc.i.g: fixed append int to struct array bug * gdl.kdevelop, gdl.kdevses, src/dstructdesc.hpp, src/typetraits.cpp, src/typetraits.hpp: ref count for DStructDesc 2007-10-22 jomoga * src/math_utl.cpp: Change Get to GetTag (structure method) 2007-10-22 m_schellens * src/default_io.cpp, gdl.kdevelop, gdl.kdevses: Fixed reading/writing for struct arrays 2007-10-20 m_schellens * src/typetraits.cpp, src/typetraits.hpp, testsuite/test_suite.pro, src/devicez.hpp, src/dstructdesc.cpp, src/dstructdesc.hpp, src/dstructgdl.cpp, src/dstructgdl.hpp, src/envt.cpp, src/extrat.cpp, src/gdl.cpp, src/gdlc.i.g, src/gdlexception.cpp, src/gdljournal.cpp, src/graphics.hpp, src/ifmt.cpp, src/initsysvar.cpp, src/math_fun_gm.cpp, src/ncdf_att_cl.cpp, src/ncdf_var_cl.cpp, src/plotting.cpp, src/specializations.hpp, src/typedefs.hpp, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/accessdesc.hpp, src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/basic_pro.cpp, src/datatypes.cpp, src/datatypes.hpp, src/default_io.cpp, src/devicex.hpp, gdl.kdevses: more effective internal memory handling for structs 2007-09-17 m_schellens * src/basic_fun.cpp: fixed: strpos takes any to string convertible type as 2nd parameter * src/datatypes.hpp, src/dstructgdl.hpp, src/arrayindex.hpp: fixed: a[[scalar]] returns one element array 2007-09-12 jomoga * src/ncdf_var_cl.cpp: Fix VARPUT bugs 2007-09-11 jomoga * src/ncdf_var_cl.cpp: Fix input parameter bugs 2007-09-10 jomoga * src/libinit_cl.cpp, src/ncdf_att_cl.cpp, src/ncdf_dim_cl.cpp: Fix various input parameter bugs 2007-09-08 m_schellens * src/basic_op.cpp, src/typedefs.hpp: Fixed AND for FLOAT 2007-09-07 m_schellens * src/basic_op.cpp: Fixed AND bug 2007-09-06 jomoga * src/ncdf_var_cl.cpp: Change var_id to varid 2007-09-05 jomoga * src/ncdf_var_cl.cpp: Allow varid to be variable name in VARGET, VARGET1, VARPUT 2007-09-05 alaingdl * testsuite/test_plot_benchmark.pro: correcting bug when selecting only one test * src/pro/file_basename.pro, src/pro/file_dirname.pro: initial import of File_Basename and File_Dirname, thanks to S. Masson 2007-09-03 m_schellens * src/basegdl.hpp, src/basic_op.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dimension.hpp, src/typedefs.hpp, src/typetraits.hpp, gdl.kdevelop, gdl.kdevses: Introduced GDLArray 2007-09-01 m_schellens * src/ofmt.cpp, src/topython.cpp, gdl.kdevses, src/basic_op.cpp, src/convert2.cpp, src/convol.cpp, src/datatypes.cpp, src/default_io.cpp, src/dstructgdl.hpp, src/ifmt.cpp: channel all data (dd member) access through [] operator 2007-08-30 m_schellens * aclocal.m4, configure, gdl.kdevelop, gdl.kdevses, src/Makefile.in, src/antlr/Makefile.in, src/datatypes.cpp, src/datatypes.hpp, src/dstructgdl.cpp, src/dstructgdl.hpp, Makefile.in: custom operator new/delete 2007-08-30 jomoga * src/ncdf_var_cl.cpp: Preliminary fix for INT bug in NCDF_VARGET 2007-08-25 jomoga * src/basic_fun.cpp, src/libinit.cpp: Add support for DIM & DOUBLE keywords in MEDIAN 2007-08-23 jomoga * src/libinit_jmg.cpp, src/gsl_fun.cpp, src/gsl_fun.hpp: Add LA_TRIRED routine 2007-08-21 m_schellens * src/dnode.hpp, src/GDLLexer.hpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/dnode.cpp, src/GDLLexer.cpp, gdl.kdevses: Fixed discrepency in conversion of constant numbers 2007-08-13 jomoga * src/basic_fun.cpp: Fix indexing bug in MEDIAN with EVEN keyword 2007-08-08 m_schellens * NEWS, gdl.kdevses, src/libinit_cl.cpp, src/ncdf_att_cl.cpp, src/ncdf_var_cl.cpp: Applied two patches from Sylwester Arabas 2007-07-09 alaingdl * NEWS, testsuite/test_plot_benchmark.pro: remove 3 duplicated lines in NEWS; bug in "test_plot_benchmark.pro" 2007-07-05 m_schellens * src/basic_pro.cpp, configure.in, configure: sync 0.9pre5 * gdl.kdevses, NEWS, README, configure: edit 2007-06-28 jbronn * configure.in: fixed python configure bug (no sub version numbers, e.g., 2.5 not 2.5.1) 2007-06-25 alaingdl * testsuite/test_plot_benchmark.pro, testsuite/test_plot_linestyle.pro, NEWS: info in NEWS; correction of details in "test_plot_benchmark.pro" and "test_plot_linestyle.pro" 2007-06-23 m_schellens * src/basic_fun.cpp, src/basic_pro.cpp, src/convert2.cpp, src/envt.cpp, src/envt.hpp, src/basegdl.hpp, gdl.kdevses, gdl.kdevelop: Full ON_IOERROR support 2007-06-19 m_schellens * src/io.cpp, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/basic_fun.cpp, src/basic_pro.cpp, src/gdlc.i.g, gdl.kdevses: ON_IOERROR support 2007-06-19 jomoga * src/export.hpp: Change to GDL_VarCopy() * src/basic_pro_jmg.cpp: Small changes to LINKIMAGE * src/export.hpp: Initial import. 2007-06-18 m_schellens * gdl.kdevelop, src/dinterpreter.cpp, src/gdl.cpp: init readline already before interpreter is instantiated 2007-06-18 alaingdl * src/plotting.cpp: several important changes in "plotting.cpp" -- autoscaling providing better mimic of IDL except when all data are equal -- providing 6 linestyle, managing keyword versus !p.linestyle -- rewriting of "draw_polyline" using <> to improve speed for large datasets * testsuite/test_histo.pro: initial import of a test program for histogram with 2 procedures * testsuite/test_plot_inf_nan.pro, testsuite/test_plot_info.pro, testsuite/test_plot_linestyle.pro, testsuite/test_map.pro, testsuite/test_minmax.pro, testsuite/test_plot_basic.pro, testsuite/test_plot_benchmark.pro: initial import of 5 programs for checking plotting options (/nan now works on Nan and +-Inf; linestyle, "fast" plot) 2007-06-11 m_schellens * gdl.kdevelop, configure, configure.in, README: sync 2007-06-10 m_schellens * src/math_fun_ac.cpp: small corrections 2007-06-07 alaingdl * src/basic_fun.cpp, src/datatypes.cpp: In "basic_fun.cpp", correcting /Nan keyword for Min() and Max() In "datatypes.cpp", managing -/+ Inf and also solve case when NaN is first element. * testsuite/test_minmax.pro: Add testsuite/test_minmax.pro, a serie of tests for Min() and Max() 2007-06-03 m_schellens * src/antlr/Makefile.in, src/terminfo.cpp, src/Makefile.in, configure.in, gdl.kdevses, aclocal.m4, config.h.in, configure, Makefile.in: Some small changes for OS X 2007-06-02 m_schellens * src/basic_fun_jmg.cpp, src/dstructgdl.hpp: use of New( dim, BaseGDL::INIT * src/assocdata.cpp, src/dstructgdl.hpp: Fixed ASSOC for STRUCTS * src/assocdata.cpp, src/basic_fun.cpp: Fixed ASSOC for structs and 1 element arrays * gdl.kdevelop, gdl.kdevses, src/Makefile.in, src/basic_pro.cpp, src/terminfo.cpp: Fixed APPEND keyword for OPENW 2007-05-29 alaingdl * src/libinit_gm.cpp, src/math_fun_gm.cpp, src/math_fun_gm.hpp: Initial import of GAUSSINT() using gsl_sf_erf() * testsuite/test_gammas.pro: removing +-Inf for plotting in test_gammas * NEWS: the new functions (erf, erfc, ...) are added in NEWS 2007-05-25 alaingdl * src/Makefile.am, src/Makefile.in: Makefile should now link to Gregory's files ... (libinit_gm.cpp, math_fun_gm.*) * src/basic_fun_cl.cpp, src/basic_fun_cl.hpp, src/libinit_cl.cpp: Since reworked of Gregory, GAMMA(), LnGAMMA(), IGamma() and BETA() are removed from C. Lee codes. * src/math_fun_gm.cpp, src/math_fun_gm.hpp: Initial import of Gregory's work in C++: ERF(), ERFC(), EXPINT() and ERRORF() (clone of ERF() for old IDL codes) Rework of functions with weakness in many cases: GAMMA(), LnGAMMA(), IGamma() and BETA(). These functions were previously in "basic_fun_cl.*" where they have been removed. (please see related test functions in testsuite/) [tested on x86, x86_64 and MacOS] * src/libinit.cpp, src/libinit_gm.cpp: Initial import of libinit_gm.cpp (Gregory's functions to come) Modification of libinit.cpp to take into account libinit_gm.cpp * testsuite/test_erfs.pro, testsuite/test_expint.pro, testsuite/test_gammas.pro: adding 3 files in testsuite/ for testing: ERF(), ERFC(), GAMMA(), LnGAMMA(), IGamma(), BETA() and EXPINT() Files are : test_erfs.pro test_expint.pro test_gammas.pro * testsuite/test_map.pro: removing useless warning of x86_64 bugs in test_map 2007-05-23 jomoga * src/gsl_fun.cpp: Fix random Poisson for large mu 2007-05-10 jomoga * src/terminfo.cpp: Fix bug with initscr() for batch or ssh mode 2007-05-08 jomoga * src/plotting.cpp: Fix DEVICE & NORMAL bug in xyouts,plots * src/basic_fun_jmg.cpp, src/hdf_fun.cpp, src/hdf_pro.cpp, src/gsl_fun.cpp, src/math_fun_jmg.cpp, src/ncdf_var_cl.cpp, src/plotting.cpp: Change cast in 1st arg to dim() from SizeT to DLong to fix alloc buf on x86_64 2007-05-07 jomoga * src/gsl_fun.cpp: Add 3D support for INTERPOLATE 2007-05-01 jomoga * src/basic_pro.cpp: Allow leading '~/' in OPEN filenames 2007-04-25 jomoga * src/initsysvar.cpp: Apply patch for environment variable GDL_DIR 2007-04-22 m_schellens * src/file.cpp, src/Makefile.in: Fixed FILE_SEARCH multiple repetition of dir in result strings 2007-04-21 alaingdl * src/libinit_ac.cpp: forgotten file for BESELx functions (sorry) 2007-04-20 alaingdl * NEWS: updated "NEWS" for Bessel Functions initial import * src/Makefile.am, src/libinit.cpp, src/math_fun_ac.cpp, src/math_fun_ac.hpp: initial import for BESEL {I,J,K,Y} functions * testsuite/test_besel.pro: initial import for test BESEL {I,J,K,Y} functions 2007-04-18 jomoga * src/math_utl.cpp: Fix CONIC p0lon/lat bug * src/plotting.cpp: Fix !p.multi bugs introduced by map support 2007-04-17 alaingdl * testsuite/test_map.pro: TEST_MAP: checking if data are in !dir; more explicite messages 2007-04-16 jomoga * src/plotting.cpp: Fix PS newpage plotting bug * src/gdlgstream.cpp, src/gdlpsstream.hpp: Remove PS eop() function 2007-04-11 m_schellens * src/math_fun.cpp: All types for SVDC * src/libinit.cpp, src/math_fun.cpp, src/math_fun.hpp, configure, configure.in, gdl.kdevses: SVDC 2007-04-07 m_schellens * src/dnode.cpp: short circuit for logical 'or' and 'and' * src/basegdl.cpp, src/basegdl.hpp, src/basic_op.cpp, src/datatypes.hpp, src/dnode.cpp, src/dstructgdl.hpp, src/specializations.hpp: Changed scalar op one_element_array result to array 2007-04-06 m_schellens * src/dcompiler.cpp, gdl.kdevses: Changed order of function/variable lookup 2007-04-02 jomoga * src/basic_fun.cpp: Trap 0 values in dimensions for array generator functions. 2007-03-31 m_schellens * src/dcompiler.cpp: Changed: variable and function ambiguity: variables precede now * src/convert2.cpp, gdl.kdevses: Fixed conversion of empty string to byte 2007-03-29 m_schellens * src/envt.cpp: Fix for HEAP_GC 2007-03-28 jomoga * src/print.cpp: Fix MSG_NOSIGNAL compile problem on OS X 2007-03-28 m_schellens * gdl.kdevses, src/envt.cpp: Handle nested HEAP_GC calls from CLEANUP 2007-03-27 jomoga * NEWS, src/devicex.hpp: Add support for TRUE/CHANNEL keywords in TVRD for X 2007-03-25 m_schellens * src/assocdata.hpp, src/basegdl.cpp, src/basegdl.hpp, src/basic_op.cpp, src/datatypes.hpp, src/dnode.cpp, src/dstructgdl.hpp, src/specializations.hpp: Speedup for POW 2007-03-24 m_schellens * gdl.kdevses, src/basic_op.cpp, configure, configure.in: added -ltermcap to LDFLAGS in 2007-03-24 jomoga * src/devicez.hpp, src/gdlgstream.cpp, src/gdlgstream.hpp, src/gdlxstream.cpp, src/gdlxstream.hpp, src/gdlzstream.cpp, src/gdlzstream.hpp, src/graphics.hpp, src/plotting.cpp: Add support for bkgr color in ERASE/Fix zbuf fill problem 2007-03-23 jomoga * src/math_utl.cpp: Add support for Oblique Cylindrical projection 2007-03-22 m_schellens * src/envt.cpp, src/print.cpp: fixed printf,-1,var 2007-03-21 m_schellens * src/GDLTreeParser.cpp, src/basic_pro.cpp, src/dnode.cpp, src/gdlc.tree.g: Fixed problem (segfault) compiling subroutines containing only common blocks 2007-03-20 m_schellens * gdl.kdevses, src/devicex.hpp: Fixed: segfault closing X graphic window 2007-03-19 m_schellens * src/basic_pro.hpp, src/envt.cpp: Proper message for HEAP_GC,/VERBOSE * gdl.kdevses, src/envt.cpp: Fixed HEAP_GC (freeing of objects without CLEANUP method) * gdl.kdevses, src/datatypes.cpp: Fixed assignment bug: struct.tag=[one_element_array] 2007-03-19 jomoga * src/pro/value_locate.pro: Remove 'default', Add 'is_defined' and 'is_scalar' * src/math_fun_jmg.cpp: Fix memory overwrite in poly_2d_fun for BYTE arrays 2007-03-19 alaingdl * src/basic_pro.cpp: Try to correct a bug in DEFSYSV when the Variable is not defined (previously, if x is undefined, this will crash : DEFSYSV, '!x', x). 2007-03-19 jomoga * src/libinit.cpp: Change max # params in ERASE to 1 for background color * src/plotting.cpp: Add support for non-X devices in CONVERT_COORD * src/libinit_jmg.cpp: Add TYPE keyword to hdf_sd_attrinfo * src/initsysvar.cpp, src/initsysvar.hpp: Add support for Device system variable access * src/hdf_pro.cpp: Add support for string attributes * src/hdf_fun.cpp: Remove cout statement 2007-03-18 m_schellens * src/envt.cpp, NEWS, src/GDLInterpreter.hpp, src/basic_pro.cpp, src/basic_pro.hpp, src/dstructdesc.hpp, src/envt.hpp, src/gdlc.i.g, src/libinit.cpp, src/math_fun.cpp, src/typedefs.hpp: Added HEAP_GC * configure.in, configure: changed configure.in for checking gsl version 1.4 or higher 2007-03-17 m_schellens * Makefile.in, gdl.kdevses, src/Makefile.in, src/antlr/Makefile.in, src/datatypes.cpp, src/devicex.hpp: Fixed WSET (ProcessDeleted did set actWin) bug 2007-03-15 alaingdl * gsl.m4: initial import for "gsl.m4" which is used by "configure.in" to check the GSL version * configure.in, INSTALL, README, config.h.in, configure: changes in configure.in : checking GSL version (>= 1.4), Zlib presence details in README and INSTALL 2007-03-14 jomoga * src/plotting.cpp: Fix cast in TYPE write in set_mapset 2007-03-09 jomoga * src/gdlpsstream.hpp, src/gdlgstream.cpp: Fix initial blank page for PS output 2007-03-09 alaingdl * src/pro/findfile.pro: bug Keyword --> keyword_set ;-) 2007-03-08 alaingdl * src/pro/findfile.pro: add very basic FINDFILE (as a .pro) since oftenly used in old codes. please consider FILE_SEARCH --provided by GDL-- instead. 2007-03-04 jomoga * src/gzstream.hpp: Initial import. * src/assocdata.cpp, src/basegdl.cpp, src/basegdl.hpp, src/basic_pro.cpp, src/datatypes.hpp, src/default_io.cpp, src/dstructgdl.hpp, src/gdljournal.cpp, src/io.cpp, src/io.hpp, src/specializations.hpp: Add partial support for COMPRESS keyword in OPEN (read only) 2007-03-02 jomoga * configure, configure.in: Check for libfftw3f library 2007-03-02 alaingdl * README: how to really have FFTw in GDL ! 2007-02-28 alaingdl * src/pro/save.pro, testsuite/test_map.pro, testsuite/test_restore.pro, testsuite/test_save.pro, MAP_INSTALL, src/pro/restore.pro: add options and several checks when using SAVE and RESTORE, especially the verbose keyword in RESTORE and the check of unamed variables in SAVE in testsuite/, add TEST_SAVE and TEST_RESTORE for fast basic tests in testsuite/, add TEST_MAP for quicky run a demo for MAP_SET,/continent ! 2007-02-28 jomoga * src/basic_fun_jmg.hpp: Fix title statement * src/hdf_fun.cpp, src/hdf_fun.hpp, src/hdf_pro.cpp, src/hdf_pro.hpp: Transfer include mfhdf.h statement from include to source files * src/libinit_jmg.cpp: Remove dpro.hpp statement 2007-02-27 jomoga * INSTALL, MAP_INSTALL, NEWS: Update libproj4 info 2007-02-25 jomoga * src/libinit.cpp, src/math_fun.cpp: ADD L64 keyword to ROUND 2007-02-21 jomoga * src/libinit_jmg.cpp, src/math_fun_jmg.cpp, src/math_fun_jmg.hpp: Add TRIGRID function * MAP_INSTALL: Initial import. 2007-02-17 m_schellens * src/accessdesc.hpp, src/datatypes.cpp, src/datatypes.hpp: fixed assignment of arrays to struct expressions * gdl.kdevses, src/basic_pro.cpp: allow all types for REPLICATE_INPLACE 2007-02-13 jomoga * src/math_utl.cpp, src/math_utl.hpp, src/plotting.cpp, src/plotting.hpp: Transfer map_init() from plotting.cpp to math_utl.cpp 2007-02-09 jomoga * src/read.cpp: Replace 'push_back' loop with 'append' method in READF 2007-02-08 jomoga * src/basic_fun.cpp: Set default pattern to ' ' in STRTOK for /REGEX 2007-02-06 jomoga * src/gsl_fun.cpp: Speed up INTERPOLATE 2007-02-06 m_schellens * configure.in, gdl.kdevelop, gdl.kdevses, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/arrayindex.cpp, src/arrayindexlistt.hpp, src/basic_pro.cpp, src/basic_pro.hpp, src/dstructgdl.hpp, src/gdlc.tree.g, src/libinit.cpp, configure: REPLICATE_INPLACE from Sergio Gelato 2007-02-06 jomoga * src/pro/read_jpeg.pro: 16-bit image redux 2007-02-05 jomoga * src/pro/read_jpeg.pro: Convert 16-bit image to byte 2007-02-04 jomoga * src/plotting.cpp: Add TO_DEVICE keyword support for ll->xy map conversions * src/libinit_jmg.cpp: Add XSIZE/YSIZE keywords to tvKey 2007-02-02 jomoga * src/plotting.cpp, src/plotting.hpp: Add map support to XYOUTS 2007-02-01 jomoga * src/libinit.cpp: Add 'Z' to xyoutsKey 2007-01-30 m_schellens * Makefile.in, aclocal.m4, config.h.in, configure, gdl.kdevelop, gdl.kdevses, src/FMTIn.cpp, src/FMTIn.hpp, src/FMTInTokenTypes.hpp, src/FMTInTokenTypes.txt, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/Makefile.in, src/antlr/Makefile.in, src/assocdata.cpp, src/basic_fun.cpp, src/datatypes.cpp, src/gsl_fun.hpp, src/ifmt.cpp, src/io.cpp, src/io.hpp: Fixed ASSOC bug (bug tracker ID 1631690) 2007-01-29 jomoga * src/plotting.cpp: Add MERCATOR projection. Fix grid/cont line jumps 2007-01-25 jomoga * NEWS: SOCKET & FFT/DIMENSION keyword support * src/fftw.cpp, src/gsl_fun.cpp: Add support for DIMENSION keyword in FFT 2007-01-19 jomoga * src/basic_fun.cpp, src/basic_pro.hpp, src/io.cpp, src/io.hpp, src/libinit.cpp, src/print.cpp, src/read.cpp, src/basic_pro.cpp: Add SOCKET support 2007-01-07 jomoga * src/basic_fun_jmg.cpp: Rewrite ROUTINE_NAMES without pop_back 2006-12-30 m_schellens * src/basic_pro.cpp, src/libinit.cpp, src/ncdf_att_cl.cpp, src/ncdf_var_cl.cpp: Added the unofficial CALLS keyword to HELP 2006-12-29 m_schellens * gdl.kdevses, src/dcompiler.cpp, src/dcompiler.hpp: purge common blocks before recursive compilation 2006-12-21 jomoga * src/gsl_fun.cpp: Fix 'ny' for vector output 2006-12-19 jomoga * src/pro/ishft.pro: Fix for column vectors 2006-12-19 alaingdl * src/pro/restore.pro, src/pro/save.pro: since EXECUTE is now working in GDL, finalization of CMSVlib checks and users informations in SAVE/RESTORE 2006-12-19 m_schellens * gdl.kdevses, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/basic_fun.cpp, src/gdlc.i.g: Corrected return value of EXECUTE * AUTHORS, src/arrayindex.hpp, src/arrayindexlistt.hpp: made something like a[3,i] scalar 2006-12-18 alaingdl * src/pro/README.txt, src/pro/UrgentNeed.txt: dd direct link to http://idlastro.gsfc.nasa.gov/idllibsrch.html which provides some files from the IDL lib. 2006-12-15 alaingdl * src/pro/restore.pro, src/pro/save.pro: add in headers of these 2 files link to the external CMSV lib. add a test to check wether the CMSV lib. is available or not * src/pro/README.txt, src/pro/UrgentNeed.txt: typo corrected 2006-12-15 m_schellens * gdl.kdevses, src/extrat.cpp: Fixed problem with _EXTRA=undefined keywords 2006-12-14 alaingdl * src/pro/README.txt, src/pro/STATUS, src/pro/UrgentNeed.txt: add README.txt in order to give explainations about the content of this directory. add UrgentNeed.txt in order to indicate clearly the most urgent procedures and is someone has started to work on. update STATUS since I have added few files * src/pro/file_lines.pro: add FILE_LINES, pro file of a function appering in IDL 5.5 2006-12-11 alaingdl * AUTHORS, NEWS: add Alain as tester in AUTHORS' list; typo for integer in NEWS * testsuite/test_colors.pro, testsuite/test_op_elem.pro, testsuite/test_op_power.pro: add 3 test files : one for checking colors, 2 for time test. 2006-12-02 m_schellens * src/ncdf_att_cl.cpp, src/ncdf_var_cl.cpp: Included patch from opoplawski 2006-11-27 jomoga * NEWS: Update NEWS * src/basic_pro.cpp, src/io.cpp, src/io.hpp: Remove streamVMS support; Add variable-length file support * src/gdljournal.cpp: Conform to new Open method * src/default_io.cpp: Remove XDR conversion for BYTE (Not in IDL) * src/basic_pro_jmg.cpp: Remove streamVMS adjustment from POINT_LUN 2006-11-22 jomoga * src/basic_pro.cpp: STREAM keyword only supported in VMS * src/basic_pro_jmg.cpp: Add STREAM file fix to POINT_LUN 2006-11-22 m_schellens * src/gdljournal.cpp, src/initsysvar.cpp, src/initsysvar.hpp, src/libinit.cpp, configure.in, src/GDLInterpreter.cpp, src/basic_pro.cpp, src/gdl.cpp, src/gdlc.i.g: 0.9pre3 2006-11-21 jomoga * src/gdl.cpp: Remove HELP,/INFO message 2006-11-20 jomoga * NEWS: Update NEWS * src/basic_pro.cpp, src/gdljournal.cpp, src/io.cpp, src/io.hpp: Add support for STREAM keyword in OPEN 2006-11-17 jomoga * src/initsysvar.cpp: Change MAP structure tag to UP_NAME * NEWS: Update NEWS * src/basic_pro.cpp, src/libinit.cpp: Add support for PROCEDURES, FUNCTIONS keywords in HELP 2006-11-16 m_schellens * src/datatypes.cpp, src/io.cpp: Fixed XDR bug 2006-11-15 m_schellens * src/basic_fun_jmg.cpp, configure, configure.in: Made REFORM conforming (no folding of all dimensions anymore) 2006-11-13 m_schellens * src/basegdl.cpp, src/typetraits.cpp: proper type names 2006-11-11 m_schellens * configure, configure.in, src/basic_pro.cpp, src/datatypes.cpp, src/datatypes.hpp, src/default_io.cpp, src/io.cpp, src/io.hpp, config.h.in: Proper handling of XDR structure, OS X 10.5 compliance 2006-11-10 m_schellens * src/datatypes.cpp: Fixed problem with gcc 4.1.1 error: specialization after instantiation 2006-11-04 jomoga * src/pro/value_locate.pro: Fix concatenation problems 2006-11-04 m_schellens * src/GDLInterpreter.cpp, src/gdlc.i.g, src/gdlc.tree.g, testsuite/test_suite.pro: fixed left assignment (soemthing like: ((a=2))=3) 2006-11-01 m_schellens * src/dnode.cpp, src/dnode.hpp, src/gdlc.g, src/gdlc.i.g, src/gdlc.tree.g, testsuite/test_suite.pro, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/arrayindexlistt.hpp, src/GDLLexer.cpp, configure.in, gdl.kdevelop, gdl.kdevses, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, README: fixed op= (+=, *= ...) for indexed expressions on the left side 2006-10-30 jomoga * NEWS: update NEWS 2006-10-25 jomoga * src/basic_pro.cpp: HELP displays compiled pro/fun * src/basic_fun_jmg.cpp: ROUTINE_NAMES returns compiled pro/fun if no keywords specified 2006-10-23 m_schellens * testsuite/test_suite.pro, src/dstructgdl.hpp, src/gdlc.i.g, src/dstructgdl.cpp, src/GDLInterpreter.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/dstructdesc.cpp, Doxyfile, gdl.kdevelop, gdl.kdevses: Allow named struct tags to be converted to first definition in redefiniton (raised an error before) 2006-10-23 jomoga * src/basic_fun_jmg.cpp: Fix seg fault with ROUTINE_NAMES if no keywords 2006-10-20 jomoga * src/gsl_fun.cpp: Implement INPUT keyword in HISTOGRAM 2006-10-19 jomoga * src/pro/value_locate.pro: Modified to return array with same dimensions as second argument 2006-10-18 jomoga * src/gdlgstream.cpp, src/gdlgstream.hpp: Use decomposed value in Background() method 2006-10-17 jomoga * src/libinit.cpp, src/math_fun.cpp: Support for L64 keyword in CEIL/FLOOR * src/plotting.cpp: Fix various COLOR/BACKGROUND bugs 2006-10-16 alaingdl * src/initsysvar.cpp: add a "!GDL" constant system variable in order to easily distinguish IDL and GDL (sometimes we know some tricky differences between both) 2006-10-12 jomoga * src/gdlgstream.cpp, src/gdlgstream.hpp: Use decomposed value in Color method * src/plotting.cpp: Get # of colors from DEVICE system variable * src/devicex.hpp: Change default N_COLORS to 16777216 2006-10-11 jomoga * src/dnode.cpp: Fix AdjustType bug (1st operand determines type) 2006-10-11 alaingdl * testsuite/test_uf77.pro: add a demo file in order to test /f77unformatted writeu/readu 2006-10-08 m_schellens * src/GDLInterpreter.cpp, src/gdlc.i.g, gdl.kdevses: Changed structs to be arrays 2006-10-05 m_schellens * NEWS: update NEWS * src/gdlc.i.g, src/pro/deriv.pro, src/pro/smooth.pro, testsuite/test_deriv.pro, testsuite/test_smooth.pro: Added SMOOTH and DERIV from Alain Coulais * src/gdlc.i.g, src/GDLInterpreter.cpp, src/dcompiler.cpp, gdl.kdevses: Fixed bug with FOR statement when the loop contains EXECUTE and within this a new variable is created 2006-09-28 jomoga * src/pro/ishft.pro: Get name right in header * src/pro/ishft.pro: Initial import 2006-09-27 m_schellens * src/ofmt.cpp: Fixed I format code zero padding (I0x formats are not supported) * src/basegdl.cpp, src/basegdl.hpp, src/datatypes.cpp, src/datatypes.hpp, src/math_fun.cpp: log10( valarray<...>) for ALOG10, gcc 3.2.x compliance for ALOG and ALOG10 2006-09-27 jomoga * src/Makefile.in: Recommit V 1.47 * src/antlr/Makefile.in: Recommit V 1.32 * src/Makefile.in, src/antlr/Makefile.in, src/plotting.cpp: Fix bug [1560714] (PLOTS log scaling)plotting.cpp 2006-09-26 m_schellens * src/FMTOut.cpp, src/basic_pro.cpp, src/format.out.g: Fixed 'z' format code * src/Makefile.in, src/antlr/Makefile.in, src/basic_fun.cpp, src/plotting.cpp, Makefile.in, configure, configure.in: Fixed offset without dim1,... for type conversion functions (BYTE, FIX, LONG, ...) 2006-09-26 jomoga * src/GDLInterpreter.cpp: Add support for ON_IOERROR 2006-09-25 jomoga * config.h.in, configure, configure.in: Fix 64-bit OS check 2006-09-24 jomoga * src/basic_fun_jmg.cpp: Fix st_atim bug [1563930] 2006-09-22 m_schellens * configure.in, config.h.in, configure, gdl.kdevses, src/plotting.cpp: Handle something like PLOT,/XLOG,/YLOG,[x,x],[y,y] 2006-09-21 jomoga * src/specializations.hpp: Install Patch [ 1561592 ] * src/basic_fun_jmg.cpp: Add ATIME, CTIME, MTIME to FSTAT 2006-09-20 jomoga * src/typedefs.hpp: Make SizeT typedef 32/64 OS-dependent * configure.in, config.h.in, configure: Check for 64-bit OS 2006-09-19 jomoga * src/plotting.cpp: Change wIx from int to DLong in wdelete 2006-09-18 m_schellens * src/arrayindex.hpp, src/arrayindexlistt.hpp, src/default_io.cpp, src/dstructgdl.hpp, gdl.kdevelop: Fixed boundary check for ArrayIndexListMultiT ALLONE 2006-09-17 m_schellens * src/FMTIn.cpp, src/FMTOut.cpp, src/format.in.g, src/format.out.g, gdl.kdevelop, gdl.kdevses: fixed T format code (starts from 1) 2006-09-16 m_schellens * src/FMTOut.cpp, src/FMTOut.hpp, src/convert2.cpp, src/format.g, src/format.out.g, src/ofmt.cpp, src/str.cpp: Fixed T format code (now count from 1, before fomr 0) 2006-09-15 jomoga * src/plotting.cpp: Add support for ORTHOGRAPHIC,STEREO,AZIMUTHAL,GNOMIC,CONIC,LAMBERT,AITOFF projections * src/devicex.hpp, src/devicez.hpp, src/image.hpp, src/libinit_jmg.cpp: Add support for CHANNEL keyword in TV/TVSCL 2006-09-14 m_schellens * src/ofmt.cpp: Fixed I format code (removed zero padding) * src/datatypes.cpp, src/dstructgdl.cpp, gdl.kdevses, src/FMTIn.hpp, src/default_io.cpp, src/format.in.g, src/gdlc.i.g, src/gdlexception.hpp, src/io.cpp, testsuite/test_suite.pro: Fixed assignment 'at' (one dim index: var[0]=...) for multi dim var 2006-09-13 jomoga * src/plotting.cpp: Change INF to NAN in CONVERT_COORD * src/basic_fun_jmg.cpp: Fix REFORM with 1 parameter 2006-09-12 m_schellens * src/convert2.cpp: Removed warning message for converting empty string to DOUBLE * src/default_io.cpp: Made read strings without FORMAT handle DOS mode files 2006-09-08 jomoga * src/basic_fun_jmg.cpp: Fix ROUTINE_NAMES GetPar (STORE) bug 2006-09-07 m_schellens * src/accessdesc.hpp, src/basic_fun.cpp: tags containing one element are skiped from dimension 2006-09-06 m_schellens * src/basic_fun.cpp: Minor chnages to CREATE_STRUCT * src/basic_pro.cpp: Output of HELP,/STRUCT for struct arrays 2006-09-04 m_schellens * src/GDLInterpreter.cpp, src/gdlc.i.g, testsuite/test_suite.pro, gdl.kdevses: Fixed: CASE with empty statement list 2006-09-03 jomoga * src/basic_fun_jmg.cpp: Fix structure store bug in ROUTINE_NAMES * src/basic_fun.cpp: Structure variable bug fixes * src/GDLInterpreter.cpp: Make new structure single-element array rather than scalar * src/libinit.cpp, src/basic_pro.cpp: Add support for OUTPUT in HELP 2006-09-02 jomoga * src/pro/str_sep.pro: Initial import 2006-09-01 jomoga * src/pro/restore.pro, src/pro/save.pro: Add GPL license 2006-08-31 jomoga * src/basic_fun.cpp: Fix CREATE_STRUCTURE for undefined name 2006-08-30 jomoga * src/basic_fun_jmg.cpp: Add /STRUCTURE to SIZE * src/initsysvar.cpp, src/initsysvar.hpp: Add !CPU system variable * src/pro/write_png.pro: Fix /ORDER bug * src/pro/map_clip_set.pro: Initial import 2006-08-25 m_schellens * gdl.kdevses, src/basic_pro.cpp: CLOSE,/ALL now also frees LUNs 2006-08-25 jomoga * config.h.in: Preliminary support for map projections 2006-08-24 jomoga * INSTALL, NEWS, src/libinit_jmg.cpp, src/plotting.cpp, src/plotting.hpp, configure, configure.in: Preliminary support for map projections 2006-08-23 jomoga * src/pro/last_item.pro, src/pro/value_locate.pro: Inital import * NEWS: Support for XDR I/O & POLY_2D * src/basegdl.cpp, src/basegdl.hpp, src/basic_pro.cpp, src/datatypes.hpp, src/default_io.cpp, src/dstructgdl.hpp, src/gdljournal.cpp, src/io.cpp, src/io.hpp, src/print.cpp, src/specializations.hpp, src/assocdata.cpp: Support for XDR I/O 2006-08-06 m_schellens * src/extrat.cpp: Made empty _EXTRA values undefined * src/arrayindex.hpp, gdl.kdevses: made [*] to return one-dim index (not preserve indices) 2006-08-03 jomoga * src/math_fun_jmg.cpp: Fix perfect square test for coeff array 2006-08-02 jomoga * src/initsysvar.cpp, src/initsysvar.hpp: Add !MAP system variable 2006-07-30 m_schellens * gdl.kdevses, src/extrat.cpp, testsuite/test_suite.pro: Fixed _EXTRA with undefined variable bug 2006-07-29 m_schellens * src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/arrayindex.cpp, src/gdlc.tree.g: Fixed indexing with loop variable bug 2006-07-27 jomoga * src/math_fun_jmg.cpp: Fix SQRT cast bug 2006-07-18 jomoga * src/libinit_jmg.cpp, src/math_fun_jmg.cpp, src/math_fun_jmg.hpp: Add POLY_2D function 2006-07-08 m_schellens * src/basic_fun.cpp: Fixed N_PARAMS for member subroutines * src/basic_fun.cpp: Allow structs for KEYWORD_SET (always 1) 2006-06-24 m_schellens * gdl.kdevses, src/GDLTreeParser.hpp, src/arrayindex.cpp, src/arrayindex.hpp, src/arrayindexlistt.hpp, src/basic_pro.cpp, src/datatypes.cpp, src/file.cpp, src/gdlc.tree.g: Indexing bug (arg[0,0]) and STRUCT_ASSIGN bug 2006-06-20 jomoga * src/basic_fun.cpp, src/libinit_mes.cpp, src/pro/strsplit.pro: Add REGEX keyword support to strtok * src/basic_fun_cl.cpp: Fix gsl_exp bug (1509339) 2006-06-16 m_schellens * gdl.kdevses, src/GDLParser.cpp, src/gdlc.g: Fixed named struct syntax bug 2006-06-14 m_schellens * src/datatypes.hpp, src/dnode.cpp, src/basegdl.cpp, src/basegdl.hpp, src/basic_op.cpp: fixed binary operator results if one operand is an one element array 2006-06-13 m_schellens * src/basic_op.cpp, src/specializations.hpp: Allow EQ and NE for ptr and objects * INSTALL, PYTHON.txt, README: Corrected spelling (pyhton -> python) * src/basic_fun.cpp, src/libinit.cpp, NEWS, gdl.kdevelop, gdl.kdevses: INTEGER Keyword for TOTAL (by Erin Sheldon) 2006-06-06 m_schellens * src/gdlc.g, src/GDLLexer.cpp: Fixed U suffix for decimal constants 2006-06-04 m_schellens * gdl.kdevses, src/convert2.cpp: Suppress warning for conversion of null string 2006-05-31 m_schellens * README, gdl.kdevses: Notification for the need of development packages * src/ofmt.cpp: Correct zero padding for I format 2006-05-22 m_schellens * configure, configure.in, gdl.kdevses: Make configure look in additional direcotries fro HDF(4/5) includes and libs 2006-05-19 m_schellens * src/basic_pro.cpp: Raise error for XDR keyword for OPEN procedures * src/plotting.cpp: Fixed XYOUTS [XY]LOG keyword * NEWS, gdl.kdevelop, gdl.kdevses, src/plotting.cpp: sync 2006-05-17 retsil * src/pro/dicom/gdlffdicom__assoc__define.pro, src/pro/dicom/gdlffdicom__define.pro, src/pro/dicom/gdlffdicom__dictionary.pro, src/pro/dicom/gdlffdicom_copy_lun.pro, src/pro/dicom/gdlffdicom_date.pro, src/pro/dicom/gdlffdicom_time.pro, src/pro/dicom/gdlffdicom_trim.pro: Adding code for the GDLffDICOM class. This class reads and writes to DICOM files. 2006-05-16 m_schellens * README, src/initsysvar.cpp: Added GDLffDICOM object * gdl.kdevses, src/gdlgstream.cpp, src/gdlgstream.hpp, src/plotting.cpp, gdl.kdevelop: Joel: fixed \!P.MULTI bug 2006-05-10 m_schellens * src/accessdesc.hpp, configure, Makefile.in, aclocal.m4: removed rank restrictions for struct assignment * src/Makefile.in, src/antlr/Makefile.in, src/gdl.cpp, src/gdlgstream.cpp, src/gdlgstream.hpp, src/plotting.cpp, testsuite/test_suite.pro, configure.in, gdl.kdevelop, ChangeLog, HACKING, INSTALL, NEWS, README, configure: syncing CVS with release 2006-04-05 jomoga * src/gdlgstream.cpp, src/gdlgstream.hpp: Fix color='ff'x bug * src/plotting.cpp: Fix oplot P.MULTI bug/Fix color='ff'x bug 2006-03-31 m_schellens * many changes (ChangeLog incomplete due to CVS server problems) * please see NEWS for an overview GDL 0.8.11: 2005-10-17 m_schellens * AUTHORS, HACKING, INSTALL, NEWS, README, src/basic_pro.cpp: update 2005-10-14 m_schellens * src/arrayindex.hpp: sync 2005-10-13 m_schellens * gdl.kdevelop, src/basic_pro.cpp, src/gdljournal.cpp, src/io.cpp, src/io.hpp: Added F77_UNFORMATTED error message (OPEN) 2005-10-12 m_schellens * src/assocdata.cpp, src/assocdata.hpp, src/envt.hpp, src/arrayindex.hpp: Some bugfixes 2005-10-11 m_schellens * gdl.kdevelop, src/FMTIn.cpp, src/FMTLexer.cpp, src/FMTOut.cpp, src/FMTParser.cpp, src/GDLInterpreter.cpp, src/Makefile.am, src/Makefile.in, src/datatypes.cpp, src/dcompiler.cpp, src/format.g, src/format.in.g, src/format.out.g, src/gdlc.i.g: Fixed: some shadowed variables 2005-10-07 medericboquien * NEWS: Adding GAUSS_PDF and GAUSS_CVF functions 2005-10-05 m_schellens * src/GDLInterpreter.cpp, src/Makefile.in, src/arrayindexlistt.hpp, src/datatypes.hpp, src/dcompiler.cpp, src/fftw.cpp, src/libinit_jmg.cpp, src/math_fun.cpp, config.h.in, configure, configure.in, gdl.kdevelop: Fixed array indexing error 2005-10-04 jomoga * NEWS, configure.in, src/Makefile.in, src/libinit_jmg.cpp: Support for FFTW * src/fftw.cpp, src/fftw.hpp: Initial import 2005-10-03 m_schellens * src/basic_fun_cl.cpp, src/libinit.cpp, src/math_fun.cpp, src/math_fun.hpp, src/new.cpp, src/new.hpp: Added GAUSS_PDF and GAUSS_CVF functions. More precise SYSTIME function 2005-09-30 m_schellens * src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/basic_fun.hpp, src/datatypes.cpp, src/datatypes.hpp, src/libinit.cpp: Added ROTATE function * src/basic_fun.cpp, src/ofmt.hpp: fixed F FORMAT bug * src/arrayindex.cpp, src/arrayindexlistt.hpp, NEWS: fixed array index bug 2005-09-29 m_schellens * src/basic_fun.cpp, src/basic_fun.hpp, src/gdlc.i.g, src/libinit.cpp: Added CREATE_STRUCT function * src/arrayindex.cpp, src/arrayindex.hpp, src/arrayindexlistt.hpp: array index bugfix 2005-09-28 jomoga * src/plotting.cpp: Fix plvpor bug in CONTOUR 2005-09-27 m_schellens * src/arrayindex.cpp: add file * src/GDLTreeParser.hpp, src/Makefile.am, src/Makefile.in, src/arrayindex.hpp, src/arrayindexlistt.hpp, src/basegdl.cpp, src/basegdl.hpp, src/datatypes.cpp, src/datatypes.hpp, src/dnode.hpp, src/dstructgdl.cpp, src/gdlc.i.g, src/gdlc.tree.g, src/GDLInterpreter.cpp, src/GDLTreeParser.cpp: scalar array index optimization 2005-09-26 m_schellens * Makefile.in, aclocal.m4, configure, gdl.kdevses, src/GDLInterpreter.hpp, src/Makefile.in, src/antlr/Makefile.in, src/gdlc.i.g, src/plotting.cpp: Fixed recognition of PLOT,/[XY]LOG keywords 2005-09-24 m_schellens * Makefile.in, aclocal.m4, config.h.in, configure, configure.in, gdl.kdevelop, gdl.kdevses, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/Makefile.in, src/antlr/Makefile.in, src/dinterpreter.cpp, src/extrat.hpp, src/gdlc.i.g, src/initsysvar.cpp: Added DIR system variable 2005-09-22 m_schellens * src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/Makefile.am, src/Makefile.in, src/accessdesc.hpp, src/antlr/Makefile.in, src/arrayindex.hpp, src/arrayindexlistt.hpp, src/assocdata.cpp, src/datatypes.cpp, src/dnode.cpp, src/dstructgdl.cpp, src/gdlc.tree.g, src/typedefs.hpp, Makefile.in, aclocal.m4, configure, gdl.kdevelop: array index optimization 2005-09-20 m_schellens * gdl.kdevses, src/Makefile.in, src/antlr/Makefile.in, src/arrayindex.hpp, src/gdlc.tree.g, src/math_fun.cpp, Makefile.in, aclocal.m4, configure: optimizations * Makefile.in, aclocal.m4, configure, src/Makefile.in, src/antlr/Makefile.in, src/arrayindex.hpp, src/basic_fun.cpp, src/datatypes.cpp, src/dimension.hpp: array index optimization 2005-09-19 m_schellens * src/dimension.hpp: dimension optimization * configure, configure.in, src/envt.cpp, src/envt.hpp, src/extrat.cpp: Subroutine call optimization (EnvT) 2005-09-18 m_schellens * src/dinterpreter.cpp, src/gdl.cpp: Make GDL handle non-tty input. * Makefile.in, aclocal.m4, configure, gdl.kdevelop, gdl.kdevses, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/Makefile.in, src/antlr/Makefile.in, src/arrayindex.hpp, src/basic_fun.cpp, src/basic_pro.cpp, src/dcompiler.cpp, src/dcompiler.hpp, src/dinterpreter.cpp, src/dnode.cpp, src/dnode.hpp, src/dpro.hpp, src/envt.cpp, src/envt.hpp, src/extrat.cpp, src/extrat.hpp, src/gdl.cpp, src/gdlc.i.g, src/gdlc.tree.g: EnvT optimization. Startup file is not prepended with users home anymore. 2005-09-16 m_schellens * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/basegdl.cpp, src/basegdl.hpp, src/basic_pro.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dinterpreter.cpp, src/dpro.cpp, src/dpro.hpp, src/envt.cpp, src/envt.hpp, src/gdlc.g, src/gdlc.i.g, src/gdlc.tree.g, src/libinit.cpp, src/math_fun.cpp: Fixed EXIT_STATUS for SPAWN procedure 2005-09-14 m_schellens * src/GDLInterpreter.cpp, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/basic_op.cpp, src/datatypes.cpp, src/gdlc.tree.g, src/plotting.cpp, src/pro/read_pict.pro: Fixed scalar +(operator) array bug 2005-09-13 m_schellens * src/datatypes.cpp: Fixed problem with New( dim, BaseGDL::INIT) 2005-09-12 m_schellens * configure, src/Makefile.in, src/antlr/Makefile.in, src/basic_fun.cpp, src/libinit.cpp, src/new.cpp, src/new.hpp, Makefile.in, NEWS, aclocal.m4: Fixed bug in COMPLEX(arr,scalar) 2005-09-11 m_schellens * Makefile.in, aclocal.m4, configure, gdl.kdevses, src/Makefile.in, src/antlr/Makefile.in, src/arrayindex.hpp, src/dnode.cpp, src/dnode.hpp, src/gdlc.tree.g: Fixed ^ operator bug. 2005-09-09 jomoga * src/devicex.hpp: Fix closed window core dump * src/math_fun_jmg.cpp: Fix ambiguous sqrt call in radon 2005-09-09 m_schellens * src/GDLInterpreter.cpp, src/arrayindex.hpp, src/basegdl.cpp, src/basegdl.hpp, src/datatypes.cpp, src/datatypes.hpp, src/gdlc.i.g: AssignAt optimization * Makefile.in, aclocal.m4, configure, src/GDLInterpreter.cpp, src/GDLLexer.cpp, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/Makefile.in, src/antlr/Makefile.in, src/arrayindex.hpp, src/basegdl.cpp, src/basegdl.hpp, src/datatypes.cpp, src/datatypes.hpp, src/dnode.cpp, src/gdlc.g, src/gdlc.i.g, src/gdlc.tree.g, src/libinit.cpp, src/math_fun.cpp, src/pro/test_suite.pro: Index optimization 2005-09-08 m_schellens * gdl.kdevelop, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/arrayindex.hpp, src/dinterpreter.cpp, src/dnode.cpp, src/dnode.hpp, src/gdlc.tree.g: comp_assign_expr (+=,*=,...) fix. 2005-09-07 m_schellens * configure, src/GDLInterpreter.cpp, src/datatypes.cpp, src/gdlc.i.g, src/pro/test_suite.pro: NewIx... return statement fix * src/antlr/Makefile.in, Makefile.in, aclocal.m4, configure, configure.in, gdl.kdevelop, gdl.kdevses, src/Makefile.in, src/arrayindex.hpp, src/basic_op.cpp, src/datatypes.cpp: Index optimization * src/GDLInterpreter.cpp, src/accessdesc.hpp, src/arrayindex.hpp, src/assocdata.cpp, src/assocdata.hpp, src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dstructgdl.cpp, src/dstructgdl.hpp, src/gdlc.i.g, src/typedefs.hpp: Indexing optimization. 2005-09-05 m_schellens * NEWS, src/basic_fun.cpp, src/basic_fun.hpp, src/libinit.cpp: STRCMP function * NEWS, src/GDLInterpreter.cpp, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/basic_op.cpp, src/datatypes.cpp, src/dnode.cpp, src/dnode.hpp, src/gdlc.i.g, src/gdlc.tree.g, src/specializations.hpp: unary minus optimization for constants 2005-09-01 m_schellens * Makefile.in, aclocal.m4, configure, gdl.kdevses, src/GDLInterpreter.cpp, src/GDLParser.cpp, src/GDLTreeParser.cpp, src/Makefile.in, src/antlr/Makefile.in, src/arrayindex.hpp, src/basegdl.cpp, src/basegdl.hpp, src/basic_op.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dnode.cpp, src/dstructgdl.hpp, src/gdlc.g, src/gdlc.i.g, src/gdlc.tree.g: Operator optimizations. 2005-08-30 jomoga * src/libinit_jmg.cpp, src/math_fun_jmg.cpp, src/math_fun_jmg.hpp: Add support for RADON function * src/initsysvar.cpp: Add MAP system variable 2005-08-25 m_schellens * gdl.kdevelop, gdl.kdevses, src/basegdl.cpp, src/basegdl.hpp, src/basic_op.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dnode.cpp: Optimize ^ r expressions * src/arrayindex.hpp: array index optimization 2005-08-24 m_schellens * src/basegdl.hpp, src/basic_op.cpp, src/dnode.cpp: Significant speedup for complex^int 2005-08-23 m_schellens * Makefile.in, aclocal.m4, configure, gdl.kdevelop, gdl.kdevses, src/arrayindex.hpp: Fixed array index memory leak * README, src/basic_op.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dnode.cpp, src/dnode.hpp: Avoid copying in r_expr 2005-08-22 m_schellens * src/Makefile.in, src/antlr/Makefile.in, src/dnode.cpp, src/dnode.hpp, src/gdlc.i.g: Avoid copying in r_expr 2005-08-19 m_schellens * src/basic_op.cpp, src/dinterpreter.cpp, src/dnode.cpp, gdl.kdevses: Cleaned up right expression evaluation 2005-08-18 m_schellens * src/GDLInterpreter.cpp, src/GDLTreeParser.cpp, src/basic_fun.cpp, src/dinterpreter.cpp, src/dinterpreter.hpp, src/dnode.cpp, src/dnode.hpp, src/dpro.hpp, src/gdlc.i.g: Introduced heterogenous AST 2005-08-17 m_schellens * src/basic_fun.cpp, src/dinterpreter.cpp, src/dnode.cpp, src/dnode.hpp, src/gdlc.tree.g, gdl.kdevelop: transfer files 2005-08-16 m_schellens * src/GDLInterpreter.cpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/gdlc.g, src/gdlc.i.g, src/pro/test_suite.pro, configure: Fixed || operator bug * configure, configure.in: FC4 complicance for netCDF HDF4 and Magick * INSTALL, Makefile.in, NEWS, README, aclocal.m4, configure, src/GDLInterpreter.cpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/Makefile.in, src/antlr/Makefile.in, src/gdlc.g, src/print_tree.cpp: Fixed LOG_NEG (~) operator syntax bug. 2005-08-14 m_schellens * src/arrayindex.hpp, src/basic_fun.cpp, src/datatypes.cpp, src/datatypes.hpp, gdl.kdevelop, gdl.kdevses, src/basegdl.cpp, src/basegdl.hpp, src/dstructgdl.hpp, src/specializations.hpp: WHERE optimization 2005-08-11 m_schellens * src/Makefile.in, src/antlr/Makefile.in, src/arrayindex.hpp, src/datatypes.cpp, Makefile.in, aclocal.m4, configure, gdl.kdevses, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/accessdesc.hpp, src/dcompiler.cpp, src/dcompiler.hpp, src/dnode.cpp, src/dnode.hpp, src/gdlc.i.g, src/gdlc.tree.g: Array index optimization 2005-08-09 m_schellens * src/arrayindex.hpp, src/datatypes.cpp, src/dimension.hpp, src/dstructgdl.cpp, src/initct.cpp: Optimization for InsAt (b[0]=a) * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/Makefile.in, src/antlr/Makefile.in, src/arrayindex.hpp, src/datatypes.cpp, src/dcompiler.cpp, src/gdlc.i.g, configure, Makefile.in, aclocal.m4: Avoid extra copying in replace assignment 2005-08-07 m_schellens * src/antlr/Makefile.in, src/gdlc.g, src/gdlc.i.g, src/gdlc.tree.g, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/Makefile.in, src/basic_op.cpp, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, configure.in, gdl.kdevses, configure, Makefile.in, aclocal.m4: Avoid additional copy in replace assignment 2005-08-05 m_schellens * src/plotting.cpp, src/dpro.cpp, gdl.kdevses: Fixed AXIS bug 2005-08-03 jomoga * src/plotting.cpp: Fix plot/oplot/erase bugs 2005-07-29 m_schellens * src/dpro.cpp, src/gdlc.i.g, gdl.kdevses, src/GDLInterpreter.cpp: Fixed bug which made GDL crash on empty subroutines 2005-07-27 jomoga * src/libinit.cpp, src/plotting.hpp, src/plotting.cpp: Preliminary version of CONTOUR 2005-07-26 m_schellens * src/format.g, src/plotting.cpp: Fixed PLOT/OPLOT no erase bug. 2005-07-25 jomoga * src/devicex.hpp: Fix memory leak in plimage_gdl 2005-07-25 m_schellens * src/pro/regression-total.pro, src/FMTLexer.cpp, src/format.g: Fixed H format code. * src/pro/dist.pro, src/pro/kurtosis.pro, src/pro/mean.pro, src/pro/meanabsdev.pro, src/pro/moment.pro, src/pro/skewness.pro, src/pro/stddev.pro, src/pro/strsplit.pro, src/pro/variance.pro, NEWS: NAN keyword for MOMENT related functions. * src/Makefile.in, src/antlr/Makefile.in, src/basic_fun.cpp, src/basic_pro.cpp, src/basic_pro.hpp, src/dimension.hpp, src/gdljournal.cpp, src/initsysvar.cpp, configure, Makefile.in, aclocal.m4: Added keywords: NAN for TOTAL, STRUCTURES fro HELP. Small correction for JOUNRAL. 2005-07-21 jomoga * src/plotting.cpp: Fix xrange plot bug 2005-07-14 m_schellens * src/default_io.cpp, src/io.hpp, gdl.kdevelop, gdl.kdevses: EOF function: EOF status was not reset properly. Fixed. 2005-07-12 m_schellens * src/pro/primes.pro: file removal * README: Update HDF5 and netCDF problems. * src/hdf5_fun.cpp, gdl.kdevelop, gdl.kdevses: Compliance with HDF 1.6.4 2005-07-12 c_lee * src/pro/poly.pro: POLY function to calculate polynomials 2005-07-10 m_schellens * src/gsl_fun.cpp, gdl.kdevelop, gdl.kdevses: Fixed INTERPOLATE bug. * src/Makefile.in, src/antlr/Makefile.in, src/basic_pro.cpp, gdl.kdevelop, gdl.kdevses, configure, Makefile.in, aclocal.m4: Fixed HELP,/LIB: number of printed functions. GDL 0.8.10: 2005-07-08 m_schellens * INSTALL: INSTALL update * src/basic_op.cpp: POW optimization 2005-07-07 m_schellens * src/basic_op.cpp: Changed raise to power calculation for integral types * src/antlr/Makefile.in, src/basic_op.cpp, src/convert2.cpp, src/default_io.cpp, src/gdlc.i.g, src/initsysvar.cpp, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/Makefile.am, src/Makefile.in, configure.in, configure, INSTALL, Makefile.in, PYTHON.txt, README, aclocal.m4: Fixed inconistency with return type of ^ operator for integer types 2005-07-06 m_schellens * src/basic_fun_jmg.cpp, src/dstructdesc.hpp: VALUE keyword for MAKE_ARRAY. 2005-07-05 m_schellens * src/basic_fun_cl.cpp: Extensions to LEGENDRE. Fixed memory leaks 2005-07-03 m_schellens * gdl.kdevelop, gdl.kdevses, src/ncdf_var_cl.cpp: remove some diagnostic prints. 2005-07-02 m_schellens * src/libinit_cl.cpp, src/magick_cl.cpp: 4 parameters for NCDF_ATTPUT. Fixed memory leak in magick_writeColorTable * src/antlr/Makefile.in, src/plotting.cpp, src/pythongdl.cpp, src/Makefile.in, src/magick_cl.cpp, src/ofmt.hpp, gdl.kdevelop, gdl.kdevses, configure, Makefile.in, aclocal.m4: avoid linker error under OS X 2005-07-01 jomoga * src/gsl_fun.cpp: Fix memory leak in INTERPOLATE 2005-07-01 m_schellens * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/dinterpreter.cpp, src/gdlc.i.g, gdl.kdevses: Code refactorization * src/convert2.cpp: double to string conversion * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/arrayindex.hpp, src/dinterpreter.hpp, src/gdlc.g, src/gdlc.i.g, src/gdlc.tree.g, src/includefirst.hpp, src/pro/test_suite.pro, NEWS, config.h.in, configure, configure.in: stride index support ([n:n:n]) 2005-06-29 jomoga * src/plotting.cpp: Support for YNOZERO 2005-06-29 m_schellens * src/gdlc.i.g, src/GDLInterpreter.cpp, src/arrayindex.hpp, src/datatypes.cpp, src/dnode.cpp, src/dnode.hpp, src/dstructgdl.cpp, NEWS, gdl.kdevses: move ConvertAST to source file. Fixed arrayindex list BuildIx memory leak. 2005-06-28 jomoga * src/devicex.hpp, src/devicez.hpp, src/gdlzstream.cpp, src/gdlzstream.hpp, src/graphics.hpp, src/plotting.cpp, src/plotting.hpp: Support for additional plotting keywords and COLORBAR * src/libinit.cpp: Added AXIS,ERASE routines * src/gsl_fun.cpp: interpolation scalar bug fix 2005-06-28 m_schellens * src/print.cpp, src/print_tree.cpp, src/print_tree.hpp: PRINT, correction. * src/GDLInterpreter.hpp, src/GDLTreeParser.cpp, src/arrayindex.hpp, src/basic_fun.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dcompiler.cpp, src/dcompiler.hpp, src/dinterpreter.cpp, src/dinterpreter.hpp, src/dnode.cpp, src/dnode.hpp, src/dpro.cpp, src/dpro.hpp, src/dstructgdl.hpp, src/envt.cpp, src/envt.hpp, src/gdlc.i.g, src/gdlc.tree.g, src/gdlexception.cpp, src/gdlexception.hpp, src/objects.cpp, src/GDLInterpreter.cpp: ProgNode type for interpreter. 2005-06-21 m_schellens * src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLTreeParser.cpp, src/Makefile.in, src/antlr/Makefile.in, src/dinterpreter.cpp, src/gdlc.g, configure.in, Makefile.in, aclocal.m4, configure: Make .RUN handle files without subroutine. 2005-06-20 m_schellens * src/dinterpreter.cpp, src/pythongdl.cpp, configure.in, gdl.kdevelop, gdl.kdevses, configure, Makefile.in, README, aclocal.m4: python module 2005-06-17 m_schellens * src/dinterpreter.cpp, src/dinterpreter.hpp, src/envt.cpp, src/print.cpp, src/pythongdl.cpp: python module 2005-06-16 m_schellens * src/antlr/Makefile.in, src/datatypes.hpp, src/Makefile.in: GCC 4.0 compliancy * src/datatypes.cpp, src/gdlc.tree.g, src/gdlexception.hpp, src/gdlpython.cpp, src/gdlpython.hpp, src/pythongdl.cpp, src/topython.cpp: python module 2005-06-15 m_schellens * src/Makefile.am, src/Makefile.in, src/antlr/Makefile.am, src/antlr/Makefile.in, src/cformat.g, src/dpro.hpp, src/format.g, src/format.in.g, src/format.out.g, src/gdl.cpp, src/gdlc.i.g, src/gdljournal.cpp, src/gdlpython.cpp, src/includefirst.hpp, src/print_tree.cpp, src/pythongdl.cpp, src/sigfpehandler.hpp, src/CFMTLexer.cpp, src/FMTIn.cpp, src/FMTIn.hpp, src/FMTLexer.cpp, src/FMTLexer.hpp, src/FMTOut.cpp, src/FMTOut.hpp, src/FMTParser.cpp, src/FMTParser.hpp, src/GDLInterpreter.cpp, configure.in, gdl.kdevses, ltmain.sh, Makefile.in, config.guess, config.sub, configure: python module 2005-06-13 m_schellens * src/dinterpreter.cpp: .R equivalent to .RUN 2005-06-10 m_schellens * src/gdlpython.cpp, gdl.kdevelop, gdl.kdevses, Doxyfile, src/envt.cpp, src/extrat.cpp, src/file.cpp, src/format.in.g, src/gdl.cpp, src/gdleventhandler.cpp, src/gdlexception.cpp, src/gdlgstream.cpp, src/gdlpsstream.cpp, src/gdlwidget.cpp, src/gdlwinstream.cpp, src/gdlxstream.cpp, src/gdlzstream.cpp, src/getfmtast.cpp, src/graphics.cpp, src/gsl_fun.cpp, src/hdf5_fun.cpp, src/hdf_fun.cpp, src/hdf_pro.cpp, src/image.cpp, src/includefirst.hpp, src/initct.cpp, src/initsysvar.cpp, src/io.cpp, src/libinit.cpp, src/libinit_cl.cpp, src/libinit_jmg.cpp, src/libinit_mes.cpp, src/magick_cl.cpp, src/math_fun.cpp, src/math_fun_jmg.cpp, src/math_utl.cpp, src/ncdf_att_cl.cpp, src/ncdf_cl.cpp, src/ncdf_dim_cl.cpp, src/ncdf_var_cl.cpp, src/objects.cpp, src/plotting.cpp, src/print.cpp, src/read.cpp, src/sigfpehandler.cpp, src/str.cpp, src/typedefs.hpp, src/typetraits.cpp, src/widget.cpp, src/FMTIn.cpp, src/FMTIn.hpp, src/assocdata.cpp, src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/basic_fun_cl.cpp, src/basic_fun_jmg.cpp, src/basic_pro.cpp, src/basic_pro_jmg.cpp, src/convert2.cpp, src/datatypes.cpp, src/dcommon.cpp, src/dcompiler.cpp, src/dinterpreter.cpp, src/dnode.cpp, src/dpro.cpp, src/dpro.hpp, src/dstructdesc.cpp, src/dstructgdl.cpp, src/dvar.cpp, configure.in, config.h.in, configure: python module 2005-06-06 m_schellens * src/FMTIn.cpp, src/FMTIn.hpp, src/format.in.g: Fixed READS 'z' format code bug. 2005-06-03 m_schellens * src/basic_fun.cpp, src/basic_fun_cl.cpp, src/gdlc.i.g, src/GDLInterpreter.cpp, configure: Fixed return from FOR bug. 2005-06-01 m_schellens * src/devicex.hpp, src/envt.cpp, src/envt.hpp, src/graphics.hpp, src/libinit.cpp, src/plotting.cpp, src/plotting.hpp: DEVICE,GET_DECOMPOSED. Consistent using CHARSIZE as float (instead of double). 2005-05-31 m_schellens * src/pro/loadct.pro, src/devicex.hpp, src/graphics.cpp, src/graphics.hpp, src/image.cpp, src/libinit_jmg.cpp: common block COLORS for LOADCT * src/image.cpp, config.h.in, configure, configure.in: remove wxWidgets from configure script. * src/pro/lmgr.pro, src/Makefile.am, src/Makefile.in, src/gdlwidget.cpp, src/gdlwidget.hpp, src/graphics.cpp, src/graphics.hpp, src/image.cpp, src/libinit_jmg.cpp, src/widget.cpp, configure.in, gdl.kdevses, config.h.in, configure: LMGR function. 2005-05-24 jomoga * src/gsl_fun.cpp, src/gsl_fun.hpp, src/libinit_jmg.cpp: Initial version of INTERPOLATE 2005-05-12 m_schellens * src/default_io.cpp, src/ifmt.cpp, src/io.hpp, README: Fixed input and eof detection. 2005-05-10 m_schellens * src/devicex.hpp: Second parameter for TV. 2005-05-09 m_schellens * src/arrayindex.hpp, src/envt.cpp, src/plotting.cpp: Removed BACKGROUND keyword check from XYOUTS. * src/accessdesc.hpp, src/arrayindex.hpp, src/datatypes.cpp, src/devicex.hpp, src/dstructgdl.cpp: Set AllIxT to valarray. * src/GDLInterpreter.cpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/gdlc.g: Allow BREAK, CONTINUE as identifiers. 2005-04-30 c_lee * src/plotting.cpp, src/plotting.hpp: more refactoring (xyouts) * src/plotting.cpp, src/plotting.hpp: refactored to common plot subroutines (crange, type) * src/plotting.cpp, src/plotting.hpp: refactored to common plot subroutines (color, background, symsize,psym, line) * src/datatypes.hpp: include cassert 2005-04-28 jomoga * src/gdlxstream.hpp, src/devicex.hpp: TV writes to off-screen window 2005-04-28 m_schellens * NEWS, src/gdlc.i.g, src/math_fun.cpp, src/pro/appleman.pro, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/accessdesc.hpp, src/arrayindex.hpp, src/basegdl.hpp, src/basic_fun_cl.cpp, src/basic_op.cpp, src/convert2.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dstructgdl.cpp, ChangeLog, INSTALL, README: Optimization for complex (pow, abs). Non-copy constants 2005-04-22 m_schellens * src/basic_pro.cpp, src/datatypes.cpp, src/dinterpreter.cpp, src/dinterpreter.hpp, src/gdl.cpp, src/math_fun_jmg.cpp, src/pro/test_suite.pro, ChangeLog, NEWS: OS X compilance. GDL 0.8.9: 2005-04-21 m_schellens * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/dcompiler.cpp, src/dinterpreter.cpp, src/dinterpreter.hpp, src/dpro.cpp, src/dpro.hpp, src/gdlc.i.g, src/gdleventhandler.cpp, src/pro/test_suite.pro, ChangeLog: Added .RUN command. 2005-04-20 jomoga * src/libinit_jmg.cpp, src/basic_pro_jmg.hpp, src/basic_pro_jmg.cpp: Added WAIT procedure 2005-04-20 m_schellens * src/dcompiler.cpp, src/dcompiler.hpp, src/dpro.hpp, src/gdlc.tree.g, src/GDLTreeParser.cpp: correct common blocks and gotos for command line. 2005-04-19 m_schellens * src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/dcompiler.cpp, src/devicez.hpp, src/dinterpreter.cpp, src/dinterpreter.hpp, src/dpro.hpp, src/gdl.cpp, src/gdlc.g, src/gdlc.tree.g, src/gdlzstream.hpp, src/GDLInterpreter.cpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp: Accept main programs. * src/gdlgstream.cpp, src/gdlgstream.hpp, src/gdlzstream.hpp: plplot mem driver eop() workaround. 2005-04-18 m_schellens * src/devicex.hpp, src/basic_op.cpp, src/deviceps.hpp, src/devicewin.hpp, src/devicez.hpp, src/graphics.hpp, src/image.cpp, src/libinit.cpp, src/plotting.cpp, src/plotting.hpp, src/sigfpehandler.cpp, ChangeLog: Fixed MOD 0 bug. 2005-04-15 m_schellens * src/devicez.hpp, gdl.kdevses: Fixed SetResolution bug. 2005-04-14 m_schellens * src/devicez.hpp, src/image.cpp: Fixed TV for z-buffer device. * src/devicez.hpp, src/Makefile.in, src/deviceps.hpp, src/devicex.hpp, src/gdlzstream.cpp, src/gdlzstream.hpp, src/graphics.cpp, src/graphics.hpp, src/image.cpp, src/libinit.cpp, src/plotting.cpp, src/Makefile.am: Added z-buffer device. 2005-04-13 m_schellens * src/devicex.hpp, src/graphics.hpp, src/libinit.cpp, src/plotting.cpp: DECOMPOSED keyword for DEVICE. * src/gstream.hpp, src/gdlgstream.cpp: Fix for multiple plots in one window. 2005-04-12 m_schellens * src/GDLInterpreter.cpp, src/gdlc.i.g: Line number output for interrupts (cntrl-c). 2005-04-11 m_schellens * src/pro/test_suite.pro, src/deviceps.hpp, src/devicewin.hpp, src/gdlc.i.g, src/gdlgstream.cpp, src/gdlgstream.hpp, src/plotting.cpp, src/GDLInterpreter.cpp: Fixed OPLOT, PLOTS for /DEVICE, /NORMAL. Code cleanup. 2005-04-09 m_schellens * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/gdlc.i.g: Avoid copying for indexed expressions. 2005-04-07 m_schellens * src/FMTOut.cpp, src/FMTParser.cpp, src/format.g, src/format.out.g: Fixed format-code 'x' bug. 2005-04-06 m_schellens * ChangeLog, src/image.cpp: Proper multi-plot handling for TV. 2005-04-05 jomoga * src/image.cpp: Compatible with PLPLOT-5.5.0 2005-04-05 m_schellens * src/basic_pro.cpp, src/libinit.cpp, ChangeLog: NTOHL, NTOHS, HTONL, HTONS keywords to BYTEORDER. 2005-04-04 m_schellens * src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dstructgdl.hpp, src/libinit.cpp, src/specializations.hpp: NAN keyword for MAX, MIN, BYTSCL. SUBSCRIPT_MIN/MAX for MAX/MIN. 2005-04-01 m_schellens * src/dcompiler.cpp: Fix: Allowed x=x(0) for a function x (defined in x.pro). 2005-03-31 m_schellens * src/dcompiler.cpp: Fix: Allowed x=x(0) for a function x. * src/image.cpp: Removed debug output. * src/GDLInterpreter.cpp, src/basic_fun_jmg.cpp, src/dcompiler.cpp, src/gdlc.tree.g, src/image.cpp: Allowed x=x(0) for a function x (defined in x.pro). 2005-03-30 m_schellens * gdl.kdevses, src/image.cpp: Fixed TV bug. 2005-03-29 m_schellens * gdl.kdevses, src/gdlgstream.cpp, src/plotting.cpp: plplot 5.5.0 compatibility. 2005-03-24 jomoga * src/image.cpp: Fix orientation bug in TVRD 2005-03-24 m_schellens * src/devicex.hpp, src/gdlgstream.cpp, src/gdlgstream.hpp, src/plotting.cpp: Constant charsize for graphics. 2005-03-23 jomoga * src/image.cpp: Fix orientation bug in TV 2005-03-23 m_schellens * src/pro/test_suite.pro, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/gdl.cpp, src/gdlc.i.g, src/gsl_fun.cpp, README: Fixed braced (r)expr bug. 2005-03-22 m_schellens * src/basic_fun.cpp, HACKING, README, gdl.kdevses: ULONARR, LON64ARR, ULON64ARR bugfix. 2005-03-21 jomoga * src/image.hpp, src/image.cpp: Support for TRUE keyword in TV 2005-03-21 c_lee * src/basic_fun_jmg.cpp: CL: update make_array to use TYPE keyword and sorted argument precendence (fixed) * src/basic_fun_jmg.cpp: CL: update make_array to use TYPE keyword and sorted argument precendence 2005-03-19 m_schellens * src/gsl_fun.cpp: Fixed RANDOM bug. 2005-03-18 m_schellens * src/plotting.cpp: PLOT: POSITION keyword. 2005-03-17 m_schellens * src/arrayindex.hpp, src/basic_pro.cpp, src/datatypes.cpp, src/datatypes.hpp, src/dstructgdl.cpp, src/dstructgdl.hpp, src/gdl.cpp, src/libinit.cpp, src/pro/test_suite.pro, configure, configure.in: Fixed assignment bug. * src/basic_fun.cpp: Fixed ASSOC bug. 2005-03-16 jomoga * src/basic_fun_jmg.cpp: Set FLOAT as default for make_array 2005-03-16 m_schellens * src/basic_fun.cpp, src/libinit.cpp: Sorted libFunList and libProList. * src/GDLInterpreter.cpp, src/gdlc.i.g, ChangeLog: Fixed interpreter memory leak. 2005-03-15 m_schellens * src/pro/test_suite.pro, src/GDLInterpreter.cpp, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/gdlc.g, src/gdlc.i.g, src/gdlc.tree.g: Cleaned up compiler/interpreter. * src/pro/dist.pro, src/pro/tvscl.pro, src/gdlc.tree.g, src/GDLTreeParser.cpp: Add dist.pro and tvscl.pro 2005-03-14 m_schellens * src/pro/test_suite.pro, src/gdlc.tree.g, src/GDLTreeParser.hpp, src/dcompiler.cpp, src/dinterpreter.cpp, src/gdlc.g, src/gdlc.i.g, src/GDLParser.cpp, src/GDLTreeParser.cpp, src/GDLInterpreter.hpp, src/GDLLexer.cpp, src/GDLInterpreter.cpp: Allow assignment for parameters/keywords. 2005-03-13 m_schellens * src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/dcompiler.cpp, src/dinterpreter.cpp, src/gdlc.g, src/gdlc.i.g, src/gdlc.tree.g, src/GDLInterpreter.cpp, gdl.kdevses, gdl.kdevelop, src/pro/test_suite.pro, src/dcommon.cpp, src/dcommon.hpp, src/dcompiler.hpp, src/dpro.hpp, src/envt.cpp, src/envt.hpp: maintenance. 2005-03-10 m_schellens * src/pro/test_suite.pro, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/basegdl.hpp, src/dnode.hpp, src/gdlc.g, src/gdlc.i.g, src/gdlc.tree.g, src/gdlexception.hpp, src/gdlpython.cpp, src/print_tree.cpp, gdl.kdevses: Allow braced indexed expressions as l-values. Line number info. 2005-03-08 m_schellens * src/basic_fun.hpp, src/basic_fun_jmg.cpp, src/libinit.cpp, src/pro/test_suite.pro, src/GDLInterpreter.cpp, src/basic_fun.cpp, ChangeLog: Added TEMPORARY function. * src/pro/test_suite.pro, src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/basic_fun.cpp, src/datalistt.hpp, src/dstructgdl.hpp, src/envt.hpp, src/gdlc.i.g: Allow library functions as l-functions. Fixed REPLICATE for structs. 2005-03-07 m_schellens * src/pro/test_suite.pro, src/GDLInterpreter.cpp, src/datalistt.hpp, src/envt.hpp, src/gdlc.i.g, src/print.cpp: Return reference variable via library function (/OVERWRITE) now works. * src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/basic_fun.cpp, src/dinterpreter.cpp, src/gdlc.g, src/gdlc.tree.g, src/GDLInterpreter.cpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp: Made RETURN not a reserved word. 2005-03-06 messmer * src/print.cpp: Removed '\n' if the last element to print is a scalar null string (''). * src/basic_fun.cpp: arr was limited to n scalar arguments to specify the array dimension. IDL, however, also allows a single array-valued argument. This little patch should enable now stuff like a = indgen([2,3]) or a =[[1,2],[3,4]] & print, reform(a, [1,4]). 2005-03-03 m_schellens * src/basic_fun.cpp, src/basic_fun.hpp, src/datatypes.cpp, src/libinit.cpp, ChangeLog, HACKING: Add ROUTINE_INFO. 2005-03-01 jomoga * src/libinit_jmg.cpp: Added UNIFORM keyword RANDOMU/RANDOMN 2005-03-01 m_schellens * src/gsl_fun.cpp, ChangeLog: Corrected RANDOMU/N. * src/gsl_fun.cpp: New RANDOMU/N keywords. 2005-02-28 m_schellens * src/dpro.hpp, src/envt.cpp, src/gsl_fun.cpp, src/dpro.cpp: Functionality for warn keywords. * src/gsl_fun.cpp, configure.in, configure: Cosmetic change. 2005-02-27 jomoga * src/libinit_jmg.cpp, src/dinterpreter.cpp, src/dinterpreter.hpp, src/math_fun_jmg.hpp, src/math_fun_jmg.cpp: Support for CHECK_MATH 2005-02-25 c_lee * src/basic_fun_cl.cpp, src/libinit_cl.cpp: adding warnings for IGAMMA unsupported keywords 2005-02-25 m_schellens * src/dpro.cpp, src/dpro.hpp: Added warn keyword list. * src/dcompiler.cpp, src/dcompiler.hpp: Corrected common block handling of compiler. 2005-02-25 jomoga * src/math_fun_jmg.cpp: Support for DOUBLE keyword in MACHAR * src/libinit_jmg.cpp, src/gsl_fun.hpp, src/gsl_fun.cpp: Improved support of RANDOMU, RANDOMN 2005-02-24 m_schellens * src/basic_fun.cpp, TODO: Add all keywords to INDGEN. * src/pro/test_suite.pro, src/dcommon.cpp, src/dcompiler.cpp, src/dcompiler.hpp, src/dinterpreter.cpp, src/dpro.cpp, src/dpro.hpp, src/envt.cpp, src/gdl.cpp, src/libinit_jmg.cpp, src/math_fun_jmg.cpp, src/math_utl.cpp, src/math_utl.hpp, src/objects.cpp, src/str.hpp: Allow multiple common blocks in one subroutine. 2005-02-24 c_lee * src/basic_fun_cl.cpp, src/basic_fun_cl.hpp, src/libinit_cl.cpp: Fixed keywords in IGAMMA and BETA, commented out unsupported keywordsin IGAMMA. added DOUBLE keyword to BETA 2005-02-22 m_schellens * src/pro/factorial.pro, src/pro/swap_endian.pro: Add SWAP_ENDIAN, FACTORIAL * src/math_fun_jmg.cpp, ChangeLog: Update ChangeLog. Some small improvements. * src/math_fun.cpp, src/sigfpehandler.cpp, src/sigfpehandler.hpp, src/Makefile.am, src/Makefile.in, src/basic_fun_cl.cpp, src/basic_op.cpp, src/basic_pro.cpp, src/devicex.hpp, src/gdl.cpp, src/gdlgstream.cpp, src/gdlgstream.hpp, src/gdlxstream.cpp, src/gdlxstream.hpp, src/image.cpp, src/initsysvar.cpp, configure.in, configure: SIGFPE handler. 2005-02-21 jomoga * src/libinit.cpp: Add TYPE keyword to FIX * src/libinit_jmg.cpp: Add TVRD & FINITE * src/basic_fun.cpp: Support for TYPE keyword in FIX * src/math_fun_jmg.hpp, src/math_fun_jmg.cpp: Support for FINITE function * src/image.hpp, src/image.cpp: Support for TVRD 2005-02-18 m_schellens * src/Makefile.in, src/antlr/Makefile.in, src/basic_op.cpp, src/pro/test_suite.pro, configure, Makefile.in, aclocal.m4: Fixed # operator (1D # 2D). 2005-02-17 m_schellens * src/basic_pro.cpp, src/basic_pro.hpp, src/dinterpreter.cpp, src/libinit.cpp, src/topython.cpp, ChangeLog, INSTALL, README, gdl.kdevses: Add SPAWN procedure. 2005-02-15 m_schellens * src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/basic_fun.cpp, src/gdlc.g, src/GDLInterpreter.cpp, README: Allow leading '!' also in struct names. GDL 0.8.8: 2005-02-14 m_schellens * src/GDLInterpreter.cpp, src/GDLInterpreter.hpp, src/GDLInterpreterTokenTypes.hpp, src/GDLInterpreterTokenTypes.txt, src/GDLLexer.cpp, src/GDLLexer.hpp, src/GDLParser.cpp, src/GDLParser.hpp, src/GDLTokenTypes.hpp, src/GDLTokenTypes.txt, src/GDLTreeParser.cpp, src/GDLTreeParser.hpp, src/GDLTreeParserTokenTypes.hpp, src/GDLTreeParserTokenTypes.txt, src/basic_fun.cpp, src/default_io.cpp, src/gdlc.g, src/gdlc.tree.g, ChangeLog, README: Widen rules for struct tag names to allow a leading '!'. * src/GDLLexer.cpp, src/basegdl.cpp, src/basegdl.hpp, src/basic_fun.cpp, src/basic_fun.hpp, src/basic_pro.cpp, src/basic_pro.hpp, src/datatypes.cpp, src/datatypes.hpp, src/default_io.cpp, src/dinterpreter.cpp, src/gdlc.g, src/libinit_mes.cpp, src/ofmt.hpp, ChangeLog, README: Include subroutines by Peter Messmer. 2005-02-12 jomoga * src/image.cpp, src/libinit_jmg.cpp: X,Y support for TV 2005-02-10 m_schellens * ChangeLog, gdl.kdevses: ChangeLog update. * src/GDLInterpreter.hpp, src/GDLLexer.cpp, src/dinterpreter.cpp, src/gdlc.g, src/gdlc.i.g, src/str.cpp, src/str.hpp: made @ honor !PATH * src/Makefile.in, src/antlr/Makefile.in, src/default_io.cpp, src/dstructdesc.cpp, src/dstructdesc.hpp, src/dstructgdl.cpp, src/dstructgdl.hpp, src/extrat.cpp, src/gdlc.i.g, src/ifmt.cpp, src/initsysvar.cpp, src/ncdf_att_cl.cpp, src/ofmt.cpp, src/typetraits.cpp, src/typetraits.hpp, src/GDLInterpreter.cpp, configure.in, gdl.kdevses, configure, ChangeLog, Makefile.in, aclocal.m4: Changed handling of unnamed struct descriptors. 2005-02-08 jomoga * src/gsl_fun.hpp, src/gsl_fun.cpp: Improved FFT routine; OMIN,OMAX keyword support HISTOGRAM 2005-02-08 m_schellens * src/plotting.cpp: Fixed TVLCT bug. 2005-02-03 m_schellens * src/antlr/Makefile.in, src/Makefile.in, src/basic_op.cpp, src/convol.cpp, src/convol_inc0.cpp, src/convol_inc1.cpp, src/convol_inc2.cpp, src/datatypes.cpp, src/ofmt.cpp, aclocal.m4, configure, ChangeLog, Makefile.in: g++ 3.4 compliance 2005-01-29 c_lee * src/antlr/Makefile.in, src/Makefile.in, src/libinit.cpp, src/plotting.cpp, aclocal.m4, configure, Makefile.in: Added NOCLIP support to PLOTS/OPLOT. Added XYOUTS command with support for COLOR, ORIENTATION, ALIGNMENT,CHARSIZE,CLIP,DEVICE,DATA,COLOR. Also supports array format for COLOR, ORIENTATION keywords, and X, Y, STRING arguments. Does not support the pseudo line continuation using only 1 argument. 2005-01-26 m_schellens * src/GDLInterpreter.cpp, src/basic_fun.cpp, src/basic_fun.hpp, src/basic_fun_jmg.cpp, src/basic_op.cpp, src/datalistt.hpp, src/datatypes.cpp, src/envt.hpp, src/extrat.cpp, src/gdlc.i.g, src/libinit.cpp, ChangeLog: Fixed OR and AND bug. Fixed lib function /OVERWRITE bug. 2005-01-20 m_schellens * src/basic_fun.hpp, src/basic_fun_jmg.cpp, src/basic_pro.cpp, src/basic_pro.hpp, src/libinit.cpp, src/basic_fun.cpp, ChangeLog: Added SWAP_ENDIAN and BYTEORDER. Fixed /OVERWRITE bug in REFORM. 2005-01-19 m_schellens * src/GDLInterpreter.cpp, src/basic_fun.cpp, src/basic_fun.hpp, src/datatypes.hpp, src/dstructdesc.cpp, src/dstructgdl.cpp, src/gdlc.i.g, src/libinit.cpp, ChangeLog, INSTALL, README: Added OBJ_ISA. Changed struct compatibility checking. 2005-01-18 m_schellens * src/basic_fun.cpp, src/basic_fun.hpp, src/dstructdesc.hpp, src/libinit.cpp: Added OBJ_CLASS function. 2005-01-17 m_schellens * src/GDLTreeParser.cpp, src/basic_op.cpp, src/default_io.cpp, src/gdlc.tree.g, src/libinit.cpp, src/plotting.cpp: fixed bug concerning braced variables passed by reference; added PLOTS procedure (2D only) 2005-01-14 m_schellens * src/plotting.cpp, src/libinit_cl.cpp, gdl.kdevses: re-insert JOURNAL into lib procedure list, removed diagnostic message in OPLOT 2004-12-14 m_schellens * src/basic_fun_cl.cpp: small corrections. * src/basic_fun_cl.cpp, src/basic_fun_cl.hpp, src/initsysvar.cpp, src/initsysvar.hpp, src/libinit_cl.cpp, src/plotting.cpp, ChangeLog: added LEGENDRE, IGAMMA, LNGAMMA and BETA functions from cl 2004-12-09 m_schellens * ALL FILES Initial import. gdl-0.9.4/src/0000775000175000017500000000000012221570137011511 5ustar marcmarcgdl-0.9.4/src/cformat.g0000664000175000017500000001114012162632107013311 0ustar marcmarc/* ************************************************************************* cformat.g - parser for GDL format strings ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@hotmail.com ***************************************************************************/ /* ************************************************************************* * * * 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. * * * ***************************************************************************/ header "pre_include_cpp" { #include "includefirst.hpp" #include } header { #include "antlr/TokenStreamSelector.hpp" // using namespace antlr; } options { language="Cpp"; genHashLines = false; namespaceStd="std"; // cosmetic option to get rid of long defines namespaceAntlr="antlr"; // cosmetic option to get rid of long defines } // the C-Format Lexer ********************************************* class CFMTLexer extends Lexer; options { charVocabulary = '\3'..'\377'; caseSensitive=true ; testLiterals =true; caseSensitiveLiterals=false; exportVocab=CFMT; k=2; defaultErrorHandler = false; // defaultErrorHandler = true; } { private: antlr::TokenStreamSelector* selector; bool doubleQuotes; bool format; public: void SetSelector( antlr::TokenStreamSelector& s) { selector = &s; } void DoubleQuotes( bool dQ) { doubleQuotes = dQ; format=false; } } ALL : { format}? ( ( ( CD { $setType(CD);} | CE { $setType(CE);} | CI { $setType(CI);} | CF { $setType(CF);} | CG { $setType(CG);} | CO { $setType(CO);} | CB { $setType(CB);} | CS { $setType(CS);} | CX { $setType(CX);} | CZ { $setType(CZ);} ) { format = false;} ) | CNUMBER { $setType(CNUMBER);} | CDOT { $setType(CDOT);} | CWS { _ttype=antlr::Token::SKIP; } ) | CSTR { $setType(CSTR);} ; protected CSTR : { doubleQuotes}? ( CSTR1 ( '\"'! { selector->pop();} | '%'! { format = true;} ) ) | ( CSTR2 ( '\''! { selector->pop();} | '%'! { format = true;} ) ) ; protected CSTR1 : ( '%'! '%' | ESC | ~('%' | '\"' | '\\'))* ; protected CSTR2 : ( '%'! '%' | ESC | ~('%' | '\'' | '\\'))* ; protected ESC : '\\'! ( ('a'|'A')! { $setText( "\7");} | ('b'|'B')! { $setText( "\b");} | ('f'|'F')! { $setText( "\f");} | ('n'|'N')! { $setText( "\n");} | ('r'|'R')! { $setText( "\r");} | ('t'|'T')! { $setText( "\t");} | ('v'|'V')! { $setText( "\13");} | OCTESC | ('x'|'X')! HEXESC | ~('a'|'A'|'b'|'B'|'f'|'F'|'n'|'N'|'r'|'R'|'t'|'T'|'v'|'V'| '0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'x'|'X') // just insert ) ; protected OCTESC : ODIGIT (options {greedy=true;}: ODIGIT (options {greedy=true;}: ODIGIT)?)? { std::string s = $getText; char c = static_cast(strtoul(s.c_str(),NULL,8)); $setText( c); } ; protected ODIGIT: ('0'..'7'); protected HEXESC : HDIGIT (options {greedy=true;}: HDIGIT)? { std::string s = $getText; char c = static_cast(strtoul(s.c_str(),NULL,16)); $setText( c); } ; protected HDIGIT: ('0'..'9'|'a'..'f'|'A'..'F'); protected CD: ('d'|'D'); protected CE: ('e'|'E'); protected CI: ('i'|'I'); protected CF: ('f'|'F'); protected CG: ('g'|'G'); protected CO: ('o'|'O'); protected CB: ('b'|'B'); protected CS: ('s'|'S'); protected CX: ('x'|'X'); protected CZ: ('z'|'Z'); protected CDOT:'.'; protected DIGITS : ('0'..'9')+ ; protected CNUMBER : DIGITS ; protected CWS : (' '| '\t')+ ; gdl-0.9.4/src/new.cpp0000664000175000017500000000225712074036031013010 0ustar marcmarc/*************************************************************************** |FILENAME| - description ------------------- begin : |DATE| copyright : (C) |YEAR| by |AUTHOR| email : |EMAIL| ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" #include #include #include "datatypes.hpp" #include "envt.hpp" #include "dinterpreter.hpp" namespace lib { } gdl-0.9.4/src/dll/0000775000175000017500000000000012221570143012261 5ustar marcmarcgdl-0.9.4/src/dll/two.cpp0000664000175000017500000000136512026060416013603 0ustar marcmarc#include "envt.hpp" using namespace std; template< typename T> BaseGDL* two_fun_template( BaseGDL* p0) { T* p0C = static_cast( p0); T* res = new T( p0C->Dim(), BaseGDL::NOZERO); SizeT nEl = p0->N_Elements(); for( SizeT i=0; iNParam(); if (nParam != 1) { cout << "TWO: Improper Number of Variables" << endl; return new DLongGDL( -1); } BaseGDL* p0 = e->GetPar( 0);//, "TWO"); if( p0->Type() == GDL_DOUBLE) return two_fun_template< DDoubleGDL>( p0); else if( p0->Type() == GDL_FLOAT) return two_fun_template< DFloatGDL>( p0); else { return new DLongGDL( -1); } } gdl-0.9.4/src/extrat.cpp0000664000175000017500000001745712174065225013546 0ustar marcmarc/*************************************************************************** extrat.cpp - (_REF)_EXTRA keyword handling ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" #include "objects.hpp" #include "extrat.hpp" #include "envt.hpp" #include "nullgdl.hpp" using namespace std; void ExtraT::ResolveExtra(EnvBaseT* callerIn) { // if the subroutine has _REF_EXTRA, explicit keywords override // if the subroutine has _EXTRA, _EXTRA keywords override // 1. extract own keywords from _EXTRA data (override explicit ones) // put all others to extra data BaseGDL* extraVal= (envExtraVal != NULL)? *envExtraVal : locExtraVal; DSub* pro=thisEnv->pro; DSub::ExtraType extraType= pro->Extra(); // EnvBaseT* callerDebug=thisEnv->Caller(); // DSub::ExtraType extraTypeDebug= callerDebug->pro->Extra(); if( extraVal != NULL) { if( extraVal->Type() == GDL_STRUCT) // _EXTRA { DStructGDL* extraStruct= static_cast(extraVal); DStructDesc* desc=extraStruct->Desc(); SizeT nTag=desc->NTags(); for( SizeT t=0; tTagName( t); // search keyword KeyVarListT::iterator f=find_if(pro->key.begin(), pro->key.end(), String_abbref_eq( tName)); if (f != pro->key.end()) { // found, _EXTRA always overrides explicit keywords SizeT varIx = distance(pro->key.begin(), f); thisEnv->env.Reset(varIx, extraStruct->Get(t)); // local } else // not found -> add tag to extra data { if (extraType != DSub::NONE) { listName.push_back(tName); listEnv.push_back(extraStruct->Get(t)); // always local } else if (strict || callerIn != NULL) // always strict if callerIn is set { // pro has no (_REF)_EXTRA and _STRICT_EXTRA -> error // ... unless keyword is a warnkey! // search warn keyword IDList::iterator wf=find_if(pro->warnKey.begin(), pro->warnKey.end(), String_abbref_eq( tName)); if (wf == pro->warnKey.end()) { thisEnv->Throw("Keyword " + tName + " not allowed in call to: " + pro->ObjectName()); } } } } } else // _REF_EXTRA { if( extraVal->Type() == GDL_STRING) // _EXTRA { DStringGDL* extraString= static_cast(extraVal); EnvBaseT* caller; if( callerIn == NULL) caller = thisEnv->Caller(); else caller = callerIn; // GDL_STRING only works, if the *caller* has _REF_EXTRA if( caller->pro->Extra() == DSub::REFEXTRA) { // caller's extra member holds the actual data assert( caller->extra != NULL); ExtraT& cExtra=*caller->extra; SizeT nStr=extraString->N_Elements(); for( SizeT t=0; tkey.begin(), pro->key.end(), String_abbref_eq( kName)); if( f != pro->key.end()) { // found, _EXTRA always overrides SizeT varIx=distance(pro->key.begin(),f); // global, caller is owner thisEnv->env.Reset( varIx, &cExtra.listEnv[dataIx]); } else // not found -> add to extra data { if( extraType != DSub::NONE) { listName.push_back( kName); // global listEnv.push_back( &cExtra.listEnv[dataIx]); } else if( strict) { // pro has no (_REF)_EXTRA) and _STRICT_EXTRA -> // error thisEnv->Throw( "Keyword "+kName+ " not allowed in call to: "+ pro->ObjectName()); } } } // dataIx != -1 } // for } // caller->pro->Extra() == DSub::REFEXTRA) } // extraString != NULL } } // all keywords are now overridden in the actual environment // listName/listEnv holds all _EXTRA data, which is not used by this // subroutine // 2. if pro has (_REF)_EXTRA: // combine additional keywords and the (remaining) _EXTRA data to pro's // (_REF)_EXTRA value if( extraType == DSub::REFEXTRA) { // make string array SizeT nEl = listName.size(); if( nEl > 0) { dimension dim( &nEl, 1); DStringGDL* extraString = new DStringGDL( dim); for( SizeT i=0; ienv.Loc(static_cast(pro->extraIx)) == NULL /*|| thisEnv->env.Loc(static_cast(pro->extraIx)) == NullGDL::GetSingleInstance()*/); // assert( thisEnv->env.Env(static_cast(pro->extraIx)) == NULL ); delete thisEnv->env.Loc(static_cast(pro->extraIx)); thisEnv->env.Set( static_cast(pro->extraIx), static_cast(extraString)); // thisEnv->env.Reset( static_cast(pro->extraIx), // static_cast(extraString)); } else { assert( thisEnv->env.Loc(static_cast(pro->extraIx)) == NULL); assert( thisEnv->env.Env(static_cast(pro->extraIx)) == NULL); } } else if( extraType == DSub::EXTRA) { // make structure SizeT nEl = listName.size(); if( nEl > 0) { DStructDesc* extraStructDesc; DStructGDL* extraStruct = NULL; // from back -> _EXTRA overrides additional keyword for( int i=nEl-1; i>=0; --i) { if( listEnv[i] != NULL) // if undef just skip (pass by value) { if( extraStruct == NULL) { extraStructDesc = new DStructDesc( "$truct"); // extraStruct = new DStructGDL( extraStructDesc, dimension(1)); extraStruct = new DStructGDL( extraStructDesc); // extraStructDesc->AddTag( listName[i], listEnv[i]); // extraStruct->AddTagGrab( listEnv.Grab(i)); extraStruct->NewTag( listName[i], listEnv.Grab(i)); } else if( extraStructDesc->TagIndex( listName[i]) == -1) { extraStruct->NewTag( listName[i], listEnv.Grab(i)); // extraStructDesc->AddTag( listName[i], listEnv[i]); // extraStruct->AddTagGrab( listEnv.Grab(i)); // extraStruct->AddTag( listEnv[i]); } } } // look if equal is already there (very possible eg. _EXTRA in loops) // DStructDesc* oStructDesc=extraStructDesc->FindEqual( structList); // if( oStructDesc != NULL) // { // extraStruct->SetDesc(oStructDesc); // delete extraStructDesc; // } // else // { // // insert into struct list // NOT ANYMORE!!! // structList.push_back( extraStructDesc); // } // structList.push_back( extraStructDesc); assert( thisEnv->env.Loc(static_cast(pro->extraIx)) == NULL); assert( thisEnv->env.Env(static_cast(pro->extraIx)) == NULL); thisEnv->env.Set( static_cast(pro->extraIx), static_cast(extraStruct)); // thisEnv->env.Reset( static_cast(pro->extraIx), // static_cast(extraStruct)); } } } gdl-0.9.4/src/getas.cpp0000664000175000017500000003650112216134234013323 0ustar marcmarc/*************************************************************************** getas.cpp - get element as different type ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ // to be included from datatypes.cpp #ifdef INCLUDE_GETAS_CPP // #include "includefirst.hpp" // //#include "datatypes.hpp" // #include "dstructgdl.hpp" // #include "real2int.hpp" #include "ofmt.hpp" // OutAuto // // #include "dinterpreter.hpp" using namespace std; // for double -> string inline string double2string( DDouble d) { std::ostringstream os; OutAuto( os, d, 16, 8, ' '); return os.str(); } // for float -> string inline string float2string( DFloat f) { std::ostringstream os; OutAuto( os, f, 13, 6, ' '); return os.str(); } // typedef Data_ DByteGDL; // typedef Data_ DIntGDL; // typedef Data_ DUIntGDL; // typedef Data_ DLongGDL; // typedef Data_ DULongGDL; // typedef Data_ DLong64GDL; // typedef Data_ DULong64GDL; // typedef Data_ DFloatGDL; // typedef Data_ DDoubleGDL; // typedef Data_ DStringGDL; // typedef Data_ DPtrGDL; // typedef Data_ DObjGDL; // typedef Data_ DComplexGDL; // typedef Data_ DComplexDblGDL; // general case template template typename Data_::Ty Data_::GetAs( SizeT i) { return this->dd[ i]; } // non convertable types // DPtrGDL specialization template<> template typename Data_::Ty Data_::GetAs( SizeT i) { if(BaseGDL::interpreter!=NULL&&BaseGDL::interpreter->CallStack().size()>0) BaseGDL::interpreter->CallStack().back()->Throw("Ptr expression not allowed in this context: "+BaseGDL::interpreter->Name(this)); throw GDLException("Ptr expression not allowed in this context."); } // DObjGDL specialization template<> template typename Data_::Ty Data_::GetAs( SizeT i) { if(BaseGDL::interpreter!=NULL&&BaseGDL::interpreter->CallStack().size()>0) BaseGDL::interpreter->CallStack().back()->Throw("Object expression not allowed in this context: "+BaseGDL::interpreter->Name(this)); throw GDLException("Object expression not allowed in this context."); } // DStructGDL template typename Data_::Ty DStructGDL::GetAs( SizeT i) { if(BaseGDL::interpreter!=NULL&&BaseGDL::interpreter->CallStack().size()>0) BaseGDL::interpreter->CallStack().back()->Throw("Struct expression not allowed in this context: "+BaseGDL::interpreter->Name(this)); throw GDLException("Struct expression not allowed in this context."); } // Ptr, Obj, Struct: GetAs throws // The operators are overloaded for these types, they throw // hence GetAs( SizeT i) is never called and does not need to be overloaded // integer types // DByteGDL full specializations template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return i2s<>(this->dd[ i],4); } // DIntGDL full specializations template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return i2s<>(this->dd[ i],8); } // DUIntGDL full specializations template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return i2s<>(this->dd[ i],8); } // DLongGDL full specializations template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return i2s<>(this->dd[ i],12); } // DULongGDL full specializations template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return i2s<>(this->dd[ i],12); } // DLong64GDL full specializations template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return i2s<>(this->dd[ i],22); } // DULong64GDL full specializations template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return i2s<>(this->dd[ i],22); } // DFloatGDL full specializations template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return Real2DByte((*this)[i]); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return Real2Int((*this)[i]); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return static_cast< DUInt>((*this)[i]); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return Real2Int((*this)[i]); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return Real2Int((*this)[i]); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return static_cast< DULong>((*this)[i]); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return static_cast< DULong64>((*this)[i]); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return float2string((*this)[i]); } // DDoubleGDL full specializations template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return Real2DByte((*this)[i]); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return Real2Int((*this)[i]); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return static_cast< DUInt>((*this)[i]); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return Real2Int((*this)[i]); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return Real2Int((*this)[i]); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return static_cast< DULong>((*this)[i]); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return static_cast< DULong64>((*this)[i]); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return double2string((*this)[i]); } // DStringGDL full specializations inline void StringConversionErrorGetAs( const string& msg) { // if( (mode & BaseGDL::THROWIOERROR) != 0) // { // errorFlag = true; // } // else Warning( msg); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { const char* cStart=(*this)[i].c_str(); char* cEnd; long int result =strtol(cStart,&cEnd,10); if( cEnd == cStart && (*this)[i] != "") { StringConversionErrorGetAs( "Type conversion error: " "Unable to convert given STRING: '"+(*this)[i]+"' to BYTE."); } return result; } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { const char* cStart=(*this)[i].c_str(); char* cEnd; long int result =strtol(cStart,&cEnd,10); if( cEnd == cStart && (*this)[i] != "") { StringConversionErrorGetAs( "Type conversion error: " "Unable to convert given STRING: '"+(*this)[i]+"' to INT."); } return result; } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { const char* cStart=(*this)[i].c_str(); char* cEnd; unsigned long int result =strtoul(cStart,&cEnd,10); if( cEnd == cStart && (*this)[i] != "") { StringConversionErrorGetAs( "Type conversion error: " "Unable to convert given STRING: '"+(*this)[i]+"' to UINT."); } return result; } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { const char* cStart=(*this)[i].c_str(); char* cEnd; long int result =strtol(cStart,&cEnd,10); if( cEnd == cStart && (*this)[i] != "") { StringConversionErrorGetAs( "Type conversion error: " "Unable to convert given STRING: '"+(*this)[i]+"' to LONG."); } return result; } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { const char* cStart=(*this)[i].c_str(); char* cEnd; unsigned long int result =strtoul(cStart,&cEnd,10); if( cEnd == cStart && (*this)[i] != "") { StringConversionErrorGetAs( "Type conversion error: " "Unable to convert given STRING: '"+(*this)[i]+"' to ULONG."); } return result; } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { const char* cStart=(*this)[i].c_str(); char* cEnd; Data_::Ty result =strtol(cStart,&cEnd,10); if( cEnd == cStart && (*this)[i] != "") { StringConversionErrorGetAs( "Type conversion error: " "Unable to convert given STRING: '"+(*this)[i]+"' to LONG64."); } return result; } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { const char* cStart=(*this)[i].c_str(); char* cEnd; Data_::Ty result =strtoul(cStart,&cEnd,10); if( cEnd == cStart && (*this)[i] != "") { StringConversionErrorGetAs( "Type conversion error: " "Unable to convert given STRING: '"+(*this)[i]+"' to ULONG64."); } return result; } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { const char* cStart=(*this)[i].c_str(); char* cEnd; float result = strtod(cStart,&cEnd); if( cEnd == cStart && (*this)[i] != "") { StringConversionErrorGetAs( "Type conversion error: " "Unable to convert given STRING: '"+(*this)[i]+"' to FLOAT."); } return result; } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { const char* cStart=(*this)[i].c_str(); char* cEnd; double result = strtod(cStart,&cEnd); if( cEnd == cStart && (*this)[i] != "") { StringConversionErrorGetAs( "Type conversion error: " "Unable to convert given STRING: '"+(*this)[i]+"' to DOUBLE."); } return result; } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { const char* cStart=(*this)[i].c_str(); char* cEnd; float result = strtod(cStart,&cEnd); if( cEnd == cStart && (*this)[i] != "") { StringConversionErrorGetAs( "Type conversion error: " "Unable to convert given STRING: '"+(*this)[i]+"' to COMPLEX."); } return result; } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { const char* cStart=(*this)[i].c_str(); char* cEnd; double result = strtod(cStart,&cEnd); if( cEnd == cStart && (*this)[i] != "") { StringConversionErrorGetAs( "Type conversion error: " "Unable to convert given STRING: '"+(*this)[i]+"' to DCOMPLEX."); } return result; } // DComplexGDL full specializations template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return Real2DByte(real((*this)[i])); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return Real2Int(real((*this)[i])); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return static_cast< DUInt>(real((*this)[i])); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return Real2Int(real((*this)[i])); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return Real2Int(real((*this)[i])); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return static_cast< DULong>(real((*this)[i])); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return static_cast< DULong64>(real((*this)[i])); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return real((*this)[i]); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return real((*this)[i]); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return "("+i2s(real((*this)[i]))+","+i2s(imag((*this)[i]))+")"; } // DComplexDblGDL full specializations template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return Real2DByte(real((*this)[i])); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return Real2Int(real((*this)[i])); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return static_cast< DUInt>(real((*this)[i])); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return Real2Int(real((*this)[i])); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return Real2Int(real((*this)[i])); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return static_cast< DULong>(real((*this)[i])); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return static_cast< DULong64>(real((*this)[i])); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return real((*this)[i]); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return real((*this)[i]); } template<> template<> /*typename*/ Data_::Ty Data_::GetAs( SizeT i) { return "("+i2s(real((*this)[i]))+","+i2s(imag((*this)[i]))+")"; } #endif gdl-0.9.4/src/plotting_polyfill.cpp0000664000175000017500000003235512154445470016005 0ustar marcmarc/*************************************************************************** plotting.cpp - GDL routines for plotting ------------------- begin : July 22 2002 copyright : (C) 2002-2011 by Marc Schellens et al. email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" #include "plotting.hpp" #include "math_utl.hpp" namespace lib { using namespace std; class polyfill_call: public plotting_routine_call { private: DDoubleGDL *xVal, *yVal, *zVal; Guard xval_guard, yval_guard, zval_guard; DDouble xStart, xEnd, yStart, yEnd, zStart, zEnd; DLong psym; bool xLog, yLog, zLog; SizeT xEl, yEl, zEl; bool append; bool doClip; bool restoreClipBox; PLFLT savebox[4]; bool doT3d, real3d; DDouble zValue; DDoubleGDL* plplot3d; Guard plplot3d_guard; // DLongGDL *color; private: bool handle_args(EnvT* e) // {{{ { real3d=false; //T3D static int t3dIx = e->KeywordIx( "T3D"); doT3d=(e->KeywordSet(t3dIx)|| T3Denabled(e)); //note: Z (VALUE) will be used uniquely if Z is not effectively defined. static int zvIx = e->KeywordIx( "Z"); zValue=0.0; e->AssureDoubleScalarKWIfPresent ( zvIx, zValue ); if ( nParam()==1 ) { BaseGDL* p0; p0=e->GetParDefined(0); SizeT dim0=p0->Dim(0); if ( dim0<2 || dim0>3 ) e->Throw("When only 1 param, dims must be (2,n) or (3,n)"); if (p0->Dim(1) < 3 ) e->Throw("Not enough valid and unique points specified."); DDoubleGDL *val=e->GetParAs< DDoubleGDL>(0); xEl=p0->N_Elements()/dim0; xVal=new DDoubleGDL(dimension(xEl), BaseGDL::NOZERO); xval_guard.Reset(xVal); // delete upon exit yEl=p0->N_Elements()/dim0; yVal=new DDoubleGDL(dimension(yEl), BaseGDL::NOZERO); yval_guard.Reset(yVal); // delete upon exit for ( SizeT i=0; iN_Elements()/dim0; zVal=new DDoubleGDL(dimension(zEl), BaseGDL::NOZERO); zval_guard.Reset(zVal); // delete upon exit if (dim0==3) for ( SizeT i=0; iGetParAs< DDoubleGDL>(0); xEl=xVal->N_Elements(); yVal=e->GetParAs< DDoubleGDL>(1); yEl=yVal->N_Elements(); if ( xEl < 3 || yEl < 3 ) e->Throw("Not enough valid and unique points specified."); //silently drop unmatched values if ( yEl!=xEl ) { SizeT size; size=min(xEl, yEl); xEl=size; yEl=size; } //z will be set at Zero unless Z=value is given zEl=xEl; zVal=new DDoubleGDL(dimension(zEl)); zval_guard.Reset(zVal); // delete upon exit for (SizeT i=0; i< zEl ; ++i) (*zVal)[i]=zValue; } else if ( nParam()==3 ) { if (doT3d) real3d=true; zVal=e->GetParAs< DDoubleGDL>(2); zEl=zVal->N_Elements(); xVal=e->GetParAs< DDoubleGDL>(0); xEl=xVal->N_Elements(); yVal=e->GetParAs< DDoubleGDL>(1); yEl=yVal->N_Elements(); if ( xEl < 3 || yEl < 3 || zEl < 3) e->Throw("Not enough valid and unique points specified."); if ( !(xEl==yEl&&yEl==zEl) ) { SizeT size; size=min(xEl, yEl); size=min(size, zEl); xEl=size; yEl=size; zEl=size; } } return false; // return true; } // }}} void old_body(EnvT* e, GDLGStream* actStream) // {{{ { enum { DATA=0, NORMAL, DEVICE } coordinateSystem=DATA; //check presence of DATA,DEVICE and NORMAL options if ( e->KeywordSet("DATA") ) coordinateSystem=DATA; if ( e->KeywordSet("DEVICE") ) coordinateSystem=DEVICE; if ( e->KeywordSet("NORMAL") ) coordinateSystem=NORMAL; // get_axis_type gdlGetAxisType("X", xLog); gdlGetAxisType("Y", yLog); gdlGetAxisType("Z", zLog); // get ![XY].CRANGE gdlGetCurrentAxisRange("X", xStart, xEnd); gdlGetCurrentAxisRange("Y", yStart, yEnd); gdlGetCurrentAxisRange("Z", zStart, zEnd); if ((yStart == yEnd) || (xStart == xEnd) || (zStart == zEnd)) { if (zStart != 0.0 && zStart == zEnd) Message("POLYFILL: !Z.CRANGE ERROR, setting to [0,1]"); zStart = 0; zEnd = 1; if (yStart != 0.0 && yStart == yEnd) Message("POLYFILL: !Y.CRANGE ERROR, setting to [0,1]"); yStart = 0; yEnd = 1; if (xStart != 0.0 && xStart == xEnd) Message("POLYFILL: !X.CRANGE ERROR, setting to [0,1]"); xStart = 0; xEnd = 1; } bool mapSet=false; #ifdef USE_LIBPROJ4 // Map Stuff (xtype = 3) get_mapset(mapSet); if ( mapSet ) { ref=map_init(); if ( ref==NULL ) { e->Throw("Projection initialization failed."); } } #endif PLFLT wun, wdeux, wtrois, wquatre; if ( coordinateSystem==DATA) //with POLYFILL, we can plot *outside* the box(e)s in DATA coordinates. // convert to device coords in this case { actStream->pageWorldCoordinates(wun, wdeux, wtrois, wquatre); } actStream->OnePageSaveLayout(); // one page actStream->vpor(0, 1, 0, 1); if ( coordinateSystem==DEVICE ) { actStream->wind(0.0, actStream->xPageSize(), 0.0, actStream->yPageSize()); xLog=false; yLog=false; } else if ( coordinateSystem==NORMAL ) { actStream->wind(0, 1, 0, 1); xLog=false; yLog=false; } else //with POLYFILL, we can plot *outside* the box(e)s in DATA coordinates. { actStream->wind(wun, wdeux, wtrois, wquatre); } } // }}} private: void call_plplot(EnvT* e, GDLGStream* actStream) // {{{ { static DDouble x0,y0,xs,ys; //conversion to normalized coords x0=(xLog)?-log10(xStart):-xStart; y0=(yLog)?-log10(yStart):-yStart; xs=(xLog)?(log10(xEnd)-log10(xStart)):xEnd-xStart;xs=1.0/xs; ys=(yLog)?(log10(yEnd)-log10(yStart)):yEnd-yStart;ys=1.0/ys; if ( doT3d && !real3d) { //if X,Y and Z are passed, we will use !P.T and not our plplot "interpretation" of !P.T //if the x and y scaling is OK, using !P.T directly permits to use other projections //than those used implicitly by plplot. See @showhaus example for *DL // case where we project 2D data on 3D: use plplot-like matrix. DDouble az, alt, ay, scale; ORIENTATION3D axisExchangeCode; plplot3d = gdlConvertT3DMatrixToPlplotRotationMatrix( zValue, az, alt, ay, scale, axisExchangeCode); if (plplot3d == NULL) { e->Throw("Illegal 3D transformation. (FIXME)"); } Data3d.zValue = zValue; Data3d.Matrix = plplot3d; //try to change for !P.T in future? switch (axisExchangeCode) { case NORMAL: //X->X Y->Y plane XY Data3d.x0=x0; Data3d.y0=y0; Data3d.xs=xs; Data3d.ys=ys; Data3d.code = code012; break; case XY: // X->Y Y->X plane XY Data3d.x0=0; Data3d.y0=x0; Data3d.xs=ys; Data3d.ys=xs; Data3d.code = code102; break; case XZ: // Y->Y X->Z plane YZ Data3d.x0=x0; Data3d.y0=y0; Data3d.xs=xs; Data3d.ys=ys; Data3d.code = code210; break; case YZ: // X->X Y->Z plane XZ Data3d.x0=x0; Data3d.y0=y0; Data3d.xs=xs; Data3d.ys=ys; Data3d.code = code021; break; case XZXY: //X->Y Y->Z plane YZ Data3d.x0=x0; Data3d.y0=y0; Data3d.xs=xs; Data3d.ys=ys; Data3d.code = code120; break; case XZYZ: //X->Z Y->X plane XZ Data3d.x0=x0; Data3d.y0=y0; Data3d.xs=xs; Data3d.ys=ys; Data3d.code = code201; break; } actStream->stransform(gdl3dTo2dTransform, &Data3d); } //handle clipping bool doClip=(e->KeywordSet("CLIP")||e->KeywordSet("NOCLIP")); // make all clipping computations BEFORE setting graphic properties (color, size) bool stopClip=false; if ( doClip ) if ( startClipping(e, actStream, false)==TRUE ) stopClip=true; //properties // int colorIx=e->KeywordIx ( "COLOR" ); bool doColor=false; // if ( e->GetKW ( colorIx )!=NULL ) // { // color=e->GetKWAs( colorIx ); doColor=true; // } // LINE_FILL, SPACING, LINESTYLE, ORIENTATION, THICK (thanks to JW) static int line_fillIx=e->KeywordIx("LINE_FILL"); if ( e->KeywordSet(line_fillIx) ) { PLINT ori=0, spa=1500; static int orientationIx=e->KeywordIx("ORIENTATION"); if ( e->KeywordSet(orientationIx) ) ori=PLINT(1e1*(*e->GetKWAs(orientationIx))[0]); static int spacingIx=e->KeywordIx("SPACING"); if ( e->KeywordSet(spacingIx) ) spa=PLINT(1e4*(*e->GetKWAs(spacingIx))[0]); gdlSetPenThickness(e, actStream); gdlSetLineStyle(e, actStream); actStream->psty(8); actStream->pat(1, &ori, &spa); } else { actStream->psty(0); } gdlSetGraphicsForegroundColorFromKw(e, actStream); //COLOR gdlSetLineStyle(e, actStream); //LINESTYLE gdlSetPenThickness(e, actStream); //THICK if (real3d) { //try first if the matrix is a plplot-compatible one DDouble az, alt, ay, scale; ORIENTATION3D axisExchangeCode; plplot3d = gdlConvertT3DMatrixToPlplotRotationMatrix( zValue, az, alt, ay, scale, axisExchangeCode); if (plplot3d == NULL) //use the original !P.T matrix (better than nothing) { Warning("Using Illegal 3D transformation, continuing. (FIXME)"); plplot3d=gdlGetT3DMatrix(); //the original one plplot3d_guard.Reset(plplot3d); Data3d.code = code012; } else { switch (axisExchangeCode) { case NORMAL: //X->X Y->Y plane XY Data3d.code = code012; break; case XY: // X->Y Y->X plane XY Data3d.code = code102; break; case XZ: // Y->Y X->Z plane YZ Data3d.code = code210; break; case YZ: // X->X Y->Z plane XZ Data3d.code = code021; break; case XZXY: //X->Y Y->Z plane YZ Data3d.code = code120; break; case XZYZ: //X->Z Y->X plane XZ Data3d.code = code201; break; } } DDoubleGDL *xValou=new DDoubleGDL(dimension(xEl)); DDoubleGDL *yValou=new DDoubleGDL(dimension(yEl)); Guard xval_guard, yval_guard; xval_guard.reset(xValou); yval_guard.reset(yValou); //rescale to normalized box before conversions --- works for both matrices. gdl3dto2dProjectDDouble(gdlGetScaledNormalizedT3DMatrix(plplot3d),xVal,yVal,zVal,xValou,yValou,Data3d.code); actStream->fill(xEl, static_cast(&(*xValou)[0]), static_cast(&(*yValou)[0])); } else actStream->fill(xEl, static_cast(&(*xVal)[0]), static_cast(&(*yVal)[0])); if (stopClip) stopClipping(actStream); } // }}} private: virtual void post_call(EnvT*, GDLGStream *actStream) // {{{ { if (doT3d && !real3d) { plplot3d_guard.Reset(plplot3d); actStream->stransform(NULL,NULL); } actStream->RestoreLayout(); actStream->lsty(1); //reset linestyle actStream->psty(0); //reset fill } }; void polyfill(EnvT* e) { polyfill_call polyfill; polyfill.call(e, 1); } } // namespace gdl-0.9.4/src/GDLInterpreterTokenTypes.txt0000664000175000017500000000713712221270776017150 0ustar marcmarc// $ANTLR 2.7.7 (20120518): gdlc.i.g -> GDLInterpreterTokenTypes.txt$ GDLInterpreter // output token vocab name ALL=4 ASSIGN=5 ASSIGN_INPLACE=6 ASSIGN_REPLACE=7 ASSIGN_ARRAYEXPR_MFCALL=8 ARRAYDEF=9 ARRAYDEF_CONST=10 ARRAYIX=11 ARRAYIX_ALL=12 ARRAYIX_ORANGE=13 ARRAYIX_RANGE=14 ARRAYIX_ORANGE_S=15 ARRAYIX_RANGE_S=16 ARRAYEXPR=17 ARRAYEXPR_FCALL=18 ARRAYEXPR_MFCALL=19 BLOCK=20 BREAK=21 CSBLOCK=22 CONTINUE=23 COMMONDECL=24 COMMONDEF=25 CONSTANT=26 DEREF=27 ELSEBLK=28 EXPR=29 FOR="for"=30 FOR_STEP=31 FOREACH="foreach"=32 FOREACH_INDEX=33 FOR_LOOP=34 FOR_STEP_LOOP=35 FOREACH_LOOP=36 FOREACH_INDEX_LOOP=37 FCALL=38 FCALL_LIB=39 FCALL_LIB_DIRECT=40 FCALL_LIB_N_ELEMENTS=41 FCALL_LIB_RETNEW=42 GDLNULL=43 IF_ELSE=44 KEYDECL=45 KEYDEF=46 KEYDEF_REF=47 KEYDEF_REF_CHECK=48 KEYDEF_REF_EXPR=49 LABEL=50 MPCALL=51 MPCALL_PARENT=52 MFCALL=53 MFCALL_LIB=54 MFCALL_LIB_RETNEW=55 MFCALL_PARENT=56 MFCALL_PARENT_LIB=57 MFCALL_PARENT_LIB_RETNEW=58 NOP=59 NSTRUC=60 NSTRUC_REF=61 ON_IOERROR_NULL=62 PCALL=63 PCALL_LIB=64 PARADECL=65 PARAEXPR=66 PARAEXPR_VN=67 DEC_REF_CHECK=68 INC_REF_CHECK=69 POSTDEC=70 POSTINC=71 DECSTATEMENT=72 INCSTATEMENT=73 REF=74 REF_VN=75 REF_CHECK=76 REF_CHECK_VN=77 REF_EXPR=78 REF_EXPR_VN=79 REPEAT="repeat"=80 REPEAT_LOOP=81 RETURN=82 RETF=83 RETP=84 STRUC=85 SYSVAR=86 UMINUS=87 VAR=88 VARPTR=89 WHILE="while"=90 IDENTIFIER=91 AND_OP="and"=92 BEGIN="begin"=93 CASE="case"=94 COMMON="common"=95 COMPILE_OPT="compile_opt"=96 DO="do"=97 ELSE="else"=98 END="end"=99 ENDCASE="endcase"=100 ENDELSE="endelse"=101 ENDFOR="endfor"=102 ENDFOREACH="endforeach"=103 ENDIF="endif"=104 ENDREP="endrep"=105 ENDSWITCH="endswitch"=106 ENDWHILE="endwhile"=107 EQ_OP="eq"=108 FORWARD="forward_function"=109 FUNCTION="function"=110 GE_OP="ge"=111 GOTO="goto"=112 GT_OP="gt"=113 IF="if"=114 INHERITS="inherits"=115 LE_OP="le"=116 LT_OP="lt"=117 MOD_OP="mod"=118 NE_OP="ne"=119 NOT_OP="not"=120 OF="of"=121 ON_IOERROR="on_ioerror"=122 OR_OP="or"=123 PRO="pro"=124 SWITCH="switch"=125 THEN="then"=126 UNTIL="until"=127 XOR_OP="xor"=128 METHOD=129 COMMA=130 COLON=131 END_U=132 EQUAL=133 DEC=134 INC=135 AND_OP_EQ=136 ASTERIX_EQ=137 EQ_OP_EQ=138 GE_OP_EQ=139 GTMARK_EQ=140 GT_OP_EQ=141 LE_OP_EQ=142 LTMARK_EQ=143 LT_OP_EQ=144 MATRIX_OP1_EQ=145 MATRIX_OP2_EQ=146 MINUS_EQ=147 MOD_OP_EQ=148 NE_OP_EQ=149 OR_OP_EQ=150 PLUS_EQ=151 POW_EQ=152 SLASH_EQ=153 XOR_OP_EQ=154 MEMBER=155 LBRACE=156 RBRACE=157 SLASH=158 LSQUARE=159 RSQUARE=160 SYSVARNAME=161 EXCLAMATION=162 LCURLY=163 RCURLY=164 CONSTANT_HEX_BYTE=165 CONSTANT_HEX_LONG=166 CONSTANT_HEX_LONG64=167 CONSTANT_HEX_INT=168 CONSTANT_HEX_I=169 CONSTANT_HEX_ULONG=170 CONSTANT_HEX_ULONG64=171 CONSTANT_HEX_UI=172 CONSTANT_HEX_UINT=173 CONSTANT_BYTE=174 CONSTANT_LONG=175 CONSTANT_LONG64=176 CONSTANT_INT=177 CONSTANT_I=178 CONSTANT_ULONG=179 CONSTANT_ULONG64=180 CONSTANT_UI=181 CONSTANT_UINT=182 CONSTANT_OCT_BYTE=183 CONSTANT_OCT_LONG=184 CONSTANT_OCT_LONG64=185 CONSTANT_OCT_INT=186 CONSTANT_OCT_I=187 CONSTANT_OCT_ULONG=188 CONSTANT_OCT_ULONG64=189 CONSTANT_OCT_UI=190 CONSTANT_OCT_UINT=191 CONSTANT_FLOAT=192 CONSTANT_DOUBLE=193 CONSTANT_BIN_BYTE=194 CONSTANT_BIN_LONG=195 CONSTANT_BIN_LONG64=196 CONSTANT_BIN_INT=197 CONSTANT_BIN_I=198 CONSTANT_BIN_ULONG=199 CONSTANT_BIN_ULONG64=200 CONSTANT_BIN_UI=201 CONSTANT_BIN_UINT=202 ASTERIX=203 DOT=204 STRING_LITERAL=205 POW=206 MATRIX_OP1=207 MATRIX_OP2=208 PLUS=209 MINUS=210 LTMARK=211 GTMARK=212 LOG_NEG=213 LOG_AND=214 LOG_OR=215 QUESTION=216 STRING=217 INCLUDE=218 EOL=219 W=220 D=221 L=222 H=223 O=224 B=225 EXP=226 DBL_E=227 DBL=228 CONSTANT_OR_STRING_LITERAL=229 COMMENT=230 END_MARKER=231 WHITESPACE=232 SKIP_LINES=233 CONT_STATEMENT=234 END_OF_LINE=235 MAX_TOKEN_NUMBER=236 gdl-0.9.4/src/getfmtast.hpp0000664000175000017500000000235710222440007014216 0ustar marcmarc/*************************************************************************** getfmtast.hpp - converts string to format AST ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifndef GETFMTAST_HPP_ #define GETFMTAST_HPP_ #include "fmtnode.hpp" #include "basegdl.hpp" #include "antlr/ASTFactory.hpp" extern antlr::ASTFactory FMTNodeFactory; RefFMTNode GetFMTAST( DString fmtString); #endif gdl-0.9.4/src/CMakeLists.txt0000664000175000017500000001075212172022234014251 0ustar marcmarcset(SOURCES CFMTLexer.cpp CFMTLexer.hpp CFMTTokenTypes.hpp FMTIn.cpp FMTIn.hpp FMTInTokenTypes.hpp FMTLexer.cpp FMTLexer.hpp FMTOut.cpp FMTOut.hpp FMTOutTokenTypes.hpp FMTParser.cpp FMTParser.hpp FMTTokenTypes.hpp GDLInterpreter.cpp GDLInterpreter.hpp GDLInterpreterTokenTypes.hpp GDLLexer.cpp GDLLexer.hpp GDLParser.cpp GDLParser.hpp GDLTokenTypes.hpp GDLTreeParser.cpp GDLTreeParser.hpp GDLTreeParserTokenTypes.hpp accessdesc.hpp allix.hpp allix.cpp arrayindex.cpp arrayindex.hpp arrayindexlistt.hpp arrayindexlistnoassoct.hpp assocdata.cpp assocdata.hpp basegdl.cpp basegdl.hpp basic_fun.cpp basic_fun.hpp basic_fun_cl.cpp basic_fun_cl.hpp basic_fun_jmg.cpp basic_fun_jmg.hpp basic_op.cpp basic_pro.cpp basic_pro.hpp basic_pro_jmg.cpp basic_pro_jmg.hpp cformat.g color.cpp color.hpp convert2.cpp convol.cpp convol_inc0.cpp convol_inc1.cpp convol_inc2.cpp datalistt.hpp datatypes.cpp datatypes.hpp datatypesref.cpp dcommon.cpp dcommon.hpp dcompiler.cpp dcompiler.hpp default_io.cpp deviceps.hpp devicesvg.hpp devicewin.hpp devicex.hpp devicez.hpp dimension.hpp dinterpreter.cpp dinterpreter.hpp dnode.cpp dnode.hpp dnodefactory.hpp dpro.cpp dpro.hpp dstructdesc.cpp dstructdesc.hpp dstructgdl.cpp dstructgdl.hpp dvar.cpp dvar.hpp envt.cpp envt.hpp extrat.cpp extrat.hpp fftw.cpp fftw.hpp file.cpp file.hpp fmtnode.cpp fmtnode.hpp format.g format.in.g format.out.g gdlc.g gdlc.i.g gdlc.tree.g gdleventhandler.cpp gdleventhandler.hpp gdlexception.cpp gdlexception.hpp gdlgstream.cpp gdlgstream.hpp gdljournal.cpp gdljournal.hpp gdlpsstream.cpp gdlpsstream.hpp gdlpython.cpp gdlpython.hpp gdlsvgstream.cpp gdlsvgstream.hpp gdlwidget.cpp gdlwidget.hpp gdlwinstream.cpp gdlwinstream.hpp gdlxstream.cpp gdlxstream.hpp gdlzstream.cpp gdlzstream.hpp getfmtast.cpp getfmtast.hpp graphics.cpp graphics.hpp grib.cpp grib.hpp gshhs.cpp gshhs.hpp gsl_fun.cpp gsl_fun.hpp gsl_matrix.cpp gsl_matrix.hpp gzstream.hpp hash.cpp hash.hpp hdf5_fun.cpp hdf5_fun.hpp hdf_fun.cpp hdf_fun.hpp hdf_pro.cpp hdf_pro.hpp ifmt.cpp image.cpp image.hpp initct.cpp initsysvar.cpp initsysvar.hpp io.cpp io.hpp lapack.cpp libinit.cpp libinit_ac.cpp libinit_cl.cpp libinit_gm.cpp libinit_jmg.cpp libinit_mes.cpp libinit_ng.cpp list.cpp list.hpp magick_cl.cpp magick_cl.hpp math_fun.cpp math_fun.hpp math_fun_ac.cpp math_fun_ac.hpp math_fun_gm.cpp math_fun_gm.hpp math_fun_jmg.cpp math_fun_jmg.hpp math_fun_ng.cpp math_fun_ng.hpp math_utl.cpp math_utl.hpp matrix_cholesky.cpp matrix_cholesky.hpp mpi.cpp mpi.hpp ncdf_att_cl.cpp ncdf_cl.cpp ncdf_cl.hpp ncdf_dim_cl.cpp ncdf_var_cl.cpp new.cpp new.hpp newprognode.cpp nullgdl.cpp nullgdl.hpp objects.cpp objects.hpp ofmt.cpp ofmt.hpp overload.cpp overload.hpp plotting_axis.cpp plotting_contour.cpp plotting_convert_coord.cpp plotting_cursor.cpp plotting_device.cpp plotting_erase.cpp plotting_map_proj.cpp plotting_misc.cpp plotting_oplot.cpp plotting_plot.cpp plotting_plots.cpp plotting_polyfill.cpp plotting_shade_surf.cpp plotting_surface.cpp plotting_windows.cpp plotting_xyouts.cpp plotting.cpp plotting.hpp print.cpp print_tree.cpp print_tree.hpp prognode.cpp prognode_lexpr.cpp prognodeexpr.cpp read.cpp real2int.hpp semshm.cpp semshm.hpp sigfpehandler.cpp sigfpehandler.hpp specializations.hpp str.cpp str.hpp strassenmatrix.hpp terminfo.cpp terminfo.hpp topython.cpp typedefs.hpp typetraits.cpp typetraits.hpp widget.cpp ) if(WIN32 AND NOT CYGWIN) set(SOURCES ${SOURCES} gtdhelper.cpp gtdhelper.hpp ) endif(WIN32 AND NOT CYGWIN) add_subdirectory(antlr) include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/antlr ${CMAKE_BINARY_DIR}) link_directories(${LINK_DIRECTORIES}) if(PYTHON_MODULE) #libgdl set(SOURCES ${SOURCES} pythongdl.cpp) add_library(gdl SHARED ${SOURCES}) else(PYTHON_MODULE) #gdl set(SOURCES ${SOURCES} gdl.cpp) add_executable(gdl ${SOURCES}) endif(PYTHON_MODULE) add_dependencies(gdl antlr) # be sure that antlr is built before gdl target_link_libraries(gdl antlr) # link antlr against gdl target_link_libraries(gdl ${LIBRARIES}) add_definitions(-DHAVE_CONFIG_H) if(PYTHON_MODULE) # TODO: this library should go to Python library path (site-packages?) # install(TARGETS gdl DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) else(PYTHON_MODULE) install(TARGETS gdl DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) set_target_properties(gdl PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE) endif(PYTHON_MODULE) install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/pro/ DESTINATION ${CMAKE_INSTALL_PREFIX}/${GDL_DATA_DIR}/lib PATTERN CVS EXCLUDE PATTERN checks EXCLUDE PATTERN Makefile* EXCLUDE PATTERN UrgentNeed.txt EXCLUDE) gdl-0.9.4/src/new.hpp0000664000175000017500000000202710320156272013012 0ustar marcmarc/*************************************************************************** |FILENAME| - description ------------------- begin : |DATE| copyright : (C) |YEAR| by |AUTHOR| email : |EMAIL| ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ namespace lib { } // namespace gdl-0.9.4/src/dstructgdl.hpp0000664000175000017500000005177512217457527014434 0ustar marcmarc/*************************************************************************** dstructgdl.hpp - GDL struct datatype ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifndef dstructgdl_hpp_ #define dstructgdl_hpp_ #include // #include #include "typedefs.hpp" #include "datatypes.hpp" // for friend declaration //#include "typetraits.hpp" #include "dstructdesc.hpp" // NOTE: lot of the code together with Data_<...>::functions // does not fit really into the template because of different // constructor // also here a vector is used instead of a valarray class DStructGDL: public SpDStruct { public: typedef SpDStruct::Ty Ty; typedef SpDStruct Traits; private: typedef SpDStruct::DataT DataT; //public: std::vector typeVar; // for accessing data #ifdef USE_EIGEN EIGEN_ALIGN16 DataT dd; // the data #else DataT dd; // the data #endif void InitTypeVar( SizeT t) { typeVar[ t] = (*Desc())[ t]->GetEmptyInstance(); typeVar[ t]->SetBufferSize( (*Desc())[ t]->N_Elements()); // no initial SetBuffer here, done anyway in ConstructTag() } const char* Buf() const { return &dd[0];} char* Buf() { return &dd[0];} public: static std::vector< void*> freeList; // operator new and delete static void* operator new( size_t bytes); static void operator delete( void *ptr); //structors ~DStructGDL(); // default (needed for test instantiation) // DStructGDL(): SpDStruct(), d() {} // new array (desc defined) DStructGDL( DStructDesc* desc_, const dimension& dim_) : SpDStruct( desc_, dim_) , typeVar( desc_->NTags()) , dd( dim.NDimElements() * desc_->NBytes(), false) //,SpDStruct::zero) { dim.Purge(); SizeT nTags = NTags(); for( SizeT t=0; t < nTags; ++t) { InitTypeVar( t); ConstructTagTo0( t); } } // new array (desc defined), don't init fields (only for New()) // (non POD must be initialized (constructed) nevertheless) // or no memeory allocation DStructGDL( DStructDesc* desc_, const dimension& dim_, BaseGDL::InitType iT) : SpDStruct( desc_, dim_) , typeVar( desc_->NTags()) , dd( (iT == BaseGDL::NOALLOC) ? 0 : dim.NDimElements() * desc_->NBytes(), false) { assert( iT == BaseGDL::NOZERO || iT == BaseGDL::NOALLOC); dim.Purge(); if( iT != BaseGDL::NOALLOC) { SizeT nTags = NTags(); // SizeT nEl = dim.N_Elements(); for( SizeT t=0; t < nTags; ++t) { InitTypeVar( t); ConstructTag( t); } } else // iT == BaseGDL::NOALLOC { SizeT nTags = NTags(); for( SizeT t=0; t < nTags; ++t) { InitTypeVar( t); } } } // c-i (desc defined) // only called from Assoc_'s c-i DStructGDL(const DStructGDL& d_); // For creating new structs (always scalar) DStructGDL( DStructDesc* desc_) : SpDStruct(desc_, dimension(1)) , typeVar() , dd() { assert( desc_->NTags() == 0); // SizeT nTags = NTags(); // for( SizeT t=0; t < nTags; ++t) // { // InitTypeVar( t); // } } // new struct (always scalar), creating new descriptor // intended for internal (C++) use to ease struct definition // ATTENTION: This can only be used for NAMED STRUCTS! // please use the normal constructor (above) for unnamed structs DStructGDL( const std::string& name_); // operators // assignment. DStructGDL& operator=(const BaseGDL& r) { assert( r.Type() == GDL_STRUCT); const DStructGDL& right = static_cast( r); assert( *Desc() == *right.Desc()); assert( &right != this); if( &right == this) return *this; // self assignment this->dim = right.dim; SizeT nTags = NTags(); SizeT nEl = N_Elements(); for( SizeT e=0; e < nEl; ++e) for( SizeT t=0; t < nTags; ++t) { *GetTag( t, e) = *right.GetTag( t, e); } return *this; } void InitFrom(const BaseGDL& r) { assert( r.Type() == GDL_STRUCT); const DStructGDL& right = static_cast( r); assert( *Desc() == *right.Desc()); assert( &right != this); this->dim = right.dim; SizeT nTags = NTags(); SizeT nEl = N_Elements(); for( SizeT e=0; e < nEl; ++e) for( SizeT t=0; t < nTags; ++t) { GetTag( t, e)->InitFrom( *right.GetTag( t, e)); } } inline BaseGDL* operator[] (const SizeT d1) { return GetTag( d1 % NTags(), d1 / NTags()); } inline const BaseGDL* operator[] (const SizeT d1) const { return GetTag( d1 % NTags(), d1 / NTags()); } // void* DataAddr( SizeT elem) // { // return &(*this)[elem]; // } void* DataAddr()// SizeT elem) { if( Buf() == NULL) throw GDLException("DStructGDL: Data not set."); return Buf(); }//elem];} void* DataAddr(SizeT tag)// SizeT elem) { if( dd.size() == 0) return typeVar[ t]; return Buf(); }//elem];} // used for named struct definition // (GDLInterpreter, basic_fun (create_struct)) void SetDesc( DStructDesc* newDesc); DStructGDL* SetBuffer( const void* b); void SetBufferSize( SizeT s); DStructGDL* CShift( DLong d) const; DStructGDL* CShift( DLong d[MAXRANK]) const; // for use by MIN and MAX functions void MinMax( DLong* minE, DLong* maxE, BaseGDL** minVal, BaseGDL** maxVal, bool omitNaN, SizeT start, SizeT stop, SizeT step, DLong valIx); // const DType Type() const { return SpDStruct::t;} // const std::string& TypeStr() const { return SpDStruct::str;} bool EqType( const BaseGDL* r) const { return (SpDStruct::t == r->Type());} SizeT N_Elements() const { if( dd.size() == 0) return 1; return dd.size()/Sizeof(); } SizeT Size() const { return N_Elements();} SizeT NBytes() const // for assoc function { return (Sizeof() * N_Elements()); } SizeT ToTransfer() const // number of elements for IO tranfer { SizeT nB = 0; SizeT nTags=NTags(); for( SizeT i=0; i < nTags; i++) { nB += GetTag( i)->ToTransfer(); } return ( nB * N_Elements()); // *** error for string? } SizeT Sizeof() const { return Desc()->NBytes(); // SizeT nB = 0; // SizeT nTags=NTags(); // for( SizeT i=0; i < nTags; i++) // { // nB += desc->GetTag( &dd[0], i)->NBytes(); // } // return nB; } private: void ClearTag( SizeT t) { if( dd.size() == 0) { typeVar[ t]->Clear(); } else { char* offs = Buf() + Desc()->Offset( t); BaseGDL* tVar = typeVar[ t]; SizeT step = Desc()->NBytes(); SizeT endIx = step * N_Elements(); for( SizeT ix=0; ixSetBuffer( offs + ix)->Clear(); } } } void ConstructTagTo0( SizeT t) { char* offs = Buf() + Desc()->Offset( t); BaseGDL* tVar = typeVar[ t]; SizeT step = Desc()->NBytes(); SizeT endIx = step * N_Elements(); for( SizeT ix=0; ixSetBuffer( offs + ix)->ConstructTo0(); } } void ConstructTag( SizeT t) { BaseGDL* tVar = typeVar[ t]; if( NonPODType( tVar->Type())) { char* offs = Buf() + Desc()->Offset( t); SizeT step = Desc()->NBytes(); SizeT endIx = step * N_Elements(); for( SizeT ix=0; ixSetBuffer( offs + ix)->Construct(); } } else tVar->SetBuffer( Buf() + Desc()->Offset( t)); } void DestructTag( SizeT t) { BaseGDL* tVar = typeVar[ t]; if( NonPODType( tVar->Type())) { char* offs = Buf() + Desc()->Offset( t); SizeT step = Desc()->NBytes(); SizeT endIx = step * N_Elements(); for( SizeT ix=0; ixSetBuffer( offs + ix)->Destruct(); } } } public: void Clear() { SizeT nTags = NTags(); for( SizeT t=0; t < nTags; t++) { ClearTag( t); } } void ConstructTo0() { SizeT nTags = NTags(); for( SizeT t=0; t < nTags; t++) { ConstructTagTo0( t); } } void Construct() { SizeT nTags = NTags(); for( SizeT t=0; t < nTags; t++) { ConstructTag( t); } } void Destruct() { SizeT nTags = NTags(); for( SizeT t=0; t < nTags; t++) { DestructTag( t); } } // code in default_io.cpp BaseGDL* AssocVar( int, SizeT); // single element access. // BaseGDL*& Get( SizeT tag, SizeT ix) BaseGDL* GetTag( SizeT t, SizeT ix) { if( dd.size() == 0) return typeVar[ t]; return typeVar[ t]->SetBuffer( Buf() + Desc()->Offset( t, ix)); } BaseGDL* GetTag( SizeT t) { if( dd.size() == 0) return typeVar[ t]; return typeVar[ t]->SetBuffer( Buf() + Desc()->Offset( t)); } const BaseGDL* GetTag( SizeT t, SizeT ix) const { if( dd.size() == 0) return typeVar[ t]; return typeVar[ t]->SetBuffer( Buf() + Desc()->Offset( t, ix)); } const BaseGDL* GetTag( SizeT t) const { if( dd.size() == 0) return typeVar[ t]; return typeVar[ t]->SetBuffer( Buf() + Desc()->Offset( t)); } // single tag access. BaseGDL* Get( SizeT tag); //*** // friend std::ostream& operator<<(std::ostream& o, DStructGDL& data_); friend std::istream& operator>>(std::istream& i, DStructGDL& data_); std::ostream& ToStream(std::ostream& o, SizeT width = 0, SizeT* actPosPtr = NULL); // std::ostream& ToStream(std::ostream& o) // { o << *this; return o;} std::istream& FromStream(std::istream& i) { i >> *this; return i;} void AddParent( DStructDesc* p); // private: // void AddTag( const BaseGDL* data); // adds copy of data // void AddTagGrab(BaseGDL* data); // adds data (only used by ExtraT) // friend class ExtraT; public: // adds data, grabs, adds also to descriptor (for initialization only) // note that initialization is only for scalars void NewTag( const std::string& tName, BaseGDL* data); // for easier internal (c++) usage template< class DataGDL> void InitTag(const std::string& tName, const DataGDL& data) { int tIx = Desc()->TagIndex( tName); if( tIx == -1) throw GDLException("Struct "+Desc()->Name()+ " does not contain tag "+tName+"."); assert( GetTag( tIx)->N_Elements() == data.N_Elements()); // SA: removed, apparently unnecessary, static_cast() which was causing // numerous compiler (e.g., i686-apple-darwin9-g++-4.0.1) warnings, e.g.: // // warning: inline function // 'Data_& Data_::operator=(const Data_&)' // used but never defined // //static_cast( *GetTag( tIx)) = data; // copy data GetTag( tIx)->InitFrom( data); // copy data } // members // used by the interpreter // throws (datatypes.cpp) int Scalar2Index( SizeT& st) const; int Scalar2RangeT( RangeT& st) const; RangeT LoopIndex() const; bool Scalar() const { return (N_Elements() == 1);} // make a duplicate on the heap BaseGDL* Dup() const { return new DStructGDL(*this);} DStructGDL* New ( const dimension& dim_, BaseGDL::InitType noZero=BaseGDL::ZERO ) const { // No NOZERO for structs if ( noZero == BaseGDL::NOZERO ) { DStructGDL* res = new DStructGDL ( Desc(), dim_, noZero ); res->MakeOwnDesc(); return res; } if ( noZero == BaseGDL::INIT ) { DStructGDL* res = new DStructGDL ( Desc(), dim_, BaseGDL::NOZERO ); res->MakeOwnDesc(); SizeT nEl = res->N_Elements(); SizeT nTags = NTags(); for ( SizeT t=0; tGetTag ( t, i )->InitFrom( cpTag); // res->dd[ i] = dd[ i % nTags]->Dup(); } return res; } DStructGDL* res = new DStructGDL ( Desc(), dim_ ); res->MakeOwnDesc(); return res; } DStructGDL* NewResult() const { DStructGDL* res = new DStructGDL ( Desc(), this->dim, BaseGDL::NOZERO); res->MakeOwnDesc(); return res; } // used by interpreter, calls CatInsert DStructGDL* CatArray( ExprListT& exprList, const SizeT catRank, const SizeT rank); template< typename To> typename Data_::Ty GetAs( SizeT i); BaseGDL* Convert2( DType destTy, BaseGDL::Convert2Mode mode = BaseGDL::CONVERT); #if defined( TEMPLATE_FRIEND_OK_) || (__GNUC__ >= 4) // make all other Convert2 functions friends template friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); #else // this explicit version should work in all cases friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); #endif std::ostream& Write( std::ostream& os, bool swapEndian, bool compress, XDR *xdrs); std::istream& Read( std::istream& os, bool swapEndian, bool compress, XDR *xdrs); bool True() { throw GDLException("Struct expression not allowed in this context.");} bool False() { throw GDLException("Struct expression not allowed in this context.");} bool LogTrue() { throw GDLException("Struct expression not allowed in this context.");} bool LogTrue( SizeT ix) { throw GDLException("Struct expression not allowed in this context.");} DLong* Where( bool, SizeT&) { throw GDLException("Struct expression not allowed in this context.");} Data_* LogNeg() { throw GDLException("Struct expression not allowed in this context.");} int Sgn(); // -1,0,1 bool Equal( BaseGDL*) const; bool EqualNoDelete( const BaseGDL*) const; bool ArrayEqual( BaseGDL*); // 'for' statement compliance (int types , float types scalar only) void ForCheck( BaseGDL**, BaseGDL** =NULL); bool ForCondUp( BaseGDL*); bool ForCondDown( BaseGDL*); void ForAdd(); void ForAdd( BaseGDL* add=NULL); BaseGDL* UMinus(); // UMinus for SpDString returns float DStructGDL* NotOp(); DStructGDL* AndOp( BaseGDL* r); DStructGDL* AndOpInv( BaseGDL* r); DStructGDL* OrOp( BaseGDL* r); DStructGDL* OrOpInv( BaseGDL* r); DStructGDL* XorOp( BaseGDL* r); DStructGDL* Add( BaseGDL* r); DStructGDL* AddInv( BaseGDL* r); DStructGDL* Sub( BaseGDL* r); DStructGDL* SubInv( BaseGDL* r); DStructGDL* GtMark( BaseGDL* r); DStructGDL* LtMark( BaseGDL* r); DStructGDL* Mult( BaseGDL* r); DStructGDL* Div( BaseGDL* r); DStructGDL* DivInv( BaseGDL* r); DStructGDL* Mod( BaseGDL* r); DStructGDL* ModInv( BaseGDL* r); DStructGDL* Pow( BaseGDL* r); DStructGDL* PowInv( BaseGDL* r); DStructGDL* PowInt( BaseGDL* r); DStructGDL* MatrixOp( BaseGDL* r, bool atranspose, bool btranspose); DStructGDL* AndOpS( BaseGDL* r); DStructGDL* AndOpInvS( BaseGDL* r); DStructGDL* OrOpS( BaseGDL* r); DStructGDL* OrOpInvS( BaseGDL* r); DStructGDL* XorOpS( BaseGDL* r); DStructGDL* AddS( BaseGDL* r); DStructGDL* AddInvS( BaseGDL* r); DStructGDL* SubS( BaseGDL* r); DStructGDL* SubInvS( BaseGDL* r); DStructGDL* GtMarkS( BaseGDL* r); DStructGDL* LtMarkS( BaseGDL* r); DStructGDL* MultS( BaseGDL* r); DStructGDL* DivS( BaseGDL* r); DStructGDL* DivInvS( BaseGDL* r); DStructGDL* ModS( BaseGDL* r); DStructGDL* ModInvS( BaseGDL* r); DStructGDL* PowS( BaseGDL* r); DStructGDL* PowInvS( BaseGDL* r); // operators returning a new value DStructGDL* AndOpNew( BaseGDL* r); DStructGDL* AndOpInvNew( BaseGDL* r); DStructGDL* OrOpNew( BaseGDL* r); DStructGDL* OrOpInvNew( BaseGDL* r); DStructGDL* XorOpNew( BaseGDL* r); // DStructGDL* EqOpNew( BaseGDL* r); // DStructGDL* NeOpNew( BaseGDL* r); // DStructGDL* LeOpNew( BaseGDL* r); // DStructGDL* GeOpNew( BaseGDL* r); // DStructGDL* LtOpNew( BaseGDL* r); // DStructGDL* GtOpNew( BaseGDL* r); DStructGDL* AddNew( BaseGDL* r); // implemented DStructGDL* AddInvNew( BaseGDL* r); // implemented DStructGDL* SubNew( BaseGDL* r); DStructGDL* SubInvNew( BaseGDL* r); DStructGDL* LtMarkNew( BaseGDL* r); DStructGDL* GtMarkNew( BaseGDL* r); DStructGDL* MultNew( BaseGDL* r); // implemented DStructGDL* DivNew( BaseGDL* r); DStructGDL* DivInvNew( BaseGDL* r); DStructGDL* ModNew( BaseGDL* r); DStructGDL* ModInvNew( BaseGDL* r); DStructGDL* PowNew( BaseGDL* r); DStructGDL* PowInvNew( BaseGDL* r); DStructGDL* PowIntNew( BaseGDL* r); // implemented // operators with scalar returning a new value DStructGDL* AndOpSNew( BaseGDL* r); DStructGDL* AndOpInvSNew( BaseGDL* r); DStructGDL* OrOpSNew( BaseGDL* r); DStructGDL* OrOpInvSNew( BaseGDL* r); DStructGDL* XorOpSNew( BaseGDL* r); DStructGDL* AddSNew( BaseGDL* r); // implemented DStructGDL* AddInvSNew( BaseGDL* r); // implemented DStructGDL* SubSNew( BaseGDL* r); DStructGDL* SubInvSNew( BaseGDL* r); DStructGDL* LtMarkSNew( BaseGDL* r); DStructGDL* GtMarkSNew( BaseGDL* r); DStructGDL* MultSNew( BaseGDL* r); // implemented DStructGDL* DivSNew( BaseGDL* r); DStructGDL* DivInvSNew( BaseGDL* r); DStructGDL* ModSNew( BaseGDL* r); DStructGDL* ModInvSNew( BaseGDL* r); DStructGDL* PowSNew( BaseGDL* r); DStructGDL* PowInvSNew( BaseGDL* r); BaseGDL* EqOp( BaseGDL* r); BaseGDL* NeOp( BaseGDL* r); BaseGDL* GtOp( BaseGDL* r); BaseGDL* GeOp( BaseGDL* r); BaseGDL* LtOp( BaseGDL* r); BaseGDL* LeOp( BaseGDL* r); // assigns srcIn to this at ixList, if ixList is NULL does linear copy // assumes: ixList has this already set as variable // frees overwritten members void AssignAt( BaseGDL* srcIn, ArrayIndexListT* ixList, SizeT offset); void AssignAt( BaseGDL* srcIn, ArrayIndexListT* ixList); void AssignAt( BaseGDL* srcIn); void AssignAtIx( RangeT ixR, BaseGDL* srcIn); void DecAt( ArrayIndexListT* ixList) { throw GDLException("Struct expression not allowed in this context."); } void IncAt( ArrayIndexListT* ixList) { throw GDLException("Struct expression not allowed in this context."); } void Dec() { throw GDLException("Struct expression not allowed in this context."); } void Inc() { throw GDLException("Struct expression not allowed in this context."); } // used by AccessDescT for resolving, no checking is done // inserts srcIn[ ixList] at offset // here d is initially empty -> no deleting of old data in InsertAt void InsertAt( SizeT offset, BaseGDL* srcIn, ArrayIndexListT* ixList); // returns (*this)[ ixList] DStructGDL* Index( ArrayIndexListT* ixList); DStructGDL* NewIx( SizeT ix); // formatting output functions SizeT OFmtA( std::ostream* os, SizeT offset, SizeT num, int width); SizeT OFmtF( std::ostream* os, SizeT offs, SizeT num, int width, int prec, char fill, BaseGDL::IOMode oM = FIXED); SizeT OFmtI( std::ostream* os, SizeT offs, SizeT num, int width, int minN, char fill, BaseGDL::IOMode oM = DEC); SizeT IFmtA( std::istream* is, SizeT offset, SizeT num, int width); SizeT IFmtF( std::istream* is, SizeT offs, SizeT num, int width); SizeT IFmtI( std::istream* is, SizeT offs, SizeT num, int width, BaseGDL::IOMode oM = DEC); private: void IFmtAll( SizeT offs, SizeT r, SizeT& firstOut, SizeT& firstOffs, SizeT& tCount, SizeT& tCountOut); void OFmtAll( SizeT offs, SizeT r, SizeT& firstOut, SizeT& firstOffs, SizeT& tCount, SizeT& tCountOut); // inserts srcIn at ixDim // respects the exact structure // used by Assign -> old data must be freed void InsAt( DStructGDL* srcIn, ArrayIndexListT* ixList); // used for concatenation, called from CatArray // assumes that everything is checked (see CatInfo) void CatInsert( const DStructGDL* srcArr, const SizeT atDim, SizeT& at); }; #endif gdl-0.9.4/src/convol.cpp0000664000175000017500000002140312171536141013516 0ustar marcmarc/*************************************************************************** convol.cpp - convol function ------------------- begin : Sep 19 2004 copyright : (C) 2004 by Marc Schellens email : m_schellens@users.sourceforge.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ // optimized version // to be included from datatypes.cpp (twice) #ifdef INCLUDE_CONVOL_CPP #ifndef CONVOL_COMMON__ #define CONVOL_COMMON__ // common used functions #endif //#define CONVOL_COMMON__ using namespace std; #ifdef CONVOL_BYTE__ template<> BaseGDL* Data_::Convol( BaseGDL* kIn, BaseGDL* scaleIn, BaseGDL* bias, bool center, bool normalize, int edgeMode) { Data_* kernel = static_cast*>( kIn); DLong scale = (*static_cast*>( scaleIn))[0]; // the result to be returned Data_* res = New( dim, BaseGDL::ZERO); DInt* ker = static_cast( kernel->DataAddr()); // DLong* biasd=static_cast( bias); Data_* biast=static_cast*>( bias); DLong* biasd = static_cast( biast->DataAddr()); #else #ifdef CONVOL_UINT__ template<> BaseGDL* Data_::Convol( BaseGDL* kIn, BaseGDL* scaleIn, BaseGDL* bias, bool center, bool normalize, int edgeMode) { Data_* kernel = static_cast( kIn); DLong scale = (*static_cast*>( scaleIn))[0]; // the result to be returned Data_* res = New( dim, BaseGDL::ZERO); // DLong* ker = static_cast( kernel->DataAddr()); Ty* ker = &(*kernel)[0]; // DLongGDL* biasd=static_cast( bias); Data_* biast=static_cast( bias); Ty* biasd = &(*biast)[0]; #else template BaseGDL* Data_::Convol( BaseGDL* kIn, BaseGDL* scaleIn, BaseGDL* bias, bool center, bool normalize, int edgeMode) { Data_* kernel = static_cast( kIn); Ty scale = (*static_cast( scaleIn))[0]; // the result to be returned Data_* res = New( this->dim, BaseGDL::ZERO); Ty* ker = &(*kernel)[0]; Data_* biast=static_cast( bias); Ty* biasd = &(*biast)[0]; #endif #endif if( scale == this->zero) scale = 1; SizeT nA = N_Elements(); SizeT nK = kernel->N_Elements(); if(normalize) { DDouble tmp=0; for ( SizeT ind=0; ind255) biasd[0]=255; #endif } SizeT nDim = this->Rank(); // number of dimension to run over SizeT kStride[MAXRANK+1]; kernel->Dim().Stride( kStride, nDim); // setup kIxArr[ nDim * nK] the offset array // this handles center long* kIxArr = new long[ nDim * nK]; ArrayGuard kIxArrGuard( kIxArr); // guard it for( SizeT k=0; kDim( 0)); if( center) kIxArr[ k * nDim + 0] = -(kIxArr[ k * nDim + 0] + kernel->Dim( 0) / 2); for( SizeT kSp=1; kSpDim( kSp); if( kDim == 0) kDim = 1; kIxArr[ k * nDim + kSp] = -((k / kStride[kSp]) % kDim); if( center) kIxArr[ k * nDim + kSp] = -(kIxArr[ k * nDim + kSp] + kDim / 2); } } SizeT aStride[ MAXRANK + 1]; this->dim.Stride( aStride, nDim); long aInitIx[ MAXRANK+1]; for( SizeT aSp=0; aSp<=nDim; ++aSp) aInitIx[ aSp] = 0; bool regArr[ MAXRANK]; long aBeg[ MAXRANK]; long aEnd[ MAXRANK]; for( SizeT aSp=0; aSpDim( aSp); if( kDim == 0) kDim = 1; aBeg[ aSp] = (center) ? kDim/2 : kDim-1; // >= regArr[ aSp] = !aBeg[ aSp]; aEnd[ aSp] = (center) ? this->dim[aSp]-(kDim-1)/2 : this->dim[aSp]; // < } Ty* ddP = &(*this)[0]; // some loop constants SizeT dim0 = this->dim[0]; SizeT aBeg0 = aBeg[0]; SizeT aEnd0 = aEnd[0]; SizeT dim0_1 = dim0 - 1; SizeT dim0_aEnd0 = dim0 - aEnd[0]; SizeT kDim0 = kernel->Dim( 0); SizeT kDim0_nDim = kDim0 * nDim; #define INCLUDE_CONVOL_INC_CPP if( edgeMode == 0) { #include "convol_inc0.cpp" } else if( edgeMode == 1) { #include "convol_inc1.cpp" } else if( edgeMode == 2) { #include "convol_inc2.cpp" } #undef INCLUDE_CONVOL_INC_CPP if(biasd[0]!=this->zero) { for(SizeT indi=0;indiNParam( 2); /************************************Checking_parameters************************************************/ BaseGDL* p0 = e->GetNumericParDefined( 0); if( p0->Rank() == 0) e->Throw( "Expression must be an array in this context: "+ e->GetParString(0)); BaseGDL* p1 = e->GetNumericParDefined( 1); if( p1->Rank() == 0) e->Throw( "Expression must be an array in this context: "+ e->GetParString(1)); if( p0->N_Elements() < p1->N_Elements()) e->Throw( "Incompatible dimensions for Array and Kernel."); // rank 1 for kernel works always if( p1->Rank() != 1) { SizeT rank = p0->Rank(); if( rank != p1->Rank()) e->Throw( "Incompatible dimensions for Array and Kernel."); for( SizeT r=0; rDim( r) < p1->Dim( r)) e->Throw( "Incompatible dimensions for Array and Kernel."); } /***************************************Preparing_matrices*************************************************/ // convert kernel to array type Guard p1Guard; if( p0->Type() == GDL_BYTE) { if( p1->Type() != GDL_INT) { p1 = p1->Convert2( GDL_INT, BaseGDL::COPY); p1Guard.Reset( p1); } } else if( p0->Type() != p1->Type()) { p1 = p1->Convert2( p0->Type(), BaseGDL::COPY); p1Guard.Reset( p1); } BaseGDL* scale; Guard scaleGuard; if( nParam > 2) { scale = e->GetParDefined( 2); if( scale->Rank() > 0) e->Throw( "Expression must be a scalar in this context: "+ e->GetParString(2)); // p1 here handles GDL_BYTE case also if( p1->Type() != scale->Type()) { scale = scale->Convert2( p1->Type(),BaseGDL::COPY); scaleGuard.Reset( scale); } } else { scale = p1->New( dimension(), BaseGDL::ZERO); } /********************************************Arguments_treatement***********************************/ bool center = true; static int centerIx = e->KeywordIx( "CENTER"); if( e->KeywordPresent( centerIx)) { DLong c; e->AssureLongScalarKW( centerIx, c); center = (c != 0); } // overrides EDGE_TRUNCATE static int edge_wrapIx = e->KeywordIx( "EDGE_WRAP"); bool edge_wrap = e->KeywordSet( edge_wrapIx); static int edge_truncateIx = e->KeywordIx( "EDGE_TRUNCATE"); bool edge_truncate = e->KeywordSet( edge_truncateIx); int edgeMode = 0; if( edge_wrap) edgeMode = 1; else if( edge_truncate) edgeMode = 2; // p0, p1 and scale have same type // p1 has rank of 1 or same rank as p0 with each dimension smaller than p0 // scale is a scalar /***********************************Parameter_BIAS**************************************/ static int biasIx = e->KeywordIx("BIAS"); bool statusBias = e->KeywordPresent( biasIx ); // DLong bias=0; BaseGDL* bias; if(statusBias) { bias=e->GetKW( biasIx); if( p0->Type() != bias->Type()) { bias = bias->Convert2( p0->Type(), BaseGDL::COPY); } } else bias=p1->New( 1,BaseGDL::ZERO); /***********************************Parameter_Normalize**********************************/ static int normalIx = e->KeywordIx( "NORMALIZE"); bool normalize = e->KeywordPresent( normalIx); return p0->Convol( p1, scale, bias, center, normalize, edgeMode); } //end of convol_fun }//end of namespace #endif #endif // #ifdef INCLUDE_CONVOL_CPP gdl-0.9.4/src/gshhs.cpp0000664000175000017500000002750012154445372013344 0ustar marcmarc/*************************************************************************** gshhs.cpp - GSHHS-related routines ------------------- begin : Apr 18 2010 copyright : (C) 2010 by Sylwester Arabas based on the GPL-licensed code (see note below) by P. Wessel and W. H. F. Smith email : slayoo@users.sourceforge.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifdef HAVE_CONFIG_H #include #else // default: assume we have GSHHS #define USE_GSHHS 1 #endif #include "includefirst.hpp" #include "gshhs.hpp" #include "plotting.hpp" #include "math_utl.hpp" #ifdef USE_GSHHS # include #endif namespace lib { using namespace std; class map_continents_call : public plotting_routine_call { private: bool handle_args(EnvT* e) { return true; } private: void old_body(EnvT* e, GDLGStream* actStream) { #ifndef USE_GSHHS e->Throw("GDL was compiled without support for GSHHS"); #else // mapping init bool mapSet = false; #ifdef USE_LIBPROJ4 LPTYPE idata; XYTYPE odata; get_mapset(mapSet); if (mapSet) { ref = map_init(); if (ref == NULL) e->Throw( "Projection initialization failed."); } #endif if (!mapSet) e->Throw("Map transform not established (MAP_SET)."); gdlSetGraphicsForegroundColorFromKw(e, actStream); actStream->NoSub(); bool forget=false; DDouble *sx, *sy; GetSFromPlotStructs(&sx, &sy); DFloat *wx, *wy; GetWFromPlotStructs(&wx, &wy); DDouble xStart, xEnd, yStart, yEnd; DataCoordLimits(sx, sy, wx, wy, &xStart, &xEnd, &yStart, &yEnd, true); actStream->vpor(wx[0], wx[1], wy[0], wy[1]); actStream->wind( xStart, xEnd, yStart, yEnd); // GDL stuff static int riversIx = e->KeywordIx("RIVERS"); bool kw_rivers = e->KeywordSet(riversIx); static int countriesIx = e->KeywordIx("COUNTRIES"); bool kw_countries = e->KeywordSet(countriesIx); static int hiresIx = e->KeywordIx("HIRES"); bool kw_hires = e->KeywordSet(hiresIx); static int fillIx = e->KeywordIx("FILL_CONTINENTS"); bool kw_fill = e->KeywordSet(fillIx); // SA: the code below is based on the gshhs.c by Paul Wessel // here's the original copyright notice: /* * Copyright (c) 1996-2009 by P. Wessel and W. H. F. Smith * See COPYING file for copying and redistribution conditions. * * PROGRAM: gshhs.c * AUTHOR: Paul Wessel (pwessel@hawaii.edu) * CREATED: JAN. 28, 1996 * PURPOSE: To extract ASCII data from the binary GSHHS shoreline data * as described in the 1996 Wessel & Smith JGR Data Analysis Note. * VERSION: 1.1 (Byte flipping added) * 1.2 18-MAY-1999: * Explicit binary open for DOS systems * POSIX.1 compliant * 1.3 08-NOV-1999: Released under GNU GPL * 1.4 05-SEPT-2000: Made a GMT supplement; FLIP no longer needed * 1.5 14-SEPT-2004: Updated to deal with latest GSHHS database (1.3) * 1.6 02-MAY-2006: Updated to deal with latest GSHHS database (1.4) * 1.7 11-NOV-2006: Fixed bug in computing level (&& vs &) * 1.8 31-MAR-2007: Updated to deal with latest GSHHS database (1.5) * 1.9 27-AUG-2007: Handle line data as well as polygon data * 1.10 15-FEB-2008: Updated to deal with latest GSHHS database (1.6) * 1.12 15-JUN-2009: Now contains information on container polygon, * the polygons ancestor in the full resolution, and * a flag to tell if a lake is a riverlake. * Updated to deal with latest GSHHS database (2.0) * * 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; version 2 of the License. * * 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. * * Contact info: www.soest.hawaii.edu/pwessel */ string dir = string(GDLDATADIR) + "/../gshhs/"; enum set {continents, countries, rivers, coasts}; string sufix = kw_hires ? "_h.b" : "_c.b"; vector files(4); files[continents] = dir + "gshhs" + sufix; files[countries] = dir + "wdb_borders" + sufix; files[rivers] = dir + "wdb_rivers" + sufix; files[coasts] = dir + "gshhs" + sufix; for (int i = 0; i < files.size(); ++i) { if (kw_fill && i != continents) continue; if (i == countries && !kw_countries) continue; if (i == rivers && !kw_rivers) continue; // TODO: coasts, continents FILE *fp = NULL; if ((fp = fopen (files[i].c_str(), "rb")) == NULL ) e->Throw("GSHHS: Could not open file: " + files[i]); FILEGuard fpGuard( fp, fclose); struct GSHHS h; int n_read = fread((void *)&h, (size_t)sizeof (struct GSHHS), (size_t)1, fp); int version = (h.flag >> 8) & 255; int flip = (version != GSHHS_DATA_RELEASE); /* Take as sign that byte-swabbing is needed */ int max_east = 270000000; while (n_read == 1) { if (flip) { h.id = swabi4((unsigned int)h.id); h.n = swabi4((unsigned int)h.n); h.west = swabi4((unsigned int)h.west); h.east = swabi4((unsigned int)h.east); h.south = swabi4((unsigned int)h.south); h.north = swabi4((unsigned int)h.north); h.area = swabi4((unsigned int)h.area); h.area_full = swabi4((unsigned int)h.area_full); h.flag = swabi4((unsigned int)h.flag); h.container = swabi4((unsigned int)h.container); h.ancestor = swabi4((unsigned int)h.ancestor); } int level = h.flag & 255; // Level is 1-4 version = (h.flag >> 8) & 255; // Version is 1-7 int greenwich = (h.flag >> 16) & 1; // Greenwich is 0 or 1 int src = (h.flag >> 24) & 1; // Greenwich is 0 (WDBII) or 1 (WVS) int river = (h.flag >> 25) & 1; // River is 0 (not river) or 1 (is river) double ww = h.west * GSHHS_SCL; // Convert from microdegrees to degrees double ee = h.east * GSHHS_SCL; double ss = h.south * GSHHS_SCL; double nn = h.north * GSHHS_SCL; char source = (src == 1) ? 'W' : 'C'; // Either WVS or CIA (WDBII) pedigree if (river) source = tolower ((int)source); // Lower case c means river-lake int line = (h.area) ? 0 : 1; // Either Polygon (0) or Line (1) (if no area) /* double area = 0.1 * h.area; // Now im km^2 double f_area = 0.1 * h.area_full; // Now im km^2 char kind[2] = {'P', 'L'}; char c = kind[line]; if (line) { printf ("%c %6d%8d%2d%2c%10.5f%10.5f%10.5f%10.5f\n", c, h.id, h.n, level, source, ww, ee, ss, nn); } else { char ancestor[8], container[8]; (h.container == -1) ? sprintf (container, "-") : sprintf (container, "%6d", h.container); (h.ancestor == -1) ? sprintf (ancestor, "-") : sprintf (ancestor, "%6d", h.ancestor); printf ("%c %6d%8d%2d%2c%13.3f%13.3f%10.5f%10.5f%10.5f%10.5f %s %s\n", c, h.id, h.n, level, source, area, f_area, ww, ee, ss, nn, container, ancestor); } */ double lon_last, lat_last, olon; PLFLT *lons, *lats; SizeT k,l; if (kw_fill && !line) { lons = (PLFLT*)malloc(h.n *2* sizeof(PLFLT)); if (lons == NULL) e->Throw("Failed to allocate memory (lons)"); lats = (PLFLT*)malloc(h.n *2* sizeof(PLFLT)); if (lats == NULL) e->Throw("Failed to allocate memory (lats)"); } // Message("in file" + files[i] + " for " + (line ? "line" : "polygon") // + i2s(h.id) + ",size " + i2s(h.n)+", level"+i2s(level)); for (k = 0, l=0 ; k < h.n; k++) { struct POINT p; if (fread ((void *)&p, (size_t)sizeof(struct POINT), (size_t)1, fp) != 1) { e->Throw("Error reading file" + files[i] + " for " + (line ? "line" : "polygon") + i2s(h.id) + ", point " + i2s(k)); } if (!(line && kw_fill)) { // byte order if (flip) { p.x = swabi4((unsigned int)p.x); p.y = swabi4((unsigned int)p.y); } // value scaling double lon = p.x * GSHHS_SCL; if ((greenwich && p.x > max_east) || (h.west > 180000000)) lon -= 360.0; double lat = p.y * GSHHS_SCL; #ifdef USE_LIBPROJ4 // map projection if (mapSet) // ... always true { idata.lam = lon * DEG_TO_RAD; idata.phi = lat * DEG_TO_RAD; odata = PJ_FWD(idata, ref); lon = odata.x; lat = odata.y; } #endif if (k != 0) { //very crude patch --- will not avoid spurious lines & artifacts! if(fabs(olon-lon) > 0.5*abs(xEnd-xStart)) forget=true; olon=lon; } // drawing line or recording data for drawing a polygon afterwards if (!kw_fill) { if (k != 0) { if (forget) forget=false; else actStream->join(lon_last, lat_last, lon, lat); } lon_last = lon; lat_last = lat; } else { if (forget) { forget=false; if (l>2) actStream->fill(l, lons, lats); // TODO: PL_MAXPOLY is 256 :( l=0; lons[l] = lon; lats[l] = lat; l++; } else { lons[l] = lon; lats[l] = lat; l++; } } } } if (kw_fill && !line) { if (l>2) actStream->fill(l, lons, lats); // TODO: PL_MAXPOLY is 256 :( free(lons); free(lats); } max_east = 180000000; /* Only Eurasia needs 270 */ n_read = fread((void *)&h, (size_t)sizeof (struct GSHHS), (size_t)1, fp); } // fclose(fp); } actStream->lsty(1); //reset linestyle #endif } // old_body private: void call_plplot(EnvT* e, GDLGStream* actStream) { } private: void post_call(EnvT* e, GDLGStream* actStream) { } }; // class definition void map_continents(EnvT* e) { map_continents_call map_continents; map_continents.call(e, 0); } } // namespace gdl-0.9.4/src/plotting_surface.cpp0000664000175000017500000003663512216133725015604 0ustar marcmarc/*************************************************************************** plotting.cpp - GDL routines for plotting ------------------- begin : July 22 2002 copyright : (C) 2002-2011 by Marc Schellens et al. email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" #include "plotting.hpp" #include "math_utl.hpp" namespace lib { //XRANGE etc behaviour not as IDL (in some ways, better!) //TBD: LEGO using namespace std; // shared parameter class surface_call: public plotting_routine_call { DDoubleGDL *zVal, *yVal, *xVal; Guard xval_guard, yval_guard, p0_guard; SizeT xEl, yEl, zEl; DDouble xStart, xEnd, yStart, yEnd, zStart, zEnd, datamax, datamin; bool nodata; bool setZrange; bool xLog; bool yLog; bool zLog; ORIENTATION3D axisExchangeCode; private: bool handle_args (EnvT* e) { xLog=e->KeywordSet ( "XLOG" ); yLog=e->KeywordSet ( "YLOG" ); zLog=e->KeywordSet ( "ZLOG" ); if ( nParam ( )==1 ) { if ( (e->GetNumericArrayParDefined ( 0 ))->Rank ( )!=2 ) e->Throw ( "Array must have 2 dimensions: " +e->GetParString ( 0 ) ); BaseGDL* p0=e->GetNumericArrayParDefined ( 0 )->Transpose ( NULL ); zVal=static_cast ( p0->Convert2 ( GDL_DOUBLE, BaseGDL::COPY ) ); p0_guard.reset ( p0 ); // delete upon exit if ( zVal->Rank ( )!=2 ) e->Throw ( "Array must have 2 dimensions: " +e->GetParString ( 0 ) ); xEl=zVal->Dim ( 1 ); yEl=zVal->Dim ( 0 ); xVal=new DDoubleGDL ( dimension ( xEl ), BaseGDL::INDGEN ); xval_guard.reset ( xVal ); // delete upon exit if (xLog) xVal->Inc(); yVal=new DDoubleGDL ( dimension ( yEl ), BaseGDL::INDGEN ); yval_guard.reset ( yVal ); // delete upon exit if (yLog) yVal->Inc(); } else if ( nParam ( )==2||nParam ( )>3 ) { e->Throw ( "Incorrect number of arguments." ); } else { BaseGDL* p0=e->GetNumericArrayParDefined ( 0 )->Transpose ( NULL ); zVal=static_cast ( p0->Convert2 ( GDL_DOUBLE, BaseGDL::COPY ) ); p0_guard.reset ( p0 ); // delete upon exit if ( zVal->Rank ( )!=2 ) e->Throw ( "Array must have 2 dimensions: " +e->GetParString ( 0 ) ); xVal=e->GetParAs< DDoubleGDL>( 1 ); yVal=e->GetParAs< DDoubleGDL>( 2 ); if ( xVal->Rank ( )!=1 ) e->Throw ( "Unable to handle non-vectorial array "+e->GetParString ( 1 )+" (FIXME!)" ); if ( yVal->Rank ( )!=1 ) e->Throw ( "Unable to handle non-vectorial array "+e->GetParString ( 1 )+" (FIXME!)" ); if ( xVal->Rank ( )==1 ) { xEl=xVal->Dim ( 0 ); if ( xEl!=zVal->Dim ( 1 ) ) e->Throw ( "X, Y, or Z array dimensions are incompatible." ); } if ( yVal->Rank ( )==1 ) { yEl=yVal->Dim ( 0 ); if ( yEl!=zVal->Dim ( 0 ) ) e->Throw ( "X, Y, or Z array dimensions are incompatible." ); } } GetMinMaxVal ( xVal, &xStart, &xEnd ); GetMinMaxVal ( yVal, &yStart, &yEnd ); //XRANGE and YRANGE overrides all that, but Start/End should be recomputed accordingly DDouble xAxisStart, xAxisEnd, yAxisStart, yAxisEnd; bool setx=gdlGetDesiredAxisRange(e, "X", xAxisStart, xAxisEnd); bool sety=gdlGetDesiredAxisRange(e, "Y", yAxisStart, yAxisEnd); if(setx && sety) { xStart=xAxisStart; xEnd=xAxisEnd; yStart=yAxisStart; yEnd=yAxisEnd; } else if (sety) { yStart=yAxisStart; yEnd=yAxisEnd; } else if (setx) { xStart=xAxisStart; xEnd=xAxisEnd; //must compute min-max for other axis! { gdlDoRangeExtrema(xVal,yVal,yStart,yEnd,xStart,xEnd); } } #undef UNDEF_RANGE_VALUE // z range datamax=0.0; datamin=0.0; GetMinMaxVal ( zVal, &datamin, &datamax ); zStart=datamin; zEnd=datamax; setZrange = gdlGetDesiredAxisRange(e, "Z", zStart, zEnd); return false; } private: #define DPI (double)(4*atan(1.0)) #define DEGTORAD DPI/180.0 void old_body (EnvT* e, GDLGStream* actStream) // {{{ { //projection: would work only with 2D X and Y. Not supported here bool mapSet=false; #ifdef USE_LIBPROJ4 static LPTYPE idata; static XYTYPE odata; static PROJTYPE* ref; get_mapset ( mapSet ); if ( mapSet ) { // do nothing // ref=map_init ( ); // if ( ref==NULL ) e->Throw ( "Projection initialization failed." ); // but warn that projection is not taken into account Warning ( "SURFACE: Projection is set, but not taken into account (ony 1d X and Y) (FIX plplot first!)." ); } #endif //T3D static int t3dIx = e->KeywordIx( "T3D"); bool doT3d=(e->KeywordSet(t3dIx)|| T3Denabled(e)); //ZVALUE static int zvIx = e->KeywordIx( "ZVALUE"); DDouble zValue=0.0; e->AssureDoubleScalarKWIfPresent ( zvIx, zValue ); zValue=min(zValue,0.999999); //to avoid problems with plplot //SAVE static int savet3dIx = e->KeywordIx( "SAVE"); bool saveT3d=e->KeywordSet(savet3dIx); //NODATA static int nodataIx = e->KeywordIx( "NODATA"); nodata=e->KeywordSet(nodataIx); //SHADES static int shadesIx = e->KeywordIx( "SHADES"); BaseGDL* shadevalues=e->GetKW ( shadesIx ); bool doShade=(shadevalues != NULL); //... But 3d mesh will be colorized anyway! if (doShade) Warning ( "SHADE_SURF: Using Fixed (Z linear) Shade Values Only (FIXME)." ); // [XYZ]STYLE DLong xStyle=0, yStyle=0, zStyle=0; ; gdlGetDesiredAxisStyle(e, "X", xStyle); gdlGetDesiredAxisStyle(e, "Y", yStyle); gdlGetDesiredAxisStyle(e, "Z", zStyle); //check here since after AutoIntvAC values will be good but arrays passed //to plplot will be bad... if ( xLog && xStart<=0.0 ) { Warning ( "SURFACE: Infinite x plot range." ); nodata=true; } if ( yLog && yStart<=0.0 ) { Warning ( "SURFACE: Infinite y plot range." ); nodata=true; } if ( zLog && zStart<=0.0 ) Warning ( "SURFACE: Infinite z plot range." ); if ( ( xStyle&1 )!=1 ) { PLFLT intv=AutoIntvAC ( xStart, xEnd, xLog ); } if ( ( yStyle&1 )!=1 ) { PLFLT intv=AutoIntvAC ( yStart, yEnd, yLog ); } bool hasMinVal=e->KeywordPresent("MIN_VALUE"); bool hasMaxVal=e->KeywordPresent("MAX_VALUE"); DDouble minVal=datamin; DDouble maxVal=datamax; e->AssureDoubleScalarKWIfPresent ( "MIN_VALUE", minVal ); e->AssureDoubleScalarKWIfPresent ( "MAX_VALUE", maxVal ); if (!setZrange) { zStart=max(minVal,zStart); zEnd=min(zEnd,maxVal); } // then only apply expansion of axes: if ( ( zStyle&1 )!=1 ) { PLFLT intv=AutoIntvAC ( zStart, zEnd, zLog ); } // background BEFORE next plot since it is the only place plplot may redraw the background... gdlSetGraphicsBackgroundColorFromKw ( e, actStream ); //BACKGROUND gdlNextPlotHandlingNoEraseOption(e, actStream); //NOERASE gdlSetPlotCharsize(e, actStream); // Deal with T3D options -- either present and we have to deduce az and alt contained in it, // or absent and we have to compute !P.T from az and alt. PLFLT alt=30.0; PLFLT az=30.0; //set az and ax (alt) DFloat alt_change=alt; e->AssureFloatScalarKWIfPresent("AX", alt_change); alt=alt_change; alt=fmod(alt,360.0); //restrict between 0 and 90 for plplot! if (alt > 90.0 || alt < 0.0) { e->Throw ( "SURFACE: AX restricted to [0-90] range by plplot (fix plplot!)" ); } DFloat az_change=az; e->AssureFloatScalarKWIfPresent("AZ", az_change); az=az_change; //now we are in plplot different kind of 3d DDoubleGDL* plplot3d; DDouble ay, scale; //not useful at this time if (doT3d) //convert to this world... { plplot3d=gdlConvertT3DMatrixToPlplotRotationMatrix(zValue, az, alt, ay, scale, axisExchangeCode); if (plplot3d == NULL) { e->Throw ( "SURFACE: Illegal 3D transformation." ); } } else //make the transformation ourselves { scale=1/sqrt(3.0); //Compute transformation matrix with plplot conventions: plplot3d=gdlComputePlplotRotationMatrix( az, alt, zValue,scale); // save !P.T if asked to... if (saveT3d) //will use ax and az values... { DDoubleGDL* t3dMatrix=plplot3d->Dup(); SelfTranspose3d(t3dMatrix); static DStructGDL* pStruct=SysVar::P(); static unsigned tTag=pStruct->Desc()->TagIndex("T"); for (int i=0; iN_Elements(); ++i )(*static_cast(pStruct->GetTag(tTag, 0)))[i]=(*t3dMatrix)[i]; GDLDelete(t3dMatrix); } } if ( gdlSet3DViewPortAndWorldCoordinates(e, actStream, plplot3d, xLog, yLog, xStart, xEnd, yStart, yEnd, zStart, zEnd, zLog)==FALSE ) return; gdlSetPlotCharthick(e,actStream); if (xLog) xStart=log10(xStart); if (yLog) yStart=log10(yStart); if (zLog) zStart=log10(zStart); if (xLog) xEnd=log10(xEnd); if (yLog) yEnd=log10(yEnd); if (zLog) zEnd=log10(zEnd); actStream->w3d(scale,scale,scale*(1.0-zValue), xStart, xEnd, yStart, yEnd, zStart, zEnd, alt, az); bool up=e->KeywordSet ( "UPPER_ONLY" ); bool low=e->KeywordSet ( "LOWER_ONLY" ); if (up && low) nodata=true; //IDL behaviour DLong bottomColorIndex=-1; e->AssureLongScalarKWIfPresent("BOTTOM", bottomColorIndex); //Draw 3d mesh before axes // PLOT ONLY IF NODATA=0 if (!nodata) { //use of intermediate map for correct handling of blanking values and nans. PLFLT ** map; actStream->Alloc2dGrid( &map, xEl, yEl); for ( SizeT i=0, k=0; i mav) v=mav; } else { if ( !isfinite(v) ) v=minVal; if ( hasMinVal && v < minVal) v=minVal; if ( hasMaxVal && v > maxVal) v=maxVal; } map[i][j] = v; } } // 1 types of grid only: 1D X and Y. PLcGrid cgrid1; // X and Y independent deformation PLFLT* xg1; PLFLT* yg1; xg1 = new PLFLT[xEl]; yg1 = new PLFLT[yEl]; cgrid1.xg = xg1; cgrid1.yg = yg1; cgrid1.nx = xEl; cgrid1.ny = yEl; for ( SizeT i=0; i0?log10(cgrid1.xg[i]):1E-12; // #define EXTENDED_DEFAULT_LOGRANGE 12 if (yLog) for ( SizeT i=0; i0?log10(cgrid1.yg[i]):1E-12; // Important: make all clipping computations BEFORE setting graphic properties (color, size) bool doClip=(e->KeywordSet("CLIP")||e->KeywordSet("NOCLIP")); bool stopClip=false; if ( doClip ) if ( startClipping(e, actStream, false)==TRUE ) stopClip=true; gdlSetGraphicsForegroundColorFromKw ( e, actStream ); //mesh option PLINT meshOpt; meshOpt=DRAW_LINEXY; if (e->KeywordSet ( "HORIZONTAL" )) meshOpt=DRAW_LINEX; if (e->KeywordSet ( "SKIRT" )) meshOpt+=DRAW_SIDES; //mesh plots both sides, so use it when UPPER_ONLY is not set. //if UPPER_ONLY is set, use plot3d/plot3dc //if LOWER_ONLY is set, use mesh/meshc and remove by plot3d! //in not up not low: mesh since mesh plots both sides if (up) { if (doShade) actStream->plot3dc(xg1,yg1,map,cgrid1.nx,cgrid1.ny,meshOpt+MAG_COLOR,NULL,0); else actStream->plot3dc(xg1,yg1,map,cgrid1.nx,cgrid1.ny,meshOpt,NULL,0); } else //mesh (both sides) but contains 'low' (remove top) and/or bottom { if (bottomColorIndex!=-1) { gdlSetGraphicsForegroundColorFromKw ( e, actStream, "BOTTOM" ); actStream->meshc(xg1,yg1,map,cgrid1.nx,cgrid1.ny,meshOpt,NULL,0); gdlSetGraphicsForegroundColorFromKw ( e, actStream ); if (!low) //redraw top with top color { if (doShade) actStream->plot3dc(xg1,yg1,map,cgrid1.nx,cgrid1.ny,meshOpt+MAG_COLOR,NULL,0); else actStream->plot3dc(xg1,yg1,map,cgrid1.nx,cgrid1.ny,meshOpt,NULL,0); } } else { if (doShade) actStream->meshc(xg1,yg1,map,cgrid1.nx,cgrid1.ny,meshOpt+MAG_COLOR,NULL,0); else actStream->meshc(xg1,yg1,map,cgrid1.nx,cgrid1.ny,meshOpt,NULL,0); } //redraw upper part with background color to remove it... Not 100% satisfying though. if (low) { if (e->KeywordSet ( "SKIRT" )) meshOpt-=DRAW_SIDES; gdlSetGraphicsPenColorToBackground(actStream); actStream->plot3dc(xg1,yg1,map,cgrid1.nx,cgrid1.ny,meshOpt,NULL,0); gdlSetGraphicsForegroundColorFromKw ( e, actStream ); } } if (stopClip) stopClipping(actStream); //Clean alllocated data struct delete[] xg1; delete[] yg1; actStream->Free2dGrid(map, xEl, yEl); } //Draw axes with normal color! gdlSetGraphicsForegroundColorFromKw ( e, actStream ); //COLOR gdlBox3(e, actStream, xStart, xEnd, yStart, yEnd, zStart, zEnd, xLog, yLog, zLog, true); } private: void call_plplot (EnvT* e, GDLGStream* actStream) { } private: virtual void post_call (EnvT*, GDLGStream* actStream) { actStream->lsty(1);//reset linestyle actStream->sizeChar(1.0); } }; // surface_call class void surface(EnvT* e) { surface_call surface; surface.call(e, 1); } } // namespace gdl-0.9.4/src/math_fun_gm.hpp0000664000175000017500000000271710627041423014514 0ustar marcmarc/*************************************************************************** math_fun_gm.cpp - math GDL library function (GM) ------------------- begin : 03 May 2007 copyright : (C) 2007 by Gregory Marchal email : gregory.marchal_at_obspm.fr website : http://format.obspm.fr/~m1/gmarchal/ ****************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "datatypes.hpp" #include "envt.hpp" namespace lib { BaseGDL* erf_fun( EnvT* e); BaseGDL* errorf_fun( EnvT* e); BaseGDL* erfc_fun( EnvT* e); BaseGDL* gamma_fun( EnvT* e); BaseGDL* lngamma_fun( EnvT* e); BaseGDL* igamma_fun( EnvT* e); BaseGDL* beta_fun( EnvT* e); BaseGDL* expint_fun( EnvT* e); BaseGDL* gaussint_fun( EnvT* e); } // namespace gdl-0.9.4/src/GDLTokenTypes.txt0000664000175000017500000000710712221270776014721 0ustar marcmarc// $ANTLR 2.7.7 (20120518): gdlc.g -> GDLTokenTypes.txt$ GDL // output token vocab name ALL=4 ASSIGN=5 ASSIGN_INPLACE=6 ASSIGN_REPLACE=7 ASSIGN_ARRAYEXPR_MFCALL=8 ARRAYDEF=9 ARRAYDEF_CONST=10 ARRAYIX=11 ARRAYIX_ALL=12 ARRAYIX_ORANGE=13 ARRAYIX_RANGE=14 ARRAYIX_ORANGE_S=15 ARRAYIX_RANGE_S=16 ARRAYEXPR=17 ARRAYEXPR_FCALL=18 ARRAYEXPR_MFCALL=19 BLOCK=20 BREAK=21 CSBLOCK=22 CONTINUE=23 COMMONDECL=24 COMMONDEF=25 CONSTANT=26 DEREF=27 ELSEBLK=28 EXPR=29 FOR="for"=30 FOR_STEP=31 FOREACH="foreach"=32 FOREACH_INDEX=33 FOR_LOOP=34 FOR_STEP_LOOP=35 FOREACH_LOOP=36 FOREACH_INDEX_LOOP=37 FCALL=38 FCALL_LIB=39 FCALL_LIB_DIRECT=40 FCALL_LIB_N_ELEMENTS=41 FCALL_LIB_RETNEW=42 GDLNULL=43 IF_ELSE=44 KEYDECL=45 KEYDEF=46 KEYDEF_REF=47 KEYDEF_REF_CHECK=48 KEYDEF_REF_EXPR=49 LABEL=50 MPCALL=51 MPCALL_PARENT=52 MFCALL=53 MFCALL_LIB=54 MFCALL_LIB_RETNEW=55 MFCALL_PARENT=56 MFCALL_PARENT_LIB=57 MFCALL_PARENT_LIB_RETNEW=58 NOP=59 NSTRUC=60 NSTRUC_REF=61 ON_IOERROR_NULL=62 PCALL=63 PCALL_LIB=64 PARADECL=65 PARAEXPR=66 PARAEXPR_VN=67 DEC_REF_CHECK=68 INC_REF_CHECK=69 POSTDEC=70 POSTINC=71 DECSTATEMENT=72 INCSTATEMENT=73 REF=74 REF_VN=75 REF_CHECK=76 REF_CHECK_VN=77 REF_EXPR=78 REF_EXPR_VN=79 REPEAT="repeat"=80 REPEAT_LOOP=81 RETURN=82 RETF=83 RETP=84 STRUC=85 SYSVAR=86 UMINUS=87 VAR=88 VARPTR=89 WHILE="while"=90 IDENTIFIER=91 AND_OP="and"=92 BEGIN="begin"=93 CASE="case"=94 COMMON="common"=95 COMPILE_OPT="compile_opt"=96 DO="do"=97 ELSE="else"=98 END="end"=99 ENDCASE="endcase"=100 ENDELSE="endelse"=101 ENDFOR="endfor"=102 ENDFOREACH="endforeach"=103 ENDIF="endif"=104 ENDREP="endrep"=105 ENDSWITCH="endswitch"=106 ENDWHILE="endwhile"=107 EQ_OP="eq"=108 FORWARD="forward_function"=109 FUNCTION="function"=110 GE_OP="ge"=111 GOTO="goto"=112 GT_OP="gt"=113 IF="if"=114 INHERITS="inherits"=115 LE_OP="le"=116 LT_OP="lt"=117 MOD_OP="mod"=118 NE_OP="ne"=119 NOT_OP="not"=120 OF="of"=121 ON_IOERROR="on_ioerror"=122 OR_OP="or"=123 PRO="pro"=124 SWITCH="switch"=125 THEN="then"=126 UNTIL="until"=127 XOR_OP="xor"=128 METHOD=129 COMMA=130 COLON=131 END_U=132 EQUAL=133 DEC=134 INC=135 AND_OP_EQ=136 ASTERIX_EQ=137 EQ_OP_EQ=138 GE_OP_EQ=139 GTMARK_EQ=140 GT_OP_EQ=141 LE_OP_EQ=142 LTMARK_EQ=143 LT_OP_EQ=144 MATRIX_OP1_EQ=145 MATRIX_OP2_EQ=146 MINUS_EQ=147 MOD_OP_EQ=148 NE_OP_EQ=149 OR_OP_EQ=150 PLUS_EQ=151 POW_EQ=152 SLASH_EQ=153 XOR_OP_EQ=154 MEMBER=155 LBRACE=156 RBRACE=157 SLASH=158 LSQUARE=159 RSQUARE=160 SYSVARNAME=161 EXCLAMATION=162 LCURLY=163 RCURLY=164 CONSTANT_HEX_BYTE=165 CONSTANT_HEX_LONG=166 CONSTANT_HEX_LONG64=167 CONSTANT_HEX_INT=168 CONSTANT_HEX_I=169 CONSTANT_HEX_ULONG=170 CONSTANT_HEX_ULONG64=171 CONSTANT_HEX_UI=172 CONSTANT_HEX_UINT=173 CONSTANT_BYTE=174 CONSTANT_LONG=175 CONSTANT_LONG64=176 CONSTANT_INT=177 CONSTANT_I=178 CONSTANT_ULONG=179 CONSTANT_ULONG64=180 CONSTANT_UI=181 CONSTANT_UINT=182 CONSTANT_OCT_BYTE=183 CONSTANT_OCT_LONG=184 CONSTANT_OCT_LONG64=185 CONSTANT_OCT_INT=186 CONSTANT_OCT_I=187 CONSTANT_OCT_ULONG=188 CONSTANT_OCT_ULONG64=189 CONSTANT_OCT_UI=190 CONSTANT_OCT_UINT=191 CONSTANT_FLOAT=192 CONSTANT_DOUBLE=193 CONSTANT_BIN_BYTE=194 CONSTANT_BIN_LONG=195 CONSTANT_BIN_LONG64=196 CONSTANT_BIN_INT=197 CONSTANT_BIN_I=198 CONSTANT_BIN_ULONG=199 CONSTANT_BIN_ULONG64=200 CONSTANT_BIN_UI=201 CONSTANT_BIN_UINT=202 ASTERIX=203 DOT=204 STRING_LITERAL=205 POW=206 MATRIX_OP1=207 MATRIX_OP2=208 PLUS=209 MINUS=210 LTMARK=211 GTMARK=212 LOG_NEG=213 LOG_AND=214 LOG_OR=215 QUESTION=216 STRING=217 INCLUDE=218 EOL=219 W=220 D=221 L=222 H=223 O=224 B=225 EXP=226 DBL_E=227 DBL=228 CONSTANT_OR_STRING_LITERAL=229 COMMENT=230 END_MARKER=231 WHITESPACE=232 SKIP_LINES=233 CONT_STATEMENT=234 END_OF_LINE=235 MAX_TOKEN_NUMBER=236 gdl-0.9.4/src/plotting_oplot.cpp0000664000175000017500000002265512154445470015312 0ustar marcmarc/*************************************************************************** plotting.cpp - GDL routines for plotting ------------------- begin : July 22 2002 copyright : (C) 2002-2011 by Marc Schellens et al. email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" #include "plotting.hpp" namespace lib { using namespace std; class oplot_call : public plotting_routine_call { DDoubleGDL *yVal, *xVal, *zVal, *xTemp, *yTemp; SizeT xEl, yEl, zEl; Guard xval_guard,yval_guard, zval_guard, xtempval_guard; bool doT3d; DDouble zValue; private: bool handle_args( EnvT* e) // {{{ { //T3D? static int t3dIx = e->KeywordIx( "T3D"); doT3d=(e->KeywordSet(t3dIx)|| T3Denabled(e)); //note: Z (VALUE) will be used uniquely if Z is not effectively defined. zValue=0.0; static int zvIx = e->KeywordIx( "ZVALUE"); e->AssureDoubleScalarKWIfPresent ( zvIx, zValue ); bool polar=FALSE; DLong nsum=1; e->AssureLongScalarKWIfPresent( "NSUM", nsum); if ( e->KeywordSet( "POLAR")) { polar=TRUE; } //test and transform eventually if POLAR and/or NSUM! if( nParam() == 1) { yTemp = e->GetParAs< DDoubleGDL>( 0); if (yTemp->Rank() == 0) e->Throw("Expression must be an array in this context: "+e->GetParString(0)); yEl=yTemp->N_Elements(); xEl=yEl; xTemp = new DDoubleGDL( dimension( xEl), BaseGDL::INDGEN); xtempval_guard.Reset( xTemp); // delete upon exit } else { xTemp = e->GetParAs< DDoubleGDL>( 0); if (xTemp->Rank() == 0) e->Throw("Expression must be an array in this context: "+e->GetParString(0)); xEl=xTemp->N_Elements(); yTemp = e->GetParAs< DDoubleGDL>( 1); if (yTemp->Rank() == 0) e->Throw("Expression must be an array in this context: "+e->GetParString(1)); yEl=yTemp->N_Elements(); //silently drop unmatched values if (yEl != xEl) { SizeT size; size = min(xEl, yEl); xEl = size; yEl = size; } } //check nsum validity nsum=max(1,nsum); nsum=min(nsum,(DLong)xEl); if (nsum == 1) { if (polar) { xVal = new DDoubleGDL(dimension(xEl), BaseGDL::NOZERO); xval_guard.Reset(xVal); // delete upon exit yVal = new DDoubleGDL(dimension(yEl), BaseGDL::NOZERO); yval_guard.Reset(yVal); // delete upon exit for (int i = 0; i < xEl; i++) (*xVal)[i] = (*xTemp)[i] * cos((*yTemp)[i]); for (int i = 0; i < yEl; i++) (*yVal)[i] = (*xTemp)[i] * sin((*yTemp)[i]); } else { //careful about previously set autopointers! if (nParam() == 1) xval_guard.Init( xtempval_guard.release()); xVal = xTemp; yVal = yTemp; } } else { int i, j, k; DLong size = xEl / nsum; xVal = new DDoubleGDL(size, BaseGDL::ZERO); //SHOULD BE ZERO, IS NOT! xval_guard.Reset(xVal); // delete upon exit yVal = new DDoubleGDL(size, BaseGDL::ZERO); //IDEM yval_guard.Reset(yVal); // delete upon exit for (i = 0, k = 0; i < size; i++) { (*xVal)[i] = 0.0; (*yVal)[i] = 0.0; for (j = 0; j < nsum; j++, k++) { (*xVal)[i] += (*xTemp)[k]; (*yVal)[i] += (*yTemp)[k]; } } for (i = 0; i < size; i++) (*xVal)[i] /= nsum; for (i = 0; i < size; i++) (*yVal)[i] /= nsum; if (polar) { DDouble x, y; for (i = 0; i < size; i++) { x = (*xVal)[i] * cos((*yVal)[i]); y = (*xVal)[i] * sin((*yVal)[i]); (*xVal)[i] = x; (*yVal)[i] = y; } } } if (doT3d) { //make zVal zEl=xVal->N_Elements(); zVal=new DDoubleGDL(dimension(zEl), BaseGDL::NOZERO); zval_guard.Reset(zVal); // delete upon exit for (SizeT i=0; i< zEl ; ++i) (*zVal)[i]=zValue; } return 0; } private: void old_body( EnvT* e, GDLGStream* actStream) { DLong psym; // get ![XY].CRANGE DDouble xStart, xEnd, yStart, yEnd; gdlGetCurrentAxisRange("X", xStart, xEnd); gdlGetCurrentAxisRange("Y", yStart, yEnd); DDouble minVal, maxVal; bool doMinMax; bool xLog; bool yLog; gdlGetAxisType("X", xLog); gdlGetAxisType("Y", yLog); if ((yStart == yEnd) || (xStart == xEnd)) { if (yStart != 0.0 && yStart == yEnd) Message("OPLOT: !Y.CRANGE ERROR, setting to [0,1]"); yStart = 0; //yVal->min(); yEnd = 1; //yVal->max(); if (xStart != 0.0 && xStart == xEnd) Message("OPLOT: !X.CRANGE ERROR, setting to [0,1]"); xStart = 0; //xVal->min(); xEnd = 1; //xVal->max(); } //now we can setup minVal and maxVal to defaults: Start-End and overload if KW present minVal = yStart; //to give a reasonable value... maxVal = yEnd; //idem doMinMax = false; //although we will not use it... if( e->KeywordSet( "MIN_VALUE") || e->KeywordSet( "MAX_VALUE")) doMinMax = true; //...unless explicitely required e->AssureDoubleScalarKWIfPresent( "MIN_VALUE", minVal); e->AssureDoubleScalarKWIfPresent( "MAX_VALUE", maxVal); int noclipvalue=0; e->AssureLongScalarKWIfPresent( "NOCLIP", noclipvalue); // Clipping is enabled by default for OPLOT. // make all clipping computations BEFORE setting graphic properties (color, size) bool doClip=(e->KeywordSet("CLIP")||noclipvalue==1); bool stopClip=false; if ( doClip ) if ( startClipping(e, actStream, false)==TRUE ) stopClip=true; // start drawing. Graphic Keywords accepted:CLIP(YES), COLOR(YES), LINESTYLE(YES), NOCLIP(YES), // PSYM(YES), SYMSIZE(YES), T3D(YES), ZVALUE(YES) gdlSetGraphicsForegroundColorFromKw(e, actStream); gdlGetPsym(e, psym); gdlSetPenThickness(e, actStream); gdlSetSymsize(e, actStream); gdlSetLineStyle(e, actStream); static DDouble x0,y0,xs,ys; //conversion to normalized coords x0=(xLog)?-log10(xStart):-xStart; y0=(yLog)?-log10(yStart):-yStart; xs=(xLog)?(log10(xEnd)-log10(xStart)):xEnd-xStart;xs=1.0/xs; ys=(yLog)?(log10(yEnd)-log10(yStart)):yEnd-yStart;ys=1.0/ys; if ( doT3d ) //convert X,Y,Z in X',Y' as per T3D perspective. { DDoubleGDL* plplot3d; DDouble az, alt, ay, scale; ORIENTATION3D axisExchangeCode; plplot3d = gdlConvertT3DMatrixToPlplotRotationMatrix( zValue, az, alt, ay, scale, axisExchangeCode); if (plplot3d == NULL) { e->Throw("Illegal 3D transformation. (FIXME)"); } Data3d.zValue = zValue; Data3d.Matrix = plplot3d; //try to change for !P.T in future? switch (axisExchangeCode) { case NORMAL: //X->X Y->Y plane XY Data3d.x0=x0; Data3d.y0=y0; Data3d.xs=xs; Data3d.ys=ys; Data3d.code = code012; break; case XY: // X->Y Y->X plane XY Data3d.x0=0; Data3d.y0=x0; Data3d.xs=ys; Data3d.ys=xs; Data3d.code = code102; break; case XZ: // Y->Y X->Z plane YZ Data3d.x0=x0; Data3d.y0=y0; Data3d.xs=xs; Data3d.ys=ys; Data3d.code = code210; break; case YZ: // X->X Y->Z plane XZ Data3d.x0=x0; Data3d.y0=y0; Data3d.xs=xs; Data3d.ys=ys; Data3d.code = code021; break; case XZXY: //X->Y Y->Z plane YZ Data3d.x0=x0; Data3d.y0=y0; Data3d.xs=xs; Data3d.ys=ys; Data3d.code = code120; break; case XZYZ: //X->Z Y->X plane XZ Data3d.x0=x0; Data3d.y0=y0; Data3d.xs=xs; Data3d.ys=ys; Data3d.code = code201; break; } actStream->stransform(gdl3dTo2dTransform, &Data3d); } // TODO: handle "valid"! bool valid=draw_polyline(e, actStream, xVal, yVal, minVal, maxVal, doMinMax, xLog, yLog, psym, FALSE); if (stopClip) stopClipping(actStream); } private: void call_plplot(EnvT* e, GDLGStream* actStream) { } private: void post_call(EnvT* e, GDLGStream* actStream) { if (doT3d) actStream->stransform(NULL,NULL); actStream->lsty(1);//reset linestyle actStream->sizeChar(1.0); } }; // oplot_call class void oplot(EnvT* e) { oplot_call oplot; oplot.call(e, 1); } } // namespace gdl-0.9.4/src/dnodefactory.hpp0000664000175000017500000000232310222440007014672 0ustar marcmarc/*************************************************************************** dnodefactory.hpp ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifndef DNodeFactory_hpp__ #define DNodeFactory_hpp__ #include "dnode.hpp" #include "antlr/ASTFactory.hpp" //ANTLR_USING_NAMESPACE(std) //ANTLR_USING_NAMESPACE(antlr) extern antlr::ASTFactory DNodeFactory; #endif gdl-0.9.4/src/color.cpp0000664000175000017500000001147612026101346013337 0ustar marcmarc/*************************************************************************** color.cpp - GDL routines for color handling ------------------- begin : March 25 2004 copyright : (C) 2004 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "color.hpp" #include #ifdef _MSC_VER #define round(f) floor(f+0.5) #endif using namespace std; const DFloat maxDByte = 255.0; void RGB2HSV( const DByte r, const DByte g, const DByte b, DFloat& h, DFloat& s, DFloat& v ) { DByte cmin = (r < g)? ((r < b)? r : b) : ((g < b)? g : b); DByte cmax = (r > g)? ((r > b)? r : b) : ((g > b)? g : b); v = static_cast(cmax) / maxDByte; // v DFloat delta = static_cast(cmax - cmin); if( cmax != 0) s = delta / static_cast(cmax); // s else { // r = g = b = 0 -> s = 0 -> h undefined s = 0.0; h = 0.0; // undefined return; } if( s == 0.0) { h = 0.0; // s = 0 -> h undefined return; } if( r == cmax ) h = static_cast( g - b) / delta; // between yellow & magenta else if( g == cmax ) h = 2.0 + static_cast( b - r) / delta; // between cyan & yellow else // ( b == cmax) h = 4.0 + static_cast( r - g) / delta; // between magenta & cyan h *= 60.0; // degrees if( h < 0.0 ) h += 360.0; } void HSV2RGB( DFloat h, const DFloat s, const DFloat v, DByte& r, DByte& g, DByte& b) { DFloat maxDByteV = v * maxDByte; if( s == 0.0) { // grey r = g = b = static_cast< DByte>(round( maxDByteV)); return; } h /= 360.0; // [0,1]*n h = h - floor(h); // [0,1] h *= 6.0; // sector 0 to 5 DFloat fh = floor( h); DFloat f = h - fh; // factorial part of h DByte p = static_cast< DByte>(round( ( 1.0 - s) * maxDByteV)); DByte q = static_cast< DByte>(round( ( 1.0 - s * f) * maxDByteV)); DByte t = static_cast< DByte>(round( ( 1.0 - s * (1.0 - f)) * maxDByteV)); int i = static_cast< int>( fh); switch( i) { case 0: r = static_cast< DByte>(round( v * maxDByte)); g = t; b = p; break; case 1: r = q; g = static_cast< DByte>(round( v * maxDByte)); b = p; break; case 2: r = p; g = static_cast< DByte>(round( v * maxDByte)); b = t; break; case 3: r = p; g = q; b = static_cast< DByte>(round( v * maxDByte)); break; case 4: r = t; g = p; b = static_cast< DByte>(round( v * maxDByte)); break; default: // case 5: r = static_cast< DByte>(round( v * maxDByte)); g = p; b = q; break; } } void RGB2HLS( const DByte r, const DByte g, const DByte b, DFloat& h, DFloat& l, DFloat& s) { DFloat cmin = (r < g)? ((r < b)? r : b) : ((g < b)? g : b); DFloat cmax = (r > g)? ((r > b)? r : b) : ((g > b)? g : b); l = (cmax+cmin) / maxDByte / 2.0; if( cmax == cmin) { s = h = 0.0; // undefined return; } DFloat delta = cmax - cmin; if( l < 0.5) s = delta/(cmax+cmin); else s = delta/(2.0 * maxDByte - cmax - cmin); if( r == cmax) h = static_cast((g-b)) / delta; else if( g == cmax) h = 2.0 + static_cast((b - r)) / delta; else h = 4.0 + static_cast((r - g)) / delta; h *= 60.0; // degrees if( h < 0.0 ) h += 360.0; } DFloat Hue2RGB( const DFloat m1, const DFloat m2, DFloat h) { h = h - floor(h); if( h < 1.0/6.0) return (m1+(m2-m1)*h*6.0); if( h < 1.0/2.0) return m2; if( h < 2.0/3.0) return (m1+(m2-m1)*((2.0/3.0)-h)*6.0); return m1; } void HLS2RGB( DFloat h, const DFloat l, const DFloat s, DByte& r, DByte& g, DByte& b) { if( s == 0.0) r = g = b = static_cast< DByte>(round( l * maxDByte)); else { h /= 360.0; // -> [0,1] DFloat m2; if (l <= 0.5) m2 = l*(1.0+s); else m2 = l+s-l*s; DFloat m1 = 2.0*l-m2; r = static_cast< DByte>(round( Hue2RGB(m1,m2,h+1.0/3.0) * maxDByte)); g = static_cast< DByte>(round( Hue2RGB(m1,m2,h) * maxDByte)); b = static_cast< DByte>(round( Hue2RGB(m1,m2,h-1.0/3.0) * maxDByte)); } } gdl-0.9.4/src/plotting_map_proj.cpp0000664000175000017500000001346112217457527015765 0ustar marcmarc/*************************************************************************** plotting.cpp - GDL routines for plotting ------------------- begin : July 22 2002 copyright : (C) 2002-2011 by Marc Schellens et al. email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" #include "plotting.hpp" #include "math_utl.hpp" namespace lib { using namespace std; BaseGDL* map_proj_forward_fun(EnvT* e) { #ifdef USE_LIBPROJ4 // lonlat -> xy SizeT nParam=e->NParam(); if ( nParam<1 ) e->Throw("Incorrect number of arguments."); LPTYPE idata; XYTYPE odata; ref=map_init(); if ( ref==NULL ) { e->Throw("Projection initialization failed."); } BaseGDL* p0; BaseGDL* p1; DDoubleGDL* lon; DDoubleGDL* lat; DDoubleGDL* ll; DDoubleGDL* res; DLong dims[2]; if ( nParam==1 ) { p0=e->GetParDefined(0); DDoubleGDL* ll=static_cast (p0->Convert2(GDL_DOUBLE, BaseGDL::COPY)); dims[0]=2; if ( p0->Rank()==1 ) { dimension dim((DLong *)dims, 1); res=new DDoubleGDL(dim, BaseGDL::NOZERO); } else { dims[1]=p0->Dim(1); dimension dim((DLong *)dims, 2); res=new DDoubleGDL(dim, BaseGDL::NOZERO); } SizeT nEl=p0->N_Elements(); for ( SizeT i=0; iGetParDefined(0); p1=e->GetParDefined(1); DDoubleGDL* lon=static_cast (p0->Convert2(GDL_DOUBLE, BaseGDL::COPY)); DDoubleGDL* lat=static_cast (p1->Convert2(GDL_DOUBLE, BaseGDL::COPY)); dims[0]=2; if ( p0->Rank()==0||p0->Rank()==1 ) { dimension dim((DLong *)dims, 1); res=new DDoubleGDL(dim, BaseGDL::NOZERO); } else { dims[1]=p0->Dim(0); dimension dim((DLong *)dims, 2); res=new DDoubleGDL(dim, BaseGDL::NOZERO); } SizeT nEl=p0->N_Elements(); for ( SizeT i=0; iThrow("More than 2 parameters not handled."); return NULL; #else e->Throw("GDL was compiled without support for map projections"); return NULL; #endif } BaseGDL* map_proj_inverse_fun(EnvT* e) { #ifdef USE_LIBPROJ4 // xy -> lonlat SizeT nParam=e->NParam(); if ( nParam<1 ) e->Throw("Incorrect number of arguments."); XYTYPE idata; LPTYPE odata; ref=map_init(); if ( ref==NULL ) { e->Throw("Projection initialization failed."); } BaseGDL* p0; BaseGDL* p1; DDoubleGDL* x; DDoubleGDL* y; DDoubleGDL* xy; DDoubleGDL* res; DLong dims[2]; if ( nParam==1 ) { p0=e->GetParDefined(0); DDoubleGDL* xy=static_cast (p0->Convert2(GDL_DOUBLE, BaseGDL::COPY)); dims[0]=2; if ( p0->Rank()==1 ) { dimension dim((DLong *)dims, 1); res=new DDoubleGDL(dim, BaseGDL::NOZERO); } else { dims[1]=p0->Dim(1); dimension dim((DLong *)dims, 2); res=new DDoubleGDL(dim, BaseGDL::NOZERO); } SizeT nEl=p0->N_Elements(); for ( SizeT i=0; iGetParDefined(0); p1=e->GetParDefined(1); DDoubleGDL* x=static_cast (p0->Convert2(GDL_DOUBLE, BaseGDL::COPY)); DDoubleGDL* y=static_cast (p1->Convert2(GDL_DOUBLE, BaseGDL::COPY)); dims[0]=2; if ( p0->Rank()==0||p0->Rank()==1 ) { dimension dim((DLong *)dims, 1); res=new DDoubleGDL(dim, BaseGDL::NOZERO); } else { dims[1]=p0->Dim(0); dimension dim((DLong *)dims, 2); res=new DDoubleGDL(dim, BaseGDL::NOZERO); } SizeT nEl=p0->N_Elements(); for ( SizeT i=0; iThrow("More than 2 parameters not handled."); return NULL; #else e->Throw("GDL was compiled without support for map projections"); return NULL; #endif } } // namespace gdl-0.9.4/src/print_tree.hpp0000664000175000017500000000251312057276651014411 0ustar marcmarc/*************************************************************************** print_tree.hpp Print an ANTLR abstract syntax tree in operator prefix form. Used for debugging only. ------------------- begin : ? copyright : ? (modified from ANTLR package) email : ? ***************************************************************************/ #ifndef _PRINT_TREE_HPP_ #define _PRINT_TREE_HPP_ #include "typedefs.hpp" #include "prognode.hpp" #include "antlr/ASTRefCount.hpp" #include "antlr/AST.hpp" namespace antlr { class print_tree { private: typedef enum { INDENT = 2 } bogus; unsigned long indent_level; private: void pr_name( RefAST node ); void pr_name( ProgNodeP node ); void pr_indent(); void pr_top( RefAST top ); void pr_top( ProgNodeP top ); void pr_open_angle(); void pr_close_angle(bool first); void pr_leaves( RefAST top ); void pr_leaves( ProgNodeP top ); bool is_nonleaf( RefAST node ) { bool rslt = (node->getFirstChild() != NULL); return rslt; } bool is_nonleaf( ProgNodeP node ) { bool rslt = (node->getFirstChild() != NULL); return rslt; } public: void pr_tree( const RefAST top ); void pr_tree( const ProgNodeP top ); }; // print_tree } // namespace #endif gdl-0.9.4/src/dcommon.hpp0000664000175000017500000000650612174065224013670 0ustar marcmarc/*************************************************************************** dcommon.hpp - GDL common blocks ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifndef DCOMMON_HPP_ #define DCOMMON_HPP_ #include "gdlexception.hpp" #include "dvar.hpp" class DCommonBase { public: virtual ~DCommonBase() {} virtual const std::string& Name() const =0; virtual unsigned NVar() const =0; virtual void AddVar(const std::string&)=0; virtual DVar* Find(const std::string&)=0; virtual int Find(const BaseGDL*)=0; virtual const std::string& VarName(const unsigned i)=0; virtual DVar* Var(unsigned ix)=0; }; // common block ******************************************************* class DCommon: public DCommonBase { private: std::string name; // common block name VarListT var; // the data public: DCommon(const std::string&); ~DCommon(); const std::string& VarName(const unsigned i) { if( i >= var.size()) throw(GDLException("Common block index out of range")); return var[i]->Name(); } unsigned NVar() const { return var.size();} void AddVar(const std::string&); const std::string& Name() const; DVar* Find(const std::string&); int Find(const BaseGDL*); DVar* Var(unsigned ix) { return var[ix];} }; class DCommon_eq: public std::unary_function { std::string name; public: explicit DCommon_eq(const std::string& s): name(s) {} bool operator() (const DCommon* v) const { return v->Name() == name;} }; // ref to common block (variable names (and number) might differ) ***** class DCommonRef: public DCommonBase { private: IDList varNames; // overridden variable names DCommon *cRef; // ptr to common blk public: DCommonRef(DCommon&); ~DCommonRef(); const std::string& VarName(const unsigned i) { if( i >= varNames.size()) throw(GDLException("CommonRef block index out of range")); return varNames[i]; } unsigned NVar() const { return varNames.size();} void AddVar(const std::string&); const std::string& Name() const; DVar* Find(const std::string&); int Find(const BaseGDL*); DVar* Var(unsigned ix); }; typedef std::vector CommonBaseListT; typedef std::vector CommonListT; class DCommon_contains_var: public std::unary_function { std::string name; public: explicit DCommon_contains_var(const std::string& s): name(s) {} bool operator() (DCommonBase* c) const { return (c->Find(name) != NULL);} }; #endif gdl-0.9.4/src/convol.sav.cpp0000664000175000017500000001311210156065333014305 0ustar marcmarc/*************************************************************************** convol.cpp - convol function ------------------- begin : Apr 19 2004 copyright : (C) 2004 by Marc Schellens email : m_schellens@users.sourceforge.net ***************************************************************************/ /*************************************************************************** * * * 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 version is simplyfied, but much shorter and easier to understand // than the optimized version // to be included from datatypes.cpp (twice) #ifdef INCLUDE_CONVOL_CPP #ifndef CONVOL_COMMON__ #define CONVOL_COMMON__ // common used functions #endif //#define CONVOL_COMMON__ #ifdef CONVOL_BYTE__ template<> BaseGDL* Data_::Convol( BaseGDL* kIn, BaseGDL* scaleIn, bool center, int edgeMode) { Data_* kernel = static_cast*>( kIn); DInt scale = (*static_cast*>( scaleIn))[0]; // the result to be returned Data_* res = New( dim, BaseGDL::NOZERO); DInt* ker = static_cast( kernel->DataAddr()); #else template BaseGDL* Data_::Convol( BaseGDL* kIn, BaseGDL* scaleIn, bool center, int edgeMode) { Data_* kernel = static_cast( kIn); Ty scale = static_cast( scaleIn)->dd[0]; // the result to be returned Data_* res = New( dim, BaseGDL::ZERO); Ty* ker = &kernel->dd[0]; #endif if( scale == zero) scale = 1; SizeT nA = N_Elements(); SizeT nK = kernel->N_Elements(); // general case (look at kernel rank == 1 later) SizeT nDim = Rank(); // number of dimension to run over SizeT kStride[MAXRANK+1]; kernel->Dim().Stride( kStride, nDim); // setup kIxArr[ nDim * nK] the offset array // this handles center long* kIxArr = new long[ nDim * nK]; long* kIxEnd = &kIxArr[ (nK-1) * nDim]; ArrayGuard kIxArrGuard( kIxArr); // guard it for( SizeT k=0; kDim( 0)); if( center) kIxArr[ k * nDim + 0] = -(kIxArr[ k * nDim + 0] + kernel->Dim( 0) / 2); for( SizeT kSp=1; kSpDim( kSp); if( kDim == 0) kDim = 1; kIxArr[ k * nDim + kSp] = -((k / kStride[kSp]) % kDim); if( center) kIxArr[ k * nDim + kSp] = -(kIxArr[ k * nDim + kSp] + kDim / 2); } } SizeT aStride[ MAXRANK + 1]; dim.Stride( aStride, nDim); long aInitIx[ MAXRANK+1]; for( SizeT aSp=0; aSp<=nDim; ++aSp) aInitIx[ aSp] = 0; bool regArr[ MAXRANK]; long aBeg[ MAXRANK]; long aEnd[ MAXRANK]; for( SizeT aSp=0; aSpDim(aSp)/2 : kernel->Dim(aSp)-1; // >= regArr[ aSp] = !aBeg[ aSp]; aEnd[ aSp] = (center) ? dim[aSp]-(kernel->Dim(aSp)-1)/2 : dim[aSp]; // < } Ty* ddP = &dd[0]; // for all result elements for( SizeT a=0; a= aBeg[aSp] && aInitIx[aSp] < aEnd[ aSp]; if( regular) for(; aSp= dim[ rSp]) aIx -= dim[ rSp]; aLonIx += aIx * aStride[ rSp]; } // res_a += dd[ aLonIx] * (*kernel)[ k]; res_a += ddP[ aLonIx] * ker[ k]; // advance kIx kIx += nDim; } res_a /= scale; } else if( edgeMode == 2) //edge_truncate { long* kIx = kIxArr; for( SizeT k=0; k nDim index of k'th element SizeT aLonIx=0; for( SizeT rSp=0; rSp= dim[ rSp]) aIx = dim[ rSp] - 1; aLonIx += aIx * aStride[ rSp]; } // res_a += dd[ aLonIx] * (*kernel)[ k]; res_a += ddP[ aLonIx] * ker[ k]; // advance kIx kIx += nDim; } res_a /= scale; } #ifdef CONVOL_BYTE__ if( res_a > 0) if( res_a < 255) (*res)[ a] = res_a; else (*res)[ a] = 255; else (*res)[ a] = 0; #endif } return res; } #endif // #ifdef INCLUDE_CONVOL_CPP gdl-0.9.4/src/color.hpp0000664000175000017500000000303610222440006013330 0ustar marcmarc/*************************************************************************** color.hpp - GDL routines for color handling ------------------- begin : March 25 2004 copyright : (C) 2004 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifndef COLOR_HPP_ #define COLOR_HPP_ #include "basegdl.hpp" // h = [0,360], s = [0,1], v = [0,1], l = [0,1] void RGB2HSV( const DByte r, const DByte g, const DByte b, DFloat& h, DFloat& s, DFloat& v ); void HSV2RGB( DFloat h, const DFloat s, const DFloat v, DByte& r, DByte& g, DByte& b); void RGB2HLS( const DByte r, const DByte g, const DByte b, DFloat& h, DFloat& l, DFloat& s); void HLS2RGB( const DFloat h, const DFloat l, const DFloat s, DByte& r, DByte& g, DByte& b); #endif gdl-0.9.4/src/math_utl.hpp0000664000175000017500000000535712116372236014054 0ustar marcmarc/*************************************************************************** math_utl.hpp - math utilities GDL library function ------------------- begin : Feb 11 2004 copyright : (C) 2004 by Joel Gales email : jomoga@users.sourceforge.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifndef MATH_UTL_HPP_ #define MATH_UTL_HPP_ #include "basegdl.hpp" //#define ABS(xxx) (( xxx > -xxx)?(xxx):(-xxx)) // This caused a compiler error on g++ 4.5, see: // http://sourceforge.net/tracker/index.php?func=detail&aid=2949808&group_id=97659&atid=618683 // template< typename T> // inline T abs( T a) { return (a>=T(0))?a:-a;} namespace lib { // SA: needs to be inside a namespace for GCC 4.5 template< typename T> inline T abs( T a) { return (a>=T(0))?a:-a;} // int trans513(char *, int, int, int, DType); // int transpose(char *, SizeT, SizeT [], SizeT, DType); // int transpose_perm(char *, SizeT, SizeT [], SizeT, DType, long []); void machar_s ( long int *ibeta, long int *it, long int *irnd, long int *ngrd, long int *machep, long int *negep, long int *iexp, long int *minexp, long int *maxexp, float *eps, float *epsneg, float *xmin, float *xmax ); void machar_d ( long int *ibeta, long int *it, long int *irnd, long int *ngrd, long int *machep, long int *negep, long int *iexp, long int *minexp, long int *maxexp, double *eps, double *epsneg, double *xmin, double *xmax ); #ifdef USE_LIBPROJ4 #define GDL_COMPLEX COMPLEX2 #ifdef USE_LIBPROJ4_NEW #define PROJTYPE PROJ #define LPTYPE PROJ_LP #define XYTYPE PROJ_XY #define PJ_INIT proj_init #define PJ_FWD proj_fwd #define PJ_INV proj_inv #else #define PROJTYPE PJ #define LPTYPE LP #define XYTYPE XY #define PJ_INIT pj_init #define PJ_FWD pj_fwd #define PJ_INV pj_inv #endif extern "C" { #include "lib_proj.h" } PROJTYPE *map_init(); static PROJTYPE *ref; static PROJTYPE *prev_ref; #define COMPLEX2 GDL_COMPLEX #endif #ifdef _MSC_VER # define isinf !_finite # define isfinite _finite # define isnan _isnan #endif } // namespace #endif gdl-0.9.4/src/gdlexception.cpp0000664000175000017500000002001112161677664014714 0ustar marcmarc/*************************************************************************** gdlexception.cpp - exception handling ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" #include "gdlexception.hpp" #include "dnode.hpp" #include "initsysvar.hpp" #include "gdljournal.hpp" #include "dinterpreter.hpp" //#define GDL_DEBUG //#undef GDL_DEBUG using namespace std; DInterpreter* GDLException::interpreter = NULL; string GDLException::Name( BaseGDL* b) { if(interpreter!=NULL && interpreter->CallStack().size()>0) return interpreter->Name(b); return ""; } GDLException::GDLException(DLong eC, const string& s, bool pre, bool decorate): ANTLRException(s), errorNode(static_cast(antlr::nullAST)), errorNodeP( NULL), errorCode(eC), line( 0), col( 0), prefix( pre), ioException( false), targetEnv( NULL), arrayexprIndexeeFailed(false) { if(decorate && interpreter!=NULL && interpreter->CallStack().size()>0) { EnvBaseT* e = interpreter->CallStack().back(); errorNodeP = e->CallingNode(); msg = e->GetProName(); if( msg != "$MAIN$") msg += ": "+ s; else msg = s; } else { msg = s; } // note: This is for cases, when form a destructor is thrown // in these cases, program aborts #ifdef GDL_DEBUG cerr << s << endl; #endif } GDLException::GDLException(const string& s, bool pre, bool decorate): ANTLRException(s), errorNode(static_cast(antlr::nullAST)), errorNodeP( NULL), errorCode(-1), line( 0), col( 0), prefix( pre), ioException( false), targetEnv( NULL) { if(decorate && interpreter!=NULL && interpreter->CallStack().size()>0) { EnvBaseT* e = interpreter->CallStack().back(); errorNodeP = e->CallingNode(); msg = e->GetProName(); if( msg != "$MAIN$") msg += ": "+ s; else msg = s; } else { msg = s; } // note: This is for cases, when form a destructor is thrown // in these cases, program aborts #ifdef GDL_DEBUG cerr << s << endl; #endif } GDLException::GDLException(const RefDNode eN, const string& s): ANTLRException(s), errorNode(eN), errorNodeP( NULL), errorCode(-1), line( 0), col( 0), prefix( true), ioException( false), targetEnv( NULL), arrayexprIndexeeFailed(false) { if(interpreter!=NULL && interpreter->CallStack().size()>0) { EnvBaseT* e = interpreter->CallStack().back(); errorNodeP = e->CallingNode(); msg = e->GetProName(); if( msg != "$MAIN$") msg += ": "+ s; else msg = s; } else { msg = s; } #ifdef GDL_DEBUG cerr << s << endl; #endif } GDLException::GDLException(DLong eC, const RefDNode eN, const string& s): ANTLRException(s), errorNode(eN), errorNodeP( NULL), errorCode(eC), line( 0), col( 0), prefix( true), ioException( false), targetEnv( NULL), arrayexprIndexeeFailed(false) { if(interpreter!=NULL && interpreter->CallStack().size()>0) { EnvBaseT* e = interpreter->CallStack().back(); errorNodeP = e->CallingNode(); msg = e->GetProName(); if( msg != "$MAIN$") msg += ": "+ s; else msg = s; } else { msg = s; } #ifdef GDL_DEBUG cerr << s << endl; #endif } GDLException::GDLException(const ProgNodeP eN, const string& s, bool decorate, bool overWriteNode): ANTLRException(s), errorNode(static_cast(antlr::nullAST)), errorNodeP( eN), errorCode(-1), line( 0), col( 0), prefix( true), ioException( false), targetEnv( NULL), arrayexprIndexeeFailed(false) { if( overWriteNode && interpreter!=NULL && interpreter->CallStack().size()>0) { EnvBaseT* e = interpreter->CallStack().back(); errorNodeP = e->CallingNode(); } if( decorate && interpreter!=NULL && interpreter->CallStack().size()>0) { EnvBaseT* e = interpreter->CallStack().back(); msg = e->GetProName(); if( msg != "$MAIN$") msg += ": "+ s; else msg = s; } else { msg = s; } #ifdef GDL_DEBUG cerr << s << endl; #endif } GDLException::GDLException(DLong eC, const ProgNodeP eN, const string& s, bool decorate, bool overWriteNode): ANTLRException(s), errorNode(static_cast(antlr::nullAST)), errorNodeP( eN), errorCode(eC), line( 0), col( 0), prefix( true), ioException( false), targetEnv( NULL), arrayexprIndexeeFailed(false) { if( overWriteNode && interpreter!=NULL && interpreter->CallStack().size()>0) { EnvBaseT* e = interpreter->CallStack().back(); errorNodeP = e->CallingNode(); } if( decorate && interpreter!=NULL && interpreter->CallStack().size()>0) { EnvBaseT* e = interpreter->CallStack().back(); msg = e->GetProName(); if( msg != "$MAIN$") msg += ": "+ s; else msg = s; } else { msg = s; } #ifdef GDL_DEBUG cerr << s << endl; #endif } GDLException::GDLException(SizeT l, SizeT c, const string& s): ANTLRException(s), errorNode(static_cast(antlr::nullAST)), errorNodeP( NULL), errorCode(-1), line( l), col( c), prefix( true), ioException( false), targetEnv( NULL), arrayexprIndexeeFailed(false) { if(interpreter!=NULL && interpreter->CallStack().size()>0) { EnvBaseT* e = interpreter->CallStack().back(); errorNodeP = e->CallingNode(); msg = e->GetProName(); if( msg != "$MAIN$") msg += ": "+ s; else msg = s; } else { msg = s; } #ifdef GDL_DEBUG cerr << s << endl; #endif } GDLException::GDLException(DLong eC, SizeT l, SizeT c, const string& s): ANTLRException(s), errorNode(static_cast(antlr::nullAST)), errorNodeP( NULL), errorCode(eC), line( l), col( c), prefix( true), targetEnv( NULL), arrayexprIndexeeFailed(false) { if(interpreter!=NULL && interpreter->CallStack().size()>0) { EnvBaseT* e = interpreter->CallStack().back(); errorNodeP = e->CallingNode(); msg = e->GetProName(); if( msg != "$MAIN$") msg += ": "+ s; else msg = s; } else { msg = s; } #ifdef GDL_DEBUG cerr << s << endl; #endif } void Message(const string& s) { if( SysVar::Quiet() == 0) { cout << SysVar::MsgPrefix() << s << endl; lib::write_journal_comment( SysVar::MsgPrefix() + s); } } void Warning(const std::string& s) { cout << SysVar::MsgPrefix() << s << endl; lib::write_journal_comment( SysVar::MsgPrefix() + s); } void ThrowGDLException( const std::string& str) { throw GDLException( str); } void WarnAboutObsoleteRoutine(const string& name) { // no static here due to .RESET_SESSION DStructGDL* warnStruct = SysVar::Warn(); // this static is ok as it will evaluate always to the same value static unsigned obs_routinesTag = warnStruct->Desc()->TagIndex( "OBS_ROUTINES"); if (((static_cast( warnStruct->GetTag(obs_routinesTag, 0)))[0]).LogTrue()) Message("Routine compiled from an obsolete library: " + name); // TODO: journal / !QUIET?? } void WarnAboutObsoleteRoutine(const RefDNode eN, const string& name) { // TODO: journal? // no static here due to .RESET_SESSION DStructGDL* warnStruct = SysVar::Warn(); // this static is ok as it will evaluate always to the same value static unsigned obs_routinesTag = warnStruct->Desc()->TagIndex( "OBS_ROUTINES"); if (((static_cast( warnStruct->GetTag(obs_routinesTag, 0)))[0]).LogTrue()) { GDLException* e = new GDLException(eN, "Routine compiled from an obsolete library: " + name ); Guard eGuard(e); GDLInterpreter::ReportCompileError(*e, ""); // TODO: file } } gdl-0.9.4/src/objects.cpp0000664000175000017500000004033112220037623013644 0ustar marcmarc/*************************************************************************** objects.cpp - global structures ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" #include #include #include "str.hpp" #include "gdlexception.hpp" #include "initsysvar.hpp" #include "dnodefactory.hpp" #include "objects.hpp" #include "graphics.hpp" #include "preferences.hpp" #include "overload.hpp" //#include "dinterpreter.hpp" #ifdef _OPENMP #include #endif #ifdef HAVE_LIBWXWIDGETS #include "gdlwidget.hpp" #endif #ifdef USE_PYTHON #include "gdlpython.hpp" #endif using namespace std; // DInterpreter* interpreter = NULL; // instantiate the global lists VarListT sysVarList; VarListT sysVarRdOnlyList; FunListT funList; ProListT proList; LibFunListT libFunList; LibProListT libProList; CommonListT commonList; StructListT structList; GDLFileListT fileUnits; // flag for control-c volatile bool sigControlC; int debugMode; namespace structDesc { // set in InitStructs() DStructDesc* LIST = NULL; DStructDesc* HASH = NULL; DStructDesc* GDL_CONTAINER_NODE = NULL; DStructDesc* GDL_HASHTABLEENTRY = NULL; } // for OpenMP DLong CpuTPOOL_NTHREADS; DLong CpuTPOOL_MIN_ELTS; DLong CpuTPOOL_MAX_ELTS; const DLong CpuTPOOL_MAX_ELTS_max = numeric_limits::max(); // instantiate own AST factory //_DNodeFactory DNodeFactory; antlr::ASTFactory DNodeFactory("DNode",DNode::factory); void ResetObjects() { Graphics::DestroyDevices(); fileUnits.clear(); cerr << flush; cout << flush; clog << flush; PurgeContainer(sysVarList); PurgeContainer(funList); PurgeContainer(proList); PurgeContainer(structList); // now deletes member subroutines (and they in turn common block references // hence delete common blocks after structList PurgeContainer(commonList); // don't purge library here // PurgeContainer(libFunList); // PurgeContainer(libProList); #ifdef USE_PYTHON PythonEnd(); #endif } // initialize struct descriptors which are not system variables void InitStructs() { SpDInt aInt; SpDLong aLong; SpDString aString; SpDByte aByte; SpDULong aULong; SpDLong64 aLong64; SpDFloat aFloat; SpDDouble aDouble; SpDLong aLongArr8( dimension(8)); SpDPtr aPtrRef; SpDObj aObjRef; // OBJECTS ================================================= DStructDesc* gdl_object = new DStructDesc( GDL_OBJECT_NAME); gdl_object->AddTag("GDL_OBJ_TOP", &aLong64); gdl_object->AddTag("__OBJ__", &aObjRef); gdl_object->AddTag("GDL_OBJ_BOTTOM", &aLong64); // special for GDL_OBJECT ony gdl_object->InitOperatorList(); // insert into structList structList.push_back(gdl_object); DStructDesc* gdlList = new DStructDesc( "LIST"); gdlList->AddTag("GDL_CONTAINER_TOP", &aLong64); gdlList->AddTag("GDLCONTAINERVERSION", &aInt); gdlList->AddTag("PHEAD", &aPtrRef); gdlList->AddTag("PTAIL", &aPtrRef); gdlList->AddTag("NLIST", &aLong); gdlList->AddTag("GDL_CONTAINER_BOTTOM", &aLong64); // use operator overloading (note: gdl_object's operators are not set yet) gdlList->AddParent(gdl_object); // insert into structList structList.push_back(gdlList); structDesc::LIST = gdlList; DStructDesc* gdlContainerNode = new DStructDesc( "GDL_CONTAINER_NODE"); gdlContainerNode->AddTag("PNEXT", &aPtrRef); gdlContainerNode->AddTag("PDATA", &aPtrRef); // gdlContainerNode->AddTag("OOBJ", &aObjRef); // gdlContainerNode->AddTag("FLAGS", &aLong); // insert into structList structList.push_back(gdlContainerNode); structDesc::GDL_CONTAINER_NODE = gdlContainerNode; DStructDesc* gdlHash = new DStructDesc( "HASH"); gdlHash->AddTag("TABLE_BITS", &aULong); gdlHash->AddTag("TABLE_SIZE", &aULong); gdlHash->AddTag("TABLE_COUNT", &aULong); gdlHash->AddTag("TABLE_REMOVE", &aULong); gdlHash->AddTag("TABLE_FOREACH", &aULong); gdlHash->AddTag("TABLE_DATA", &aPtrRef); // use operator overloading (note: gdl_object's operators are not set yet) gdlHash->AddParent(gdl_object); // insert into structList structList.push_back(gdlHash); structDesc::HASH = gdlHash; DStructDesc* gdlHashTE = new DStructDesc( "GDL_HASHTABLEENTRY"); gdlHashTE->AddTag("PKEY", &aPtrRef); gdlHashTE->AddTag("PVALUE", &aPtrRef); // insert into structList structList.push_back(gdlHashTE); structDesc::GDL_HASHTABLEENTRY = gdlHashTE; // OBJECTS END ======================================================= DStructDesc* gdl_size = new DStructDesc( "IDL_SIZE"); gdl_size->AddTag("TYPE_NAME", &aString); gdl_size->AddTag("STRUCTURE_NAME", &aString); gdl_size->AddTag("TYPE", &aInt); gdl_size->AddTag("FILE_LUN", &aInt); gdl_size->AddTag("FILE_OFFSET", &aLong); gdl_size->AddTag("N_ELEMENTS", &aLong); gdl_size->AddTag("N_DIMENSIONS", &aLong); gdl_size->AddTag("DIMENSIONS", &aLongArr8); // insert into structList structList.push_back(gdl_size); for (int big = 1; big >= 0; --big) { DStructDesc* fstat = new DStructDesc( big ? "FSTAT64" : "FSTAT"); fstat->AddTag("UNIT", &aLong); fstat->AddTag("NAME", &aString); fstat->AddTag("OPEN", &aByte); fstat->AddTag("ISATTY", &aByte); fstat->AddTag("ISAGUI", &aByte); fstat->AddTag("INTERACTIVE", &aByte); fstat->AddTag("XDR", &aByte); fstat->AddTag("COMPRESS", &aByte); fstat->AddTag("READ", &aByte); fstat->AddTag("WRITE", &aByte); fstat->AddTag("ATIME", &aLong64); fstat->AddTag("CTIME", &aLong64); fstat->AddTag("MTIME", &aLong64); if (big) { fstat->AddTag("TRANSFER_COUNT", &aLong64); fstat->AddTag("CUR_PTR", &aLong64); fstat->AddTag("SIZE", &aLong64); fstat->AddTag("REC_LEN", &aLong64); } else { fstat->AddTag("TRANSFER_COUNT", &aLong); fstat->AddTag("CUR_PTR", &aLong); fstat->AddTag("SIZE", &aLong); fstat->AddTag("REC_LEN", &aLong); } // insert into structList structList.push_back( fstat); } DStructDesc* finfo = new DStructDesc("FILE_INFO"); finfo->AddTag("NAME", &aString); finfo->AddTag("EXISTS", &aByte); finfo->AddTag("READ", &aByte); finfo->AddTag("WRITE", &aByte); finfo->AddTag("EXECUTE", &aByte); finfo->AddTag("REGULAR", &aByte); finfo->AddTag("DIRECTORY", &aByte); finfo->AddTag("BLOCK_SPECIAL", &aByte); finfo->AddTag("CHARACTER_SPECIAL", &aByte); finfo->AddTag("NAMED_PIPE", &aByte); finfo->AddTag("SETUID", &aByte); finfo->AddTag("SETGID", &aByte); finfo->AddTag("SOCKET", &aByte); finfo->AddTag("STICKY_BIT", &aByte); finfo->AddTag("SYMLINK", &aByte); finfo->AddTag("DANGLING_SYMLINK", &aByte); finfo->AddTag("MODE", &aLong); finfo->AddTag("ATIME", &aLong64); finfo->AddTag("CTIME", &aLong64); finfo->AddTag("MTIME", &aLong64); finfo->AddTag("SIZE", &aLong64); // insert into structList structList.push_back( finfo); DStructDesc* memory = new DStructDesc("IDL_MEMORY"); memory->AddTag("CURRENT", &aLong); memory->AddTag("NUM_ALLOC", &aLong); memory->AddTag("NUM_FREE", &aLong); memory->AddTag("HIGHWATER", &aLong); // insert into structList structList.push_back(memory); DStructDesc* memory64 = new DStructDesc("IDL_MEMORY64"); memory64->AddTag("CURRENT", &aLong64); memory64->AddTag("NUM_ALLOC", &aLong64); memory64->AddTag("NUM_FREE", &aLong64); memory64->AddTag("HIGHWATER", &aLong64); // insert into structList structList.push_back(memory64); DStructDesc* machar = new DStructDesc( "MACHAR"); machar->AddTag("IBETA", &aLong); machar->AddTag("IT", &aLong); machar->AddTag("IRND", &aLong); machar->AddTag("NGRD", &aLong); machar->AddTag("MACHEP", &aLong); machar->AddTag("NEGEP", &aLong); machar->AddTag("IEXP", &aLong); machar->AddTag("MINEXP", &aLong); machar->AddTag("MAXEXP", &aLong); machar->AddTag("EPS", &aFloat); machar->AddTag("EPSNEG", &aFloat); machar->AddTag("XMIN", &aFloat); machar->AddTag("XMAX", &aFloat); // insert into structList structList.push_back( machar); DStructDesc* dmachar = new DStructDesc( "DMACHAR"); dmachar->AddTag("IBETA", &aLong); dmachar->AddTag("IT", &aLong); dmachar->AddTag("IRND", &aLong); dmachar->AddTag("NGRD", &aLong); dmachar->AddTag("MACHEP", &aLong); dmachar->AddTag("NEGEP", &aLong); dmachar->AddTag("IEXP", &aLong); dmachar->AddTag("MINEXP", &aLong); dmachar->AddTag("MAXEXP", &aLong); dmachar->AddTag("EPS", &aDouble); dmachar->AddTag("EPSNEG", &aDouble); dmachar->AddTag("XMIN", &aDouble); dmachar->AddTag("XMAX", &aDouble); // insert into structList structList.push_back( dmachar); DStructDesc* widgbut = new DStructDesc( "WIDGET_BUTTON"); widgbut->AddTag("ID", &aLong); widgbut->AddTag("TOP", &aLong); widgbut->AddTag("HANDLER", &aLong); widgbut->AddTag("SELECT", &aLong); // insert into structList structList.push_back( widgbut); DStructDesc* widgdlist = new DStructDesc( "WIDGET_DROPLIST"); widgdlist->AddTag("ID", &aLong); widgdlist->AddTag("TOP", &aLong); widgdlist->AddTag("HANDLER", &aLong); widgdlist->AddTag("SELECT", &aLong); // insert into structList structList.push_back( widgdlist); DStructDesc* widglist = new DStructDesc( "WIDGET_LIST"); widglist->AddTag("ID", &aLong); widglist->AddTag("TOP", &aLong); widglist->AddTag("HANDLER", &aLong); widglist->AddTag("SELECT", &aLong); // insert into structList structList.push_back( widglist); DStructDesc* widgbgroup = new DStructDesc( "WIDGET_BGROUP"); widgbgroup->AddTag("ID", &aLong); widgbgroup->AddTag("TOP", &aLong); widgbgroup->AddTag("HANDLER", &aLong); widgbgroup->AddTag("SELECT", &aLong); widgbgroup->AddTag("VALUE", &aLong); // insert into structList structList.push_back(widgbgroup); DStructDesc* widgtxt = new DStructDesc( "WIDGET_TEXT"); widgtxt->AddTag("ID", &aLong); widgtxt->AddTag("TOP", &aLong); widgtxt->AddTag("HANDLER", &aLong); widgtxt->AddTag("SELECT", &aLong); // insert into structList structList.push_back( widgtxt); DStructDesc* widgver = new DStructDesc( "WIDGET_VERSION"); widgver->AddTag("STYLE", &aString); widgver->AddTag("TOOLKIT", &aString); widgver->AddTag("RELEASE", &aString); // insert into structList structList.push_back( widgver); } void InitObjects() { sigControlC = false; debugMode = 0; fileUnits.resize( maxLun); // 0-127 -> 1-128 within GDL for files // initialize GDL system variables SysVar::InitSysVar(); // initialize struct descriptors which are not system variables InitStructs(); // add internal memeber subroutines SetupOverloadSubroutines(); // graphic devices must be initialized after system variables // !D must already exist Graphics::Init(); // preferences // Preferences::Init(); #ifdef HAVE_LIBWXWIDGETS // initialize widget system GDLWidget::Init(); #endif } // returns GDL lun, 0 on failure DLong GetLUN() { for( DLong lun=maxUserLun+1; lun <= fileUnits.size(); lun++) if( !fileUnits[ lun-1].InUse() && !fileUnits[ lun-1].GetGetLunLock()) { fileUnits[ lun-1].SetGetLunLock( true); return lun; } return 0; } // for semantic predicate bool IsFun(antlr::RefToken rT1) { antlr::Token& T1=*rT1; // search for T1.getText() in function table and path string searchName=StrUpCase(T1.getText()); // cout << "IsFun: Searching for: " << searchName << endl; unsigned fLSize=funList.size(); for( unsigned f=0; fName() == searchName) return true; } // cout << "Not found: " << searchName << endl; return false; } int ProIx(const string& n) { SizeT nF=proList.size(); for( SizeT i=0; i(n)(proList[i])) return (int)i; return -1; } int FunIx(const string& n) { SizeT nF=funList.size(); for( SizeT i=0; i(n)(funList[i])) return (int)i; return -1; } int LibProIx(const string& n) { SizeT nF=libProList.size(); for( SizeT i=0; i(n)(libProList[i])) return (int)i; } return -1; } int LibFunIx(const string& n) { SizeT nF=libFunList.size(); for( SizeT i=0; i(n)(libFunList[i])) return (int)i; } return -1; } // returns the endian of the current machine bool BigEndian() { // a long should at least have two bytes // big endian -> msb first (msb is 0 here) static const unsigned long int s = 0x0001; static const bool bigEndian = !(*reinterpret_cast( &s)); return bigEndian; } // test--------------- void breakpoint() { static SizeT num=1; cout << "objects.cpp: at breakpoint(): " << num << endl; num++; } #ifndef _OPENMP int get_suggested_omp_num_threads() { return 1; } #endif #if defined _OPENMP int get_suggested_omp_num_threads() { int default_num_threads=1, suggested_num_threads=1; char* env_var_c; env_var_c = getenv ("OMP_NUM_THREADS"); if(env_var_c) { return atoi(env_var_c); } // cout<<"OMP_NUM_THREADS is not defined"</dev/null|cut -d\" \" -f3", "r"); if (!iff) { return default_num_threads; } #elif defined(_WIN32) || defined(__WIN32__) || defined(__WINDOWS__) cout<<"is windows"<5?1:0); suggested_num_threads=nbofproc-avload; return suggested_num_threads; } #endif gdl-0.9.4/src/topython.cpp0000664000175000017500000001020312055721152014075 0ustar marcmarc/*************************************************************************** topython.cpp - ToPython functions ------------------- begin : Apr 19 2004 copyright : (C) 2004 by Marc Schellens email : m_schellens@users.sourceforge.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ // to be included from datatypes.cpp #ifdef INCLUDE_TOPYTHON_CPP using namespace std; const int pyType[] = { NPY_NOTYPE, //GDL_UNDEF*** NPY_UINT8, //GDL_BYTE NPY_INT16, //GDL_INT NPY_INT32, //GDL_LONG, NPY_FLOAT32, //GDL_FLOAT, NPY_FLOAT64, //GDL_DOUBLE, NPY_COMPLEX64, //GDL_COMPLEX, NPY_NOTYPE, //GDL_STRING*** NPY_NOTYPE, //GDL_STRUCT*** NPY_COMPLEX128, //GDL_COMPLEXDBL, NPY_NOTYPE, //GDL_PTR*** NPY_NOTYPE, //GDL_OBJ*** NPY_UINT32, //GDL_UINT* NPY_UINT32, //GDL_ULONG* NPY_INT64, //GDL_LONG64* NPY_UINT64 //GDL_ULONG64* }; template < typename Sp> PyObject* Data_::ToPython() { SizeT nEl = dd.size(); if( nEl == 1) { // return simple python object return ToPythonScalar(); } const int item_type = pyType[ Sp::t]; if( item_type == NPY_NOTYPE) throw GDLException("Cannot convert "+this->TypeStr()+" array to python."); int n_dim = this->Rank(); npy_intp dimArr[MAXRANK]; for( int i=0; idim[i]; // SA: this does not copy the data (see tracker item no. 3148396) // return //reinterpret_cast< PyObject*> // (PyArray_SimpleNewFromData( n_dim, dimArr, item_type, DataAddr())); PyObject* ret = PyArray_SimpleNew(n_dim, dimArr, item_type); if (!PyArray_CHKFLAGS(ret, NPY_C_CONTIGUOUS)) { // TODO: free the memory: PyArray_Free(PyObject* op, void* ptr) ? throw GDLException("Failed to convert array to python."); } memcpy(PyArray_DATA(ret), DataAddr(), this->N_Elements() * sizeof(Sp::t)); return ret; } template < typename Sp> PyObject* Data_::ToPythonScalar() { throw GDLException("Cannot convert scalar "+this->TypeStr()+" to python."); return NULL; } template<> PyObject* Data_::ToPythonScalar() { return Py_BuildValue("B", (*this)[0]); } template<> PyObject* Data_::ToPythonScalar() { return Py_BuildValue("h", (*this)[0]); } template<> PyObject* Data_::ToPythonScalar() { return Py_BuildValue("H", (*this)[0]); } template<> PyObject* Data_::ToPythonScalar() { return Py_BuildValue("i", (*this)[0]); } template<> PyObject* Data_::ToPythonScalar() { return Py_BuildValue("I", (*this)[0]); } // template<> // PyObject* Data_::ToPythonScalar() // { // return Py_BuildValue("L", (*this)[0]); // } // template<> // PyObject* Data_::ToPythonScalar() // { // return Py_BuildValue("K", (*this)[0]); // } template<> PyObject* Data_::ToPythonScalar() { return Py_BuildValue("f", (*this)[0]); } template<> PyObject* Data_::ToPythonScalar() { return Py_BuildValue("d", (*this)[0]); } template<> PyObject* Data_::ToPythonScalar() { Py_complex c; c.real = (*this)[0].real(); c.imag = (*this)[0].imag(); return Py_BuildValue("D", c); } template<> PyObject* Data_::ToPythonScalar() { Py_complex c; c.real = (*this)[0].real(); c.imag = (*this)[0].imag(); return Py_BuildValue("D", c); } template<> PyObject* Data_::ToPythonScalar() { return Py_BuildValue("s", (*this)[0].c_str()); } //#include "instantiate_templates.hpp" #endif gdl-0.9.4/src/py/0000775000175000017500000000000012221570143012136 5ustar marcmarcgdl-0.9.4/src/py/python_print.py0000664000175000017500000000004310156065335015251 0ustar marcmarcdef py_print(a): print a gdl-0.9.4/src/py/python_plot.py0000664000175000017500000000034710156065335015102 0ustar marcmarc# simple example for GDL's python interface # note that the matplotlib package has *much* more capabilities. # feel free to experiment. from matplotlib.matlab import * def py_plot( x, y): plot(x, y, linewidth=1.0) show() gdl-0.9.4/src/datatypesref.cpp0000664000175000017500000012673412216014714014723 0ustar marcmarc/************************************************************************** datatypesref.cpp - specializations for DPtrGDL and DObjGDL for reference counting ------------------- begin : March 08 2010 copyright : (C) 2010 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /* ************************************************************************* * * * 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. * * * ***************************************************************************/ // to be included from datatypes.cpp #ifdef INCLUDE_DATATYPESREF_CPP #undef INCLUDE_DATATYPESREF_CPP #include "nullgdl.hpp" // reference counting for INIT template<> Data_* Data_::New( const dimension& dim_, BaseGDL::InitType noZero) const { if( noZero == BaseGDL::NOZERO) return new Data_(dim_, BaseGDL::NOZERO); if( noZero == BaseGDL::INIT) { Data_* res = new Data_(dim_, BaseGDL::NOZERO); SizeT nEl = res->dd.size(); /*#pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for*/ for( OMPInt i=0; i Data_* Data_::New( const dimension& dim_, BaseGDL::InitType noZero) const { if( noZero == BaseGDL::NOZERO) return new Data_(dim_, BaseGDL::NOZERO); if( noZero == BaseGDL::INIT) { Data_* res = new Data_(dim_, BaseGDL::NOZERO); SizeT nEl = res->dd.size(); /*#pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for*/ for( OMPInt i=0; i void Data_::InsAt( Data_* srcIn, ArrayIndexListT* ixList, SizeT offset) { // max. number of dimensions to copy SizeT nDim = ixList->NDim(); if( nDim == 1) { SizeT destStart = ixList->LongIx(); //SizeT len; if( this->N_Elements() == 1) { // len = 1; SizeT rStride = srcIn->Stride(this->Rank()); Ty& a = (*this)[ destStart]; Ty b = (*srcIn)[ offset/rStride]; GDLInterpreter::IncRef( b); GDLInterpreter::DecRef( a); a = b;//(*this)[ destStart] = (*srcIn)[ offset/rStride]; } else { SizeT len = srcIn->Dim( 0); // length of segment to copy // TODO: IDL reports here (and probably in the insert-dimension case below as well) // the name of a variable, e.g.: // IDL> a=[0,0,0] & a[2]=[2,2,2] // % Out of range subscript encountered: A. if( (destStart+len) > this->N_Elements()) //dim[0]) throw GDLException("Out of range subscript encountered (length of insert exceeds array boundaries)."); // DataT& srcIn_dd = srcIn->dd; SizeT srcIx = 0; // this one simply runs from 0 to N_Elements(srcIn) SizeT destEnd = destStart + len; for( SizeT destIx = destStart; destIx < destEnd; ++destIx) { Ty& a = (*this)[ destIx]; Ty b = (*srcIn)[ srcIx++]; GDLInterpreter::IncRef( b); GDLInterpreter::DecRef( a); a = b;// (*this)[ destIx] = (*srcIn)[ srcIx++]; } } return; } SizeT destStart; // 1-dim starting index // ATTENTION: dimension is used as an index here dimension ixDim = ixList->GetDimIx0( destStart); nDim--; dimension srcDim=srcIn->Dim(); SizeT len=srcDim[0]; // length of one segment to copy (one line of srcIn) // SizeT nDim =RankIx(ixDim.Rank()); SizeT srcNDim=RankIx(srcDim.Rank()); // number of source dimensions if( srcNDim < nDim) nDim=srcNDim; // check limits (up to Rank to consider) for( SizeT dIx=0; dIx <= nDim; ++dIx) // check if in bounds of a if( (ixDim[dIx]+srcDim[dIx]) > this->dim[dIx]) throw GDLException("Out of range subscript encountered (dimension of insert exceeds array boundaries for dimension " + i2s(dIx +1) + ")."); SizeT nCp=srcIn->Stride(nDim+1)/len; // number of OVERALL copy actions // as lines are copied, we need the stride from 2nd dim on SizeT retStride[MAXRANK]; for( SizeT a=0; a <= nDim; ++a) retStride[a]=srcDim.Stride(a+1)/len; // a magic number, to reset destStart for this dimension SizeT resetStep[MAXRANK]; for( SizeT a=1; a <= nDim; ++a) resetStep[a]=(retStride[a]-1)/retStride[a-1]*this->dim.Stride(a); // SizeT destStart=this->dim.LongIndex(ixDim); // starting pos // DataT& srcIn_dd = srcIn->dd; SizeT srcIx=0; // this one simply runs from 0 to N_Elements(srcIn) for( SizeT c=1; c<=nCp; ++c) // linearized verison of nested loops { // copy one segment SizeT destEnd=destStart+len; for( SizeT destIx=destStart; destIxdim.Stride(a); break; } else { // reset destStart -= resetStep[a]; } } } } template<> void Data_::InsAt( Data_* srcIn, ArrayIndexListT* ixList, SizeT offset) { // max. number of dimensions to copy SizeT nDim = ixList->NDim(); if( nDim == 1) { SizeT destStart = ixList->LongIx(); //SizeT len; if( this->N_Elements() == 1) { // len = 1; SizeT rStride = srcIn->Stride(this->Rank()); Ty& a = (*this)[ destStart]; Ty b = (*srcIn)[ offset/rStride]; GDLInterpreter::IncRefObj( b); GDLInterpreter::DecRefObj( a); a = b;//(*this)[ destStart] = (*srcIn)[ offset/rStride]; } else { SizeT len = srcIn->Dim( 0); // length of segment to copy // TODO: IDL reports here (and probably in the insert-dimension case below as well) // the name of a variable, e.g.: // IDL> a=[0,0,0] & a[2]=[2,2,2] // % Out of range subscript encountered: A. if( (destStart+len) > this->N_Elements()) //dim[0]) throw GDLException("Out of range subscript encountered (length of insert exceeds array boundaries)."); // DataT& srcIn_dd = srcIn->dd; SizeT srcIx = 0; // this one simply runs from 0 to N_Elements(srcIn) SizeT destEnd = destStart + len; for( SizeT destIx = destStart; destIx < destEnd; ++destIx) { Ty& a = (*this)[ destIx]; Ty b = (*srcIn)[ srcIx++]; GDLInterpreter::IncRefObj( b); GDLInterpreter::DecRefObj( a); a = b;// (*this)[ destIx] = (*srcIn)[ srcIx++]; } } return; } SizeT destStart; // 1-dim starting index // ATTENTION: dimension is used as an index here dimension ixDim = ixList->GetDimIx0( destStart); nDim--; dimension srcDim=srcIn->Dim(); SizeT len=srcDim[0]; // length of one segment to copy (one line of srcIn) // SizeT nDim =RankIx(ixDim.Rank()); SizeT srcNDim=RankIx(srcDim.Rank()); // number of source dimensions if( srcNDim < nDim) nDim=srcNDim; // check limits (up to Rank to consider) for( SizeT dIx=0; dIx <= nDim; ++dIx) // check if in bounds of a if( (ixDim[dIx]+srcDim[dIx]) > this->dim[dIx]) throw GDLException("Out of range subscript encountered (dimension of insert exceeds array boundaries for dimension " + i2s(dIx +1) + ")."); SizeT nCp=srcIn->Stride(nDim+1)/len; // number of OVERALL copy actions // as lines are copied, we need the stride from 2nd dim on SizeT retStride[MAXRANK]; for( SizeT a=0; a <= nDim; ++a) retStride[a]=srcDim.Stride(a+1)/len; // a magic number, to reset destStart for this dimension SizeT resetStep[MAXRANK]; for( SizeT a=1; a <= nDim; ++a) resetStep[a]=(retStride[a]-1)/retStride[a-1]*this->dim.Stride(a); // SizeT destStart=this->dim.LongIndex(ixDim); // starting pos // DataT& srcIn_dd = srcIn->dd; SizeT srcIx=0; // this one simply runs from 0 to N_Elements(srcIn) for( SizeT c=1; c<=nCp; ++c) // linearized verison of nested loops { // copy one segment SizeT destEnd=destStart+len; for( SizeT destIx=destStart; destIxdim.Stride(a); break; } else { // reset destStart -= resetStep[a]; } } } } template<> void Data_::AssignAtIx( RangeT ix, BaseGDL* srcIn) { if( srcIn->Type() != this->Type()) throw GDLException("Only expressions of type " + srcIn->TypeStr() + " can be assigned to " + this->TypeStr()); GDLInterpreter::IncRef( (*static_cast(srcIn))[0]); GDLInterpreter::DecRef( (*this)[ix]); (*this)[ix] = (*static_cast(srcIn))[0]; } template<> void Data_::AssignAtIx( RangeT ix, BaseGDL* srcIn) { if( srcIn->Type() != this->Type()) throw GDLException("Only expressions of type " + srcIn->TypeStr() + " can be assigned to " + this->TypeStr()); GDLInterpreter::IncRefObj( (*static_cast(srcIn))[0]); GDLInterpreter::DecRefObj( (*this)[ix]); (*this)[ix] = (*static_cast(srcIn))[0]; } template<> void Data_::AssignAt( BaseGDL* srcIn, ArrayIndexListT* ixList, SizeT offset) { // breakpoint(); // gdbg can not handle breakpoints in template functions Data_* src = static_cast(srcIn); SizeT srcElem= src->N_Elements(); // bool isScalar= (srcElem == 1); bool isScalar= (srcElem == 1) && (src->Rank() == 0); if( isScalar) { // src is scalar Ty scalar=(*src)[0]; if( ixList == NULL) { SizeT nCp=Data_::N_Elements(); GDLInterpreter::AddRef( scalar, nCp); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; cN_Elements(); AllIxBaseT* allIx = ixList->BuildIx(); GDLInterpreter::AddRef( scalar, nCp); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; cGetIx( c)]=scalar; } } else { if( ixList == NULL) { SizeT nCp=Data_::N_Elements(); // if (non-indexed) src is smaller -> just copy its number of elements if( nCp > (srcElem-offset)) { if( offset == 0) nCp=srcElem; else throw GDLException("Source expression contains not enough elements."); } //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; cN_Elements(); if( nCp == 1) { SizeT destStart = ixList->LongIx(); // len = 1; SizeT rStride = srcIn->Stride(this->Rank()); (*this)[ destStart] = (*src)[ offset/rStride]; // InsAt( src, ixList, offset); } else { if( offset == 0) { if( srcElem < nCp) throw GDLException("Array subscript must have same size as" " source expression."); AllIxBaseT* allIx = ixList->BuildIx(); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; cGetIx( c)]=(*src)[c+offset]; } else { if( (srcElem-offset) < nCp) throw GDLException("Array subscript must have same size as" " source expression."); AllIxBaseT* allIx = ixList->BuildIx(); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; cGetIx( c)]=(*src)[c+offset]; } } } } } template<> void Data_::AssignAt( BaseGDL* srcIn, ArrayIndexListT* ixList, SizeT offset) { // breakpoint(); // gdbg can not handle breakpoints in template functions Data_* src = static_cast(srcIn); SizeT srcElem= src->N_Elements(); // bool isScalar= (srcElem == 1); bool isScalar= (srcElem == 1) && (src->Rank() == 0); if( isScalar) { // src is scalar Ty scalar=(*src)[0]; if( ixList == NULL) { SizeT nCp=Data_::N_Elements(); GDLInterpreter::AddRefObj( scalar, nCp); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; cN_Elements(); AllIxBaseT* allIx = ixList->BuildIx(); GDLInterpreter::AddRefObj( scalar, nCp); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; cGetIx( c)]=scalar; } } else { if( ixList == NULL) { SizeT nCp=Data_::N_Elements(); // if (non-indexed) src is smaller -> just copy its number of elements if( nCp > (srcElem-offset)) { if( offset == 0) nCp=srcElem; else throw GDLException("Source expression contains not enough elements."); } //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; cN_Elements(); if( nCp == 1) { SizeT destStart = ixList->LongIx(); // len = 1; SizeT rStride = srcIn->Stride(this->Rank()); (*this)[ destStart] = (*src)[ offset/rStride]; // InsAt( src, ixList, offset); } else { if( offset == 0) { if( srcElem < nCp) throw GDLException("Array subscript must have same size as" " source expression."); AllIxBaseT* allIx = ixList->BuildIx(); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; cGetIx( c)]=(*src)[c+offset]; } else { if( (srcElem-offset) < nCp) throw GDLException("Array subscript must have same size as" " source expression."); AllIxBaseT* allIx = ixList->BuildIx(); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; cGetIx( c)]=(*src)[c+offset]; } } } } } template<> void Data_::AssignAt( BaseGDL* srcIn, ArrayIndexListT* ixList) { assert( ixList != NULL); // breakpoint(); // gdbg can not handle breakpoints in template functions Data_* src = static_cast(srcIn); SizeT srcElem= src->N_Elements(); bool isScalar= (srcElem == 1); if( isScalar) { // src is scalar SizeT nCp=ixList->N_Elements(); if( nCp == 1) { Ty& a = (*this)[ ixList->LongIx()] ; Ty b = (*src)[ 0]; GDLInterpreter::IncRef( b); GDLInterpreter::DecRef( a); a = b;//(*this)[ ixList->LongIx()] = (*src)[0]; } else { Ty scalar=(*src)[0]; AllIxBaseT* allIx = ixList->BuildIx(); GDLInterpreter::AddRef( scalar, nCp); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; cGetIx( c)]=scalar; } } else { // crucial part SizeT nCp=ixList->N_Elements(); if( nCp == 1) { InsAt( src, ixList); } else { if( srcElem < nCp) throw GDLException("Array subscript must have same size as" " source expression."); AllIxBaseT* allIx = ixList->BuildIx(); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; cGetIx( c)]=(*src)[c+offset]; } } } template<> void Data_::AssignAt( BaseGDL* srcIn) { // breakpoint(); // gdbg can not handle breakpoints in template functions Data_* src = static_cast(srcIn); SizeT srcElem= src->N_Elements(); bool isScalar= (srcElem == 1); if( isScalar) { // src is scalar Ty scalar=(*src)[0]; /* dd = scalar;*/ SizeT nCp=Data_::N_Elements(); GDLInterpreter::AddRef( scalar, nCp); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; c just copy its number of elements if( nCp > srcElem) nCp=srcElem; //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; c void Data_::AssignAt( BaseGDL* srcIn, ArrayIndexListT* ixList) { assert( ixList != NULL); // breakpoint(); // gdbg can not handle breakpoints in template functions Data_* src = static_cast(srcIn); SizeT srcElem= src->N_Elements(); bool isScalar= (srcElem == 1); if( isScalar) { // src is scalar SizeT nCp=ixList->N_Elements(); if( nCp == 1) { Ty& a = (*this)[ ixList->LongIx()] ; Ty b = (*src)[ 0]; GDLInterpreter::IncRefObj( b); GDLInterpreter::DecRefObj( a); a = b;//(*this)[ ixList->LongIx()] = (*src)[0]; } else { Ty scalar=(*src)[0]; AllIxBaseT* allIx = ixList->BuildIx(); GDLInterpreter::AddRefObj( scalar, nCp); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; cGetIx( c)]=scalar; } } else { // crucial part SizeT nCp=ixList->N_Elements(); if( nCp == 1) { InsAt( src, ixList); } else { if( srcElem < nCp) throw GDLException("Array subscript must have same size as" " source expression."); AllIxBaseT* allIx = ixList->BuildIx(); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; cGetIx( c)]=(*src)[c+offset]; } } } template<> void Data_::AssignAt( BaseGDL* srcIn) { // breakpoint(); // gdbg can not handle breakpoints in template functions Data_* src = static_cast(srcIn); SizeT srcElem= src->N_Elements(); bool isScalar= (srcElem == 1); if( isScalar) { // src is scalar Ty scalar=(*src)[0]; /* dd = scalar;*/ SizeT nCp=Data_::N_Elements(); GDLInterpreter::AddRefObj( scalar, nCp); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; c just copy its number of elements if( nCp > srcElem) nCp=srcElem; //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; c Data_* Data_::Index( ArrayIndexListT* ixList) { // ixList->SetVariable( this); Data_* res=Data_::New( ixList->GetDim(), BaseGDL::NOZERO); SizeT nCp=ixList->N_Elements(); // cout << "nCP = " << nCp << endl; // cout << "dim = " << this->dim << endl; // DataT& res_dd = res->dd; AllIxBaseT* allIx = ixList->BuildIx(); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; cGetIx(c)]; return res; } // returns (*this)[ ixList] template<> Data_* Data_::Index( ArrayIndexListT* ixList) { // ixList->SetVariable( this); Data_* res=Data_::New( ixList->GetDim(), BaseGDL::NOZERO); SizeT nCp=ixList->N_Elements(); // cout << "nCP = " << nCp << endl; // cout << "dim = " << this->dim << endl; // DataT& res_dd = res->dd; AllIxBaseT* allIx = ixList->BuildIx(); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; cGetIx(c)]; return res; } // used by AccessDescT for resolving, no checking is done // inserts srcIn[ ixList] at offset // used by DotAccessDescT::DoResolve template<> void Data_::InsertAt( SizeT offset, BaseGDL* srcIn, ArrayIndexListT* ixList) { Data_* src=static_cast(srcIn); if( ixList == NULL) { SizeT nCp=src->N_Elements(); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; cN_Elements(); AllIxBaseT* allIx = ixList->BuildIx(); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; cGetIx( c)]; } } } // used for concatenation, called from CatArray // assumes that everything is checked (see CatInfo) template<> void Data_::CatInsert( const Data_* srcArr, const SizeT atDim, SizeT& at) { // length of one segment to copy SizeT len=srcArr->dim.Stride(atDim+1); // src array // number of copy actions SizeT nCp=srcArr->N_Elements()/len; // initial offset SizeT destStart= this->dim.Stride(atDim) * at; // dest array SizeT destEnd = destStart + len; // number of elements to skip SizeT gap=this->dim.Stride(atDim+1); // dest array #ifdef _OPENMP SizeT nEl = srcArr->N_Elements(); //#pragma omp parallel for if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) for( SizeT c=0; cdim[atDim]; // update 'at' at += (add > 1)? add : 1; } // used by AccessDescT for resolving, no checking is done // inserts srcIn[ ixList] at offset // used by DotAccessDescT::DoResolve template<> void Data_::InsertAt( SizeT offset, BaseGDL* srcIn, ArrayIndexListT* ixList) { Data_* src=static_cast(srcIn); if( ixList == NULL) { SizeT nCp=src->N_Elements(); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; cN_Elements(); AllIxBaseT* allIx = ixList->BuildIx(); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; cGetIx( c)]; } } } // used for concatenation, called from CatArray // assumes that everything is checked (see CatInfo) template<> void Data_::CatInsert( const Data_* srcArr, const SizeT atDim, SizeT& at) { // length of one segment to copy SizeT len=srcArr->dim.Stride(atDim+1); // src array // number of copy actions SizeT nCp=srcArr->N_Elements()/len; // initial offset SizeT destStart= this->dim.Stride(atDim) * at; // dest array SizeT destEnd = destStart + len; // number of elements to skip SizeT gap=this->dim.Stride(atDim+1); // dest array #ifdef _OPENMP SizeT nEl = srcArr->N_Elements(); //#pragma omp parallel for if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) for( SizeT c=0; cdim[atDim]; // update 'at' at += (add > 1)? add : 1; } template<> void Data_::Assign( BaseGDL* src, SizeT nEl) { // Data_* srcT = dynamic_cast( src); // // Guard< Data_> srcTGuard; // if( srcT == NULL) // { // srcT = static_cast( src->Convert2( Data_::t, BaseGDL::COPY)); // srcTGuard.Reset( srcT); // } Data_* srcT; // = dynamic_cast( src); Guard< Data_> srcTGuard; if( src->Type() != Data_::t) { srcT = static_cast( src->Convert2( Data_::t, BaseGDL::COPY)); srcTGuard.Init( srcT); } else { srcT = static_cast( src); } //#pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { //#pragma omp for for(long k=0; k < nEl; ++k) { Ty a = (*this)[ k]; Ty b = (*srcT)[k]; GDLInterpreter::IncRef( b); GDLInterpreter::DecRef( a); (*this)[ k] = (*srcT)[ k]; } } } template<> void Data_::Assign( BaseGDL* src, SizeT nEl) { // Data_* srcT = dynamic_cast( src); // // Guard< Data_> srcTGuard; // if( srcT == NULL) // { // srcT = static_cast( src->Convert2( Data_::t, BaseGDL::COPY)); // srcTGuard.Reset( srcT); // } Data_* srcT; // = dynamic_cast( src); Guard< Data_> srcTGuard; if( src->Type() != Data_::t) { srcT = static_cast( src->Convert2( Data_::t, BaseGDL::COPY)); srcTGuard.Init( srcT); } else { srcT = static_cast( src); } //#pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { //#pragma omp for for(long k=0; k < nEl; ++k) { Ty a = (*this)[ k]; Ty b = (*srcT)[k]; GDLInterpreter::IncRefObj( b); GDLInterpreter::DecRefObj( a); (*this)[ k] = (*srcT)[ k]; } } } // return a new type of itself (only for one dimensional case) template<> BaseGDL* Data_::NewIx( SizeT ix) { Ty b = (*this)[ ix]; GDLInterpreter::IncRef( b); return new Data_( (*this)[ ix]); } // return a new type of itself (only for one dimensional case) template<> BaseGDL* Data_::NewIx( SizeT ix) { if( !this->StrictScalar()) { Ty b = (*this)[ ix]; GDLInterpreter::IncRefObj( b); return new Data_( (*this)[ ix]); } DObj s = dd[0]; // is StrictScalar() if( s == 0) // no overloads for null object return new Data_( 0); DStructGDL* oStructGDL= GDLInterpreter::GetObjHeapNoThrow( s); if( oStructGDL == NULL) // if object not valid -> default behaviour return new Data_( 0); DStructDesc* desc = oStructGDL->Desc(); if( desc->IsParent("LIST")) { static DString cNodeName("GDL_CONTAINER_NODE"); // because of .RESET_SESSION, we cannot use static here DStructDesc* containerDesc=structDesc::GDL_CONTAINER_NODE; // no static here, might vary in derived object // unsigned pHeadTag = desc->TagIndex( "PHEAD"); static unsigned pTailTag = desc->TagIndex( "PTAIL"); static unsigned pNextTag = structDesc::GDL_CONTAINER_NODE->TagIndex( "PNEXT"); static unsigned pDataTag = structDesc::GDL_CONTAINER_NODE->TagIndex( "PDATA"); // unsigned nListTag = desc->TagIndex( "NLIST"); // SizeT listSize = (*static_cast(oStructGDL->GetTag( nListTag, 0)))[0]; DPtr actP = (*static_cast(oStructGDL->GetTag( pTailTag, 0)))[0]; for( SizeT elIx = 0; elIx < ix; ++elIx) { BaseGDL* actPHeap = BaseGDL::interpreter->GetHeap( actP); if( actPHeap->Type() != GDL_STRUCT) throw GDLException( "LIST node must be a STRUCT."); DStructGDL* actPStruct = static_cast( actPHeap); if( actPStruct->Desc() != containerDesc) throw GDLException( "LIST node must be a GDL_CONTAINER_NODE STRUCT."); actP = (*static_cast( actPStruct->GetTag( pNextTag, 0)))[0]; } BaseGDL* actPHeap = BaseGDL::interpreter->GetHeap( actP); if( actPHeap->Type() != GDL_STRUCT) throw GDLException( "LIST node must be a STRUCT."); DStructGDL* actPStruct = static_cast( actPHeap); if( actPStruct->Desc() != containerDesc) throw GDLException( "LIST node must be a GDL_CONTAINER_NODE STRUCT."); actP = (*static_cast(actPStruct->GetTag( pDataTag, 0)))[0]; BaseGDL* result = BaseGDL::interpreter->GetHeap( actP); if( result == NULL) return NullGDL::GetSingleInstance(); return result->Dup(); } if( desc->IsParent("HASH")) { static DString hashName("HASH"); static DString entryName("GDL_HASHTABLEENTRY"); static unsigned pDataTag = structDesc::HASH->TagIndex( "TABLE_DATA"); static unsigned nSizeTag = structDesc::HASH->TagIndex( "TABLE_SIZE"); static unsigned nCountTag = structDesc::HASH->TagIndex( "TABLE_COUNT"); static unsigned nForEachTag = structDesc::HASH->TagIndex( "TABLE_FOREACH"); static unsigned pKeyTag = structDesc::GDL_HASHTABLEENTRY->TagIndex( "PKEY"); static unsigned pValueTag = structDesc::GDL_HASHTABLEENTRY->TagIndex( "PVALUE"); DPtr pHashTable = (*static_cast( oStructGDL->GetTag( pDataTag, 0)))[0]; DStructGDL* hashTable = static_cast(BaseGDL::interpreter->GetHeap( pHashTable)); DLong validIx = 0; DLong i = 0; for(; iN_Elements(); ++i) { DPtr pKey = (*static_cast(hashTable->GetTag( pKeyTag, i)))[0]; if( pKey != 0) { if( validIx == ix) break; ++validIx; } } assert( iN_Elements()); DPtr pValue = (*static_cast(hashTable->GetTag( pValueTag, i)))[0]; DPtr pKey = (*static_cast(hashTable->GetTag( pKeyTag, i)))[0]; (*static_cast( oStructGDL->GetTag( nForEachTag, 0)))[0] = pKey; BaseGDL* result = BaseGDL::interpreter->GetHeap( pValue); if( result == NULL) return NullGDL::GetSingleInstance(); return result->Dup(); } return new Data_( s); } template<> Data_* Data_::NewIx( AllIxBaseT* ix, const dimension* dIn) { SizeT nCp = ix->size(); Data_* res=Data_::New( *dIn, BaseGDL::NOZERO); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; c Data_* Data_::NewIx( AllIxBaseT* ix, const dimension* dIn) { SizeT nCp = ix->size(); Data_* res=Data_::New( *dIn, BaseGDL::NOZERO); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; c Data_* Data_::NewIxFrom( SizeT s) { SizeT nCp = dd.size() - s; Data_* res=Data_::New( dimension( nCp), BaseGDL::NOZERO); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; c Data_* Data_::NewIxFrom( SizeT s) { SizeT nCp = dd.size() - s; Data_* res=Data_::New( dimension( nCp), BaseGDL::NOZERO); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; c Data_* Data_::NewIxFrom( SizeT s, SizeT e) { SizeT nCp = e - s + 1; Data_* res=Data_::New( dimension( nCp), BaseGDL::NOZERO); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; c Data_* Data_::NewIxFrom( SizeT s, SizeT e) { SizeT nCp = e - s + 1; Data_* res=Data_::New( dimension( nCp), BaseGDL::NOZERO); //#pragma omp parallel if (nCp >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCp)) { //#pragma omp for for( SizeT c=0; c Data_* Data_::NewIxFromStride( SizeT s, SizeT stride) { SizeT nCp = (dd.size() - s + stride - 1)/stride; Data_* res=Data_::New( dimension( nCp), BaseGDL::NOZERO); for( SizeT c=0; c Data_* Data_::NewIxFromStride( SizeT s, SizeT e, SizeT stride) { SizeT nCp = (e - s + stride)/stride; Data_* res=Data_::New( dimension( nCp), BaseGDL::NOZERO); for( SizeT c=0; c Data_* Data_::NewIxFromStride( SizeT s, SizeT stride) { SizeT nCp = (dd.size() - s + stride - 1)/stride; Data_* res=Data_::New( dimension( nCp), BaseGDL::NOZERO); for( SizeT c=0; c Data_* Data_::NewIxFromStride( SizeT s, SizeT e, SizeT stride) { SizeT nCp = (e - s + stride)/stride; Data_* res=Data_::New( dimension( nCp), BaseGDL::NOZERO); for( SizeT c=0; c upper) \ { \ if( strict) \ throw GDLException("Array used to subscript array " \ "contains out of range (>) subscript."); \ (*res)[i++]= upperVal; \ break; \ } \ else \ (*res)[i]= (*this)[ (*src)[i]]; \ for(; i < nElem; ++i) \ if( (*src)[i] > upper) \ (*res)[i] = upperVal; \ else \ (*res)[i]= (*this)[ (*src)[i]]; \ GDLInterpreter::IncRef( res); \ return guard.release(); #define NEWIX_SIGNEDINT \ SizeT i = 0; \ for(; i < nElem; ++i) \ if( (*src)[i] < 0) \ { \ if( strict) \ throw GDLException("Array used to subscript array " \ "contains out of range (<0) subscript."); \ (*res)[i++]= zeroVal; \ break; \ } \ else if( (*src)[i] > upper) \ { \ if( strict) \ throw GDLException("Array used to subscript array " \ "contains out of range (>) subscript."); \ (*res)[i++]= upperVal; \ break; \ } \ else \ (*res)[ i] = (*this)[ (*src)[ i]]; \ for(; i < nElem; ++i) \ if( (*src)[i] < 0) \ (*res)[i]= zeroVal; \ else if( (*src)[i] > upper) \ (*res)[i]= upperVal; \ else \ (*res)[ i] = (*this)[ (*src)[ i]]; \ GDLInterpreter::IncRef( res); \ return guard.release(); template<> Data_* Data_::NewIx( BaseGDL* ix, bool strict) { assert( ix->Type() != GDL_UNDEF); // no type checking needed here: GetAsIndex() will fail with grace // int typeCheck = DTypeOrder[ dType]; // if( typeCheck >= 100) // throw GDLException("Type "+ix->TypeStr()+" not allowed as subscript."); SizeT nElem = ix->N_Elements(); Data_* res = New( ix->Dim(), BaseGDL::NOZERO); Guard guard( res); SizeT upper = dd.size() - 1; Ty upperVal = (*this)[ upper]; if( strict) { for(SizeT i = 0 ; i < nElem; ++i) { SizeT actIx = ix->GetAsIndexStrict( i); if( actIx > upper) throw GDLException("Array used to subscript array " "contains out of range (>) subscript (at index: "+i2s(i)+")."); (*res)[i]= (*this)[ actIx]; } } else // not strict { for(SizeT i = 0 ; i < nElem; ++i) { SizeT actIx = ix->GetAsIndex( i); if( actIx >= upper) (*res)[i] = upperVal; else (*res)[i]= (*this)[ actIx]; } } GDLInterpreter::IncRef( res); return guard.release(); } template<> Data_* Data_::NewIx( BaseGDL* ix, bool strict) { SizeT nElem = ix->N_Elements(); Data_* res = New( ix->Dim(), BaseGDL::NOZERO); Guard guard( res); SizeT upper = dd.size() - 1; Ty upperVal = (*this)[ upper]; if( strict) { for(SizeT i = 0 ; i < nElem; ++i) { SizeT actIx = ix->GetAsIndexStrict( i); if( actIx > upper) throw GDLException("Array used to subscript array " "contains out of range (>) subscript (at index: "+i2s(i)+")."); (*res)[i]= (*this)[ actIx]; } } else // not strict { for(SizeT i = 0 ; i < nElem; ++i) { SizeT actIx = ix->GetAsIndex( i); if( actIx >= upper) (*res)[i] = upperVal; else (*res)[i]= (*this)[ actIx]; } } GDLInterpreter::IncRefObj( res); return guard.release(); } #endif gdl-0.9.4/src/gdlarray.hpp0000664000175000017500000001653612220547451014044 0ustar marcmarc/*************************************************************************** gdlarray.hpp - basic typedefs ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifndef GDLARRAY_HPP_ #define GDLARRAY_HPP_ // #define GDLARRAY_CACHE #undef GDLARRAY_CACHE //#define GDLARRAY_DEBUG #undef GDLARRAY_DEBUG // for complex (of POD) const bool TreatPODComplexAsPOD = true; template class GDLArray { private: enum GDLArrayConstants { smallArraySize = 27, maxCache = 1000 * 1000 // ComplexDbl is 16 bytes }; typedef T Ty; #ifdef USE_EIGEN EIGEN_ALIGN16 char scalarBuf[ smallArraySize * sizeof(Ty)]; #else char scalarBuf[ smallArraySize * sizeof(Ty)]; #endif Ty* InitScalar() { assert( sz <= smallArraySize); if( IsPOD) { return reinterpret_cast(scalarBuf); } else { Ty* b = reinterpret_cast(scalarBuf); for( int i = 0; i( s); #else return new Ty[ s]; #endif } public: GDLArray() throw() : buf( NULL), sz( 0) {} #ifndef GDLARRAY_CACHE ~GDLArray() throw() { if( IsPOD) { #ifdef USE_EIGEN if( buf != reinterpret_cast(scalarBuf)) Eigen::internal::aligned_delete( buf, sz); #else if( buf != reinterpret_cast(scalarBuf)) delete[] buf; // buf == NULL also possible #endif // no cleanup of "buf" here } else { #ifdef USE_EIGEN if( buf != reinterpret_cast(scalarBuf)) Eigen::internal::aligned_delete( buf, sz); else for( int i = 0; i(scalarBuf)) delete[] buf; // buf == NULL also possible else for( int i = 0; i smallArraySize) ? New(cp.size()) /*New T[ cp.size()]*/ : InitScalar(); } catch (std::bad_alloc&) { ThrowGDLException("Array requires more memory than available"); } std::memcpy(buf,cp.buf,sz*sizeof(T)); } else { try { buf = (cp.size() > smallArraySize) ? New(cp.size()) /*new Ty[ cp.size()]*/ : InitScalar(); } catch (std::bad_alloc&) { ThrowGDLException("Array requires more memory than available"); } for( SizeT i=0; i smallArraySize) ? New(s) /*T[ s]*/ : InitScalar(); } catch (std::bad_alloc&) { ThrowGDLException("Array requires more memory than available"); } } GDLArray( T val, SizeT s) : sz( s) { try { buf = (s > smallArraySize) ? New(s) /*T[ s]*/ : InitScalar(); } catch (std::bad_alloc&) { ThrowGDLException("Array requires more memory than available"); } for( SizeT i=0; i smallArraySize ) ? New(s) /*T[ s]*/: InitScalar(); } catch ( std::bad_alloc& ) { ThrowGDLException ( "Array requires more memory than available" ); } std::memcpy(buf,arr,sz*sizeof(T)); } else { try { buf = (s > smallArraySize) ? New(s) /*new Ty[ s]*/: InitScalar(); } catch (std::bad_alloc&) { ThrowGDLException("Array requires more memory than available"); } for( SizeT i=0; i(scalarBuf); buf[0] = s; } else { Ty* b = reinterpret_cast(scalarBuf); new (&(b[ 0])) Ty( s); buf = b; } } T& operator[]( SizeT ix) throw() { // if( ix >= sz) // debug assert( ix < sz); return buf[ ix]; } const T& operator[]( SizeT ix) const throw() { // if( ix >= sz) // debug assert( ix < sz); return buf[ ix]; } // private: // disable // only used (indirect) by DStructGDL::DStructGDL(const DStructGDL& d_) void InitFrom( const GDLArray& right ) { assert( &right != this); assert ( sz == right.size() ); if( IsPOD) { std::memcpy(buf,right.buf,sz*sizeof(Ty)); } else { for ( SizeT i=0; i smallArraySize ) { try { buf = New(sz) /*new T[ newSz]*/; } catch ( std::bad_alloc& ) { ThrowGDLException ( "Array requires more memory than available" ); } } else { // default constructed instances have buf == NULL and size == 0 // make sure buf is set corectly if such instances are resized buf = InitScalar(); } } // protected: // void assert(ix 1) e->Throw( "Incorrect number of arguments."); return false; } // }}} void old_body( EnvT* e, GDLGStream* actStream) // {{{ { } // }}} private: void call_plplot(EnvT* e, GDLGStream* actStream) // {{{ { // if (e->KeywordPresent(0)) if (e->KeywordPresent(e->KeywordIx("CHANNEL"))) Message(e->GetProName() + " : CHANNEL keyword not yet supported."); static int bColorIx = e->KeywordIx("COLOR"); // cout << "bColorIx"<< bColorIx << endl; DLong MaxColorIdx; DLong bColor=-1; MaxColorIdx=256*256*256-1; // cout << MaxColorIdx << endl; if (nParam() == 0) { if (e->KeywordPresent(e->KeywordIx("COLOR"))) { e->AssureLongScalarKWIfPresent(bColorIx, bColor); if (bColor > MaxColorIdx) bColor = MaxColorIdx; if (bColor < 0) bColor = 0; //if (bColor >= 0 & bColor <= MaxColorIdx) //actStream->Background( bColor, 1); } else // we have to read back !p.background value { static DStructGDL* pStruct = SysVar::P(); bColor =(*static_cast (pStruct->GetTag(pStruct->Desc()->TagIndex("BACKGROUND"),0)))[0]; } } else { e->AssureLongScalarPar(0, bColor); if (bColor > MaxColorIdx) bColor = MaxColorIdx; if (bColor < 0) bColor = 0; } actStream->Background( bColor); actStream->Clear(); } private: virtual void post_call(EnvT*, GDLGStream*) // {{{ { } // }}} }; void erase(EnvT* e) { erase_call erase; erase.call(e, 0); } } // namespace gdl-0.9.4/src/libinit_cl.cpp0000664000175000017500000001761212217457527014350 0ustar marcmarc/*************************************************************************** libinit_cl.cpp - initialization of GDL library routines ------------------- begin : March 18 2004 copyright : (C) 2004 by Christopher Lee, : Original by Marc Schellens(2002(C)) email : chrislee0@hotmail.com ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifdef HAVE_CONFIG_H #include #else // default: assume we have netCDF #define USE_NETCDF 1 #define USE_MAGICK 1 #endif #include "includefirst.hpp" #include #include #include "envt.hpp" #include "dpro.hpp" #include "gdljournal.hpp" #include "basic_fun_cl.hpp" #ifdef USE_MAGICK #include "magick_cl.hpp" #endif #ifdef USE_NETCDF #include "ncdf_cl.hpp" #endif using namespace std; void LibInit_cl() { const char KLISTEND[] = ""; new DLibPro(lib::journal,string("JOURNAL"),1); const string systimeKey[]={"JULIAN","SECONDS","UTC",KLISTEND}; new DLibFunRetNew(lib::systime,string("SYSTIME"),2,systimeKey); const string legendreKey[]={"DOUBLE",KLISTEND}; new DLibFunRetNew(lib::legendre,string("LEGENDRE"),3,legendreKey); new DLibFunRetNew(lib::gsl_exp, string("GSL_EXP"),1); new DLibFunRetNew(lib::ncdf_exists,string("NCDF_EXISTS")); new DLibFunRetNew(lib::magick_exists,string("MAGICK_EXISTS")); #ifdef USE_NETCDF //open NetCDF const string ncdf_openKey[]={"WRITE","NOWRITE",KLISTEND}; new DLibFunRetNew(lib::ncdf_open,string("NCDF_OPEN"),1,ncdf_openKey); //create NetCDF const string ncdf_createKey[]={"CLOBBER","NOCLOBBER",KLISTEND}; new DLibFunRetNew(lib::ncdf_create,string("NCDF_CREATE"),1,ncdf_createKey); //close NetCDF new DLibPro(lib::ncdf_close,string("NCDF_CLOSE"),1); //reading NetCDF //Inquire new DLibFunRetNew(lib::ncdf_inquire,string("NCDF_INQUIRE"),1); //Variable Inquire new DLibFunRetNew(lib::ncdf_varinq,string("NCDF_VARINQ"),2); //Varget 1 const string ncdf_varget1Key[]={"OFFSET",KLISTEND}; new DLibPro(lib::ncdf_varget1,string("NCDF_VARGET1"),3,ncdf_varget1Key); //Varget const string ncdf_vargetKey[]={"COUNT","OFFSET", "STRIDE",KLISTEND}; new DLibPro(lib::ncdf_varget,string("NCDF_VARGET"),3,ncdf_vargetKey); //Variable ID new DLibFunRetNew(lib::ncdf_varid,string("NCDF_VARID"),2); //Dimension Inquire new DLibPro(lib::ncdf_diminq,string("NCDF_DIMINQ"),4); //Dimension ID new DLibFunRetNew(lib::ncdf_dimid,string("NCDF_DIMID"),2); //Get attribute name const string ncdf_attnameKey[]={"GLOBAL",KLISTEND}; new DLibFunRetNew(lib::ncdf_attname,string("NCDF_ATTNAME"),3,ncdf_attnameKey); //Get attribute const string ncdf_attgetKey[]={"GLOBAL",KLISTEND}; new DLibPro(lib::ncdf_attget,string("NCDF_ATTGET"),4,ncdf_attgetKey); //Inquire attribute (datatype, size?) const string ncdf_attinqKey[]={"GLOBAL",KLISTEND}; new DLibFunRetNew(lib::ncdf_attinq,string("NCDF_ATTINQ"),3,ncdf_attinqKey); //Control functions, define mode etc. const string ncdf_controlKey[]={"ABORT","ENDEF","FILL","NOFILL", "VERBOSE", "NOVERBOSE","OLDFILL","REDEF","SYNC", KLISTEND}; new DLibPro(lib::ncdf_control,string("NCDF_CONTROL"),1,ncdf_controlKey); //writing NetCDF //Put attribute into file const string ncdf_attputKey[]={"GLOBAL","LENGTH","BYTE","CHAR","DOUBLE","FLOAT","LONG","SHORT",KLISTEND}; new DLibPro(lib::ncdf_attput, string("NCDF_ATTPUT"), 4,ncdf_attputKey); //copy attribute between files const string ncdf_attcopyKey[]={"IN_GLOBAL","OUT_GLOBAL",KLISTEND}; new DLibFunRetNew(lib::ncdf_attcopy, string("NCDF_ATTCOPY"), 5,ncdf_attcopyKey); //delete attribute const string ncdf_attdelKey[]={"GLOBAL",KLISTEND}; new DLibPro(lib::ncdf_attdel, string("NCDF_ATTDEL"), 3,ncdf_attdelKey); //rename attribute const string ncdf_attrenameKey[]={"GLOBAL",KLISTEND}; new DLibPro(lib::ncdf_attrename, string("NCDF_ATTRENAME"), 4, ncdf_attrenameKey); //define dimension const string ncdf_dimdefKey[]={"UNLIMITED",KLISTEND}; new DLibFunRetNew(lib::ncdf_dimdef, string("NCDF_DIMDEF"), 3,ncdf_dimdefKey); //rename dimension new DLibPro(lib::ncdf_dimrename, string("NCDF_DIMRENAME"), 3); //define variable const string ncdf_vardefKey[]={"BYTE","CHAR","DOUBLE","FLOAT","LONG","SHORT", KLISTEND}; new DLibFunRetNew(lib::ncdf_vardef, string("NCDF_VARDEF"), 3,ncdf_vardefKey); //rename variable new DLibPro(lib::ncdf_varrename, string("NCDF_VARRENAME"), 3); //put variable const string ncdf_varputKey[]={"COUNT","OFFSET", "STRIDE",KLISTEND}; new DLibPro(lib::ncdf_varput, string("NCDF_VARPUT"), 3,ncdf_varputKey); //epoch time conversion const string cdf_epochKey[]={"BREAKDOWN_EPOCH","COMPUTE_EPOCH",KLISTEND}; new DLibPro(lib::cdf_epoch, string("CDF_EPOCH"),8,cdf_epochKey); #endif #ifdef USE_MAGICK new DLibFunRetNew(lib::magick_open,string("MAGICK_OPEN"),1); new DLibFunRetNew(lib::magick_create,string("MAGICK_CREATE"),3); new DLibPro(lib::magick_close,string("MAGICK_CLOSE"),1); const string magick_readKey[]={"RGB","SUB_RECT","MAP",KLISTEND}; new DLibFunRetNew(lib::magick_read,string("MAGICK_READ"),1,magick_readKey); new DLibFunRetNew(lib::magick_readindexes,string("MAGICK_READINDEXES"),1); new DLibPro(lib::magick_readcolormapRGB,string("MAGICK_READCOLORMAPRGB"),4); const string magick_writeKey[]={"RGB",KLISTEND}; new DLibPro(lib::magick_write,string("MAGICK_WRITE"),2,magick_writeKey); new DLibPro(lib::magick_writefile,string("MAGICK_WRITEFILE"),3); //attributes new DLibFunRetNew(lib::magick_IndexedColor,string("MAGICK_INDEXEDCOLOR"),1); new DLibFunRetNew(lib::magick_rows,string("MAGICK_ROWS"),1); new DLibFunRetNew(lib::magick_columns,string("MAGICK_COLUMNS"),1); new DLibFunRetNew(lib::magick_colormapsize,string("MAGICK_COLORMAPSIZE"),2); new DLibFunRetNew(lib::magick_magick,string("MAGICK_MAGICK"),2); new DLibPro(lib::magick_quality,string("MAGICK_QUALITY"),2); const string magick_quantizeKey[]={"TRUECOLOR","YUV","GRAYSCALE","DITHER",KLISTEND}; new DLibPro(lib::magick_quantize,string("MAGICK_QUANTIZE"),2,magick_quantizeKey); new DLibPro(lib::magick_writeIndexes, string("MAGICK_WRITEINDEXES"),2); new DLibPro(lib::magick_writeColorTable, string("MAGICK_WRITECOLORTABLE"),4); //manipulation new DLibPro(lib::magick_flip,string("MAGICK_FLIP"),1); const string magick_matteKey[]={"TRUE","FALSE",KLISTEND}; new DLibPro(lib::magick_matte,string("MAGICK_MATTE"),1); const string magick_interlaceKey[]={"NOINTERLACE","LINEINTERLACE","PLANEINTERLACE",KLISTEND}; new DLibPro(lib::magick_interlace,string("MAGICK_INTERLACE"),1,magick_interlaceKey); const string magick_addnoiseKey[]={"UNIFORMNOISE","GAUSSIANNOISE","MULTIPLICATIVEGAUSSIANNOISE","IMPULSENOISE","LAPLACIANNOISE","POISSONNOISE","NOISE",KLISTEND}; new DLibPro(lib::magick_addNoise,string("MAGICK_ADDNOISE"),1,magick_addnoiseKey); //hmm new DLibPro(lib::magick_display,string("MAGICK_DISPLAY"),1); // SA: support fot query/ping routines const string magick_pingKey[] = {"INFO", "CHANNELS", "DIMENSIONS", "HAS_PALETTE", "IMAGE_INDEX", "NUM_IMAGES", "PIXEL_TYPE",/* "SUPPORTED_READ", "SUPPORTED_WRITE", */"TYPE",KLISTEND}; new DLibFunRetNew(lib::magick_ping, string("MAGICK_PING"), 2, magick_pingKey); // see bug no. 3376577 Magick::InitializeMagick(NULL); #endif } gdl-0.9.4/src/datatypes.hpp0000664000175000017500000004257312174226377014246 0ustar marcmarc/*************************************************************************** datatypes.hpp - defines all data types of GDL except DStructGDL ------------------- begin : Tue Feb 13 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifndef DATATYPES_HPP_ #define DATATYPES_HPP_ #include #include //#include //#include #include //#include // #include // #include #include "typedefs.hpp" #include "basegdl.hpp" #include "typetraits.hpp" #if defined(__GNUC__) && !defined(__INTEL_COMPILER) // by default intel C++ defines __GNUC__ #pragma interface #endif // for each group we need one definition // usage: GDL_DEFINE_INTEGER_FUNCTION(retType) fName( arg list) { definition} #define GDL_DEFINE_INTEGER_FUNCTION( retType ) templatetemplate< typename U> typename U::template IfInteger< retType >::type Data_:: #define GDL_DEFINE_FLOAT_FUNCTION( retType ) templatetemplate< typename U> typename U::template IfFloat< retType >::type Data_:: #define GDL_DEFINE_COMPLEX_FUNCTION( retType ) templatetemplate< typename U> typename U::template IfComplex< retType >::type Data_:: #define GDL_DEFINE_OTHER_FUNCTION( retType ) templatetemplate< typename U> typename U::template IfOther< retType >::type Data_:: const size_t multiAlloc = 256; template class Data_: public Sp { // save some typing. Declares function "fName" for all four groups (with return type "retType") #define GDL_DECLARE_FUNCTION( retType, fName, ... ) \ template< typename U = Sp > typename U::template IfInteger< retType >::type fName( __VA_ARGS__); \ template< typename U = Sp > typename U::template IfFloat< retType >::type fName( __VA_ARGS__); \ template< typename U = Sp > typename U::template IfComplex< retType >::type fName( __VA_ARGS__); \ template< typename U = Sp > typename U::template IfOther< retType >::type fName( __VA_ARGS__) public: typedef typename Sp::Ty Ty; typedef Sp Traits; #ifdef _MSC_VER public: // MSC cannot handle friend template specialization properly #else private: #endif typedef typename Sp::DataT DataT; #ifdef USE_EIGEN EIGEN_ALIGN16 DataT dd; // the data #else DataT dd; // the data #endif public: // #define TESTTG // TEST TEMPLATE GROUPING #ifdef TESTTG void TestTemplateGrouping(); // #define GDL_TEMPLATE_Integer( retType ) template< typename U = Sp > typename U::template IfInteger< retType >::type // #define GDL_TEMPLATE_IntegerDef( retType ) templatetemplate< typename U> typename U::template IfInteger< retType >::type Data_:: GDL_DECLARE_FUNCTION(bool,Test2); // template< typename U = Sp > //typename U::template IfInteger::type // GDL_TEMPLATE_Integer(bool) Test2(); // template< typename U = Sp > // typename U::template IfFloat::type // Test2(); // template< typename U = Sp > // typename U::template IfComplex::type // Test2(); // template< typename U = Sp > // typename U::template IfOther::type // Test2(); #endif public: // memory management optimization static FreeListT freeList; // operator new and delete static void* operator new( size_t bytes); static void operator delete( void *ptr); //structors ~Data_(); // default Data_(); // scalar Data_(const Ty& d_); // new array, no zero or indgen Data_(const dimension& dim_, BaseGDL::InitType iT); // new array, zero fields Data_(const dimension& dim_); // new array from Ty[], one dimensional Data_( const Ty* p, SizeT nEl); // new array from DataT Data_(const dimension& dim_, const DataT& dd_): Sp( dim_), dd( dd_) {} // c-i Data_(const Data_& d_);//: Sp(d_.dim), dd(d_.dd) {} // operators // assignment. Data_& operator=(const BaseGDL& right); // for structs void InitFrom(const BaseGDL& right); // one dim array access (unchecked) inline Ty& operator[] (const SizeT d1) { return dd[d1];} inline const Ty& operator[] (const SizeT d1) const { return dd[d1];} // Ty& operator[] (const SizeT d1) { return dd[d1];} template friend std::istream& operator>>(std::istream& i, Data_& data_); // valarrays cannot be resized (without loosing data) // inline DataT& Resize( SizeT n); // // note that min and max these are not defined in BaseGDL // Ty min() const;// { return dd.min();} // Ty max() const;// { return dd.max();} bool Greater(SizeT i1, SizeT i2) const; // comp 2 elements bool Equal(SizeT i1, SizeT i2) const; // comp 2 elements BaseGDL* CShift( DLong d) const; BaseGDL* CShift( DLong d[MAXRANK]) const; BaseGDL* Transpose( DUInt* perm); BaseGDL* Rotate( DLong dir); void Reverse( DLong dim); BaseGDL* DupReverse( DLong dim); // for use by MIN and MAX functions void MinMax( DLong* minE, DLong* maxE, BaseGDL** minVal, BaseGDL** maxVal, bool omitNaN, SizeT start = 0, SizeT stop = 0, SizeT step = 1, DLong valIx = -1); bool EqType( const BaseGDL* r) const; void* DataAddr();// SizeT elem=0); Ty Sum() const; SizeT N_Elements() const; SizeT Size() const; SizeT NBytes() const; SizeT ToTransfer() const; // IO transfer count SizeT Sizeof() const; int HashCompare( BaseGDL* p2) const; void Clear(); void Construct(); // construction (for DStructGDL) void ConstructTo0(); // construction (for DStructGDL) void Destruct(); // destruction (for DStructGDL) BaseGDL* SetBuffer( const void* b); void SetBufferSize( SizeT s); BaseGDL* AssocVar( int, SizeT); std::ostream& ToStream(std::ostream& o, SizeT width = 0, SizeT* actPosPtr = NULL); std::istream& FromStream(std::istream& i); // used by the interpreter int Scalar2Index( SizeT& st) const; int Scalar2RangeT( RangeT& st) const; RangeT LoopIndex() const; DDouble HashValue() const; // used for indexing of arrays SizeT GetAsIndex( SizeT i) const; SizeT GetAsIndexStrict( SizeT i) const; // make a duplicate on the heap Data_* Dup() const; // // make a duplicate at loc // Data_* Dup( void* loc) const { return ::new ( loc) Data_(*this);} bool OutOfRangeOfInt() const; bool Scalar() const { return (dd.size() == 1);} bool StrictScalar() const { return (this->Rank() == 0);} bool Scalar(Ty& s) const { if( dd.size() != 1) return false; s=dd[0]; return true; } bool StrictScalar(Ty& s) const { if( this->Rank() != 0) return false; s=dd[0]; return true; } Data_* New( const dimension& dim_, BaseGDL::InitType noZero=BaseGDL::ZERO) const; Data_* NewResult() const; // convert *this to other 'destTy' BaseGDL* Convert2( DType destTy, BaseGDL::Convert2Mode=BaseGDL::CONVERT); // not all compilers can handle template friend member functions #ifndef _MSC_VER #if defined( TEMPLATE_FRIEND_OK_) || (__GNUC__ >= 4) // make all other Convert2 functions friends template friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); #else // this explicit version does not work with GCC 4.0 friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); friend BaseGDL* Data_::Convert2( DType destTy, BaseGDL::Convert2Mode); #endif #endif bool True(); bool False(); bool LogTrue(); bool LogTrue( SizeT ix); DLong* Where( bool comp, SizeT& count); Data_* LogNeg(); int Sgn(); // returns -1,0,1 bool Equal( BaseGDL*) const; bool EqualNoDelete( const BaseGDL*) const; bool ArrayEqual( BaseGDL*); void ForCheck( BaseGDL**, BaseGDL** =NULL); bool ForCondUp( BaseGDL*); bool ForCondDown( BaseGDL*); bool ForAddCondUp( BaseGDL* loopInfo); // bool ForAddCondUp( ForLoopInfoT& loopInfo); // bool ForCondUpDown( BaseGDL*); void ForAdd(); void ForAdd( BaseGDL* add); BaseGDL* Abs() const; BaseGDL* Convol( BaseGDL* kIn, BaseGDL* scaleIn, BaseGDL* bias, bool center, bool normalize, int edgeMode); BaseGDL* Rebin( const dimension& newDim, bool sample); void Assign( BaseGDL* src, SizeT nEl); template< typename To> typename Data_::Ty GetAs( SizeT i); // { // return dd[ i]; // } BaseGDL* Log(); BaseGDL* LogThis(); BaseGDL* Log10(); BaseGDL* Log10This(); // operators BaseGDL* UMinus(); // UMinus for SpDString returns float Data_* NotOp(); // GDL_DECLARE_FUNCTION( Data_*, AndOp, BaseGDL* r); Data_* AndOp( BaseGDL* r); Data_* AndOpInv( BaseGDL* r); Data_* OrOp( BaseGDL* r); Data_* OrOpInv( BaseGDL* r); Data_* XorOp( BaseGDL* r); BaseGDL* Add( BaseGDL* r); BaseGDL* AddInv( BaseGDL* r); BaseGDL* AddS( BaseGDL* r); BaseGDL* AddInvS( BaseGDL* r); BaseGDL* AddNew( BaseGDL* r); // implemented BaseGDL* AddInvNew( BaseGDL* r); // implemented BaseGDL* AddSNew( BaseGDL* r); // implemented BaseGDL* AddInvSNew( BaseGDL* r); // implemented // Data_* AddNew( BaseGDL* r); // Data_* AddInvNew( BaseGDL* r); BaseGDL* Sub( BaseGDL* r); BaseGDL* SubInv( BaseGDL* r); Data_* GtMark( BaseGDL* r); Data_* LtMark( BaseGDL* r); Data_* Mult( BaseGDL* r); // Data_* MultNew( BaseGDL* r); Data_* Div( BaseGDL* r); Data_* DivInv( BaseGDL* r); Data_* Mod( BaseGDL* r); Data_* ModInv( BaseGDL* r); Data_* Pow( BaseGDL* r); Data_* PowInv( BaseGDL* r); Data_* PowInt( BaseGDL* r); // Data_* PowIntNew( BaseGDL* r); Data_* MatrixOp( BaseGDL* r, bool atranspose, bool btranspose); // operators with scalar Data_* AndOpS( BaseGDL* r); Data_* AndOpInvS( BaseGDL* r); Data_* OrOpS( BaseGDL* r); Data_* OrOpInvS( BaseGDL* r); Data_* XorOpS( BaseGDL* r); // Data_* AddSNew( BaseGDL* r); // Data_* AddInvSNew( BaseGDL* r); Data_* SubS( BaseGDL* r); Data_* SubInvS( BaseGDL* r); Data_* GtMarkS( BaseGDL* r); Data_* LtMarkS( BaseGDL* r); Data_* MultS( BaseGDL* r); // Data_* MultSNew( BaseGDL* r); Data_* DivS( BaseGDL* r); Data_* DivInvS( BaseGDL* r); Data_* ModS( BaseGDL* r); Data_* ModInvS( BaseGDL* r); Data_* PowS( BaseGDL* r); Data_* PowInvS( BaseGDL* r); // operators returning a new value Data_* AndOpNew( BaseGDL* r); Data_* AndOpInvNew( BaseGDL* r); Data_* OrOpNew( BaseGDL* r); Data_* OrOpInvNew( BaseGDL* r); Data_* XorOpNew( BaseGDL* r); // Data_* EqOpNew( BaseGDL* r); // Data_* NeOpNew( BaseGDL* r); // Data_* LeOpNew( BaseGDL* r); // Data_* GeOpNew( BaseGDL* r); // Data_* LtOpNew( BaseGDL* r); // Data_* GtOpNew( BaseGDL* r); BaseGDL* SubNew( BaseGDL* r); BaseGDL* SubInvNew( BaseGDL* r); Data_* LtMarkNew( BaseGDL* r); Data_* GtMarkNew( BaseGDL* r); Data_* MultNew( BaseGDL* r); // implemented Data_* DivNew( BaseGDL* r); Data_* DivInvNew( BaseGDL* r); Data_* ModNew( BaseGDL* r); Data_* ModInvNew( BaseGDL* r); Data_* PowNew( BaseGDL* r); Data_* PowInvNew( BaseGDL* r); Data_* PowIntNew( BaseGDL* r); // implemented // operators with scalar returning a new value Data_* AndOpSNew( BaseGDL* r); Data_* AndOpInvSNew( BaseGDL* r); Data_* OrOpSNew( BaseGDL* r); Data_* OrOpInvSNew( BaseGDL* r); Data_* XorOpSNew( BaseGDL* r); BaseGDL* SubSNew( BaseGDL* r); BaseGDL* SubInvSNew( BaseGDL* r); Data_* LtMarkSNew( BaseGDL* r); Data_* GtMarkSNew( BaseGDL* r); Data_* MultSNew( BaseGDL* r); // implemented Data_* DivSNew( BaseGDL* r); Data_* DivInvSNew( BaseGDL* r); Data_* ModSNew( BaseGDL* r); Data_* ModInvSNew( BaseGDL* r); Data_* PowSNew( BaseGDL* r); Data_* PowInvSNew( BaseGDL* r); BaseGDL* EqOp( BaseGDL* r); BaseGDL* NeOp( BaseGDL* r); BaseGDL* GtOp( BaseGDL* r); BaseGDL* GeOp( BaseGDL* r); BaseGDL* LtOp( BaseGDL* r); BaseGDL* LeOp( BaseGDL* r); // used by interpreter, calls CatInsert Data_* CatArray( ExprListT& exprList, const SizeT catRank, const SizeT rank); // assigns srcIn to this at ixList, if ixList is NULL does linear copy // assumes: ixList has this already set as variable void AssignAt( BaseGDL* srcIn, ArrayIndexListT* ixList, SizeT offset); void AssignAt( BaseGDL* srcIn, ArrayIndexListT* ixList); void AssignAt( BaseGDL* srcIn); void AssignAtIx( RangeT ix, BaseGDL* srcIn); // decrement (--) and increment (++) operators void DecAt( ArrayIndexListT* ixList); void IncAt( ArrayIndexListT* ixList); void Dec(); void Inc(); // used by AccessDescT for resolving, no checking is done // inserts srcIn[ ixList] at offset void InsertAt( SizeT offset, BaseGDL* srcIn, ArrayIndexListT* ixList); // returns (*this)[ ixList] Data_* Index( ArrayIndexListT* ixList); // return a new type of itself BaseGDL* NewIx( SizeT ix); Data_* NewIx( BaseGDL* ix, bool strict); Data_* NewIx( AllIxBaseT* ix, const dimension* dIn); Data_* NewIxFrom( SizeT s); Data_* NewIxFrom( SizeT s, SizeT e); Data_* NewIxFromStride( SizeT s, SizeT stride); Data_* NewIxFromStride( SizeT s, SizeT e, SizeT stride); // binary input/output std::ostream& Write( std::ostream& os, bool swapEndian, bool compress, XDR *xdrs); std::istream& Read( std::istream& os, bool swapEndian, bool compress, XDR *xdrs); SizeT OFmtA( std::ostream* os, SizeT offset, SizeT num, int width); SizeT OFmtF( std::ostream* os, SizeT offs, SizeT num, int width, int prec, char fill, BaseGDL::IOMode oM = BaseGDL::FIXED); SizeT OFmtI( std::ostream* os, SizeT offs, SizeT num, int width, int minN, char fill, BaseGDL::IOMode oM = BaseGDL::DEC); SizeT OFmtCal( std::ostream* os, SizeT offs, SizeT num, int width, int minN, char fill, BaseGDL::Cal_IOMode oM = BaseGDL::DEFAULT); // formatting input functions SizeT IFmtA( std::istream* is, SizeT offset, SizeT num, int width); SizeT IFmtF( std::istream* is, SizeT offs, SizeT num, int width); SizeT IFmtI( std::istream* is, SizeT offs, SizeT num, int width, BaseGDL::IOMode oM = BaseGDL::DEC); #ifdef USE_PYTHON public: PyObject* ToPython(); private: PyObject* ToPythonScalar(); #endif private: // inserts srcIn at ixDim, used by AssignAt(...) // respects the exact structure void InsAt( Data_* srcIn, ArrayIndexListT* ixList, SizeT offset = 0); // used for concatenation, called from CatArray // assumes that everything is checked (see CatInfo) void CatInsert( const Data_* srcArr, const SizeT atDim, SizeT& at); // only to be used here #undef GDL_DECLARE_FUNCTION }; // template<> Data_::Data_(const Ty& d_); // template<> Data_::Data_(const Ty& d_); #include "specializations.hpp" typedef Data_ DByteGDL; typedef Data_ DIntGDL; typedef Data_ DUIntGDL; typedef Data_ DLongGDL; typedef Data_ DULongGDL; typedef Data_ DLong64GDL; typedef Data_ DULong64GDL; typedef Data_ DFloatGDL; typedef Data_ DDoubleGDL; typedef Data_ DStringGDL; typedef Data_ DPtrGDL; typedef Data_ DObjGDL; typedef Data_ DComplexGDL; typedef Data_ DComplexDblGDL; // DStructGDL defined separately // on OS X isfinite is not defined #if defined(__APPLE__) && defined(OLD_DARWIN) && !defined(isfinite) #ifdef __cplusplus extern "C" { #endif #define isfinite( x ) ( ( sizeof ( x ) == sizeof(double) ) ? \ __isfinited ( x ) : \ ( sizeof ( x ) == sizeof( float) ) ? \ __isfinitef ( x ) : \ __isfinite ( x ) ) #ifdef __cplusplus } #endif #endif // isfinite & isinf for Solaris #if defined(__sun__) # include # define isfinite finite # ifndef isinf # define isinf(x) (!finite(x) && x==x) # endif #endif #endif gdl-0.9.4/src/sigfpehandler.hpp0000664000175000017500000000244412026101347015035 0ustar marcmarc/*************************************************************************** sigfpehandler.hpp - handle floating exceptions ------------------- begin : Wed Apr 18 16:58:14 JST 2001 copyright : (C) 2002-2004 by Marc Schellens email : m_schellens@users.sourceforge.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifndef SIGFPEHANDLER_HPP_ #define SIGFPEHANDLER_HPP_ #include #ifdef _MSC_VER extern jmp_buf sigFPEJmpBuf; #define sigsetjmp(x,s) setjmp(x) #else extern sigjmp_buf sigFPEJmpBuf; #endif void SigFPEHandler( int signo); #endif gdl-0.9.4/src/arrayindexlistt.hpp0000664000175000017500000015331712216103533015456 0ustar marcmarc/*************************************************************************** arrayindexlistt.hpp - array access descriptor ------------------- begin : July 22 2005 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifndef ARRAYINDEXLISTT_HPP_ #define ARRAYINDEXLISTT_HPP_ #include "arrayindex.hpp" class ArrayIndexListT { protected: SizeT nParam; // number of (BaseGDL*) parameters public: SizeT NParam() { return nParam;} virtual ~ArrayIndexListT(); // constructor ArrayIndexListT() {} ArrayIndexListT( const ArrayIndexListT& cp): nParam( cp.nParam) {} virtual void Clear() {} virtual ArrayIndexListT* Clone() { assert( 0); return NULL;} virtual void InitAsOverloadIndex( IxExprListT& ixIn, /*IxExprListT* cleanupIx,*/ IxExprListT& ixOut) { throw GDLException( -1, NULL,"Internal error: ArrayIndexListT::InitAsOverladIndex( IxExprListT& ixInOut) called.",true,false); } virtual void Init( IxExprListT& ix)//, IxExprListT* cleanupIx) { assert( 0); throw GDLException( -1, NULL,"Internal error: ArrayIndexListT::Init( IxExprListT& ix, IxExprListT* cleanupIx) called.",true,false); } virtual IxExprListT* GetCleanupIx() { assert( 0); throw GDLException( -1, NULL,"Internal error: ArrayIndexListT::GetCleanupIx() called.",true,false); } virtual void Init() {} virtual bool ToAssocIndex( SizeT& lastIx) { assert( 0); throw GDLException( -1, NULL,"Internal error: ArrayIndexListT::ToAssocIndex( SizeT& lastIx) called.",true,false); } // virtual bool ToAssocIndex( RangeT& lastIx) = 0; // set the root variable which is indexed by this ArrayIndexListT virtual void SetVariable( BaseGDL* var) {} // structure of indexed expression virtual const dimension GetDim() = 0; virtual SizeT N_Elements() = 0; // returns 1-dim index for all elements virtual AllIxBaseT* BuildIx(); // returns one dim long ix in case of one element array index // used by AssignAt functions virtual SizeT LongIx() const = 0; virtual void AssignAt( BaseGDL* var, BaseGDL* right) {} // optimized for one dimensional access // this is called from the interpreter and ARRAYEXPRNode::Eval() virtual BaseGDL* Index( BaseGDL* var, IxExprListT& ix) = 0; // returns multi-dim index for 1st element // used by InsAt functions virtual const dimension GetDimIx0( SizeT& destStart) = 0; virtual SizeT NDim() = 0; }; #include "arrayindexlistnoassoct.hpp" // only one index [ix],[s:e],... // NEVER ArrayIndexScalar types (they have their own ArrayIndexListT) class ArrayIndexListOneT: public ArrayIndexListT { private: IxExprListT cleanupIx; ArrayIndexT* ix; SizeT nIx; // number of indexed elements AllIxBaseT* allIx; char allIxInstance[ AllIxMaxSize]; public: IxExprListT* GetCleanupIx() { return &cleanupIx;} ~ArrayIndexListOneT() { // delete allIx; delete ix; cleanupIx.Cleanup(); // must be explicitely cleaned up } // constructor ArrayIndexListOneT() : cleanupIx() , ix( NULL) , allIx( NULL) { nParam = 0;} ArrayIndexListOneT( const ArrayIndexListOneT& cp): cleanupIx(), ArrayIndexListT( cp), ix( cp.ix->Dup()), allIx( NULL) { assert( cp.allIx == NULL); assert( cp.cleanupIx.size() == 0); } // called after structure is fixed ArrayIndexListOneT( ArrayIndexVectorT* aIV): allIx( NULL) { ix = (*aIV)[0]; nParam = ix->NParam(); } void Clear() { // delete allIx; allIx = NULL; // allIxMulti.Clear(); ix->Clear(); cleanupIx.Cleanup(); } ArrayIndexListT* Clone() { return new ArrayIndexListOneT( *this);} void Init( IxExprListT& ix_)//, IxExprListT* cleanupIxIn) { assert( allIx == NULL); assert( ix_.size() == nParam); // if( cleanupIxIn != NULL) // cleanupIx = *cleanupIxIn; if( nParam == 0) return; if( nParam == 1) { ix->Init( ix_[ 0]); } else if( nParam == 2) { ix->Init( ix_[ 0], ix_[ 1]); return; } else // nParam == 3 { ix->Init( ix_[ 0], ix_[ 1], ix_[ 2]); return; } } void Init() {} // eg. a[*] // requires special handling // used by Assoc_<> returns last index in lastIx, removes it // and returns true is the list is empty // bool ToAssocIndex( SizeT& lastIx) bool ToAssocIndex( SizeT& lastIx) { // cannot be ArrayIndexScalar[VP] ix->Init(); RangeT lastValIx; if( !ix->Scalar( lastValIx)) throw GDLException( -1, NULL,"Record number must be a scalar in this context.",true,false); if( lastValIx < 0) throw GDLException( -1, NULL,"Record number must be a scalar > 0 in this context.",true,false); lastIx = lastValIx; return true; } // set the root variable which is indexed by this ArrayIndexListT void SetVariable( BaseGDL* var) { assert( allIx == NULL); // for assoc variables last index is the record if( var->IsAssoc()) { // note: s is copied from sIter in ArrayIndex::Init return; } // ArrayIndexScalar[VP] are not initialized // they need the NIter call, but // for only one index they have their own ArrayIndexListT nIx=ix->NIter( var->N_Elements()/*var->Size()*/); } // structure of indexed expression const dimension GetDim() { if( ix->Scalar()) { return dimension(); } else if( ix->Indexed()) { return static_cast(ix)->GetDim(); // gets structure of indexing array } else { return dimension( nIx); // one dimensional if not indexed } } SizeT N_Elements() { return nIx; } // returns 1-dim index for all elements AllIxBaseT* BuildIx() { if( allIx != NULL) // can happen if called from DotAccessDescT::DoAssign() return allIx; assert( allIx == NULL); // if( allIx != NULL) // return allIx; if( ix->Indexed()) { // allIx = static_cast< ArrayIndexIndexed*>(ix)->StealIx(); allIx = static_cast< ArrayIndexIndexed*>(ix)->GetAllIx(); return allIx; } if( nIx == 1) { allIx = new (allIxInstance) AllIxT( ix->GetS()); return allIx; } // allIx = new AllIxMulAllIxRangeStrideTtiT( nIx); SizeT s = ix->GetS(); SizeT ixStride = ix->GetStride(); if( ixStride <= 1) if( s != 0) { allIx = new (allIxInstance) AllIxRangeT( nIx, s); // for( SizeT i=0; i(allIx)->SetIx( i, i + s); // (*allIx)[i] = i + s; } else { allIx = new (allIxInstance) AllIxRange0T( nIx); // for( SizeT i=0; i(allIx)->SetIx( i, i ); // (*allIx)[i] = i; } else if( s != 0) { allIx = new (allIxInstance) AllIxRangeStrideT( nIx, s, ixStride); // for( SizeT i=0; i(allIx)->SetIx( i, i * ixStride + s); // (*allIx)[i] = i * ixStride + s; } else { allIx = new (allIxInstance) AllIxRange0StrideT( nIx, ixStride); // for( SizeT i=0; i(allIx)->SetIx( i, i * ixStride); // (*allIx)[i] = i * ixStride; } return allIx; } // returns one dim long ix in case of one element array index // used by AssignAt functions SizeT LongIx() const { return ix->GetIx0(); } void AssignAt( BaseGDL* var, BaseGDL* right) { // scalar case if( right->N_Elements() == 1 && !var->IsAssoc() && ix->NIter( var->N_Elements()/*var->Size()*/) == 1)// && var->Type() != GDL_STRUCT) { var->AssignAtIx( ix->GetIx0(), right); return; } SetVariable( var); if( var->EqType( right)) { var->AssignAt( right, this); // assigns inplace } else { BaseGDL* rConv = right->Convert2( var->Type(), BaseGDL::COPY); Guard conv_guard( rConv); var->AssignAt( rConv, this); // assigns inplace } } // optimized for one dimensional access BaseGDL* Index( BaseGDL* var, IxExprListT& ix_) { Init( ix_);//, NULL); if( var->IsAssoc()) // deault case return var->Index( this); if( /*!var->IsAssoc() &&*/ ix->Scalar()) //ix->NIter( var->N_Elements()/*var->Size()*/) == 1)// && var->Type() != GDL_STRUCT) { SizeT assertValue = ix->NIter( var->N_Elements()/*var->Size()*/); assert( assertValue == 1); return var->NewIx( ix->GetIx0()); } // normal case, no assoc SetVariable( var); return var->Index( this); } // returns multi-dim index for 1st element // used by InsAt functions const dimension GetDimIx0( SizeT& destStart) { destStart = ix->GetIx0(); return dimension( destStart); } SizeT NDim() { return 1; } }; //class ArrayIndexListOneT: public ArrayIndexListT // loop index class ArrayIndexListOneScalarT: public ArrayIndexListT { protected: SizeT varIx; RangeT sInit; RangeT s; AllIxT allIx; public: ~ArrayIndexListOneScalarT() { // delete allIx; } // constructor ArrayIndexListOneScalarT() : varIx( 0) // , allIx( NULL) { nParam = 0;} ArrayIndexListOneScalarT( const ArrayIndexListOneScalarT& cp) : ArrayIndexListT( cp) , varIx( cp.varIx) , s( cp.s) // , allIx( NULL) { // assert( cp.allIx == NULL); } // called after structure is fixed ArrayIndexListOneScalarT( ArrayIndexVectorT* aIV) // : allIx( NULL) { nParam = 0; varIx = static_cast((*aIV)[0])->GetVarIx(); delete (*aIV)[0]; } void Clear() {} ArrayIndexListT* Clone() { return new ArrayIndexListOneScalarT( *this);} void Init() {} // requires special handling // used by Assoc_<> returns last index in lastIx, removes it // and returns true is the list is empty bool ToAssocIndex( SizeT& lastIx); // set the root variable which is indexed by this ArrayIndexListT void SetVariable( BaseGDL* var); // structure of indexed expression const dimension GetDim() { return dimension(); } SizeT N_Elements() { return 1; } // returns 1-dim index for all elements AllIxT* BuildIx() { allIx.Set( s); return &allIx; // if( allIx != NULL) // { // allIx->Set( s); // return allIx; // } // // allIx = new AllIxT( s); // return allIx; } // returns one dim long ix in case of one element array index // used by AssignAt functions SizeT LongIx() const { return s; } void AssignAt( BaseGDL* var, BaseGDL* right); // optimized for one dimensional access BaseGDL* Index( BaseGDL* var, IxExprListT& ix_); // returns multi-dim index for 1st element // used by InsAt functions const dimension GetDimIx0( SizeT& destStart) { destStart = s; return dimension( destStart); } SizeT NDim() { return 1; } }; // class ArrayIndexListOneScalarT: public ArrayIndexListT class ArrayIndexListOneScalarVPT: public ArrayIndexListT { protected: DVar* varPtr; RangeT sInit; RangeT s; AllIxT allIx; // AllIxT* allIx; public: ~ArrayIndexListOneScalarVPT() { // delete allIx; } // constructor ArrayIndexListOneScalarVPT() : varPtr( NULL) // , allIx( NULL) { nParam = 0;} ArrayIndexListOneScalarVPT( const ArrayIndexListOneScalarVPT& cp) : ArrayIndexListT( cp) , varPtr( cp.varPtr) , sInit( cp.sInit) , s( cp.s) // , allIx( NULL) { // assert( cp.allIx == NULL); } // called after structure is fixed ArrayIndexListOneScalarVPT( ArrayIndexVectorT* aIV) // : allIx( NULL) { nParam = 0; varPtr = static_cast((*aIV)[0])->GetVarPtr(); delete (*aIV)[0]; } void Clear() {} ArrayIndexListT* Clone() { return new ArrayIndexListOneScalarVPT( *this);} void Init() {} // requires special handling // used by Assoc_<> returns last index in lastIx, removes it // and returns true is the list is empty bool ToAssocIndex( SizeT& lastIx) { sInit = varPtr->Data()->LoopIndex(); if( sInit < 0) throw GDLException( -1, NULL,"Record number must be a scalar > 0 in this context.",true,false); s = sInit; lastIx = s; return true; } // set the root variable which is indexed by this ArrayIndexListT void SetVariable( BaseGDL* var) { sInit = varPtr->Data()->LoopIndex(); if( sInit < 0) s = sInit + var->N_Elements(); else s = sInit; // for assoc variables last index is the record if( var->IsAssoc()) return; if( s >= var->N_Elements()/*var->Size()*/) throw GDLException(-1, NULL,"Scalar subscript out of range (>).",true,false); if( s < 0) throw GDLException(-1,NULL,"Scalar subscript out of range (<-1).",true,false); } // structure of indexed expression const dimension GetDim() { return dimension(); } SizeT N_Elements() { return 1; } // returns 1-dim index for all elements AllIxT* BuildIx() { allIx.Set( s); return &allIx; // if( allIx != NULL) // { // allIx->Set( s); // return allIx; // } // // allIx = new AllIxT( s); // return allIx; } // returns one dim long ix in case of one element array index // used by AssignAt functions SizeT LongIx() const { return s; } void AssignAt( BaseGDL* var, BaseGDL* right) { // Init() was already called // scalar case if( right->N_Elements() == 1 && !var->IsAssoc()) // && var->Type() != GDL_STRUCT) { s = varPtr->Data()->LoopIndex(); if( s >= var->N_Elements()/*var->Size()*/) throw GDLException(-1,NULL,"Scalar subscript out of range [>].2",true,false); var->AssignAtIx( s, right); return; } SetVariable( var); if( var->EqType( right)) { var->AssignAt( right, this); // assigns inplace } else { BaseGDL* rConv = right->Convert2( var->Type(), BaseGDL::COPY); Guard conv_guard( rConv); var->AssignAt( rConv, this); // assigns inplace } } // optimized for one dimensional access BaseGDL* Index( BaseGDL* var, IxExprListT& ix_); // returns multi-dim index for 1st element // used by InsAt functions const dimension GetDimIx0( SizeT& destStart) { destStart = s; return dimension( destStart); } SizeT NDim() { return 1; } }; // class ArrayIndexListOneScalarVPT: public ArrayIndexListT class ArrayIndexListOneConstScalarT: public ArrayIndexListT { RangeT sInit; RangeT s; AllIxT allIx; // AllIxT* allIx; public: ~ArrayIndexListOneConstScalarT() { // delete allIx; } // constructor ArrayIndexListOneConstScalarT() // : allIx( NULL) { nParam = 0; } ArrayIndexListOneConstScalarT( const ArrayIndexListOneConstScalarT& cp) : ArrayIndexListT( cp) , sInit( cp.sInit) , s( cp.s) // , allIx( NULL) { // assert( cp.allIx == NULL); // all copying should be done before using. } // called after structure is fixed ArrayIndexListOneConstScalarT( ArrayIndexVectorT* aIV) // : allIx( NULL) { sInit = (*aIV)[0]->GetS(); if( sInit >= 0) s = sInit; nParam = 0; delete (*aIV)[0]; } void Clear() {} ArrayIndexListT* Clone() { return new ArrayIndexListOneConstScalarT( *this);} void Init() {} SizeT N_Elements() { return 1; } // returns 1-dim index for all elements AllIxT* BuildIx() { allIx.Set( s); return &allIx; // if( allIx != NULL) // return allIx; // // allIx = new AllIxT( s); // return allIx; } // requires special handling // used by Assoc_<> returns last index in lastIx, removes it // and returns true is the list is empty bool ToAssocIndex( SizeT& lastIx) { if( sInit < 0) throw GDLException(-1,NULL,"Record number must be a scalar > 0 in this context.",true,false); lastIx = sInit; return true; } // set the root variable which is indexed by this ArrayIndexListT void SetVariable( BaseGDL* var) { if( var->IsAssoc()) return; if( sInit < 0) s = sInit + var->N_Elements()/*var->Size()*/; // for assoc variables last index is the record if( s < 0) throw GDLException(-1,NULL,"Scalar subscript out of range [<].1",true,false); if( s >= var->N_Elements()/*var->Size()*/) throw GDLException(-1,NULL,"Scalar subscript out of range [>].1",true,false); } // returns one dim long ix in case of one element array index // used by AssignAt functions SizeT LongIx() const { return s; } void AssignAt( BaseGDL* var, BaseGDL* right) { // one index and assoc -> no index left -> no AssignAt // wrong! This is the entry function // assert( !var->IsAssoc()); // Init() was already called // scalar case if( right->N_Elements() == 1 && !var->IsAssoc())// && var->Type() != GDL_STRUCT) { if( sInit < 0) s = sInit + var->N_Elements()/*var->Size()*/; if( s < 0) throw GDLException(-1,NULL,"Scalar subscript out of range [<].2",true,false); if( s >= var->N_Elements()/*var->Size()*/) throw GDLException(-1,NULL,"Scalar subscript out of range [>].2",true,false); var->AssignAtIx( s, right); return; } SetVariable( var); if( var->EqType( right)) { var->AssignAt( right, this); // assigns inplace } else { BaseGDL* rConv = right->Convert2( var->Type(), BaseGDL::COPY); Guard conv_guard( rConv); var->AssignAt( rConv, this); // assigns inplace } } // optimized for one dimensional access BaseGDL* Index( BaseGDL* var, IxExprListT& ix_) { // Init() not called if( !var->IsAssoc())// && var->Type() != GDL_STRUCT) { if( sInit < 0) s = sInit + var->N_Elements()/*var->Size()*/; if( s < 0) throw GDLException(-1,NULL,"Scalar subscript out of range [<].3",true,false); if( s >= var->N_Elements()/*var->Size()*/) { // std::cout << s << " var->N_Elements()/*var->Size()*/:" << var->N_Elements()/*var->Size()*/ << std::endl; throw GDLException(-1,NULL,"Scalar subscript out of range [>].3",true,false); } return var->NewIx( s); } // normal case //Init();// ix_); //SetVariable( var); return var->Index( this); } const dimension GetDim() { return dimension(); } const dimension GetDimIx0( SizeT& destStart) { destStart = s; return dimension( destStart); } SizeT NDim() { return 1; } }; // class ArrayIndexListOneConstScalarT: public ArrayIndexListT // all scalar elements (multi-dim) class ArrayIndexListScalarT: public ArrayIndexListT { private: ArrayIndexVectorT ixList; // std::vector paramPresent; SizeT acRank; // rank upto which indexing is done const SizeT* varStride; // variables stride // SizeT varStride[MAXRANK+1]; // variables stride SizeT nIx; // number of indexed elements AllIxT allIx; // AllIxT allIxInstance; ArrayIndexT* ixListEnd; // for assoc index public: ~ArrayIndexListScalarT() { // delete allIx; ixList.Destruct(); // for( std::vector::iterator i=ixList.begin(); // i != ixList.end(); ++i) // { delete *i;} } // constructor ArrayIndexListScalarT(): acRank(0), // allIx( NULL), ixListEnd( NULL) { nParam = 0;} ArrayIndexListScalarT( const ArrayIndexListScalarT& cp): ArrayIndexListT( cp), // paramPresent( cp.paramPresent), acRank(cp.acRank), // allIx( NULL), ixListEnd( NULL) { // ixList.reserve(MAXRANK); // assert( cp.allIx == NULL); assert( cp.ixListEnd == NULL); for( SizeT i=0; iDup()); } // called after structure is fixed ArrayIndexListScalarT( ArrayIndexVectorT* ix): ixList( *ix), // allIx( NULL), ixListEnd( NULL) { assert( ixList.size() > 1); // must be, from compiler if( ix->size() > MAXRANK) throw GDLException(-1,NULL,"Maximum of "+MAXRANK_STR+" dimensions allowed.",true,false); nParam = 0; for( SizeT i=0; iNParam(); if( actNParam == 1) { // paramPresent.push_back( i); nParam++; } } } void Clear() { // delete allIx; // allIx = NULL; if( ixListEnd != NULL) // revert assoc indexing { ixList.push_back( ixListEnd); ixListEnd = NULL; } // // no clearing of scalar indices // for( std::vector::iterator i=ixList.begin(); // i != ixList.end(); ++i) // { (*i)->Clear();} } // void Init( IxExprListT& ix) // { // assert( allIx == NULL); // assert( ix.size() == nParam); // for( SizeT i=0; iInit( ix[ i]); // } // } ArrayIndexListT* Clone() { return new ArrayIndexListScalarT( *this);} void Init() {} // requires special handling // used by Assoc_<> returns last index in lastIx, removes it // and returns true if the list is empty bool ToAssocIndex( SizeT& lastIx) { assert( ixListEnd == NULL); ixListEnd = ixList.pop_back_get(); // init in case of ixListEnd->NParam == 0 ixListEnd->Init(); RangeT lastIxVal; ixListEnd->Scalar( lastIxVal); // always scalar if( lastIxVal < 0) throw GDLException(-1,NULL,"Record number must be a scalar > 0 in this context.",true,false); lastIx = lastIxVal; return false; // multi dim } // set the root variable which is indexed by this ArrayIndexListScalarT void SetVariable( BaseGDL* var) { // assert( allIx == NULL); // set acRank acRank = ixList.size(); // for assoc variables last index is the record if( var->IsAssoc()) { acRank--; // if( acRank == 0) return; // multi dim } // ArrayIndexScalar[VP] need this call to read their actual data // as their are not initalized (nParam == 0) for( SizeT i=0; iNIter( var->Dim(i)); // check boundary varStride = var->Dim().Stride(); // var->Dim().Stride( varStride, acRank); // copy variables stride into varStride nIx = 1; } // structure of indexed expression const dimension GetDim() { return dimension(); // -> results in scalar } SizeT N_Elements() { return 1; } // returns 1-dim index for all elements AllIxT* BuildIx() { // if( allIx != NULL) // return allIx; SizeT s = ixList.FrontGetS(); //[0]->GetS(); for( SizeT l=1; l < acRank; ++l) { s += ixList[l]->GetS() * varStride[l]; } // allIx = &allIxInstance; //new AllIxT(s); // allIx->Set( s); allIx.Set( s); // allIx = new AllIxT(s); // (*allIx)[0] = s; return &allIx; } // returns one dim long ix in case of one element array index // used by AssignAt functions SizeT LongIx() const { // if( acRank == 1) // return ixList.FrontGetS(); //ixList[0]->GetS(); SizeT dStart = ixList.FrontGetS(); //[0]->GetS(); for( SizeT i=1; i < acRank; ++i) dStart += ixList[i]->GetS() * varStride[ i]; return dStart; } void AssignAt( BaseGDL* var, BaseGDL* right) { if( var->N_Elements() == 1 && !var->IsAssoc()) { // SetVariable( var); // set acRank acRank = ixList.size(); varStride = var->Dim().Stride(); // ArrayIndexScalar[VP] need this call to read their actual data // as their are not initalized (nParam == 0) ixList[0]->NIter( var->Dim(0)); // check boundary SizeT dStart = ixList.FrontGetS(); //[0]->GetS(); for( SizeT i=1; i < acRank; ++i) { ixList[i]->NIter( var->Dim(i)); // check boundary dStart += ixList[i]->GetS() * varStride[ i]; } var->AssignAtIx( dStart, right); // assigns inplace return; } // var->N_Elements() > 1 SetVariable( var); assert( nIx == 1); if( var->EqType( right)) { var->AssignAt( right, this); // assigns inplace (not only scalar) } else { BaseGDL* rConv = right->Convert2( var->Type(), BaseGDL::COPY); Guard conv_guard( rConv); var->AssignAt( rConv, this); // assigns inplace (not only scalar) } } // optimized for one dimensional access BaseGDL* Index( BaseGDL* var, IxExprListT& ix) { // Init(); // SetVariable( var); // set acRank acRank = ixList.size(); // for assoc variables last index is the record if( var->IsAssoc()) { acRank--; varStride = var->Dim().Stride(); // ArrayIndexScalar[VP] need this call to read their actual data // as their are not initalized (nParam == 0) ixList[0]->NIter( var->Dim(0)); // check boundary for( SizeT i=1; i < acRank; ++i) { ixList[i]->NIter( var->Dim(i)); // check boundary } // return dStart; // for( SizeT i=0; iNIter( var->Dim(i)); // check boundary // return var->NewIx( dStart); //this->LongIx()); return var->Index( this); } varStride = var->Dim().Stride(); // ArrayIndexScalar[VP] need this call to read their actual data // as their are not initalized (nParam == 0) ixList[0]->NIter( var->Dim(0)); // check boundary SizeT dStart = ixList.FrontGetS(); //[0]->GetS(); for( SizeT i=1; i < acRank; ++i) { ixList[i]->NIter( var->Dim(i)); // check boundary dStart += ixList[i]->GetS() * varStride[ i]; } // return dStart; // for( SizeT i=0; iNIter( var->Dim(i)); // check boundary return var->NewIx( dStart); //this->LongIx()); // return var->Index( this); } // returns multi-dim index for 1st element // used by InsAt functions const dimension GetDimIx0( SizeT& destStart) { SizeT dStart = 0; SizeT actIx[ MAXRANK]; for( SizeT i=0; i < acRank; ++i) { actIx[ i] = ixList[i]->GetS(); dStart += actIx[ i] * varStride[ i]; } destStart = dStart; return dimension( actIx, acRank); } SizeT NDim() { return acRank; } }; // class ArrayIndexListScalarT: public ArrayIndexListT /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // general case (mixed, multi-dim) at least one indexed // but note: last index can be assoc index class ArrayIndexListMultiT: public ArrayIndexListT { private: IxExprListT cleanupIx; protected: ArrayIndexVectorT ixList; enum AccessType { GDL_UNDEF=0, // for init access type INDEXED_ONE, // all indexed OR one NORMAL, // mixed ALLINDEXED, ALLONE // all ONE }; AccessType accessType; // actual access type AccessType accessTypeInit; // possible access type non assoc AccessType accessTypeAssocInit;// possible access type for assoc SizeT acRank; // rank upto which indexing is done SizeT nIterLimit[MAXRANK]; // for each dimension, how many iterations SizeT stride[MAXRANK+1]; const SizeT* varStride; // variables stride // SizeT varStride[MAXRANK+1]; // variables stride SizeT nIx; // number of indexed elements AllIxBaseT* allIx; char allIxInstance[ AllIxMaxSize]; ArrayIndexT* ixListEnd; // for assoc index // for access with only a single variable index (column/row-extractor) SizeT nIterLimitGt1; // how many dimensions > 1 RankT gt1Rank; // which rank is the variable rank SizeT baseIx; // offset to add for all other constant dims bool indexed; // is the variable index indexed? public: IxExprListT* GetCleanupIx() { return &cleanupIx;} ~ArrayIndexListMultiT() { // delete allIx; ixList.Destruct(); // for( std::vector::iterator i=ixList.begin(); // i != ixList.end(); ++i) // { delete *i;} cleanupIx.Cleanup(); } // constructor ArrayIndexListMultiT(): accessType(NORMAL), acRank(0), allIx( NULL), ixListEnd( NULL) { nParam = 0;} ArrayIndexListMultiT( const ArrayIndexListMultiT& cp): ArrayIndexListT( cp), accessType(cp.accessType), accessTypeInit(cp.accessTypeInit), accessTypeAssocInit(cp.accessTypeAssocInit), acRank(cp.acRank), allIx( NULL), ixListEnd( NULL) { assert( cp.allIx == NULL); assert( cp.ixListEnd == NULL); assert( cp.cleanupIx.size() == 0); for( SizeT i=0; iDup()); } // called once after structure is fixed at (GDL-)compile time ArrayIndexListMultiT( ArrayIndexVectorT* ix): ixList( *ix), allIx( NULL), ixListEnd( NULL) { assert( ix->size() != 0); // must be, from compiler if( ixList.size() > MAXRANK) throw GDLException(-1,NULL,"Maximum of "+MAXRANK_STR+" dimensions allowed.",true,false); nParam = 0; for( SizeT i=0; isize(); ++i) nParam += (*ix)[i]->NParam(); // determine type of index SizeT nIndexed = 0; SizeT nScalar = 0; for( SizeT i=0; (i+1)Type() || ArrayIndexScalarVPID == ixList[i]->Type() || // ? (from MakeArrayIndex) CArrayIndexScalarID == ixList[i]->Type() ) nScalar++; else if( ArrayIndexIndexedID == ixList[i]->Type() || CArrayIndexIndexedID == ixList[i]->Type()) nIndexed++; } if( nScalar == ixList.size()-1) accessTypeAssocInit = ALLONE; else if( nIndexed == ixList.size()-1) accessTypeAssocInit = ALLINDEXED; // might be ALLONE as well else if( nScalar + nIndexed < ixList.size()-1) accessTypeAssocInit = NORMAL; else accessTypeAssocInit = INDEXED_ONE; // save some checking later if( ArrayIndexScalarID == ixList[ixList.size()-1]->Type() || ArrayIndexScalarVPID == ixList[ixList.size()-1]->Type() || // ? (from MakeArrayIndex) CArrayIndexScalarID == ixList[ixList.size()-1]->Type()) nScalar++; else if( ArrayIndexIndexedID == ixList[ixList.size()-1]->Type() || CArrayIndexIndexedID == ixList[ixList.size()-1]->Type()) nIndexed++; if( nScalar == ixList.size()) accessTypeInit = ALLONE; else if( nIndexed == ixList.size()) // actually cannot happen (ArrayIndexListMultiAllIndexedT) // but better keep it for stability accessTypeInit = ALLINDEXED; // might be ALLONE as well else if( nScalar + nIndexed < ixList.size()) accessTypeInit = NORMAL; else accessTypeInit = INDEXED_ONE; // save some checking later // std::cout << "accessTypeInit: " << accessTypeInit << std::endl; } void Clear() { // delete allIx; allIx = NULL; if( ixListEnd != NULL) // revert assoc indexing { ixList.push_back( ixListEnd); ixListEnd = NULL; } ixList.Clear(); // for( ArrayIndexVectorT::iterator i=ixList.begin(); i != ixList.end(); ++i) // { (*i)->Clear();} cleanupIx.Cleanup(); } ArrayIndexListT* Clone() { return new ArrayIndexListMultiT( *this);} void Init( IxExprListT& ix)//, IxExprListT* cleanupIxIn) { assert( allIx == NULL); assert( ix.size() == nParam); // if( cleanupIxIn != NULL) // cleanupIx = *cleanupIxIn; SizeT pIX = 0; for( SizeT i=0; iNParam(); if( ixNParam == 0) { ixList[ i]->Init(); continue; } if( ixNParam == 1) { ixList[ i]->Init( ix[ pIX]); pIX += 1; continue; } if( ixNParam == 2) { ixList[ i]->Init( ix[ pIX], ix[ pIX+1]); pIX += 2; continue; } if( ixNParam == 3) { ixList[ i]->Init( ix[ pIX], ix[ pIX+1], ix[ pIX+2]); pIX += 3; continue; } } } // requires special handling // used by Assoc_<> returns last index in lastIx, removes it // and returns true is the list is empty bool ToAssocIndex( SizeT& lastIx) { assert( ixListEnd == NULL); ArrayIndexT* ixListEndTmp = ixList.back(); ixListEndTmp->Init(); RangeT lastValIx; if( !ixListEndTmp->Scalar( lastValIx)) throw GDLException(-1, NULL ,"Record number must be a scalar in this context.",true,false); if( lastValIx < 0) throw GDLException(-1, NULL,"Record number must be a scalar > 0 in this context.",true,false); lastIx = lastValIx; ixListEnd = ixListEndTmp; ixList.pop_back(); return false; // multi dim ixList.empty(); } // set the root variable which is indexed by this ArrayIndexListMultiT void SetVariable( BaseGDL* var) { assert( allIx == NULL); // set acRank acRank = ixList.size(); // for assoc variables last index is the record if( var->IsAssoc()) { acRank--; accessType = accessTypeAssocInit; } else accessType = accessTypeInit; // can happen due to assoc variables if( accessType == ALLONE) // implied none INDEXED { const dimension& varDim = var->Dim(); SizeT varRank = varDim.Rank(); varStride = varDim.Stride(); nIterLimitGt1 = 0; // marker for BuildIx ixList[0]->NIter( (0NIter( (iGetS() * varStride[i]; // GetS() ok because of none INDEXED } nIx = 1; return; // varStride = var->Dim().Stride(); // // check boundary // const dimension& varDim = var->Dim(); // SizeT varRank = varDim.Rank(); // for(SizeT i=0; iNIter( (iScalar()) break; if( i == acRank) // counted up to acRank -> all scalar { accessType = ALLONE; // needed for GetDim() const dimension& varDim = var->Dim(); SizeT varRank = varDim.Rank(); varStride = varDim.Stride(); nIterLimitGt1 = 0; // marker for BuildIx ixList[0]->NIter( (0GetIx0(); // * varStride[0]; // GetS() not ok because INDEXED // check boundary for(SizeT i=1; iNIter( (iGetIx0() * varStride[i]; // GetS() not ok because INDEXED } nIx = 1; return; // accessType = ALLONE; // varStride = var->Dim().Stride(); // // check boundary // const dimension& varDim = var->Dim(); // SizeT varRank = varDim.Rank(); // for(SizeT i=0; iNIter( (i 0 || accessType == INDEXED_ONE) { accessType = NORMAL; // there was a scalar (and break because of non-scalar) } else // i == 0 -> first was (because of ALLINDEXED) indexed { ++i; // first was already non-scalar -> indexed for(; iIndexed()) { accessType = NORMAL; break; } // else // accessType = ALLINDEXED; // is already } } // accessType can be at this point: // NORMAL // ALLINDEXED // both are the definite types here assert( accessType == NORMAL || accessType == ALLINDEXED); // set varDim from variable const dimension& varDim = var->Dim(); SizeT varRank = varDim.Rank(); if( accessType == ALLINDEXED) { nIx=ixList[0]->NIter( (0 1); for( SizeT i=1; iNIter( (iDim().Stride(); // varDim.Stride( varStride,acRank); // copy variables stride into varStride return; } // NORMAL varStride = var->Dim().Stride(); // varDim.Stride( varStride,acRank); // copy variables stride into varStride assert( varStride[0] == 1); nIterLimit[0]=ixList[0]->NIter( (0 1) { nIterLimitGt1 = 1; // important for BuildIx gt1Rank = 0; if( ixList[0]->Indexed()) { baseIx = 0; indexed = true; } else { baseIx = ixList[0]->GetS();// * varStride[0]; indexed = false; } } else { nIterLimitGt1 = 0; // important for BuildIx if( ixList[0]->Indexed()) { baseIx = static_cast< ArrayIndexIndexed*>( ixList[0])->GetIx0();// * varStride[0]; } else { baseIx = ixList[0]->GetS();// * varStride[0]; } } for( SizeT i=1; iNIter( (i 1) { ++nIterLimitGt1; gt1Rank = i; if( ixList[i]->Indexed()) { indexed = true; } else { baseIx += ixList[i]->GetS() * varStride[i]; indexed = false; } } else { if( ixList[i]->Indexed()) { baseIx += static_cast< ArrayIndexIndexed*>( ixList[i])->GetIx0() * varStride[i]; } else { baseIx += ixList[i]->GetS() * varStride[i]; } } } stride[acRank]=stride[acRank-1]*nIterLimit[acRank-1]; // index stride } // structure of indexed expression const dimension GetDim() { // should be changed to ALLINDEXED or ALLONE by now assert( accessType != INDEXED_ONE); if( accessType == ALLONE) return dimension(); // -> results in scalar if( accessType == ALLINDEXED) { // always indexed return static_cast(ixList[0])->GetDim(); } // accessType == NORMAL -> structure from indices return dimension( nIterLimit, acRank); } SizeT N_Elements() { return nIx; } // returns 1-dim index for all elements AllIxBaseT* BuildIx() // ArrayIndexListMultiT { if( allIx != NULL) // can happen if called from DotAccessDescT::DoAssign() return allIx; assert( allIx == NULL); if( accessType == ALLINDEXED) // nIterLimitGt1 is not properly set { // note that this indexer cannot live without this ArrayIndexListMultiT allIx = new (allIxInstance) AllIxAllIndexedT( &ixList, acRank, nIx, varStride); return allIx; } // can happen // this must be done only here as oterwise nIterLimitGt1 is not properly set if( nIterLimitGt1 == 0) // only one single index { allIx = new (allIxInstance) AllIxT( baseIx); return allIx; } if( acRank == 1) // assoc already recognized { ArrayIndexT* ix = ixList[0]; if( ix->Indexed()) { allIx = static_cast< ArrayIndexIndexed*>(ix)->GetAllIx(); return allIx; } if( nIx == 1) { allIx = new (allIxInstance) AllIxT( ix->GetS()); return allIx; } SizeT s = ix->GetS(); SizeT ixStride = ix->GetStride(); if( ixStride <= 1) if( s != 0) { allIx = new (allIxInstance) AllIxRangeT( nIx, s); } else { allIx = new (allIxInstance) AllIxRange0T( nIx); } else if( s != 0) { allIx = new (allIxInstance) AllIxRangeStrideT( nIx, s, ixStride); } else { allIx = new (allIxInstance) AllIxRange0StrideT( nIx, ixStride); } return allIx; } // NORMAL // loop only over specified indices // higher indices of variable are implicitely zero, // therefore they are not checked in 'SetRoot' if( nIterLimitGt1 == 1) // only one variable dimension { if( indexed) allIx = new (allIxInstance) AllIxNewMultiOneVariableIndexIndexedT( gt1Rank, baseIx, &ixList, acRank, nIx, varStride, nIterLimit, stride); else allIx = new (allIxInstance) AllIxNewMultiOneVariableIndexNoIndexT( gt1Rank, baseIx, &ixList, acRank, nIx, varStride, nIterLimit, stride); return allIx; } if( acRank == 2) { allIx = new (allIxInstance) AllIxNewMulti2DT( &ixList, nIx, varStride, nIterLimit, stride); return allIx; } allIx = new (allIxInstance) AllIxNewMultiT( &ixList, acRank, nIx, varStride, nIterLimit, stride); return allIx; } // returns one dim long ix in case of one element array index // used by AssignAt and Index functions SizeT LongIx() const { SizeT dStart = ixList[0]->GetIx0(); for( SizeT i=1; i < acRank; ++i) dStart += ixList[i]->GetIx0() * varStride[ i]; return dStart; } void AssignAt( BaseGDL* var, BaseGDL* right) { SetVariable( var); if( var->EqType( right)) { var->AssignAt( right, this); // assigns inplace } else { BaseGDL* rConv = right->Convert2( var->Type(), BaseGDL::COPY); Guard conv_guard( rConv); var->AssignAt( rConv, this); // assigns inplace } } // optimized for one dimensional access BaseGDL* Index( BaseGDL* var, IxExprListT& ix) { // normal case Init( ix);//, NULL); SetVariable( var); if( nIx == 1 && !var->IsAssoc()) { BaseGDL* res = var->NewIx( baseIx); res->MakeArrayFromScalar(); return res; } return var->Index( this); } // returns multi-dim index for 1st element // used by InsAt functions const dimension GetDimIx0( SizeT& destStart) { SizeT dStart = 0; SizeT actIx[ MAXRANK]; for( SizeT i=0; i < acRank; ++i) { actIx[ i] = ixList[i]->GetIx0(); dStart += actIx[ i] * varStride[ i]; } destStart = dStart; return dimension( actIx, acRank); } SizeT NDim() { return acRank;} }; //class ArrayIndexListMultiT: public ArrayIndexListT // some checks are not needed here class ArrayIndexListMultiNoneIndexedT: public ArrayIndexListMultiT { public: // constructor // ArrayIndexListMultiNoneIndexedT // : ArrayIndexListMultiT() // {} // ArrayIndexListMultiNoneIndexedT( const ArrayIndexListMultiNoneIndexedT& cp): // ArrayIndexListMultiT( cp) // {} // called after structure is fixed ArrayIndexListMultiNoneIndexedT( ArrayIndexVectorT* ix) // : ixList( *ix), // allIx( NULL), // ixListEnd( NULL) { ixList = *ix; allIx = NULL; ixListEnd = NULL; assert( ix->size() != 0); // must be, from compiler if( ixList.size() > MAXRANK) throw GDLException(-1,NULL,"Maximum of "+MAXRANK_STR+" dimensions allowed.",true,false); nParam = 0; for( SizeT i=0; isize(); ++i) nParam += (*ix)[i]->NParam(); // determine type of index // SizeT nIndexed = 0; SizeT nScalar = 0; for( SizeT i=0; (i+1)Type() || ArrayIndexScalarVPID == ixList[i]->Type() || // ? (from MakeArrayIndex) CArrayIndexScalarID == ixList[i]->Type() ) nScalar++; // else if( ArrayIndexIndexedID == ixList[i]->Type() || // CArrayIndexIndexedID == ixList[i]->Type()) nIndexed++; } if( nScalar == ixList.size()-1) accessTypeAssocInit = ALLONE; // else if( nIndexed == ixList.size()-1) // accessTypeAssocInit = ALLINDEXED; // might be ALLONE as well // else if( nScalar + nIndexed < ixList.size()-1) else accessTypeAssocInit = NORMAL; // else // accessTypeAssocInit = INDEXED_ONE; if( ArrayIndexScalarID == ixList[ixList.size()-1]->Type() || ArrayIndexScalarVPID == ixList[ixList.size()-1]->Type() || // ? (from MakeArrayIndex) CArrayIndexScalarID == ixList[ixList.size()-1]->Type()) nScalar++; // else if( ArrayIndexIndexedID == ixList[ixList.size()-1]->Type() || // CArrayIndexIndexedID == ixList[ixList.size()-1]->Type()) nIndexed++; /* if( dynamic_cast< ArrayIndexScalar*>(ixList[ixList.size()-1]) || dynamic_cast< CArrayIndexScalar*>(ixList[ixList.size()-1])) nScalar++; if( dynamic_cast(ixList[ixList.size()-1]) || dynamic_cast(ixList[ixList.size()-1]) ) nIndexed++;*/ assert( nScalar <= ixList.size()); // from MakeArrayIndex // if( nScalar == ixList.size()) // accessTypeInit = ALLONE; // // else if( nIndexed == ixList.size()) // // accessTypeInit = ALLINDEXED; // might be ALLONE as well // // else if( nScalar + nIndexed < ixList.size()) // else accessTypeInit = NORMAL; // std::cout << "accessTypeInit: " << accessTypeInit << std::endl; } ArrayIndexListT* Clone() { return new ArrayIndexListMultiNoneIndexedT( *this);} // set the root variable which is indexed by this ArrayIndexListMultiT void SetVariable( BaseGDL* var) { assert( allIx == NULL); // set acRank acRank = ixList.size(); // for assoc variables last index is the record if( var->IsAssoc()) { acRank--; accessType = accessTypeAssocInit; } else accessType = accessTypeInit; // can happen due to assoc variables if( accessType == ALLONE) { const dimension& varDim = var->Dim(); SizeT varRank = varDim.Rank(); varStride = varDim.Stride(); nIterLimitGt1 = 0; // marker for BuildIx ixList[0]->NIter( (0NIter( (iGetS() * varStride[i]; } nIx = 1; return; } // accessType can be at this point: // NORMAL // now the definite types here assert( accessType == NORMAL); // set varDim from variable const dimension& varDim = var->Dim(); SizeT varRank = varDim.Rank(); varStride = varDim.Stride(); // varDim.Stride( varStride,acRank); // copy variables stride into varStride nIterLimit[0]=ixList[0]->NIter( (0 1)? 1 : 0; gt1Rank = 0; assert( varStride[0] == 1); baseIx = ixList[0]->GetS(); // * varStride[0]; for( SizeT i=1; iNIter( (i 1) { ++nIterLimitGt1; gt1Rank = i; } baseIx += ixList[i]->GetS() * varStride[i]; } stride[acRank]=stride[acRank-1]*nIterLimit[acRank-1]; // index stride } // returns 1-dim index for all elements AllIxBaseT* BuildIx() { if( allIx != NULL) // can happen if called from DotAccessDescT::DoAssign() return allIx; assert( allIx == NULL); // if( allIx != NULL) // return allIx; // if( accessType == ALLONE) // { // SizeT s = ixList.FrontGetS(); //ixList[0]->GetS(); // for( SizeT l=1; l < acRank; ++l) // { // s += ixList[l]->GetS() * varStride[l]; // } // allIx = new (allIxInstance) AllIxT(s); // return allIx; // } // ALLONE or all nIterLimit == 1 if( nIterLimitGt1 == 0) // only one single index { allIx = new (allIxInstance) AllIxT( baseIx); return allIx; } if( acRank == 1) // assoc already recognized { ArrayIndexT* ix = ixList[0]; if( nIx == 1) { allIx = new (allIxInstance) AllIxT( ix->GetS()); return allIx; } SizeT s = ix->GetS(); SizeT ixStride = ix->GetStride(); if( ixStride <= 1) if( s != 0) { allIx = new (allIxInstance) AllIxRangeT( nIx, s); } else { allIx = new (allIxInstance) AllIxRange0T( nIx); } else if( s != 0) { allIx = new (allIxInstance) AllIxRangeStrideT( nIx, s, ixStride); } else { allIx = new (allIxInstance) AllIxRange0StrideT( nIx, ixStride); } return allIx; } // NORMAL // loop only over specified indices // higher indices of variable are implicitely zero, // therefore they are not checked in 'SetRoot' if( nIterLimitGt1 == 1) // only one variable dimension { allIx = new (allIxInstance) AllIxNewMultiOneVariableIndexNoIndexT( gt1Rank, baseIx, &ixList, acRank, nIx, varStride, nIterLimit, stride); return allIx; } if( acRank == 2) // assoc already recognized { allIx = new (allIxInstance) AllIxNewMultiNoneIndexed2DT( &ixList, nIx, varStride, nIterLimit, stride); return allIx; } allIx = new (allIxInstance) AllIxNewMultiNoneIndexedT( &ixList, acRank, nIx, varStride, nIterLimit, stride); return allIx; } }; // ArrayIndexListMultiNoneIndexedT class ArrayIndexListMultiAllIndexedT: public ArrayIndexListMultiT { public: // called once after structure is fixed at (GDL-)compile time ArrayIndexListMultiAllIndexedT( ArrayIndexVectorT* ix) // : ixList( *ix), // allIx( NULL), // ixListEnd( NULL) { ixList = *ix; allIx = NULL; ixListEnd = NULL; assert( ix->size() != 0); // must be, from compiler if( ixList.size() > MAXRANK) throw GDLException(-1,NULL,"Maximum of "+MAXRANK_STR+" dimensions allowed.",true,false); nParam = 0; for( SizeT i=0; isize(); ++i) nParam += (*ix)[i]->NParam(); accessTypeAssocInit = ALLINDEXED; // might be ALLONE as well accessTypeInit = ALLINDEXED; // might be ALLONE as well } ArrayIndexListT* Clone() { return new ArrayIndexListMultiAllIndexedT( *this);} // set the root variable which is indexed by this ArrayIndexListMultiT void SetVariable( BaseGDL* var) { assert( allIx == NULL); // set acRank acRank = ixList.size(); // for assoc variables last index is the record if( var->IsAssoc()) { acRank--; accessType = accessTypeAssocInit; } else accessType = accessTypeInit; SizeT i=0; for(; iScalar()) break; if( i == acRank) // counted up to acRank -> all scalar { accessType = ALLONE; // needed for GetDim() const dimension& varDim = var->Dim(); SizeT varRank = varDim.Rank(); varStride = varDim.Stride(); nIterLimitGt1 = 0; // marker for BuildIx ixList[0]->NIter( (0GetIx0(); // * varStride[0]; // GetS() not ok because INDEXED // check boundary for(SizeT i=1; iNIter( (iGetIx0() * varStride[i]; // GetS() not ok because INDEXED } nIx = 1; return; } if( i > 0) { accessType = NORMAL; // there was a scalar (and break because of non-scalar) } else // i == 0 -> first was (because of ALLINDEXED) indexed { ++i; // first was already non-scalar -> indexed for(; iIndexed()) { accessType = NORMAL; break; } } // accessType can be at this point: // NORMAL // ALLINDEXED // both are the definite types here assert( accessType == NORMAL || accessType == ALLINDEXED); // set varDim from variable const dimension& varDim = var->Dim(); SizeT varRank = varDim.Rank(); if( accessType == ALLINDEXED) { nIx=ixList[0]->NIter( (0NIter( (iDim().Stride(); return; } // NORMAL varStride = var->Dim().Stride(); assert( varStride[0] == 1); nIterLimit[0]=ixList[0]->NIter( (0 1) { nIterLimitGt1 = 1; // important for BuildIx gt1Rank = 0; if( ixList[0]->Indexed()) { baseIx = 0; indexed = true; } else { baseIx = ixList[0]->GetS();// * varStride[0]; indexed = false; } } else { nIterLimitGt1 = 0; // important for BuildIx if( ixList[0]->Indexed()) { baseIx = static_cast< ArrayIndexIndexed*>( ixList[0])->GetIx0();// * varStride[0]; } else { baseIx = ixList[0]->GetS();// * varStride[0]; } } for( SizeT i=1; iNIter( (i 1) { ++nIterLimitGt1; gt1Rank = i; if( ixList[i]->Indexed()) { indexed = true; } else { baseIx += ixList[i]->GetS() * varStride[i]; indexed = false; } } else { if( ixList[i]->Indexed()) { baseIx += static_cast< ArrayIndexIndexed*>( ixList[i])->GetIx0() * varStride[i]; } else { baseIx += ixList[i]->GetS() * varStride[i]; } } } stride[acRank]=stride[acRank-1]*nIterLimit[acRank-1]; // index stride } }; //class ArrayIndexListMultiAllIndexedT: public ArrayIndexListMultiT class ArrayIndexListGuard { private: ArrayIndexListT* aL; public: ArrayIndexListGuard(): aL( NULL) {} ArrayIndexListGuard(ArrayIndexListT* aLToGuard): aL( aLToGuard) {} ~ArrayIndexListGuard() { if( aL != NULL) aL->Clear(); } void reset( ArrayIndexListT* aL_) { aL = aL_;} ArrayIndexListT* release() { ArrayIndexListT* res = aL; aL = NULL; return res;} }; // called after structure is fixed (code in arrayindex.cpp) //ArrayIndexListT* MakeArrayIndex( ArrayIndexVectorT* ixList); void MakeArrayIndex( ArrayIndexVectorT* ixList, ArrayIndexListT** arrayIndexOut, ArrayIndexListT** arrayIndexNoAssocOut = NULL); #endif gdl-0.9.4/src/libinit_jmg.cpp0000664000175000017500000004037512217625432014521 0ustar marcmarc/*************************************************************************** libinit_jmg.cpp - initialization of GDL library routines ------------------- begin : 2004 copyright : (C) 2004 by Joel Gales email : jomoga@users.sourceforge.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ // the following is already done in "includefirst.hpp" // #ifdef HAVE_CONFIG_H // #include // #else // // default: assume we have HDF // #define USE_HDF 1 // #define USE_FFTW 1 // #endif #include "includefirst.hpp" #include #include #include "envt.hpp" #include "basic_fun_jmg.hpp" #include "math_fun_jmg.hpp" #include "basic_pro_jmg.hpp" #include "gsl_fun.hpp" #include "image.hpp" #include "plotting.hpp" #include "widget.hpp" #if defined(USE_HDF) #include "hdf_fun.hpp" #include "hdf_pro.hpp" #endif #if defined(USE_FFTW) #include "fftw.hpp" #endif #if defined(USE_EIGEN) #include "matrix_cholesky.hpp" #endif #include "gshhs.hpp" using namespace std; void LibInit_jmg() { const char KLISTEND[] = ""; // the following by Joel Gales const string sizeKey[]={"L64","DIMENSIONS","FILE_LUN","N_DIMENSIONS", "N_ELEMENTS","STRUCTURE","TNAME","TYPE",KLISTEND}; new DLibFunRetNew(lib::size,string("SIZE"),1,sizeKey); new DLibFunRetNew(lib::fstat,string("FSTAT"),1); const string routine_namesKey[]={"LEVEL","VARIABLES","FETCH","ARG_NAME", "STORE","S_FUNCTIONS","S_PROCEDURES", KLISTEND}; new DLibFun(lib::routine_names_value,string("ROUTINE_NAMES"),-1,routine_namesKey); const string invertKey[]={"DOUBLE",KLISTEND}; #if defined(USE_EIGEN) // new DLibFunRetNew(lib::invert_fun2,string("INVERT_EIG"),2,invertKey); new DLibPro(lib::choldc_pro,string("CHOLDC"),3,invertKey); new DLibFunRetNew(lib::cholsol_fun,string("CHOLSOL"),4,invertKey); const string lacholKey[]={"DOUBLE","STATUS","UPPER",KLISTEND}; new DLibPro(lib::la_choldc_pro,string("LA_CHOLDC"),4,lacholKey); new DLibFunRetNew(lib::la_cholsol_fun,string("LA_CHOLSOL"),4,lacholKey); #endif #if defined(HAVE_LIBGSL) && defined(HAVE_LIBGSLCBLAS) new DLibFunRetNew(lib::invert_fun,string("INVERT"),2,invertKey); const string fftKey[]={"DOUBLE","INVERSE","OVERWRITE","DIMENSION",KLISTEND}; #if defined(USE_FFTW) new DLibFun(lib::fftw_fun,string("FFT"),2,fftKey); #else new DLibFun(lib::fft_fun,string("FFT"),2,fftKey); #endif const string randomKey[]={"DOUBLE","GAMMA","LONG","NORMAL", "BINOMIAL","POISSON","UNIFORM",KLISTEND}; new DLibFunRetNew(lib::random_fun,string("RANDOMU"),MAXRANK,randomKey); new DLibFunRetNew(lib::random_fun,string("RANDOMN"),MAXRANK,randomKey); const string checkmathKey[]={"MASK","NOCLEAR","PRINT",KLISTEND}; new DLibFunRetNew(lib::check_math_fun,string("CHECK_MATH"),2,checkmathKey); const string histogramKey[]={"BINSIZE","INPUT","MAX","MIN","NBINS", "OMAX","OMIN","REVERSE_INDICES", "LOCATIONS","NAN",KLISTEND}; new DLibFunRetNew(lib::histogram_fun,string("HISTOGRAM"),1,histogramKey); const string interpolateKey[]={"CUBIC","GRID","MISSING","NEAREST_NEIGHBOUR",KLISTEND}; new DLibFunRetNew(lib::interpolate_fun,string("INTERPOLATE"),4,interpolateKey); const string la_triredKey[]={"DOUBLE","UPPER",KLISTEND}; new DLibPro(lib::la_trired_pro,string("LA_TRIRED"),3,la_triredKey); #endif const string macharKey[]={"DOUBLE",KLISTEND}; new DLibFunRetNew(lib::machar_fun,string("MACHAR"),0,macharKey); const string rk4Key[]={"DOUBLE",KLISTEND}; new DLibFunRetNew(lib::rk4jmg_fun,string("RK4JMG"),5,rk4Key); #if defined(USE_LIBPROJ4) const string map_proj_forwardKey[]={"CONNECTIVITY","FILL", "MAP_STRUCTURE","POLYGONS", "POLYLINES","RADIANS",KLISTEND}; new DLibFunRetNew(lib::map_proj_forward_fun, string("MAP_PROJ_FORWARD"),3,map_proj_forwardKey); const string map_proj_inverseKey[]={"RADIANS",KLISTEND}; new DLibFunRetNew(lib::map_proj_inverse_fun, string("MAP_PROJ_INVERSE"),3,map_proj_inverseKey); #endif // SA: GSHHS dataset // TODO: COASTS, CONTINENTS, ORIENTATION, LIMIT, // MAP_STRUCTURE, MLINESTYLE, MLINETHICK, SPACING, T3D, ZVALUE const string map_continentsKey[] = {"COLOR", "RIVERS", "COUNTRIES", "HIRES", "FILL_CONTINENTS", KLISTEND}; const string map_continentsWarnKey[] = {"USA", "COASTS", KLISTEND}; new DLibPro(lib::map_continents, string("MAP_CONTINENTS"), 0, map_continentsKey, map_continentsWarnKey); const string convert_coordKey[]={"DATA","DEVICE","NORMAL","T3D","DOUBLE", "TO_DATA","TO_DEVICE","TO_NORMAL",KLISTEND}; new DLibFunRetNew(lib::convert_coord,string("CONVERT_COORD"),3,convert_coordKey); const string finiteKey[]={"INFINITY","NAN","SIGN",KLISTEND}; new DLibFunRetNew(lib::finite_fun,string("FINITE"),1,finiteKey); const string radonKey[]={"BACKPROJECT","DOUBLE","DRHO","DX","DY", "GRAY","LINEAR","NRHO","NTHETA","NX","NY", "RHO","RMIN","THETA","XMIN","YMIN",KLISTEND}; new DLibFunRetNew(lib::radon_fun,string("RADON"),1,radonKey); #ifdef PL_HAVE_QHULL const string triangulateKey[]={"CONNECTIVITY", "SPHERE", "DEGREES", "FVALUE", "REPEATS", "TOLERANCE",KLISTEND}; new DLibPro(lib::triangulate,string("TRIANGULATE"),4,triangulateKey); const string qhullKey[]={"BOUNDS", "CONNECTIVITY", "DELAUNAY", "SPHERE", "VDIAGRAM" ,"VNORMALS", "VVERTICES", KLISTEND}; new DLibPro(lib::qhull,string("QHULL"),8,qhullKey); const string sph_scatKey[]={"BOUNDS", "BOUT", "GOUT", "GS", "NLON", "NLAT", KLISTEND}; new DLibFunRetNew(lib::sph_scat_fun,string("SPH_SCAT"),3,sph_scatKey); const string grid_inputKey[]={"SPHERE", "POLAR", "DEGREES", "DUPLICATES", "EPSILON", "EXCLUDE", KLISTEND}; new DLibPro(lib::grid_input,string("GRID_INPUT"),6,grid_inputKey); const string qgrid3Key[]={"DELTA", "DIMENSION", "MISSING", "START", KLISTEND}; new DLibFunRetNew(lib::qgrid3_fun,string("QGRID3"),5,qgrid3Key); #endif const string trigridKey[]={"MAX_VALUE","MISSING","NX","NY","MAP", KLISTEND}; new DLibFunRetNew(lib::trigrid_fun,string("TRIGRID"),6,trigridKey); const string poly_2dKey[]={"CUBIC","MISSING",KLISTEND}; new DLibFunRetNew(lib::poly_2d_fun,string("POLY_2D"),6,poly_2dKey); const string make_arrayKey[]={"NOZERO","DIMENSION","INDEX","SIZE", "TYPE","VALUE","BYTE","INTEGER", "UINT","LONG","ULONG","L64","UL64", "FLOAT","DOUBLE","COMPLEX", "DCOMPLEX","STRING","PTR","OBJ",KLISTEND}; new DLibFunRetNew(lib::make_array,string("MAKE_ARRAY"),MAXRANK,make_arrayKey); const string reformKey[]={"OVERWRITE",KLISTEND}; new DLibFun(lib::reform,string("REFORM"),MAXRANK,reformKey); new DLibPro(lib::point_lun,string("POINT_LUN"),2); new DLibPro(lib::linkimage,string("LINKIMAGE"),4); new DLibPro(lib::wait,string("WAIT"),1); #if defined(USE_HDF) const string hdf_openKey[]={"READ","RDWR","CREATE","ALL","NUM_DD","WRITE",KLISTEND}; new DLibFunRetNew(lib::hdf_open_fun,string("HDF_OPEN"),2,hdf_openKey); new DLibFunRetNew(lib::hdf_vg_getid_fun,string("HDF_VG_GETID"),2); const string hdf_vg_attachKey[]={"READ","WRITE",KLISTEND}; new DLibFunRetNew(lib::hdf_vg_attach_fun,string("HDF_VG_ATTACH"),2, hdf_vg_attachKey); const string hdf_vd_attachKey[]={"READ","WRITE",KLISTEND}; new DLibFunRetNew(lib::hdf_vd_attach_fun,string("HDF_VD_ATTACH"),2, hdf_vd_attachKey); new DLibFunRetNew(lib::hdf_vd_find_fun,string("HDF_VD_FIND"),2); const string hdf_vd_readKey[]={"FIELDS","NRECORDS","FULL_INTERLACE", "NO_INTERLACE",KLISTEND}; new DLibFunRetNew(lib::hdf_vd_read_fun,string("HDF_VD_READ"),2,hdf_vd_readKey); const string hdf_vg_getinfoKey[]={"CLASS","NAME","NENTRIES","REF","TAG", KLISTEND}; new DLibPro(lib::hdf_vg_getinfo_pro,string("HDF_VG_GETINFO"),1, hdf_vg_getinfoKey); const string hdf_vd_getKey[]={"CLASS","NAME","COUNT","REF","TAG",KLISTEND}; new DLibPro(lib::hdf_vd_get_pro,string("HDF_VD_GET"),1, hdf_vd_getKey); new DLibPro(lib::hdf_vg_gettrs_pro,string("HDF_VG_GETTRS"),3); new DLibPro(lib::hdf_vg_detach_pro,string("HDF_VG_DETACH"),1); new DLibPro(lib::hdf_vd_detach_pro,string("HDF_VD_DETACH"),1); const string hdf_sd_createKey[]={"BYTE","DFNT_INT8","DFNT_UINT8", "SHORT","INT","DFNT_INT16","DFNT_UINT16", "LONG","DFNT_INT32","DFNT_UINT32", "FLOAT","DFNT_FLOAT32", "DOUBLE","DFNT_FLOAT64", "STRING","DFNT_CHAR","HDF_TYPE",KLISTEND}; new DLibFunRetNew(lib::hdf_sd_create_fun,string("HDF_SD_CREATE"),3, hdf_sd_createKey); const string hdf_sd_startKey[]={"READ","RDWR","CREATE",KLISTEND}; new DLibFunRetNew(lib::hdf_sd_start_fun,string("HDF_SD_START"),2,hdf_sd_startKey); new DLibFunRetNew(lib::hdf_sd_nametoindex_fun,string("HDF_SD_NAMETOINDEX"),2); new DLibFunRetNew(lib::hdf_sd_attrfind_fun,string("HDF_SD_ATTRFIND"),2); new DLibFunRetNew(lib::hdf_sd_select_fun,string("HDF_SD_SELECT"),2); const string hdf_sd_getdataKey[]={"START","STRIDE","COUNT",KLISTEND}; new DLibPro(lib::hdf_sd_getdata_pro,string("HDF_SD_GETDATA"),2, hdf_sd_getdataKey); const string hdf_sd_adddataKey[]={"START","STRIDE","COUNT",KLISTEND}; new DLibPro(lib::hdf_sd_adddata_pro,string("HDF_SD_ADDDATA"),2, hdf_sd_adddataKey); new DLibPro(lib::hdf_sd_fileinfo_pro,string("HDF_SD_FILEINFO"),3); const string hdf_sd_getinfoKey[]={"DIMS","HDF_TYPE","NAME", "NATTS","NDIMS","TYPE", "LABEL","UNIT","FORMAT","COORDSYS", KLISTEND}; new DLibPro(lib::hdf_sd_getinfo_pro,string("HDF_SD_GETINFO"),1, hdf_sd_getinfoKey); const string hdf_sd_attrinfoKey[]={"COUNT","DATA","HDF_TYPE","NAME", "TYPE",KLISTEND}; new DLibPro(lib::hdf_sd_attrinfo_pro,string("HDF_SD_ATTRINFO"),2, hdf_sd_attrinfoKey); new DLibPro(lib::hdf_sd_endaccess_pro,string("HDF_SD_ENDACCESS"),1); new DLibPro(lib::hdf_sd_end_pro,string("HDF_SD_END"),1); new DLibPro(lib::hdf_close_pro,string("HDF_CLOSE"),1); new DLibFunRetNew(lib::hdf_sd_dimgetid_fun, string("HDF_SD_DIMGETID"), 2); const string hdf_sd_dimgetKey[] = { "NAME", "NATTR", "SCALE", "COUNT", KLISTEND }; const string hdf_sd_dimgetWarnKey[] = { "COMPATIBILITY", "FORMAT", "LABEL", "TYPE", "UNIT", KLISTEND }; new DLibPro(lib::hdf_sd_dimget_pro, string("HDF_SD_DIMGET"), 1, hdf_sd_dimgetKey, hdf_sd_dimgetWarnKey); #endif const string tvKey[]={"TRUE","NORMAL","CHANNEL","XSIZE","YSIZE","ORDER","DEVICE","DATA",KLISTEND}; new DLibPro(lib::tv,string("TV"),4,tvKey); const string tvrdKey[]={"CHANNEL","ORDER","TRUE","WORDS",KLISTEND}; new DLibFunRetNew(lib::tvrd,string("TVRD"),5,tvrdKey); const string loadctKey[]={"GET_NAMES","BOTTOM","NCOLORS","RGB_TABLE","SILENT",KLISTEND}; const string loadctWarnKey[]={"FILE",KLISTEND}; new DLibPro(lib::loadct,string("LOADCT_INTERNALGDL"),1,loadctKey,loadctWarnKey); const string widget_baseKey[] = {"ALIGN_BOTTOM","ALIGN_CENTER","ALIGN_LEFT","ALIGN_RIGHT","ALIGN_TOP","MBAR","MODAL","BASE_ALIGN_BOTTOM","BASE_ALIGN_CENTER","BASE_ALIGN_LEFT","BASE_ALIGN_RIGHT","BASE_ALIGN_TOP","COLUMN","ROW","CONTEXT_EVENTS","CONTEXT_MENU","EVENT_FUNC","EVENT_PRO","EXCLUSIVE","NONEXCLUSIVE","FLOATING","FRAME","FUNC_GET_VALUE","GRID_LAYOUT","GROUP_LEADER","KBRD_FOCUS_EVENTS","KILL_NOTIFY","MAP","NO_COPY","NOTIFY_REALIZE","PRO_SET_VALUE","SCR_XSIZE","SCR_YSIZE","SCROLL","SENSITIVE","SPACE","TITLE","TLB_FRAME_ATTR","TLB_ICONIFY_EVENTS","TLB_KILL_REQUEST_EVENTS","TLB_MOVE_EVENTS","TLB_SIZE_EVENTS","TOOLBAR","TRACKING_EVENTS","UNITS","UNAME","UVALUE","XOFFSET","XPAD","XSIZE","X_SCROLL_SIZE","YOFFSET","YPAD","YSIZE","Y_SCROLL_SIZE","DISPLAY_NAME","RESOURCE_NAME","RNAME_MBAR",KLISTEND}; new DLibFunRetNew(lib::widget_base,string("WIDGET_BASE"),1,widget_baseKey); const string widget_buttonKey[] = {"ACCELERATOR","ALIGN_CENTER","ALIGN_LEFT","ALIGN_RIGHT","BITMAP","CHECKED_MENU","DYNAMIC_RESIZE","EVENT_FUNC","EVENT_PRO","FONT","FRAME","FUNC_GET_VALUE","GROUP_LEADER","HELP","KILL_NOTIFY","MENU","NO_COPY","NO_RELEASE","NOTIFY_REALIZE","PRO_SET_VALUE","PUSHBUTTON_EVENTS","SCR_XSIZE","SCR_YSIZE","SENSITIVE","SEPARATOR","TAB_MODE","TOOLTIP","TRACKING_EVENTS","UNAME","UNITS","UVALUE","VALUE","X_BITMAP_EXTRA","XOFFSET","XSIZE","YOFFSET","YSIZE",KLISTEND}; new DLibFunRetNew(lib::widget_button,string("WIDGET_BUTTON"),1,widget_buttonKey); const string widget_droplistKey[] = {"DYNAMIC_RESIZE","EVENT_FUNC","EVENT_PRO","FONT","FRAME","FUNC_GET_VALUE","GROUP_LEADER","KILL_NOTIFY","NO_COPY","NOTIFY_REALIZE","PRO_SET_VALUE","RESOURCE_NAME","SCR_XSIZE","SCR_YSIZE","SENSITIVE","TAB_MODE","TITLE","TRACKING_EVENTS","UNAME","UNITS","UVALUE","VALUE","XOFFSET","XSIZE","YOFFSET","YSIZE",KLISTEND}; new DLibFunRetNew(lib::widget_droplist,string("WIDGET_DROPLIST"),1,widget_droplistKey); const string widget_listKey[] = {"CONTEXT_EVENTS","EVENT_FUNC","EVENT_PRO","FONT","FRAME","FUNC_GET_VALUE","GROUP_LEADER","KILL_NOTIFY","MULTIPLE","NO_COPY","NOTIFY_REALIZE","PRO_SET_VALUE","RESOURCE_NAME","SCR_XSIZE","SCR_YSIZE","SENSITIVE","TAB_MODE","TRACKING_EVENTS","UNAME","UNITS","UVALUE","VALUE","XOFFSET","XSIZE","YOFFSET","YSIZE",KLISTEND}; new DLibFunRetNew(lib::widget_list,string("WIDGET_LIST"),1,widget_listKey); const string widget_bgroupKey[] = {"BUTTON_UVALUE","COLUMN","EVENT_FUNC","EXCLUSIVE","NONEXCLUSIVE","SPACE","XPAD","YPAD","FONT","FRAME","IDS","LABEL_LEFT","LABEL_TOP","MAP","NO_RELEASE","RETURN_ID","RETURN_INDEX","RETURN_NAME","ROW","SCROLL","SET_VALUE","TAB_MODE","X_SCROLL_SIZE","Y_SCROLL_SIZE","SET_VALUE","UNAME","UVALUE","XOFFSET","XSIZE","YOFFSET","YSIZE",KLISTEND}; new DLibFunRetNew(lib::widget_bgroup,string("CW_BGROUP"),2,widget_bgroupKey); const string widget_textKey[] = {"ALL_EVENTS","CONTEXT_EVENTS","EDITABLE","EVENT_FUNC","EVENT_PRO","FONT","FRAME","FUNC_GET_VALUE","GROUP_LEADER","IGNORE_ACCELERATORS","KBRD_FOCUS_EVENTS","KILL_NOTIFY","NO_COPY","NO_NEWLINE","NOTIFY_REALIZE","PRO_SET_VALUE","RESOURCE_NAME","SCR_XSIZE","SCR_YSIZE","SCROLL","SENSITIVE","TAB_MODE","TRACKING_EVENTS","UNAME","UNITS","UVALUE","VALUE","WRAP","XOFFSET","XSIZE","YOFFSET","YSIZE",KLISTEND}; new DLibFunRetNew(lib::widget_text,string("WIDGET_TEXT"),1,widget_textKey); const string widget_labelKey[] = {"ALL_EVENTS","CONTEXT_EVENTS","EDITABLE","EVENT_FUNC","EVENT_PRO","FONT","FRAME","FUNC_GET_VALUE","GROUP_LEADER","IGNORE_ACCELERATORS","KBRD_FOCUS_EVENTS","KILL_NOTIFY","NO_COPY","NO_NEWLINE","NOTIFY_REALIZE","PRO_SET_VALUE","RESOURCE_NAME","SCR_XSIZE","SCR_YSIZE","SCROLL","SENSITIVE","TAB_MODE","TRACKING_EVENTS","UNAME","UNITS","UVALUE","VALUE","WRAP","XOFFSET","XSIZE","YOFFSET","YSIZE",KLISTEND}; new DLibFunRetNew(lib::widget_label,string("WIDGET_LABEL"),1,widget_labelKey); const string widget_infoKey[] = {"VALID","MODAL","MANAGED","XMANAGER_BLOCK","CHILD","VERSION", KLISTEND}; new DLibFunRetNew(lib::widget_info,string("WIDGET_INFO"),1,widget_infoKey); const string widget_eventKey[] = {"XMANAGER_BLOCK","DESTROY", KLISTEND}; new DLibFunRetNew(lib::widget_event,string("WIDGET_EVENT"),1,widget_eventKey); const string widget_controlKey[] = {"REALIZE","MANAGED","EVENT_PRO", "XMANAGER_ACTIVE_COMMAND","DESTROY", "GET_UVALUE","SET_UVALUE","SET_VALUE", "MAP","FUNC_GET_VALUE","PRO_SET_VALUE", "SET_UNAME","NO_COPY","SET_BUTTON", "SET_DROPLIST_SELECT","SENSITIVE", "GET_VALUE",KLISTEND}; new DLibPro(lib::widget_control,string("WIDGET_CONTROL"),1, widget_controlKey); // call_external (by Christoph Fuchs) const string call_externalKey[] = {"VALUE", "ALL_VALUE", "RETURN_TYPE", "B_VALUE", "I_VALUE", "L_VALUE", "F_VALUE", "D_VALUE", "UI_VALUE", "UL_VALUE", "L64_VALUE", "UL64_VALUE", "S_VALUE", "UNLOAD", "ALL_GDL", "STRUCT_ALIGN_BYTES", KLISTEND }; new DLibFunRetNew(lib::call_external, string("CALL_EXTERNAL"), -1, call_externalKey); } gdl-0.9.4/src/libinit_gm.cpp0000664000175000017500000000453412217457527014354 0ustar marcmarc/*************************************************************************** math_fun_gm.cpp - math GDL library function (GM) ------------------- begin : 03 May 2007 copyright : (C) 2007 by Gregory Marchal email : gregory.marchal_at_obspm.fr website : http://format.obspm.fr/~m1/gmarchal/ ****************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" #if defined(HAVE_LIBGSL) #include #include #endif #include "math_fun_gm.hpp" using namespace std; void LibInit_gm() { const char KLISTEND[] = ""; #if defined(HAVE_LIBGSL) const string erfKey[]={"DOUBLE",KLISTEND}; new DLibFunRetNew(lib::erf_fun,string("ERF"),1,erfKey); const string errorfKey[]={"DOUBLE",KLISTEND}; new DLibFunRetNew(lib::errorf_fun,string("ERRORF"),1,errorfKey); const string erfcKey[]={"DOUBLE",KLISTEND}; new DLibFunRetNew(lib::erfc_fun,string("ERFC"),1,erfcKey); const string gammaKey[]={"DOUBLE",KLISTEND}; new DLibFunRetNew(lib::gamma_fun,string("GAMMA"),1,gammaKey); const string lngammaKey[]={"DOUBLE",KLISTEND}; new DLibFunRetNew(lib::lngamma_fun,string("LNGAMMA"),1,lngammaKey); const string igammaKey[]={"DOUBLE",KLISTEND}; new DLibFunRetNew(lib::igamma_fun,string("IGAMMA"),2,igammaKey); const string betaKey[]={"DOUBLE",KLISTEND}; new DLibFunRetNew(lib::beta_fun,string("BETA"),2,betaKey); const string expintKey[]={"DOUBLE",KLISTEND}; new DLibFunRetNew(lib::expint_fun,string("EXPINT"),2,expintKey); const string gaussintKey[]={"DOUBLE",KLISTEND}; new DLibFunRetNew(lib::gaussint_fun,string("GAUSSINT"),1,gaussintKey); #endif } gdl-0.9.4/src/gdlxstream.cpp0000664000175000017500000003162512151616315014377 0ustar marcmarc/* ************************************************************************* gdlxstream.cpp - graphic stream x windows ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /* ************************************************************************* * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" #include #include "graphics.hpp" #include "gdlxstream.hpp" #ifndef HAVE_X #else using namespace std; // bool GDLXStream::plstreamInitCalled = false; void GDLXStream::Init() { // plstream::init() calls exit() if it cannot establish a connection with X-server { Display* display = XOpenDisplay(NULL); if (display == NULL) { valid = false; ThrowGDLException("Cannot connect to X server"); } XCloseDisplay(display); } // if( !plstreamInitCalled) // { this->plstream::init(); // plstreamInitCalled = true; // } // set_stream(); // private plgpls( &pls); XwDev *dev = (XwDev *) pls->dev; XwDisplay *xwd = (XwDisplay *) dev->xwd; wm_protocols = XInternAtom( xwd->display, "WM_PROTOCOLS", false); wm_delete_window = XInternAtom( xwd->display, "WM_DELETE_WINDOW", false); XSetWMProtocols( xwd->display, dev->window, &wm_delete_window, 1); XFlush( xwd->display); } void GDLXStream::EventHandler() { if( !valid) return; // dummy call to get private function set_stream() called // char dummy; // gesc( &dummy); // // plgpls( &pls); XwDev *dev = (XwDev *) pls->dev; // if( dev == NULL) // this->plstream::init(); // // plgpls( &pls); // // dev = (XwDev *) pls->dev; if( dev == NULL) { cerr << "X window invalid." << endl; valid = false; return; } XwDisplay *xwd = (XwDisplay *) dev->xwd; if( xwd == NULL) { cerr << "X window not set." << endl; valid = false; return; } XEvent event; if( XCheckTypedWindowEvent( xwd->display, dev->window, ClientMessage, &event)) { if( event.xclient.message_type == wm_protocols && event.xclient.data.l[0] == wm_delete_window) { valid = false; return; // no more event handling } else XPutBackEvent( xwd->display, &event); } // plplot event handler plstream::cmd( PLESC_EH, NULL); } void GDLXStream::GetGeometry( long& xSize, long& ySize, long& xoff, long& yoff) { // plplot does not return the real size XwDev *dev = (XwDev *) pls->dev; XwDisplay *xwd = (XwDisplay *) dev->xwd; XWindowAttributes win_attr; /* query the window's attributes. */ Status rc = XGetWindowAttributes(xwd->display, dev->window, &win_attr); xSize = win_attr.width; ySize = win_attr.height; PLFLT xp; PLFLT yp; PLINT xleng; PLINT yleng; PLINT plxoff; PLINT plyoff; plstream::gpage( xp, yp, xleng, yleng, plxoff, plyoff); xoff = plxoff; yoff = plyoff; if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"GDLXStream::GetGeometry(%ld %ld %ld %ld)\n", xSize, ySize, xoff, yoff); } // plplot 5.3 does not provide the clear function for c++ void GDLXStream::Clear() { // dummy call to get private function set_stream() called // PLFLT a=0.0,b=0.0,c=0.0,d,e,f; // RGB_HLS( a,b,c,&d,&e,&f); char dummy; gesc( &dummy); // this mimics better the *DL behaviour. ::c_plbop(); //plclear clears only the current subpage. // ::c_plclear(); } void GDLXStream::Clear( DLong bColor) { // dummy call to get private function set_stream() called // PLFLT a=0.0,b=0.0,c=0.0,d,e,f; // RGB_HLS( a,b,c,&d,&e,&f); char dummy; gesc( &dummy); PLINT r0,g0,b0; PLINT r1,g1,b1; DByte rb, gb, bb; // Get current background color plgcolbg (&r0, &g0, &b0); // Get desired background color GDLCT* actCT = Graphics::GetCT(); actCT->Get( bColor, rb, gb, bb); // Convert to PLINT from GDL_BYTE r1 = (PLINT) rb; g1 = (PLINT) gb; b1 = (PLINT) bb; // this mimics better the *DL behaviour. ::c_plbop(); plscolbg (r1, g1, b1); //plclear clears only the current subpage. // ::c_plclear(); // // plscolbg (r0, g0, b0); } void GDLXStream::Raise() { XwDev *dev = (XwDev *) pls->dev; XwDisplay *xwd = (XwDisplay *) dev->xwd; XRaiseWindow(dev->xwd->display, dev->window); } void GDLXStream::Lower() { XwDev *dev = (XwDev *) pls->dev; XwDisplay *xwd = (XwDisplay *) dev->xwd; XLowerWindow(dev->xwd->display, dev->window); } void GDLXStream::Iconic() { XwDev *dev = (XwDev *) pls->dev; XwDisplay *xwd = (XwDisplay *) dev->xwd; XIconifyWindow(xwd->display, dev->window,xwd->screen); } void GDLXStream::DeIconic() { XwDev *dev = (XwDev *) pls->dev; XwDisplay *xwd = (XwDisplay *) dev->xwd; XMapWindow(dev->xwd->display, dev->window); } void GDLXStream::Flush() { XwDev *dev = (XwDev *) pls->dev; XwDisplay *xwd = (XwDisplay *) dev->xwd; XFlush( xwd->display); } void GDLXStream::WarpPointer(DLong x, DLong y) { XwDev *dev = (XwDev *) pls->dev; XwDisplay *xwd = (XwDisplay *) dev->xwd; XWarpPointer( xwd->display, None, dev->window, 0, 0, 0, 0, x, dev->height-y ); } void GDLXStream::setDoubleBuffering() { XwDev *dev = (XwDev *) pls->dev; dev->write_to_window = 0; pls->db = 1; } void GDLXStream::unSetDoubleBuffering() { XwDev *dev = (XwDev *) pls->dev; dev->write_to_window = 1; pls->db = 0; } bool GDLXStream::hasDoubleBuffering() { return true; } bool GDLXStream::GetGin( PLGraphicsIn *gin, int mode) { bool status=true; bool warp=false; int dx,dy; XwDev *dev = (XwDev *) pls->dev; XwDisplay *xwd = (XwDisplay *) dev->xwd; if (mode == 0) { Window root, child; int root_x, root_y, x,y; unsigned int state; XQueryPointer(xwd->display, dev->window, &root, &child, &root_x, &root_y, &x, &y, &state ) ; gin->pX = x; gin->pY = dev->height - y; gin->state = state; gin->dX = (PLFLT) gin->pX / ( dev->width - 1 ); gin->dY = (PLFLT) gin->pY / ( dev->height - 1 ); gin->string[0] = '\0'; gin->keysym = 0x20; gin->button = 0; return true; } int x, x1, xmin = 0, xmax = (int) dev->width - 1; int y, y1, ymin = 0, ymax = (int) dev->height - 1; XWMHints gestw; XSizeHints sizehints,initialstate; long hints_supplied; /* get normal state of the window */ XGetWMNormalHints(xwd->display, dev->window,&initialstate,&hints_supplied); /* force fixed size to prevent a change of window size with the cursor*/ sizehints.min_width=sizehints.max_width=dev->width; sizehints.min_height=sizehints.max_height=dev->height; sizehints.flags=(PMinSize|PMaxSize); XSetWMNormalHints(xwd->display, dev->window,&sizehints); /* add focus to the window on (all) displays */ gestw.input = TRUE; gestw.flags = InputHint; XSetWMHints(xwd->display, dev->window, &gestw); unsigned long event_mask= PointerMotionMask | KeyPressMask; switch (mode) { case 1: case 3: event_mask |= ButtonPressMask; break; case 4: event_mask |= ButtonPressMask | ButtonReleaseMask; break; case 2: event_mask |= ButtonPressMask | ButtonReleaseMask; } XEvent event; //do our own event handling int first=0; XSelectInput(xwd->display, dev->window, event_mask); XRaiseWindow(xwd->display, dev->window); XFlush(xwd->display); while(1) { XWindowEvent(xwd->display, dev->window, event_mask, &event); switch (event.type) { int nchars; KeySym mykey; case KeyPress: // exit in error if ^C gin->pX = event.xkey.x; gin->pY = event.xkey.y; gin->state = event.xkey.state; nchars = XLookupString(&event.xkey, gin->string, PL_MAXKEY - 1, &mykey, NULL); gin->string[nchars] = '\0'; gin->keysym = (unsigned int) mykey; if (gin->state&4 && (gin->keysym==67 || gin->keysym==99)) { status=false; goto end; } warp=false; dx=0; dy=0; switch(mykey) { case XK_Cancel: case XK_Break: status = false; goto end; case XK_Left: dx=-1; warp=true; break; case XK_Up: dy=-1; warp=true; break; case XK_Right: dx=1; warp=true; break; case XK_Down: dy=1; warp=true; break; } if (warp) { // Each modifier key added increases the multiplication factor by 5 // Shift if ( gin->state & 0x01 ) { dx *= 5; dy *= 5; } // Caps Lock if ( gin->state & 0x02 ) { dx *= 5; dy *= 5; } // Control if ( gin->state & 0x04 ) { dx *= 5; dy *= 5; } // Alt if ( gin->state & 0x08 ) { dx *= 5; dy *= 5; } // Bounds checking so that we don't send cursor out of window x1 = gin->pX + dx; y1 = gin->pY + dy; if ( x1 < xmin ) dx = xmin - gin->pX; if ( y1 < ymin ) dy = ymin - gin->pY; if ( x1 > xmax ) dx = xmax - gin->pX; if ( y1 > ymax ) dy = ymax - gin->pY; XWarpPointer( xwd->display, dev->window, None, 0, 0, 0, 0, dx, dy ); } break; case MotionNotify: gin->pX = event.xmotion.x; gin->pY = event.xmotion.y; gin->state = event.xmotion.state; gin->string[0] = '\0'; gin->keysym = 0x20; // fprintf(stderr,"motion %d %d, state %d\n",gin->pX,gin->pY,gin->state); if (mode==2) goto end; // crosshair not available if we exit on motion!!! if(event.type==MotionNotify){ x=event.xmotion.x; y=event.xmotion.y; } else { x=event.xcrossing.x; y=event.xcrossing.y; } if (!first) first=1; else { XDrawLines( xwd->display, dev->window, xwd->gcXor, dev->xhair_x, 2, CoordModeOrigin ); XDrawLines( xwd->display, dev->window, xwd->gcXor, dev->xhair_y, 2, CoordModeOrigin ); } dev->xhair_x[0].x = (short) xmin; dev->xhair_x[0].y = (short) y; dev->xhair_x[1].x = (short) xmax; dev->xhair_x[1].y = (short) y; dev->xhair_y[0].x = (short) x; dev->xhair_y[0].y = (short) ymin; dev->xhair_y[1].x = (short) x; dev->xhair_y[1].y = (short) ymax; XDrawLines( xwd->display, dev->window, xwd->gcXor, dev->xhair_x, 2, CoordModeOrigin ); XDrawLines( xwd->display, dev->window, xwd->gcXor, dev->xhair_y, 2, CoordModeOrigin ); break; case ButtonPress: gin->pX = event.xbutton.x; gin->pY = event.xbutton.y; gin->state = event.xbutton.state; gin->button = event.xbutton.button; gin->string[0] = '\0'; gin->keysym = 0x20; XSync(xwd->display, true); if (mode==4) break; goto end; //always exit on this event case ButtonRelease: gin->pX = event.xbutton.x; gin->pY = event.xbutton.y; gin->state = event.xbutton.state; gin->button = event.xbutton.button; gin->string[0] = '\0'; gin->keysym = 0x20; XSync(xwd->display, true); goto end; //always exit on this event default: break; } } end: if(first) { XDrawLines( xwd->display, dev->window, xwd->gcXor, dev->xhair_x, 2, CoordModeOrigin ); XDrawLines( xwd->display, dev->window, xwd->gcXor, dev->xhair_y, 2, CoordModeOrigin ); } gin->pY = dev->height - gin->pY; gin->dX = (PLFLT) gin->pX / ( dev->width - 1 ); gin->dY = (PLFLT) gin->pY / ( dev->height - 1 ); //give back plplot's handling: XSelectInput(xwd->display, dev->window,dev->event_mask); /* restore old hints */ XSetWMNormalHints(xwd->display, dev->window, &initialstate); /* remove focus to the window on (all) displays */ gestw.input = FALSE; gestw.flags = InputHint; XSetWMHints(xwd->display, dev->window, &gestw); /* give back the right to change the window size*/ sizehints.min_width=0; sizehints.max_width=XWidthOfScreen(XDefaultScreenOfDisplay(xwd->display)); sizehints.min_height=32; sizehints.max_height=XHeightOfScreen(XDefaultScreenOfDisplay(xwd->display)); sizehints.flags=(PMinSize|PMaxSize); XSetWMNormalHints(xwd->display, dev->window,&sizehints); XFlush(xwd->display); return status; } #endif gdl-0.9.4/src/basic_fun.hpp0000664000175000017500000001127312171741033014156 0ustar marcmarc/*************************************************************************** basic_fun.hpp - basic GDL library functions ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifndef BASIC_FUN_HPP_ #define BASIC_FUN_HPP_ namespace lib { // also used from basic_fun_jmg.cpp void arr( EnvT* e, dimension& dim, SizeT pOffs=0); BaseGDL* get_kbrd( EnvT* e); BaseGDL* bytarr( EnvT* e); BaseGDL* intarr( EnvT* e); BaseGDL* uintarr( EnvT* e); BaseGDL* lonarr( EnvT* e); BaseGDL* ulonarr( EnvT* e); BaseGDL* lon64arr( EnvT* e); BaseGDL* ulon64arr( EnvT* e); BaseGDL* fltarr( EnvT* e); BaseGDL* dblarr( EnvT* e); BaseGDL* strarr( EnvT* e); BaseGDL* complexarr( EnvT* e); BaseGDL* dcomplexarr( EnvT* e); BaseGDL* ptrarr( EnvT* e); BaseGDL* objarr( EnvT* e); BaseGDL* ptr_valid( EnvT* e); BaseGDL* obj_valid( EnvT* e); BaseGDL* ptr_new( EnvT* e); BaseGDL* obj_new( EnvT* e); BaseGDL* call_function( EnvT* e); BaseGDL* call_method_function( EnvT* e); BaseGDL* bindgen( EnvT* e); BaseGDL* indgen( EnvT* e); BaseGDL* uindgen( EnvT* e); BaseGDL* sindgen( EnvT* e); BaseGDL* lindgen( EnvT* e); BaseGDL* ulindgen( EnvT* e); BaseGDL* l64indgen( EnvT* e); BaseGDL* ul64indgen( EnvT* e); BaseGDL* findgen( EnvT* e); BaseGDL* dindgen( EnvT* e); BaseGDL* cindgen( EnvT* e); BaseGDL* dcindgen( EnvT* e); BaseGDL* n_elements( EnvT* e); BaseGDL* execute( EnvT* e); BaseGDL* assoc( EnvT* e); BaseGDL* byte_fun( EnvT* e); BaseGDL* fix_fun( EnvT* e); BaseGDL* uint_fun( EnvT* e); BaseGDL* long_fun( EnvT* e); BaseGDL* ulong_fun( EnvT* e); BaseGDL* long64_fun( EnvT* e); BaseGDL* ulong64_fun( EnvT* e); BaseGDL* float_fun( EnvT* e); BaseGDL* double_fun( EnvT* e); BaseGDL* string_fun( EnvT* e); BaseGDL* complex_fun( EnvT* e); BaseGDL* dcomplex_fun( EnvT* e); BaseGDL* gdl_logical_and( EnvT* e); BaseGDL* gdl_logical_or( EnvT* e); BaseGDL* logical_true( BaseGDL* p0, bool isReference);//( EnvT* e); BaseGDL* replicate( EnvT* e); BaseGDL* strcompress( EnvT* e); BaseGDL* strlowcase( BaseGDL* p0, bool isReference);//( EnvT* e); BaseGDL* strupcase( BaseGDL* p0, bool isReference);//( EnvT* e); BaseGDL* strlen( BaseGDL* p0, bool isReference);//( EnvT* e); BaseGDL* strmid( EnvT* e); BaseGDL* strpos( EnvT* e); BaseGDL* strtrim( EnvT* e); BaseGDL* where( EnvT* e); BaseGDL* total( EnvT* e); BaseGDL* product( EnvT* e); BaseGDL* n_params( EnvT* e); BaseGDL* keyword_set( EnvT* e); BaseGDL* array_equal( EnvT* e); BaseGDL* min_fun( EnvT* e); BaseGDL* max_fun( EnvT* e); BaseGDL* transpose( EnvT* e); BaseGDL* sort_fun( EnvT* e); BaseGDL* median( EnvT* e); BaseGDL* shift_fun( EnvT* e); BaseGDL* arg_present( EnvT* e); BaseGDL* eof_fun( EnvT* e); BaseGDL* strjoin( EnvT* e); // BaseGDL* convol( EnvT* e); BaseGDL* rebin_fun( EnvT* e); BaseGDL* obj_class( EnvT* e); BaseGDL* obj_isa( EnvT* e); BaseGDL* n_tags( EnvT* e); BaseGDL* bytscl( EnvT* e); BaseGDL* routine_info( EnvT* e); BaseGDL* temporary( EnvT* e); BaseGDL* memory(EnvT* e); // the following by Peter Messmer // (messmer@users.sourceforge.net) BaseGDL* strtok_fun( EnvT* e); // strsplit BaseGDL* getenv_fun( EnvT* e); BaseGDL* tag_names_fun( EnvT* e); BaseGDL* stregex_fun( EnvT* e); BaseGDL* strcmp_fun( EnvT* e); BaseGDL* create_struct( EnvT* e); BaseGDL* rotate( EnvT* e); // the following by Sylwester Arabas // (slayoo@users.sourceforge.net) BaseGDL* reverse( EnvT* e); BaseGDL* parse_url( EnvT* e); BaseGDL* locale_get( EnvT* e); BaseGDL* get_login_info( EnvT* e); BaseGDL* command_line_args_fun(EnvT* e); BaseGDL* idl_base64(EnvT* e); BaseGDL* get_drive_list(EnvT* e); BaseGDL* scope_varfetch_value( EnvT* e); // regular library function BaseGDL** scope_varfetch_reference( EnvT* e); // special version for LEval() } // namespace #endif gdl-0.9.4/src/image.cpp0000664000175000017500000000766112071332166013312 0ustar marcmarc/*************************************************************************** image.cpp - GDL image routines ------------------- begin : Jul 20 2004 copyright : (C) 2004 by Joel Gales email : jomoga@users.sourceforge.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ // PLplot is used for direct graphics #include "includefirst.hpp" #include "graphics.hpp" #include "image.hpp" // #define ToXColor(a) (((0xFF & (a)) << 8) | (a)) // #define free_mem(a) \ // if (a != NULL) { free((void *) a); a = NULL; } using namespace std; namespace lib { void tv( EnvT* e) { Graphics* actDevice = Graphics::GetDevice(); actDevice->TV( e); } BaseGDL* tvrd( EnvT* e) { Graphics* actDevice = Graphics::GetDevice(); return actDevice->TVRD( e); } void loadct( EnvT* e) // = LOADCT_INTERNALGDL for exclusive use by LOADCT { SizeT nCT = Graphics::N_CT(); static int get_namesIx = e->KeywordIx( "GET_NAMES"); bool get_names = e->KeywordPresent( get_namesIx); if( get_names) { e->AssureGlobalKW( get_namesIx); DStringGDL* names = new DStringGDL( nCT, BaseGDL::NOZERO); for( SizeT i=0; iName(); e->SetKW( get_namesIx, names); return; //correct behaviour. } if( e->NParam() == 0) return; //FIXME should list tables names, promt for number and load it! DLong iCT; DByte r[256], g[256], b[256]; PLINT rint[256], gint[256], bint[256]; //load original table GDLCT* actCT = Graphics::GetCT(); actCT->Get(rint,gint,bint,256); e->AssureLongScalarPar( 0, iCT); if( iCT < 0 || iCT >= nCT) e->Throw( "Table number must be from 0 to "+i2s(nCT-1)); Graphics* actDevice = Graphics::GetDevice(); GDLGStream* actStream = actDevice->GetStream( false); // no open Graphics::LoadCT( iCT); //new table is: actCT = Graphics::GetCT(); #define MAX_COLORS 256 DLong bottom=0; DLong ncolors=MAX_COLORS; if ( e->KeywordSet ( "BOTTOM" ) ) e->AssureLongScalarKWIfPresent ( "BOTTOM", bottom ); if ( e->KeywordSet ( "NCOLORS" ) ) e->AssureLongScalarKWIfPresent ( "NCOLORS", ncolors ); if (bottom < 0) bottom=0; if (bottom > MAX_COLORS-1) bottom=MAX_COLORS-1; if (ncolors < 1) ncolors=1; if (ncolors > MAX_COLORS) ncolors=MAX_COLORS; if (bottom+ncolors > MAX_COLORS) ncolors=MAX_COLORS-bottom; #undef MAX_COLORS for( SizeT i=0, j=bottom ; jGet( i, r[ i], g[ i], b[ i]); //update section of colors rint[j] = (PLINT) r[i]; gint[j] = (PLINT) g[i]; bint[j] = (PLINT) b[i]; } static int rgbtableIx = e->KeywordIx( "RGB_TABLE"); if( e->KeywordPresent( rgbtableIx) ) { e->AssureGlobalKW( rgbtableIx); DByteGDL* rgbtable = new DByteGDL( dimension(ncolors, 3), BaseGDL::NOZERO); for( SizeT i=0, j=bottom ; jSetKW( rgbtableIx, rgbtable); return; //correct behaviour. } if (actStream != NULL) actStream->scmap1( rint, gint, bint, 256); } } // namespace gdl-0.9.4/src/includefirst.hpp0000664000175000017500000000427312116107025014716 0ustar marcmarc/*************************************************************************** includefirst.hpp - include this first ------------------- begin : Wed Apr 18 16:58:14 JST 2005 copyright : (C) 2002-2006 by Marc Schellens email : m_schellens@users.sourceforge.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifndef INCLUDEFIRST_HPP_ #define INCLUDEFIRST_HPP_ #ifdef HAVE_CONFIG_H #include #endif //#else //#error "config.h required. Compile with -DHAVE_CONFIG_H" //#endif #ifdef _MSC_VER #define NOMINMAX #endif // Python.h must be included before everything else #if defined(USE_PYTHON) || defined(PYTHON_MODULE) // save HAVE_LIBREADLINE status (Python.h defines HAVE_LIBREADLINE) #ifndef HAVE_LIBREADLINE #define GDL_NOT_HAVE_READLINE #endif //#undef _POSIX_C_SOURCE // get rid of warning #include //#ifndef _POSIX_C_SOURCE //#warning "_POSIX_C_SOURCE not defined in Python.h (remove #undef)" //#endif // for the python module pyhton's readline is used // this is ok as long as there is no GDL prompt within python #ifdef PYTHON_MODULE #undef HAVE_LIBREADLINE #endif #ifdef GDL_NOT_HAVE_READLINE #undef HAVE_LIBREADLINE #endif #undef GDL_NOT_HAVE_READLINE //#if defined(USE_PYTHON) || defined(PYTHON_MODULE) #endif #if defined(USE_EIGEN) #include #endif #if defined(__sun__) // SA: CS is defined in /usr/include/sys/regset.h and used in an enum statement by ANTLR # include # undef CS # undef GS #endif #endif gdl-0.9.4/src/dimension.hpp0000664000175000017500000002202412061667727014225 0ustar marcmarc/*************************************************************************** dimension.hpp - GDL array structure info ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifndef DIMENSION_HPP_ #define DIMENSION_HPP_ #include #include "typedefs.hpp" #include "gdlexception.hpp" // const SizeT MAXRANK=8; // arrays are limited to 8 dimensions // const std::string MAXRANK_STR("8"); // for use in strings (error messages) typedef char RankT; inline SizeT RankIx( const SizeT rank) { return (rank <= 1)? 0 : rank-1; } class dimension { SizeT dim[MAXRANK]; // dimension mutable SizeT stride[MAXRANK+1]; // stride char rank; // how many dim are valid public: // structors dimension(): rank(0) { stride[0] = 0; // mark as not set } // c-i dimension(const dimension& dim_) { rank = dim_.rank; for(unsigned i=0; i MAXRANK) throw GDLException("Only "+MAXRANK_STR+" dimensions allowed."); for( SizeT i=thisRank; i>(const SizeT add) { SizeT thisRank = rank++; if( rank > MAXRANK) throw GDLException("Only "+MAXRANK_STR+" dimensions allowed."); for( int i=thisRank-1; i>=0; i--) { dim[i+1]=dim[i]; } dim[0]=add; stride[0] = 0; // not set } // cat add to left void operator>>(const dimension& add) { int thisRank = rank; int addRank = add.rank; rank += addRank; if( rank > static_cast(MAXRANK)) throw GDLException("Only "+MAXRANK_STR+" dimensions allowed."); // shift dim by addRank for( int i=thisRank-1; i>=0; i--) { dim[i+addRank]=dim[i]; } // insert add on the left for( int i=0; i= rank) return 0; return dim[d1]; } // members // number of elements SizeT NDimElements() { if( stride[0] == 0) InitStride(); return stride[ rank]; // SizeT res=1; // for(unsigned i=0; i= rank) rank = ix+1; dim[ix]=d; stride[0] = 0; // not set } SizeT Stride(const SizeT i) const { if( stride[0] == 0) this->InitStride(); // const_cast(this)->InitStride(); return stride[ (iInitStride(); return stride; } void Stride( SizeT s[], SizeT upto) const { assert( upto >= 1); if( stride[0] == 0) this->InitStride(); // copy for(int m=0; m<=upto; ++m) s[m] = stride[m]; // s[0]=1; // upto must be at least 1 // if( stride[0] == 0) // stride not set yet // { // unsigned m=1; // if( upto <= rank) // for(; m<=upto; ++m) // s[m] = s[m-1] * dim[m-1]; // else // { // for(; m<=rank; ++m) // s[m] = s[m-1] * dim[m-1]; // for(; m<=upto; ++m) // s[m] = s[m-1]; // } // } // else // stride already calculated -> copy // { // unsigned m=1; // if( upto <= rank) // for(; m<=upto; ++m) // s[m] = stride[m]; // else // { // for(; m<=rank; ++m) // s[m] = stride[m]; // for(; m<=upto; ++m) // s[m] = s[m-1]; // } // } } // we must do a full stride calculation here because // variables might be indexed with more dimensions they actually have // (which indices then must all be zero) void InitStride() const { if( rank == 0) { for(int m=0; m<=MAXRANK; ++m) stride[m] = 1; } else { stride[0]=1; stride[1]=dim[0]; int m=1; for(; mscalar .. MAXRANK) // dim[rank]=0 for rank1 && dim[rank-1] <= 1; --rank); } // set the rank to r (pads 1s) if it is smaller than r void MakeRank(SizeT r) { SizeT rNow=rank; if( rNow >= r) return; if( r > MAXRANK) throw GDLException("Maximum "+MAXRANK_STR+" dimensions are allowed."); for( SizeT i=rNow; i "FMTIn.cpp"$ */ #include "includefirst.hpp" #include "FMTIn.hpp" #include #include #include #include #include #include // gets inserted after the antlr generated includes in the cpp file FMTIn::FMTIn() : antlr::TreeParser() { } void FMTIn::format(RefFMTNode _t) { RefFMTNode format_AST_in = (_t == RefFMTNode(ASTNULL)) ? RefFMTNode(antlr::nullAST) : _t; RefFMTNode fmt = RefFMTNode(antlr::nullAST); RefFMTNode __t2 = _t; fmt = (_t == RefFMTNode(ASTNULL)) ? RefFMTNode(antlr::nullAST) : _t; match(antlr::RefAST(_t),FORMAT); _t = _t->getFirstChild(); goto realCode; q(_t); _t = _retTree; { // ( ... )+ int _cnt4=0; for (;;) { if (_t == RefFMTNode(antlr::nullAST) ) _t = ASTNULL; if ((_tokenSet_0.member(_t->getType()))) { f(_t); _t = _retTree; q(_t); _t = _retTree; } else { if ( _cnt4>=1 ) { goto _loop4; } else {throw antlr::NoViableAltException(antlr::RefAST(_t));} } _cnt4++; } _loop4:; } // ( ... )+ realCode: reversionAnker = fmt; RefFMTNode blk = _t; // q (f q)+ // as later format_recursive is used, this loop only // loops once (ie. could be eliminated - left here in // case of later changes) for( int r = fmt->getRep(); r > 0; r--) { GetLine(); q( blk); _t = _retTree; for (;;) { if( _t == static_cast(antlr::nullAST)) _t = ASTNULL; switch ( _t->getType()) { case FORMAT: case STRING: case CSTRING: case TL: case TR: case TERM: case NONL: case Q: case T: case X: case A: case F: case D: case E: case G: case I: case O: case B: case Z: case ZZ: case C: { f(_t); if( actPar == NULL && termFlag) goto endFMT; _t = _retTree; q(_t); _t = _retTree; break; // out of switch } default: goto endFMT; } } endFMT: // end of one repetition if( actPar == NULL && termFlag) break; } _t = __t2; _t = _t->getNextSibling(); _retTree = _t; } void FMTIn::q(RefFMTNode _t) { RefFMTNode q_AST_in = (_t == RefFMTNode(ASTNULL)) ? RefFMTNode(antlr::nullAST) : _t; RefFMTNode s = RefFMTNode(antlr::nullAST); { if (_t == RefFMTNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case SLASH: { s = _t; match(antlr::RefAST(_t),SLASH); _t = _t->getNextSibling(); for( int r=s->getRep(); r > 0; r--) GetLine(); break; } case 3: case FORMAT: case STRING: case TL: case TR: case TERM: case NONL: case Q: case T: case X: case A: case F: case E: case G: case I: case O: case B: case Z: case ZZ: case C: { break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } _retTree = _t; } void FMTIn::f(RefFMTNode _t) { RefFMTNode f_AST_in = (_t == RefFMTNode(ASTNULL)) ? RefFMTNode(antlr::nullAST) : _t; RefFMTNode t = RefFMTNode(antlr::nullAST); RefFMTNode a = RefFMTNode(antlr::nullAST); RefFMTNode ff = RefFMTNode(antlr::nullAST); RefFMTNode ee = RefFMTNode(antlr::nullAST); RefFMTNode g = RefFMTNode(antlr::nullAST); RefFMTNode i = RefFMTNode(antlr::nullAST); RefFMTNode o = RefFMTNode(antlr::nullAST); RefFMTNode b = RefFMTNode(antlr::nullAST); RefFMTNode z = RefFMTNode(antlr::nullAST); RefFMTNode zz = RefFMTNode(antlr::nullAST); RefFMTNode c = RefFMTNode(antlr::nullAST); RefFMTNode actNode; if (_t == RefFMTNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case TERM: { RefFMTNode tmp1_AST_in = _t; match(antlr::RefAST(_t),TERM); _t = _t->getNextSibling(); termFlag = true; break; } case NONL: { RefFMTNode tmp2_AST_in = _t; match(antlr::RefAST(_t),NONL); _t = _t->getNextSibling(); break; } case Q: { RefFMTNode tmp3_AST_in = _t; match(antlr::RefAST(_t),Q); _t = _t->getNextSibling(); SizeT nLeft = ioss.rdbuf()->in_avail(); std::istringstream iossTmp( i2s( nLeft)); int r = 1; do { SizeT tCount = actPar->IFmtA( &iossTmp, valIx, r, 0); r -= tCount; NextVal( tCount); if( actPar == NULL) break; } while( r>0); break; } case T: { t = _t; match(antlr::RefAST(_t),T); _t = _t->getNextSibling(); int tVal = t->getW(); assert( tVal >= 1); ioss.seekg( tVal-1, std::ios_base::beg); break; } case STRING: case TL: case TR: { f_csubcode(_t); _t = _retTree; break; } case X: { x(_t); _t = _retTree; break; } case FORMAT: { format_recursive(_t); _t = _retTree; break; } case A: { a = _t; match(antlr::RefAST(_t),A); _t = _t->getNextSibling(); if( actPar == NULL) break; int r = a->getRep(); int w = a->getW(); do { SizeT tCount = actPar->IFmtA( &ioss, valIx, r, w); r -= tCount; NextVal( tCount); if( actPar == NULL) break; } while( r>0); break; } case F: case E: case G: { { if (_t == RefFMTNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case F: { ff = _t; match(antlr::RefAST(_t),F); _t = _t->getNextSibling(); actNode = ff; break; } case E: { ee = _t; match(antlr::RefAST(_t),E); _t = _t->getNextSibling(); actNode = ee; break; } case G: { g = _t; match(antlr::RefAST(_t),G); _t = _t->getNextSibling(); actNode = g; break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } if( actPar == NULL) break; int r = actNode->getRep(); int w = actNode->getW(); // if( w <= 0) // if( actPar->Type() == FLOAT) // w = 15; // set default // else // w = 25; do { SizeT tCount = actPar->IFmtF( &ioss, valIx, r, w); r -= tCount; NextVal( tCount); if( actPar == NULL) break; } while( r>0); break; } case I: { i = _t; match(antlr::RefAST(_t),I); _t = _t->getNextSibling(); if( actPar == NULL) break; int r = i->getRep(); int w = i->getW(); do { SizeT tCount = actPar->IFmtI( &ioss, valIx, r, w, BaseGDL::DEC); r -= tCount; NextVal( tCount); if( actPar == NULL) break; } while( r>0); break; } case O: { o = _t; match(antlr::RefAST(_t),O); _t = _t->getNextSibling(); if( actPar == NULL) break; int r = o->getRep(); int w = o->getW(); do { SizeT tCount = actPar->IFmtI( &ioss, valIx, r, w, BaseGDL::OCT); r -= tCount; NextVal( tCount); if( actPar == NULL) break; } while( r>0); break; } case B: { b = _t; match(antlr::RefAST(_t),B); _t = _t->getNextSibling(); if( actPar == NULL) break; int r = b->getRep(); int w = b->getW(); do { SizeT tCount = actPar->IFmtI( &ioss, valIx, r, w, BaseGDL::BIN); r -= tCount; NextVal( tCount); if( actPar == NULL) break; } while( r>0); break; } case Z: case ZZ: { { if (_t == RefFMTNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case Z: { z = _t; match(antlr::RefAST(_t),Z); _t = _t->getNextSibling(); actNode = z; break; } case ZZ: { zz = _t; match(antlr::RefAST(_t),ZZ); _t = _t->getNextSibling(); actNode = zz; break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } if( actPar == NULL) break; int r = actNode->getRep(); int w = actNode->getW(); do { SizeT tCount = actPar->IFmtI( &ioss, valIx, r, w, BaseGDL::HEX); r -= tCount; NextVal( tCount); if( actPar == NULL) break; } while( r>0); break; } case C: { RefFMTNode __t18 = _t; c = (_t == RefFMTNode(ASTNULL)) ? RefFMTNode(antlr::nullAST) : _t; match(antlr::RefAST(_t),C); _t = _t->getFirstChild(); { // ( ... )+ int _cnt20=0; for (;;) { if (_t == RefFMTNode(antlr::nullAST) ) _t = ASTNULL; if ((_tokenSet_1.member(_t->getType()))) { csubcode(_t); _t = _retTree; } else { if ( _cnt20>=1 ) { goto _loop20; } else {throw antlr::NoViableAltException(antlr::RefAST(_t));} } _cnt20++; } _loop20:; } // ( ... )+ _t = __t18; _t = _t->getNextSibling(); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } _retTree = _t; } void FMTIn::format_recursive(RefFMTNode _t) { RefFMTNode format_recursive_AST_in = (_t == RefFMTNode(ASTNULL)) ? RefFMTNode(antlr::nullAST) : _t; RefFMTNode fmt = RefFMTNode(antlr::nullAST); RefFMTNode __t6 = _t; fmt = (_t == RefFMTNode(ASTNULL)) ? RefFMTNode(antlr::nullAST) : _t; match(antlr::RefAST(_t),FORMAT); _t = _t->getFirstChild(); goto realCode; q(_t); _t = _retTree; { // ( ... )+ int _cnt8=0; for (;;) { if (_t == RefFMTNode(antlr::nullAST) ) _t = ASTNULL; if ((_tokenSet_0.member(_t->getType()))) { f(_t); _t = _retTree; q(_t); _t = _retTree; } else { if ( _cnt8>=1 ) { goto _loop8; } else {throw antlr::NoViableAltException(antlr::RefAST(_t));} } _cnt8++; } _loop8:; } // ( ... )+ realCode: reversionAnker = fmt; RefFMTNode blk = _t; // q (f q)+ for( int r = fmt->getRep(); r > 0; r--) { // GetLine(); // the difference to format q( blk); _t = _retTree; for (;;) { if( _t == static_cast(antlr::nullAST)) _t = ASTNULL; switch ( _t->getType()) { case FORMAT: case STRING: case CSTRING: case TL: case TR: case TERM: case NONL: case Q: case T: case X: case A: case F: case D: case E: case G: case I: case O: case B: case Z: case ZZ: case C: { f(_t); if( actPar == NULL && termFlag) goto endFMT; _t = _retTree; q(_t); _t = _retTree; break; // out of switch } default: goto endFMT; } } endFMT: // end of one repetition if( actPar == NULL && termFlag) break; } _t = __t6; _t = _t->getNextSibling(); _retTree = _t; } void FMTIn::format_reversion(RefFMTNode _t) { RefFMTNode format_reversion_AST_in = (_t == RefFMTNode(ASTNULL)) ? RefFMTNode(antlr::nullAST) : _t; format(_t); _t = _retTree; goto realCode; q(_t); _t = _retTree; { // ( ... )* for (;;) { if (_t == RefFMTNode(antlr::nullAST) ) _t = ASTNULL; if ((_tokenSet_0.member(_t->getType()))) { f(_t); _t = _retTree; q(_t); _t = _retTree; } else { goto _loop11; } } _loop11:; } // ( ... )* realCode: q( _t); _t = _retTree; for (;;) { if( _t == static_cast(antlr::nullAST)) _t = ASTNULL; switch ( _t->getType()) { case FORMAT: case STRING: case CSTRING: case TL: case TR: case TERM: case NONL: case Q: case T: case X: case A: case F: case D: case E: case G: case I: case O: case B: case Z: case ZZ: case C: { f(_t); if( actPar == NULL) goto endFMT; _t = _retTree; q(_t); _t = _retTree; break; // out of switch } default: goto endFMT; } } endFMT: _retTree = _t; } void FMTIn::f_csubcode(RefFMTNode _t) { RefFMTNode f_csubcode_AST_in = (_t == RefFMTNode(ASTNULL)) ? RefFMTNode(antlr::nullAST) : _t; RefFMTNode s = RefFMTNode(antlr::nullAST); RefFMTNode tl = RefFMTNode(antlr::nullAST); RefFMTNode tr = RefFMTNode(antlr::nullAST); if (_t == RefFMTNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case STRING: { s = _t; match(antlr::RefAST(_t),STRING); _t = _t->getNextSibling(); break; } case TL: { tl = _t; match(antlr::RefAST(_t),TL); _t = _t->getNextSibling(); SizeT actP = ioss.tellg(); int tlVal = tl->getW(); if( tlVal > actP) ioss.seekg( 0); else ioss.seekg( actP - tlVal); break; } case TR: { tr = _t; match(antlr::RefAST(_t),TR); _t = _t->getNextSibling(); int tlVal = tl->getW(); ioss.seekg( tlVal, std::ios_base::cur); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } _retTree = _t; } void FMTIn::x(RefFMTNode _t) { RefFMTNode x_AST_in = (_t == RefFMTNode(ASTNULL)) ? RefFMTNode(antlr::nullAST) : _t; RefFMTNode tl = RefFMTNode(antlr::nullAST); tl = _t; match(antlr::RefAST(_t),X); _t = _t->getNextSibling(); if( _t != static_cast(antlr::nullAST)) { int tlVal = tl->getW(); ioss.seekg( tlVal, std::ios_base::cur); } _retTree = _t; } void FMTIn::csubcode(RefFMTNode _t) { RefFMTNode csubcode_AST_in = (_t == RefFMTNode(ASTNULL)) ? RefFMTNode(antlr::nullAST) : _t; RefFMTNode c1 = RefFMTNode(antlr::nullAST); RefFMTNode c2 = RefFMTNode(antlr::nullAST); RefFMTNode c3 = RefFMTNode(antlr::nullAST); RefFMTNode c4 = RefFMTNode(antlr::nullAST); RefFMTNode c5 = RefFMTNode(antlr::nullAST); RefFMTNode c6 = RefFMTNode(antlr::nullAST); RefFMTNode c7 = RefFMTNode(antlr::nullAST); RefFMTNode c8 = RefFMTNode(antlr::nullAST); RefFMTNode c9 = RefFMTNode(antlr::nullAST); RefFMTNode c10 = RefFMTNode(antlr::nullAST); RefFMTNode c11 = RefFMTNode(antlr::nullAST); RefFMTNode c12 = RefFMTNode(antlr::nullAST); RefFMTNode c13 = RefFMTNode(antlr::nullAST); RefFMTNode c14 = RefFMTNode(antlr::nullAST); RefFMTNode c15 = RefFMTNode(antlr::nullAST); RefFMTNode c16 = RefFMTNode(antlr::nullAST); RefFMTNode c17 = RefFMTNode(antlr::nullAST); if (_t == RefFMTNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case CMOA: { c1 = _t; match(antlr::RefAST(_t),CMOA); _t = _t->getNextSibling(); break; } case CMoA: { c2 = _t; match(antlr::RefAST(_t),CMoA); _t = _t->getNextSibling(); break; } case CmoA: { c3 = _t; match(antlr::RefAST(_t),CmoA); _t = _t->getNextSibling(); break; } case CHI: { c4 = _t; match(antlr::RefAST(_t),CHI); _t = _t->getNextSibling(); break; } case ChI: { c5 = _t; match(antlr::RefAST(_t),ChI); _t = _t->getNextSibling(); break; } case CDWA: { c6 = _t; match(antlr::RefAST(_t),CDWA); _t = _t->getNextSibling(); break; } case CDwA: { c7 = _t; match(antlr::RefAST(_t),CDwA); _t = _t->getNextSibling(); break; } case CdwA: { c8 = _t; match(antlr::RefAST(_t),CdwA); _t = _t->getNextSibling(); break; } case CAPA: { c9 = _t; match(antlr::RefAST(_t),CAPA); _t = _t->getNextSibling(); break; } case CApA: { c10 = _t; match(antlr::RefAST(_t),CApA); _t = _t->getNextSibling(); break; } case CapA: { c11 = _t; match(antlr::RefAST(_t),CapA); _t = _t->getNextSibling(); break; } case CMOI: { c12 = _t; match(antlr::RefAST(_t),CMOI); _t = _t->getNextSibling(); break; } case CDI: { c13 = _t; match(antlr::RefAST(_t),CDI); _t = _t->getNextSibling(); break; } case CYI: { c14 = _t; match(antlr::RefAST(_t),CYI); _t = _t->getNextSibling(); break; } case CMI: { c15 = _t; match(antlr::RefAST(_t),CMI); _t = _t->getNextSibling(); break; } case CSI: { c16 = _t; match(antlr::RefAST(_t),CSI); _t = _t->getNextSibling(); break; } case CSF: { c17 = _t; match(antlr::RefAST(_t),CSF); _t = _t->getNextSibling(); break; } case X: { x(_t); _t = _retTree; break; } case STRING: case TL: case TR: { f_csubcode(_t); _t = _retTree; break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } _retTree = _t; } void FMTIn::initializeASTFactory( antlr::ASTFactory& ) { } const char* FMTIn::tokenNames[] = { "<0>", "EOF", "<2>", "NULL_TREE_LOOKAHEAD", "ALL", "CSTR", "CSTR1", "CSTR2", "ESC", "OCTESC", "ODIGIT", "HEXESC", "HDIGIT", "CD", "CE", "CI", "CF", "CG", "CO", "CB", "CS", "CX", "CZ", "CDOT", "DIGITS", "CNUMBER", "CWS", "FORMAT", "LBRACE", "COMMA", "RBRACE", "SLASH", "STRING", "\"tl\"", "\"tr\"", "TERM", "NONL", "Q", "T", "X", "A", "F", "D", "E", "G", "I", "O", "B", "Z", "ZZ", "C", "CMOA", "CMoA", "CmoA", "CHI", "ChI", "CDWA", "CDwA", "CdwA", "CAPA", "CApA", "CapA", "\"cmoi\"", "\"cdi\"", "\"cyi\"", "\"cmi\"", "\"csi\"", "\"csf\"", "NUMBER", "DOT", "CSTRING", "H", "L", "R", "PERCENT", "W", "WHITESPACE", "CHAR", 0 }; const unsigned long FMTIn::_tokenSet_0_data_[] = { 134217728UL, 523263UL, 0UL, 0UL }; // FORMAT STRING "tl" "tr" TERM NONL Q T X A F E G I O B Z ZZ C const antlr::BitSet FMTIn::_tokenSet_0(_tokenSet_0_data_,4); const unsigned long FMTIn::_tokenSet_1_data_[] = { 0UL, 4294443143UL, 15UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // STRING "tl" "tr" X CMOA CMoA CmoA CHI ChI CDWA CDwA CdwA CAPA CApA CapA // "cmoi" "cdi" "cyi" "cmi" "csi" "csf" const antlr::BitSet FMTIn::_tokenSet_1(_tokenSet_1_data_,8); gdl-0.9.4/src/deviceps.hpp0000664000175000017500000005600712165116026014034 0ustar marcmarc/* ************************************************************************* deviceps.hpp - postscript device ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /* ************************************************************************* * * * 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. * * * ***************************************************************************/ #ifndef DEVICEPS_HPP_ #define DEVICEPS_HPP_ #include "gdlpsstream.hpp" #include "plotting.hpp" // get_axis_crange for TV() #include "initsysvar.hpp" #include // GSL_CONST_MKSA_INCH #include "objects.hpp" # ifdef USE_PSLIB # include // tmpnam # include // uname # include # endif # ifdef HAVE_OLDPLPLOT # define SETOPT SetOpt # else # define SETOPT setopt # endif #ifdef _MSC_VER #define cm2in (.01 / GSL_CONST_MKSA_INCH); // This is not good, but works #define dpi 72.0 //in dpi; #else static const float cm2in = .01 / GSL_CONST_MKSA_INCH; static const PLFLT dpi = 72.0 ; //in dpi; #endif class DevicePS: public Graphics { std::string fileName; GDLPSStream* actStream; float XPageSize; float YPageSize; float XOffset; float YOffset; int color; int decomposed; // false -> use color table bool orient_portrait; bool encapsulated; float scale; GDLStream *psUnit; void InitStream() { delete actStream; DLongGDL* pMulti = SysVar::GetPMulti(); DLong nx = (*pMulti)[ 1]; DLong ny = (*pMulti)[ 2]; if( nx <= 0) nx = 1; if( ny <= 0) ny = 1; actStream = new GDLPSStream( nx, ny, (int)SysVar::GetPFont(), encapsulated, color); actStream->sfnam( fileName.c_str()); // trying to solve bug report 3611898 // AC 29-Avril-2013: the way I found to link GDLPSStream* and GDLStream* DLong lun=GetLUN(); psUnit = &fileUnits[ lun-1]; psUnit->Open(fileName,fstream::out,false,false,false, defaultStreamWidth,false,false); (*static_cast( dStruct->GetTag(dStruct->Desc()->TagIndex("UNIT"))))[0]=lun; // zeroing offsets (xleng and yleng are the default ones but they need to be specified // for the offsets to be taken into account by spage(), works with plplot >= 5.9.9) actStream->spage(dpi, dpi, 540, 720, 0, 0); //plplot default: portrait! // as setting the offsets and sizes with plPlot is (extremely) tricky, and some of these setting // are hardcoded into plplot (like EPS header, and offsets in older versions of plplot) // here we only specify the aspect ratio - size an offset are handled by pslib when device,/close is called // patch 3611949 by Joanna, 29 Avril 2013 PLFLT pageRatio=XPageSize/YPageSize; std::string as = i2s( pageRatio); actStream->SETOPT( "a", as.c_str()); // plot orientation //std::cout << "orientation : " << orient_portrait<< std::endl; actStream->sdiori(orient_portrait ? 1 : 2); // no pause on destruction actStream->spause( false); // extended fonts actStream->fontld( 1); // avoid to set color map 0 -- makes plplot very slow (?) PLINT r[ctSize], g[ctSize], b[ctSize]; actCT.Get( r, g, b); // actStream->scmap0( r, g, b, ctSize); actStream->scmap1( r, g, b, ctSize); // default: black+white (IDL behaviour) if (color == 0) { actStream->SETOPT( "drvopt","text=0,color=0"); } else { actStream->SETOPT( "drvopt","text=0,color=1"); //need to pass all options with the same 'setopt' command. } actStream->scolbg(255,255,255); // start with a white background actStream->Init(); // need to be called initially. permit to fix things actStream->ssub(1,1); actStream->adv(0); // load font actStream->font( 1); actStream->vpor(0,1,0,1); actStream->wind(0,1,0,1); actStream->DefaultCharSize(); //in case these are not initalized, here is a good place to do it. if (actStream->updatePageInfo()==true) { actStream->GetPlplotDefaultCharSize(); //initializes everything in fact.. } } private: void pslibHacks() { # ifndef USE_PSLIB Warning("Warning: pslib support is mandatory for the PostScript driver to handle the following"); Warning(" keywords: [X,Y]OFFSET, SCALE_FACTOR, ENCAPSULATED"); # else PSDoc *ps = PS_new(); GDLGuard psGuard( ps, PS_delete); if (ps == NULL) { Warning("Warning: pslib failed to allocate memory."); return; } FILE *fp = tmpfile(); // this creates a file which should be deleted automaticaly when it is closed FILEGuard fpGuard( fp, fclose); if (fp == NULL) { Warning("Warning: failed to create temporary PostScript file."); // PS_delete(ps); return; } if (PS_open_fp(ps, fp) == -1) { Warning("Warning: pslib failed to open a new PostScript file."); goto cleanup; } PS_set_parameter(ps, "imagereuse", "false"); PS_set_info(ps, "Title", "Graphics produced by GDL"); PS_set_info(ps, "Orientation", orient_portrait ? "Portrait" : "Landscape"); { struct utsname uts; uname(&uts); string tmp; tmp = "GDL Version " + string(VERSION) + ", " + string(uts.sysname) + " " + string(uts.machine); PS_set_info(ps, "Creator", tmp.c_str()); char* login = getlogin(); if (login == NULL) Warning("Warning: getlogin() failed!"); tmp = (login == NULL ? "?" : login) + string("@") + uts.nodename; PS_set_info(ps, "Author", tmp.c_str()); } //bug: PSLIB does not return the correct boundingbox, it forgets offx and offy. Try to get it //back (using pslib own code!)! char *bb; FILE *feps; char buffer[1024]; //largely sufficient int nbytes; feps=fopen(fileName.c_str(), "r"); nbytes=fread(buffer,sizeof(char),1023,feps); fclose(feps); buffer[1023]=0; bb = strstr(buffer, "%%BoundingBox:"); float offx, offy, width, height; if(bb) { bb += 15; sscanf(bb, "%f %f %f %f", &offx, &offy, &width, &height); } else { offx=0; offy=0; width=500; height=500; //silly values, will be replaced afterwards hopefully. } // TODO //psfont = PS_findfont(ps, "Helvetica", "", 0); //PS_setfont(ps, psfont, 8.0); char bbstr [20], offstr [20]; int bbXSize, bbYSize; { int bbXoff = XOffset*cm2in*dpi; int bbYoff = YOffset*cm2in*dpi; bbXSize = orient_portrait ? bbXoff + XPageSize*cm2in*dpi*scale : bbXoff + YPageSize*cm2in*dpi*scale; bbYSize = orient_portrait ? bbYoff + YPageSize*cm2in*dpi*scale : bbYoff + XPageSize*cm2in*dpi*scale; sprintf(bbstr,"%i %i %i %i",bbXoff,bbYoff,bbXSize,bbYSize); sprintf(offstr,"%i %i",bbXoff,bbYoff); PS_set_info(ps,"BoundingBox",bbstr); PS_begin_page(ps, bbXSize, bbYSize); { int psimage = PS_open_image_file(ps, "eps", fileName.c_str(), NULL, 0); if (psimage == 0) { Warning("Warning: pslib failed to load plPlot output file."); goto cleanup; } float scl = 0.98*min((bbXSize-bbXoff) / (width-offx), (bbYSize-bbYoff) / (height-offy) ); int margx = ((bbXSize-bbXoff) - scl*(width-offx))/2; int margy = ((bbYSize-bbYoff) - scl*(height-offy))/2; PS_place_image(ps, psimage, bbXoff-offx*scl + margx, bbYoff-offy*scl + margy, scl ); PS_close_image(ps, psimage); } PS_end_page(ps); PS_close(ps); } // Replace PageBoundingBox and CropBox and write contents to fileName { rewind(fp); FILE *fp_plplot = fopen(fileName.c_str(), "w"); FILEGuard fp_plplotGuard( fp_plplot, fclose); if (fp_plplot == NULL) { Warning("Warning: failed to open plPlot-generated file"); goto cleanup; } // When multiple pages are supported, PageBoundingBox and the cropbox // will appear more than once. Then this section will need to be redone. // Edit: change the two 0's after the PageBoundingBox string pbstr=string("%%PageBoundingBox: ")+offstr; // edits will be in the first 12288 bytes; add the length of offstr-3 const size_t buflen=12288 + pbstr.length()-22; //const size_t buflen=4096; char buff[buflen]; //do the first read: size_t cnt = fread(&buff, 1, 12288, fp); string sbuff; sbuff = string(buff); // find the PageBoundingBox statement size_t pos = sbuff.find("%%PageBoundingBox: 0 0"); if (pos != string::npos) { sbuff.replace(pos,22,pbstr); // will change the size of sbuff by offstr-3 cnt = cnt + pbstr.length()-22; } // PSlib outputs pdfmarks which resize the PDF to the size of the boundingbox // this is nice, but not IDL behaviour (and anyway, the two 0's are wrong) char mychar[60]; sprintf(mychar,"[ /CropBox [0 0 %i.00 %i.00] /PAGE pdfmark",bbXSize,bbYSize); string pdfstr=string(mychar); string pdfrepl(pdfstr.length(),' '); pos = sbuff.find(pdfstr); if (pos != string::npos) {sbuff.replace(pos,pdfstr.length(),pdfrepl);} // will not change size of sbuff // write the first buflen to file strcpy(buff,sbuff.c_str()); if (fwrite(&buff, 1, buflen, fp_plplot) < buflen) { Warning("Warning: failed to overwrite the plPlot-generated file with pslib output"); } // read the rest of fp and write to file while (true) { cnt = fread(&buff, 1, buflen, fp); if (!cnt) break; if (fwrite(&buff, 1, cnt, fp_plplot) < cnt) { Warning("Warning: failed to overwrite the plPlot-generated file with pslib output"); } } // fclose(fp_plplot); } cleanup: // PS_delete(ps); // fclose(fp); // this deletes the temporary file as well // PSlib changes locale - bug no. 3428043 # ifdef HAVE_LOCALE_H setlocale(LC_ALL, "C"); # endif # endif } private: void epsHacks() { // using namespace std; //PLPLOT outputs a strange boundingbox; this hack directly edits the eps file. //if the plplot bug ever gets fixed, this hack won't be needed. char *bb; FILE *feps; size_t buflen=2048;//largely sufficient char buffer[buflen]; int cnt; ifstream myfile (fileName.c_str()); feps=fopen(fileName.c_str(), "r"); cnt=fread(buffer,sizeof(char),buflen,feps); //read original boundingbox bb = strstr(buffer, "%%BoundingBox:"); int offx, offy, width, height; bb += 15; sscanf(bb, "%i %i %i %i", &offx, &offy, &width, &height); float hsize = XPageSize*cm2in*dpi*scale, vsize = YPageSize*cm2in*dpi*scale; float newwidth = (width - offx), newheight = (height - offy); float hscale = (orient_portrait ? hsize : vsize)/newwidth/5.0; float vscale = (orient_portrait ? vsize : hsize)/newheight/5.0; hscale = min(hscale,vscale)*0.98; vscale = hscale; float hoff = -5.*offx*hscale + ((orient_portrait ? hsize : vsize) - 5.0*hscale*newwidth)*0.5; float voff = -5.*offy*vscale + ((orient_portrait ? vsize : hsize) - 5.0*vscale*newheight)*0.5; //replace with a more sensible boundingbox string sbuff = string(buffer); stringstream searchstr,replstr; searchstr << "BoundingBox: " << offx << " " << offy << " " << width << " " << height; replstr << "BoundingBox: 0 0 " << floor((orient_portrait ? hsize : vsize)+0.5) << " " << floor((orient_portrait ? vsize : hsize)+0.5); size_t pos = sbuff.find(searchstr.str()); int extralen; if (pos != string::npos) { sbuff.replace(pos,searchstr.str().length(),replstr.str()); extralen = replstr.str().length()-searchstr.str().length(); } //replace values of hscale, vscale searchstr.str(""); searchstr << "{hs 3600 div} def" << endl << "/YScale" << endl << " {vs 2700 div} def"; replstr.str(""); replstr << hscale << " def" << endl << "/YScale" << endl << " " << vscale << " def"; pos = sbuff.find(searchstr.str()); if (pos != string::npos) { sbuff.replace(pos,searchstr.str().length(),replstr.str()); extralen = extralen + replstr.str().length()-searchstr.str().length(); } //replace the values of hoffset and voffset searchstr.str(""); searchstr << "0 @hoffset" << endl << "0 @voffset"; replstr.str(""); replstr << floor(hoff+0.5) << " " << "@hoffset" << endl << floor(voff+0.5) << " " << "@voffset"; pos = sbuff.find(searchstr.str()); if (pos != string::npos) { sbuff.replace(pos,searchstr.str().length(),replstr.str()); extralen = extralen + replstr.str().length()-searchstr.str().length(); } //add landscape if (!orient_portrait) { searchstr.str("%%Page: 1 1"); replstr.str(""); replstr << "%%Page: 1 1" << endl << "%%PageOrientation: Landscape" << endl; pos = sbuff.find(searchstr.str()); if (pos != string::npos) { sbuff.replace(pos,searchstr.str().length(),replstr.str()); extralen = extralen + replstr.str().length()-searchstr.str().length(); } } //open temp file FILE *fp = tmpfile(); // this creates a file which should be deleted automaticaly when it is closed FILEGuard fpGuard( fp, fclose); if (fp == NULL) { Warning("Warning: failed to create temporary PostScript file."); return; } // write the first buflen to temp file char buffer2[buflen + extralen]; strcpy(buffer2,sbuff.c_str()); fwrite(&buffer2, 1, buflen+extralen, fp); // read the rest of feps and write to temp file while (true) { cnt = fread(&buffer, 1, buflen, feps); if (!cnt) break; if (fwrite(&buffer, 1, cnt, fp) < cnt) { Warning("Warning: failed to write to temporary file"); } } fclose(feps); // copy temp file to fileName rewind(fp); FILE *fp_plplot = fopen(fileName.c_str(), "w"); FILEGuard fp_plplotGuard( fp_plplot, fclose); if (fp_plplot == NULL) { Warning("Warning: failed to open plPlot-generated file"); return; } while (true) { cnt = fread(&buffer, 1, buflen, fp); if (!cnt) break; if (fwrite(&buffer, 1, cnt, fp_plplot) < cnt) { Warning("Warning: failed to overwrite the plPlot-generated file with pslib output"); } } } public: DevicePS(): Graphics(), fileName( "gdl.ps"), actStream( NULL), color(0), decomposed( 0), encapsulated(false), scale(1.), XPageSize(17.78), YPageSize(12.7), XOffset(0.0),YOffset(0.0) { name = "PS"; DLongGDL origin( dimension( 2)); DLongGDL zoom( dimension( 2)); zoom[0] = 1; zoom[1] = 1; dStruct = new DStructGDL( "!DEVICE"); dStruct->InitTag("NAME", DStringGDL( name)); dStruct->InitTag("X_SIZE", DLongGDL( XPageSize*scale*1000)); //29700/1000=29.7 cm dStruct->InitTag("Y_SIZE", DLongGDL( YPageSize*scale*1000)); dStruct->InitTag("X_VSIZE", DLongGDL( XPageSize*scale*1000)); dStruct->InitTag("Y_VSIZE", DLongGDL( YPageSize*scale*1000)); dStruct->InitTag("X_CH_SIZE", DLongGDL( 360)); dStruct->InitTag("Y_CH_SIZE", DLongGDL( 360)); dStruct->InitTag("X_PX_CM", DFloatGDL( 1000.0)); //1000 pix/cm dStruct->InitTag("Y_PX_CM", DFloatGDL( 1000.0)); dStruct->InitTag("N_COLORS", DLongGDL( 256)); dStruct->InitTag("TABLE_SIZE", DLongGDL( 256)); dStruct->InitTag("FILL_DIST", DLongGDL( 1)); dStruct->InitTag("WINDOW", DLongGDL( -1)); dStruct->InitTag("UNIT", DLongGDL( 0)); dStruct->InitTag("FLAGS", DLongGDL( 266807)); dStruct->InitTag("ORIGIN", origin); dStruct->InitTag("ZOOM", zoom); SetPortrait(); # ifdef USE_PSLIB PS_boot(); // PSlib changes locale - bug no. 3428043 # ifdef HAVE_LOCALE_H setlocale(LC_ALL, "C"); # endif # endif } ~DevicePS() { delete actStream; # ifdef USE_PSLIB PS_shutdown(); // PSlib changes locale - bug no. 3428043 # ifdef HAVE_LOCALE_H setlocale(LC_ALL, "C"); # endif # endif } GDLGStream* GetStream( bool open=true) { if( actStream == NULL) { if( !open) return NULL; InitStream(); } return actStream; } bool SetFileName( const std::string& f) { fileName = f; return true; } bool CloseFile() { // trying to solve bug report 3611898 // this is needed to decrement Lun number ... (*static_cast( dStruct->GetTag(dStruct->Desc()->TagIndex("UNIT"))))[0]=0; if (actStream != NULL) { psUnit->Close(); psUnit->Free(); psUnit=NULL; delete actStream; actStream = NULL; if (!encapsulated) pslibHacks(); else epsHacks(); // needs to be called after the plPlot-generated file is closed } return true; } bool SetXOffset( const float xo) // xo [cm] { XOffset=xo; return true; } bool SetYOffset( const float yo) // yo [cm] { YOffset=yo; return true; } bool SetXPageSize( const float xs) // xs [cm] { XPageSize=xs; (*static_cast(dStruct->GetTag(dStruct->Desc()->TagIndex("X_SIZE"))))[0] = DLong(floor(0.5+ xs * (*static_cast(dStruct->GetTag(dStruct->Desc()->TagIndex("X_PX_CM"))))[0] )); (*static_cast(dStruct->GetTag(dStruct->Desc()->TagIndex("X_VSIZE"))))[0] = DLong(floor(0.5+ xs * (*static_cast(dStruct->GetTag(dStruct->Desc()->TagIndex("X_PX_CM"))))[0] )); return true; } bool SetYPageSize( const float ys) // ys [cm] { YPageSize=ys; (*static_cast(dStruct->GetTag(dStruct->Desc()->TagIndex("Y_SIZE"))))[0] = DLong(floor(0.5+ ys * (*static_cast(dStruct->GetTag(dStruct->Desc()->TagIndex("Y_PX_CM"))))[0] )); (*static_cast(dStruct->GetTag(dStruct->Desc()->TagIndex("Y_VSIZE"))))[0] = DLong(floor(0.5+ ys * (*static_cast(dStruct->GetTag(dStruct->Desc()->TagIndex("Y_PX_CM"))))[0] )); return true; } bool SetColor(const long hascolor) { if (hascolor==1) color=1; else color=0; return true; } bool SetPortrait() { orient_portrait = true; // XPageSize = 7 * 100. * GSL_CONST_MKSA_INCH; // YPageSize = 5 * 100. * GSL_CONST_MKSA_INCH; // XOffset = .75 * 100. * GSL_CONST_MKSA_INCH; // YOffset = 3 * 100. * GSL_CONST_MKSA_INCH; // TODO: this is different from IDL docs return true; } bool SetLandscape() { orient_portrait = false; // XPageSize = 10 * 100. * GSL_CONST_MKSA_INCH; // YPageSize = 7 * 100. * GSL_CONST_MKSA_INCH; // XOffset = .5 * 100. * GSL_CONST_MKSA_INCH; // YOffset = .75 * 100. * GSL_CONST_MKSA_INCH; return true; } bool SetScale(float value) { scale = value; return true; } bool SetEncapsulated(bool val) { encapsulated = val; return true; } bool Decomposed( bool value) { decomposed = value; return true; } DLong GetDecomposed() { return decomposed; } // TODO: SA: this TV() should be merged with TV() in DeviceX and DeviceZ! // TODO: SA: just a draft - a lot more needs to be done... void TV( EnvT* e) { SizeT nParam=e->NParam( 1); GDLGStream* actStream = GetStream(); // TODO: use it is XSIZE and YSIZE is not specified! //DLong xsize = (*static_cast( dStruct->GetTag( xSTag, 0)))[0]; //DLong ysize = (*static_cast( dStruct->GetTag( ySTag, 0)))[0]; DLong pos=0; // TODO: handle it! DDouble xmin, ymin; { DDouble null; lib::gdlGetCurrentAxisRange("X", xmin, null); lib::gdlGetCurrentAxisRange("Y", ymin, null); } if (nParam == 2) { e->AssureLongScalarPar( 1, pos); } else if (nParam >= 3) { if (e->KeywordSet("NORMAL")) { e->Throw("NORMAL keyword not supported yet"); //e->AssureDoubleScalarPar( 1, xmin); //e->AssureDoubleScalarPar( 2, ymin); //xLL = (DLong) rint(xLLf * xsize); //yLL = (DLong) rint(yLLf * ysize); } else if (e->KeywordSet("DEVICE")) { e->Throw("DEVICE keyword not supported yet"); } else // aka DATA { e->AssureDoubleScalarPar( 1, xmin); e->AssureDoubleScalarPar( 2, ymin); } } DByteGDL* p0B = e->GetParAs( 0); SizeT rank = p0B->Rank(); int width, height; DLong tru=0; e->AssureLongScalarKWIfPresent( "TRUE", tru); if (rank == 2) { if (tru != 0) e->Throw( "Array must have 3 dimensions: "+ e->GetParString(0)); width = p0B->Dim(0); height = p0B->Dim(1); } else if( rank == 3) { if (tru == 1) { width = p0B->Dim(1); height = p0B->Dim(2); } else if (tru == 2) { width = p0B->Dim(0); height = p0B->Dim(2); } else if (tru == 3) { width = p0B->Dim(0); height = p0B->Dim(1); } else { e->Throw( "TRUE must be between 1 and 3"); } } else { e->Throw( "Image array must have rank 2 or 3"); } if (tru != 0) e->Throw("Decomposed images not supported yet with PostScript + TV() (FIXME)"); // TODO! /* TODO... if( width + xLL > xsize || height + yLL > ysize) e->Throw( "Value of image coordinates is out of allowed range."); */ class grid2d { public: PLFLT** data; private: GDLGStream *pls; private: int w, h; public: grid2d(GDLGStream *actStream, int w, int h) : pls(actStream), w(w), h(h) { pls->Alloc2dGrid(&data, w, h); } public: ~grid2d() { pls->Free2dGrid(data, w, h); } } idata(actStream, width, height); for (int x=0; x < width; ++x) for (int y=0; y < height; ++y) idata.data[x][y] = (*p0B)[x + y * width]; PLFLT xmax, ymax; if (e->KeywordSet("XSIZE")) { DDouble tmp; e->AssureDoubleScalarKW("XSIZE", tmp); xmax = xmin + tmp; } else e->Throw("Specification of XSIZE is mandatory for PostScript/TV() (FIXME!)"); // TODO! if (e->KeywordSet("YSIZE")) { DDouble tmp; e->AssureDoubleScalarKW("YSIZE", tmp); ymax = ymin + tmp; } else e->Throw("Specification of YSIZE is mandatory for PostScript/TV() (FIXME!)"); // TODO! // TODO: map projection (via the last two arguments - same as was done in CONTOUR e.g.) bool mapSet = false; #ifdef USE_LIBPROJ4 //get_mapset(mapSet); #endif if (mapSet) e->Throw("PostScript + TV() + mapping cobination not available yet (FIXME!)"); actStream->imagefr(idata.data, width, height, xmin, xmax, ymin, ymax, 0., 255., 0., 255., NULL, NULL); } }; #endif gdl-0.9.4/src/gdlzstream.hpp0000664000175000017500000000267410601217134014402 0ustar marcmarc/* ************************************************************************* gdlzstream.hpp - graphic stream z-buffer ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /* ************************************************************************* * * * 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. * * * ***************************************************************************/ #ifndef GDLZSTREAM_HPP_ #define GDLZSTREAM_HPP_ #include #include "graphics.hpp" #include "gdlgstream.hpp" class GDLZStream: public GDLGStream { public: GDLZStream( int nx, int ny): GDLGStream( nx, ny, "mem") { } ~GDLZStream() { } // void eop() {} // never eop (mem drivers eop() sets pls->dev to NULL) void eop(); void Clear(); void Clear( DLong bColor); void Init(); }; #endif gdl-0.9.4/src/FMTTokenTypes.txt0000664000175000017500000000124512162632107014730 0ustar marcmarc// $ANTLR 2.7.7 (20120518): format.g -> FMTTokenTypes.txt$ FMT // output token vocab name ALL=4 CSTR=5 CSTR1=6 CSTR2=7 ESC=8 OCTESC=9 ODIGIT=10 HEXESC=11 HDIGIT=12 CD=13 CE=14 CI=15 CF=16 CG=17 CO=18 CB=19 CS=20 CX=21 CZ=22 CDOT=23 DIGITS=24 CNUMBER=25 CWS=26 FORMAT=27 LBRACE=28 COMMA=29 RBRACE=30 SLASH=31 STRING=32 TL="tl"=33 TR="tr"=34 TERM=35 NONL=36 Q=37 T=38 X=39 A=40 F=41 D=42 E=43 G=44 I=45 O=46 B=47 Z=48 ZZ=49 C=50 CMOA=51 CMoA=52 CmoA=53 CHI=54 ChI=55 CDWA=56 CDwA=57 CdwA=58 CAPA=59 CApA=60 CapA=61 CMOI="cmoi"=62 CDI="cdi"=63 CYI="cyi"=64 CMI="cmi"=65 CSI="csi"=66 CSF="csf"=67 NUMBER=68 DOT=69 CSTRING=70 H=71 L=72 R=73 PERCENT=74 W=75 WHITESPACE=76 CHAR=77 gdl-0.9.4/src/basic_op_new.cpp0000664000175000017500000026343512122717103014656 0ustar marcmarc/*************************************************************************** basic_op_new.cpp - GDL operators ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ // to be included from datatypes.cpp // after basic_op.cpp #ifdef INCLUDE_BASIC_OP_CPP using namespace std; // binary operators // in basic_op.cpp: // 1. operators that always return a new result (basic_op.cpp) // 2. operators which operate on 'this' (basic_op.cpp) // here: // 3. same operators as under 2. that always return a new result // AndOp &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& // Ands right and itself into a new DataT_ // right must always have more or same number of elements // for integers template Data_* Data_::AndOpNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); assert(right->N_Elements()); Data_* res = NewResult(); if( nEl == 1) { (*res)[0] = (*this)[0] & (*right)[0]; return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = (*this)[i] & (*right)[i]; // & Ty(1); } return res; } // different for floats template Data_* Data_::AndOpInvNew( BaseGDL* right) { return AndOpNew( right); } // for floats template<> Data_* Data_::AndOpNew( BaseGDL* r) { Data_* right=static_cast(r); // ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); Data_* res = NewResult(); // assert( rEl); assert( nEl); if( nEl == 1) { if ( (*right)[0] == zero ) (*res)[0] = zero; else (*res)[0] = (*this)[0]; return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for ( OMPInt i=0; i < nEl; ++i ) if ( (*right)[i] == zero ) (*res)[i] = zero; else (*res)[i] = (*this)[i]; } return res; } template<> Data_* Data_::AndOpInvNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); assert( right->N_Elements()); Data_* res = NewResult(); if( nEl == 1) { if( (*this)[0] != zero) (*res)[0] = (*right)[0]; else (*res)[0] = zero; return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) if( (*this)[i] != zero) (*res)[i] = (*right)[i]; else (*res)[i] = zero; } return res; } // for doubles template<> Data_* Data_::AndOpNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); assert( right->N_Elements()); Data_* res = NewResult(); if( nEl == 1) { if ( (*right)[0] == zero ) (*res)[0] = zero; else (*res)[0] = (*this)[0]; return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) if ( (*right)[i] == zero ) (*res)[i] = zero; else (*res)[i] = (*this)[i]; } return res; } template<> Data_* Data_::AndOpInvNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); assert( right->N_Elements()); Data_* res = NewResult(); if( nEl == 1) { if( (*this)[0] != zero) (*res)[0] = (*right)[0]; else (*res)[0] = zero; return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) if( (*this)[i] != zero) (*res)[i] = (*right)[i]; else (*res)[i] = zero; } return res; } // invalid types template<> Data_* Data_::AndOpNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::AndOpNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::AndOpNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } // template<> // Data_* Data_::AndOpInvNew( BaseGDL* r) // { // throw GDLException("Cannot apply operation to datatype STRING.",true,false); // return res; // } template<> Data_* Data_::AndOpNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } // template<> // Data_* Data_::AndOpInvNew( BaseGDL* r) // { // throw GDLException("Cannot apply operation to datatype PTR.",true,false); // return res; // } template<> Data_* Data_::AndOpNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } // template<> // Data_* Data_::AndOpInvNew( BaseGDL* r) // { // throw GDLException("Cannot apply operation to datatype PTR.",true,false); // return res; // } // scalar versions template Data_* Data_::AndOpSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Ty s = (*right)[0]; Data_* res = NewResult(); if( nEl == 1) { (*res)[0] = (*this)[0] & s; return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) shared(s) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = (*this)[i] & s; } return res; } // different for floats template Data_* Data_::AndOpInvSNew( BaseGDL* right) { return AndOpSNew( right); } // for floats template<> Data_* Data_::AndOpSNew( BaseGDL* r) { Data_* right=static_cast(r); if( (*right)[0] == zero) { return New( this->dim, BaseGDL::ZERO); } return this->Dup(); } template<> Data_* Data_::AndOpInvSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Ty s = (*right)[0]; if( s == zero) { return New( this->dim, BaseGDL::ZERO); } else { Data_* res = NewResult(); if( nEl == 1) { if( (*this)[0] != zero) (*res)[0] = s; else (*res)[0] = zero; return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) if( (*this)[i] != zero) (*res)[i] = s; else (*res)[i] = zero; } return res; } } // for doubles template<> Data_* Data_::AndOpSNew( BaseGDL* r) { Data_* right=static_cast(r); if( (*right)[0] == zero) { return New( this->dim, BaseGDL::ZERO); } return this->Dup(); } template<> Data_* Data_::AndOpInvSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Ty s = (*right)[0]; if( s == zero) { return New( this->dim, BaseGDL::ZERO); } else { Data_* res = NewResult(); if( nEl == 1) { if( (*this)[0] != zero) (*res)[0] = s; else (*res)[0] = zero; return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) if( (*this)[i] != zero) (*res)[i] = s; else (*res)[i] = zero; } return res; } } // invalid types template<> Data_* Data_::AndOpSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::AndOpSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::AndOpSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } // template<> // Data_* Data_::AndOpInvSNew( BaseGDL* r) // { // throw GDLException("Cannot apply operation to datatype STRING.",true,false); // return res; // } template<> Data_* Data_::AndOpSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::AndOpSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } // OrOp |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| // Ors right to itself returns new result // right must always have more or same number of elements // for integers template Data_* Data_::OrOpNew( BaseGDL* r) { Data_* right=static_cast(r); // ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); Data_* res = NewResult(); // assert( rEl); assert( nEl); //if( !rEl || !nEl) throw GDLException("Variable is undefined."); if( nEl == 1) { (*res)[0] = (*this)[0] | (*right)[0]; // | Ty(1); return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = (*this)[i] | (*right)[i]; // | Ty(1); } //C delete right; return res; } // different for floats template Data_* Data_::OrOpInvNew( BaseGDL* right) { return OrOpNew( right); } // for floats template<> Data_* Data_::OrOpNew( BaseGDL* r) { Data_* right=static_cast(r); // ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); Data_* res = NewResult(); // assert( rEl); assert( nEl); // if( !rEl || !nEl) throw GDLException("Variable is undefined."); if( nEl == 1) { if( (*this)[0] == zero) (*res)[0] = (*right)[0]; else (*res)[0] = (*this)[0]; return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) if( (*this)[i] == zero) (*res)[i] = (*right)[i]; else (*res)[i] = (*this)[i]; } //C delete right; return res; } template<> Data_* Data_::OrOpInvNew( BaseGDL* r) { Data_* right=static_cast(r); // ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); Data_* res = NewResult(); // assert( rEl); assert( nEl); // if( !rEl || !nEl) throw GDLException("Variable is undefined."); if( nEl == 1) { if( (*right)[0] != zero) (*res)[0] = (*right)[0]; else (*res)[0] = (*this)[0]; return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) if( (*right)[i] != zero) (*res)[i] = (*right)[i]; else (*res)[i] = (*this)[i]; } //C delete right; return res; } // for doubles template<> Data_* Data_::OrOpNew( BaseGDL* r) { Data_* right=static_cast(r); // ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); Data_* res = NewResult(); // assert( rEl); assert( nEl); // if( !rEl || !nEl) throw GDLException("Variable is undefined."); if( nEl == 1) { if( (*this)[0] == zero) (*res)[0] = (*right)[0]; else (*res)[0] = (*this)[0]; return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) if( (*this)[i] == zero) (*res)[i] = (*right)[i]; else (*res)[i] = (*this)[i]; } //C delete right; return res; } template<> Data_* Data_::OrOpInvNew( BaseGDL* r) { Data_* right=static_cast(r); // ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); Data_* res = NewResult(); // assert( rEl); assert( nEl); // if( !rEl || !nEl) throw GDLException("Variable is undefined."); if( nEl == 1) { if( (*right)[0] != zero) (*res)[0] = (*right)[0]; else (*res)[0] = (*this)[0]; return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) if( (*right)[i] != zero) (*res)[i] = (*right)[i]; else (*res)[i] = (*this)[i]; } //C delete right; return res; } // invalid types template<> Data_* Data_::OrOpNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::OrOpNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::OrOpNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::OrOpNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::OrOpNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } // OrOpS // for integers template Data_* Data_::OrOpSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); Data_* res = NewResult(); assert( nEl); Ty s = (*right)[0]; // right->Scalar(s); //s &= Ty(1); // dd |= s; if( nEl == 1) { (*res)[0] = (*this)[0] | s; return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = (*this)[i] | s; } //C delete right; return res; } // different for floats template Data_* Data_::OrOpInvSNew( BaseGDL* right) { return OrOpSNew( right); } // for floats template<> Data_* Data_::OrOpSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Ty s = (*right)[0]; if( s != zero) { Data_* res = NewResult(); if( nEl == 1) { if( (*this)[0] == zero) (*res)[0] = s; else (*res)[0] = (*this)[0]; return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) if( (*this)[i] == zero) (*res)[i] = s; else (*res)[i] = (*this)[i]; } return res; } else // s == zero { return this->Dup(); } } template<> Data_* Data_::OrOpInvSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); Data_* res = NewResult(); assert( nEl); Ty s = (*right)[0]; if( s != zero) { for( SizeT i=0; i < nEl; ++i) (*res)[i] = s; return res; } else { if( nEl == 1) { if( (*this)[0] != zero) (*res)[0] = s; else (*res)[0] = zero; return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) if( (*this)[i] != zero) (*res)[i] = s; else (*res)[i] = zero; } return res; } } // for doubles template<> Data_* Data_::OrOpSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); Data_* res = NewResult(); assert( nEl); Ty s = (*right)[0]; // right->Scalar(s); if( s != zero) { if( nEl == 1) { if( (*this)[0] == zero) (*res)[0] = s; else (*res)[0] = (*this)[0]; return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) if( (*this)[i] == zero) (*res)[i] = s; else (*res)[i] = (*this)[i]; } return res; } // s == zero return this->Dup(); } template<> Data_* Data_::OrOpInvSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); Data_* res = NewResult(); assert( nEl); Ty s = (*right)[0]; if( s != zero) { for( SizeT i=0; i < nEl; ++i) (*res)[i] = s; return res; } else { if( nEl == 1) { if( (*this)[0] != zero) (*res)[0] = s; else (*res)[0] = zero; return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) if( (*this)[i] != zero) (*res)[i] = s; else (*res)[i] = zero; } return res; } } // invalid types template<> Data_* Data_::OrOpSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::OrOpSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::OrOpSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::OrOpSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::OrOpSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } // XorOp ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // Xors right to itself, //C deletes right // right must always have more or same number of elements // for integers template Data_* Data_::XorOpNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); if( nEl == 1) { Data_* res = NewResult(); (*res)[0] = (*this)[0] ^ (*right)[0]; return res; } Ty s; if( right->StrictScalar(s)) { if( s == Sp::zero) return this->Dup(); Data_* res = NewResult(); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = (*this)[i] ^ s; } return res; } else { Data_* res = NewResult(); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = (*this)[i] ^ (*right)[i]; } return res; } } // invalid types template<> Data_* Data_::XorOpNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype FLOAT.",true,false); return NULL; } template<> Data_* Data_::XorOpNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype DOUBLE.",true,false); return NULL; } template<> Data_* Data_::XorOpNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::XorOpNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::XorOpNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::XorOpNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::XorOpNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } template Data_* Data_::XorOpSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); if( nEl == 1) { Data_* res = NewResult(); (*res)[0] = (*this)[0] ^ (*right)[0]; return res; } Ty s = (*right)[0]; if( s == this->zero) return this->Dup(); Data_* res = NewResult(); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = (*this)[i] ^ s; } return res; } // different for floats // for floats template<> Data_* Data_::XorOpSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype FLOAT.",true,false); return NULL; } // for doubles template<> Data_* Data_::XorOpSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype DOUBLE.",true,false); return NULL; } // invalid types template<> Data_* Data_::XorOpSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::XorOpSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::XorOpSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::XorOpSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::XorOpSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } // Add ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ // Adds right to itself returns new result // right must always have more or same number of elements template BaseGDL* Data_::AddNew( BaseGDL* r) { Data_* right=static_cast(r); // ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); assert( nEl); assert( right->N_Elements()); Data_* res = NewResult(); if( nEl == 1) { (*res)[0] = (*this)[0] + (*right)[0]; return res; } #ifdef USE_EIGEN Eigen::Map ,Eigen::Aligned> mThis(&(*this)[0], nEl); Eigen::Map ,Eigen::Aligned> mRight(&(*right)[0], nEl); Eigen::Map ,Eigen::Aligned> mRes(&(*res)[0], nEl); mRes = mThis + mRight; return res; #else TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = (*this)[i] + (*right)[i]; } //C delete right; return res; #endif } template BaseGDL* Data_::AddInvNew( BaseGDL* r) { return AddNew( r); } template<> BaseGDL* Data_::AddInvNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Data_* res = NewResult(); if( nEl == 1) { (*res)[0] = (*right)[0] + (*this)[0] ; return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = (*right)[i] + (*this)[i]; } //C delete right; return res; } // invalid types template<> BaseGDL* Data_::AddNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> BaseGDL* Data_::AddNew( BaseGDL* r) { return Add( r); } template<> BaseGDL* Data_::AddInvNew( BaseGDL* r) { return AddInv( r); } // scalar versions template BaseGDL* Data_::AddSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Data_* res = NewResult(); if( nEl == 1) { (*res)[0] = (*this)[0] + (*right)[0]; return res; } Ty s = (*right)[0]; #ifdef USE_EIGEN Eigen::Map ,Eigen::Aligned> mThis(&(*this)[0], nEl); Eigen::Map ,Eigen::Aligned> mRes(&(*res)[0], nEl); mRes = mThis + s; return res; #else TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = (*this)[i] + s; } //C delete right; return res; #endif } template BaseGDL* Data_::AddInvSNew( BaseGDL* r) { return AddSNew( r); } template<> BaseGDL* Data_::AddInvSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); Data_* res = NewResult(); assert( nEl); if( nEl == 1) { (*res)[0] = (*right)[0] + (*this)[0]; return res; } Ty s = (*right)[0]; TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = s + (*this)[i]; } //C delete right; return res; } // invalid types template<> BaseGDL* Data_::AddSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> BaseGDL* Data_::AddSNew( BaseGDL* r) { return Add( r); } template<> BaseGDL* Data_::AddInvSNew( BaseGDL* r) { return AddInv( r); } // Sub ---------------------------------------------------------------------- // substraction: res=left-right template BaseGDL* Data_::SubNew( BaseGDL* r) { Data_* right=static_cast(r); ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); assert( rEl); assert( nEl); Data_* res = NewResult(); if( nEl == 1)// && rEl == 1) { (*res)[0] = (*this)[0] - (*right)[0]; return res; } Ty s; if( right->StrictScalar(s)) { #ifdef USE_EIGEN Eigen::Map ,Eigen::Aligned> mThis(&(*this)[0], nEl); Eigen::Map ,Eigen::Aligned> mRes(&(*res)[0], nEl); mRes = mThis - s; return res; #else TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = (*this)[i] - s; } return res; #endif } else { #ifdef USE_EIGEN Eigen::Map ,Eigen::Aligned> mThis(&(*this)[0], nEl); Eigen::Map ,Eigen::Aligned> mRight(&(*right)[0], nEl); Eigen::Map ,Eigen::Aligned> mRes(&(*res)[0], nEl); mRes = mThis - mRight; return res; #else TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = (*this)[i] - (*right)[i]; } return res; #endif } } // inverse substraction: left=right-left template BaseGDL* Data_::SubInvNew( BaseGDL* r) { Data_* right=static_cast(r); ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); assert( rEl); assert( nEl); Data_* res = NewResult(); if( nEl == 1) { (*res)[0] = (*right)[0] - (*this)[0]; return res; } #ifdef USE_EIGEN Eigen::Map ,Eigen::Aligned> mThis(&(*this)[0], nEl); Eigen::Map ,Eigen::Aligned> mRight(&(*right)[0], nEl); Eigen::Map ,Eigen::Aligned> mRes(&(*res)[0], nEl); mRes = mRight - mThis; return res; #else TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = (*right)[i] - (*this)[i]; } return res; #endif } // invalid types template<> BaseGDL* Data_::SubNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> BaseGDL* Data_::SubInvNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> BaseGDL* Data_::SubNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> BaseGDL* Data_::SubInvNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> BaseGDL* Data_::SubNew( BaseGDL* r) { return Sub( r); } template<> BaseGDL* Data_::SubInvNew( BaseGDL* r) { return SubInv( r); } // scalar versions template BaseGDL* Data_::SubSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Data_* res = NewResult(); if( nEl == 1) { (*res)[0] = (*this)[0] - (*right)[0]; return res; } Ty s = (*right)[0]; #ifdef USE_EIGEN Eigen::Map ,Eigen::Aligned> mThis(&(*this)[0], nEl); Eigen::Map ,Eigen::Aligned> mRes(&(*res)[0], nEl); mRes = mThis - s; return res; #else TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = (*this)[i] - s; } return res; #endif } // inverse substraction: left=right-left template BaseGDL* Data_::SubInvSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Data_* res = NewResult(); if( nEl == 1) { (*res)[0] = (*right)[0] - (*this)[0]; return res; } Ty s = (*right)[0]; // right->Scalar(s); // dd = s - dd; #ifdef USE_EIGEN Eigen::Map ,Eigen::Aligned> mThis(&(*this)[0], nEl); Eigen::Map ,Eigen::Aligned> mRes(&(*res)[0], nEl); mRes = s - mThis; return res; #else TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = s - (*this)[i]; } return res; #endif } // invalid types template<> BaseGDL* Data_::SubSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> BaseGDL* Data_::SubInvSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> BaseGDL* Data_::SubSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> BaseGDL* Data_::SubInvSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> BaseGDL* Data_::SubSNew( BaseGDL* r) { return Sub( r); } template<> BaseGDL* Data_::SubInvSNew( BaseGDL* r) { return SubInv( r); } // LtMark <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // LtMarks right to itself, //C deletes right // right must always have more or same number of elements template Data_* Data_::LtMarkNew( BaseGDL* r) { Data_* right=static_cast(r); // ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); Data_* res = NewResult(); // assert( rEl); assert( nEl); // if( !rEl || !nEl) throw GDLException("Variable is undefined."); if( nEl == 1) { if( (*this)[0] > (*right)[0]) (*res)[0] = (*right)[0]; else (*res)[0] = (*this)[0]; return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) if( (*this)[i] > (*right)[i]) (*res)[i] = (*right)[i]; else (*res)[i] = (*this)[i]; } //C delete right; return res; } // invalid types template<> Data_* Data_::LtMarkNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::LtMarkNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::LtMarkNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::LtMarkNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::LtMarkNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } // scalar versions template Data_* Data_::LtMarkSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Data_* res = NewResult(); if( nEl == 1) { if( (*this)[0] > (*right)[0]) (*res)[0] = (*right)[0]; else (*res)[0] = (*this)[0]; return res; } Ty s = (*right)[0]; // right->Scalar(s); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) if( (*this)[i] > s) (*res)[i] = s; else (*res)[i] = (*this)[i]; } //C delete right; return res; } // invalid types template<> Data_* Data_::LtMarkSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::LtMarkSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::LtMarkSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::LtMarkSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::LtMarkSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } // GtMark >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> // GtMarks right to itself returns new result // right must always have more or same number of elements template Data_* Data_::GtMarkNew( BaseGDL* r) { Data_* right=static_cast(r); // ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); Data_* res = NewResult(); // assert( rEl); assert( nEl); // if( !rEl || !nEl) throw GDLException("Variable is undefined."); if( nEl == 1) { if( (*this)[0] < (*right)[0]) (*res)[0] = (*right)[0]; else (*res)[0] = (*this)[0]; return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) if( (*this)[i] < (*right)[i]) (*res)[i] = (*right)[i]; else (*res)[i] = (*this)[i]; } //C delete right; return res; } // invalid types template<> Data_* Data_::GtMarkNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::GtMarkNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::GtMarkNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::GtMarkNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::GtMarkNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } // scalar versions template Data_* Data_::GtMarkSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); Data_* res = NewResult(); assert( nEl); if( nEl == 1) { if( (*this)[0] < (*right)[0]) (*res)[0] = (*right)[0]; else (*res)[0] = (*this)[0]; return res; } Ty s = (*right)[0]; // right->Scalar(s); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) if( (*this)[i] < s) (*res)[i] = s; else (*res)[i] = (*this)[i]; } ; return res; } // invalid types template<> Data_* Data_::GtMarkSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::GtMarkSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::GtMarkSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::GtMarkSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::GtMarkSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } // Mult ********************************************************************* // Mults right to itself, //C deletes right // right must always have more or same number of elements template Data_* Data_::MultNew( BaseGDL* r) { Data_* right=static_cast(r); Data_* res=NewResult(); // ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); // assert( rEl); assert( nEl); // if( !rEl || !nEl) throw GDLException("Variable is undefined."); if( nEl == 1) { (*res)[0] = (*this)[0] * (*right)[0]; return res; } #ifdef USE_EIGEN Eigen::Map ,Eigen::Aligned> mThis(&(*this)[0], nEl); Eigen::Map ,Eigen::Aligned> mRight(&(*right)[0], nEl); Eigen::Map ,Eigen::Aligned> mRes(&(*res)[0], nEl); mRes = mThis * mRight; return res; #else TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = (*this)[i] * (*right)[i]; } //C delete right; return res; #endif } // invalid types template<> Data_* Data_::MultNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::MultNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::MultNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } // scalar versions template Data_* Data_::MultSNew( BaseGDL* r ) { Data_* right=static_cast ( r ); ULong nEl=N_Elements(); assert ( nEl ); Data_* res = NewResult(); if ( nEl == 1 ) { ( *res )[0] = ( *this )[0] * ( *right )[0]; return res; } Ty s = ( *right ) [0]; #ifdef USE_EIGEN Eigen::Map ,Eigen::Aligned> mThis(&(*this)[0], nEl); Eigen::Map ,Eigen::Aligned> mRes(&(*res)[0], nEl); mRes = mThis * s; return res; #else TRACEOMP ( __FILE__, __LINE__ ) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for ( OMPInt i=0; i < nEl; ++i ) (*res ) [i] = (*this )[i] * s; } return res; #endif } // invalid types template<> Data_* Data_::MultSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::MultSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::MultSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } // Div ////////////////////////////////////////////////////////////////////// // division: left=left/right template Data_* Data_::DivNew( BaseGDL* r) { Data_* right=static_cast(r); // ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); assert( nEl); Data_* res = NewResult(); SizeT i = 0; if( sigsetjmp( sigFPEJmpBuf, 1) == 0) { // TODO: Check if we can use OpenMP here (is longjmp allowed?) // if yes: need to run the full loop after the longjmp for( ; i < nEl; ++i) (*res)[i] = (*this)[i] / (*right)[i]; return res; } else { TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt ix=i; ix < nEl; ++ix) if( (*right)[ix] != this->zero) (*res)[ix] = (*this)[ix] / (*right)[ix]; else (*res)[ix] = (*this)[ix]; } return res; } } // inverse division: left=right/left template Data_* Data_::DivInvNew( BaseGDL* r) { Data_* right=static_cast(r); // ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); Data_* res = NewResult(); // assert( rEl); assert( nEl); SizeT i = 0; // if( !rEl || !nEl) throw GDLException("Variable is undefined."); if( sigsetjmp( sigFPEJmpBuf, 1) == 0) { for( /*SizeT i=0*/; i < nEl; ++i) (*res)[i] = (*right)[i] / (*this)[i]; return res; } else { TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt ix=i; ix < nEl; ++ix) if( (*this)[ix] != this->zero) (*res)[ix] = (*right)[ix] / (*this)[ix]; else (*res)[ix] = (*right)[ix]; } //C delete right; return res; } } // invalid types template<> Data_* Data_::DivNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::DivInvNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::DivNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::DivInvNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::DivNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } template<> Data_* Data_::DivInvNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } // scalar versions template Data_* Data_::DivSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Ty s = (*right)[0]; SizeT i=0; Data_* res = NewResult(); if( s != this->zero) { for( SizeT i=0; i < nEl; ++i) (*res)[i] = (*this)[i] / s; return res; } if( sigsetjmp( sigFPEJmpBuf, 1) == 0) { for( SizeT i=0; i < nEl; ++i) (*res)[i] = (*this)[i] / s; } else { for( SizeT i=0; i < nEl; ++i) (*res)[i] = (*this)[i]; // } } return res; } // inverse division: left=right/left template Data_* Data_::DivInvSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); Data_* res = NewResult(); assert( nEl); // if( !rEl || !nEl) throw GDLException("Variable is undefined."); if( nEl == 1 && (*this)[0] != this->zero) { (*res)[0] = (*right)[0] / (*this)[0]; return res; } Ty s = (*right)[0]; SizeT i=0; if( sigsetjmp( sigFPEJmpBuf, 1) == 0) { for( ; i < nEl; ++i) (*res)[i] = s / (*this)[i]; return res; } else { TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt ix=i; ix < nEl; ++ix) if( (*this)[ix] != this->zero) (*res)[ix] = s / (*this)[ix]; else (*res)[ix] = s; } return res; } } // invalid types template<> Data_* Data_::DivSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::DivInvSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::DivSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::DivInvSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::DivSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } template<> Data_* Data_::DivInvSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } // Mod %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // modulo division: left=left % right template Data_* Data_::ModNew( BaseGDL* r) { Data_* right=static_cast(r); // ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); Data_* res = NewResult(); // assert( rEl); assert( nEl); SizeT i=0; if( sigsetjmp( sigFPEJmpBuf, 1) == 0) { for( ; i < nEl; ++i) (*res)[i] = (*this)[i] % (*right)[i]; return res; } else { TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt ix=i; ix < nEl; ++ix) if( (*right)[ix] != this->zero) (*res)[ix] = (*this)[ix] % (*right)[ix]; else (*res)[ix] = this->zero; } return res; } } // inverse modulo division: left=right % left template Data_* Data_::ModInvNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); Data_* res = NewResult(); assert( nEl); SizeT i=0; if( sigsetjmp( sigFPEJmpBuf, 1) == 0) { for( ; i < nEl; ++i) (*res)[i] = (*right)[i] % (*this)[i]; return res; } else { TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt ix=i; ix < nEl; ++ix) if( (*this)[ix] != this->zero) (*res)[ix] = (*right)[ix] % (*this)[ix]; else (*res)[ix] = this->zero; } return res; } } // in basic_op.cpp // float modulo division: left=left % right // inline DFloat Modulo( const DFloat& l, const DFloat& r) // { // float t=abs(l/r); // if( l < 0.0) return t=(floor(t)-t)*abs(r); // return (t-floor(t))*abs(r); // } template<> Data_* Data_::ModNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); Data_* res = NewResult(); assert( nEl); if( nEl == 1) { (*res)[0] = Modulo((*this)[0],(*right)[0]); return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = Modulo((*this)[i],(*right)[i]); } return res; } // float inverse modulo division: left=right % left template<> Data_* Data_::ModInvNew( BaseGDL* r) { Data_* right=static_cast(r); // ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); Data_* res = NewResult(); assert( nEl); if( nEl == 1) { (*res)[0] = Modulo((*right)[0],(*this)[0]); return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = Modulo((*right)[i],(*this)[i]); } return res; } // double modulo division: left=left % right inline DDouble Modulo( const DDouble& l, const DDouble& r) { DDouble t=abs(l/r); if( l < 0.0) return t=(floor(t)-t)*abs(r); return (t-floor(t))*abs(r); } template<> Data_* Data_::ModNew( BaseGDL* r) { Data_* right=static_cast(r); // ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); assert( nEl); Data_* res = NewResult(); if( nEl == 1) { (*res)[0] = Modulo((*this)[0],(*right)[0]); return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = Modulo((*this)[i],(*right)[i]); } return res; } // double inverse modulo division: left=right % left template<> Data_* Data_::ModInvNew( BaseGDL* r) { Data_* right=static_cast(r); // ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); Data_* res = NewResult(); assert( nEl); if( nEl == 1) { (*res)[0] = Modulo((*right)[0],(*this)[0]); return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = Modulo((*right)[i],(*this)[i]); } return res; } // invalid types template<> Data_* Data_::ModNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::ModInvNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::ModNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::ModNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::ModInvNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::ModInvNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::ModNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::ModInvNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::ModNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } template<> Data_* Data_::ModInvNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } // scalar versions template Data_* Data_::ModSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Ty s = (*right)[0]; Data_* res = NewResult(); if( s != this->zero) { for( SizeT i=0; i < nEl; ++i) (*res)[i] = (*this)[i] % s; return res; } if( sigsetjmp( sigFPEJmpBuf, 1) == 0) { for( SizeT i=0; i < nEl; ++i) (*res)[i] = (*this)[i] % s; return res; } else { assert( s == this->zero); for( SizeT i=0; i < nEl; ++i) (*res)[i] = this->zero; return res; } } // inverse modulo division: left=right % left template Data_* Data_::ModInvSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Data_* res = NewResult(); if( nEl == 1 && (*this)[0] != this->zero) { (*res)[0] = (*right)[0] % (*this)[0]; return res; } Ty s = (*right)[0]; SizeT i=0; if( sigsetjmp( sigFPEJmpBuf, 1) == 0) { for( /*SizeT i=0*/; i < nEl; ++i) { (*res)[i] = s % (*this)[i]; } return res; } else { TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt ix=i; ix < nEl; ++ix) if( (*this)[ix] != this->zero) (*res)[ix] = s % (*this)[ix]; else (*res)[ix] = this->zero; } return res; } } template<> Data_* Data_::ModSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Data_* res = NewResult(); if( nEl == 1) { (*res)[0] = Modulo((*this)[0],(*right)[0]); return res; } Ty s = (*right)[0]; TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = Modulo((*this)[i],s); } return res; } // float inverse modulo division: left=right % left template<> Data_* Data_::ModInvSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Data_* res = NewResult(); if( nEl == 1) { (*res)[0] = Modulo((*right)[0],(*this)[0]); return res; } Ty s = (*right)[0]; TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = Modulo(s,(*this)[i]); } return res; } template<> Data_* Data_::ModSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Data_* res = NewResult(); if( nEl == 1) { (*res)[0] = Modulo((*this)[0],(*right)[0]); return res; } Ty s = (*right)[0]; TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = Modulo((*this)[i],s); } return res; } // double inverse modulo division: left=right % left template<> Data_* Data_::ModInvSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Data_* res = NewResult(); if( nEl == 1) { (*res)[0] = Modulo((*right)[0],(*this)[0]); return res; } Ty s = (*right)[0]; TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = Modulo(s,(*this)[i]); } return res; } // invalid types template<> Data_* Data_::ModSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::ModInvSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::ModSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::ModSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::ModInvSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::ModInvSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype "+str+".",true,false); return NULL; } template<> Data_* Data_::ModSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::ModInvSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::ModSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } template<> Data_* Data_::ModInvSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } // Pow pow pow pow pow pow pow pow pow pow pow pow pow pow pow pow pow pow // C++ defines pow only for floats and doubles // in basic_op.cpp: // template T pow( const T r, const T l) // { // typedef T TT; // // if( l == 0) return 1; // if( l < 0) return 0; // // const int nBits = sizeof(TT) * 8; // // T arr = r; // T res = 1; // TT mask = 1; // for( SizeT i=0; i Data_* Data_::PowNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); Data_* res = NewResult(); assert( nEl); if( nEl == 1) { (*res)[0] = pow( (*this)[0], (*right)[0]); return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = pow( (*this)[i], (*right)[i]); // valarray } //C delete right; return res; } // inverse power of value: left=right ^ left template Data_* Data_::PowInvNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Data_* res = NewResult(); if( nEl == 1) { (*res)[0] = pow( (*right)[0], (*this)[0]); return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = pow( (*right)[i], (*this)[i]); } return res; } // PowInt and PowIntNew can only be called for GDL_FLOAT and GDL_DOUBLE template Data_* Data_::PowIntNew( BaseGDL* r) { assert( 0); throw GDLException("Internal error: Data_::PowIntNew called.",true,false); return NULL; } // floats power of value with GDL_LONG: left=left ^ right template<> Data_* Data_::PowIntNew( BaseGDL* r) { DLongGDL* right=static_cast(r); ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); assert( rEl); assert( nEl); if( r->StrictScalar()) { Data_* res = new Data_( Dim(), BaseGDL::NOZERO); DLong r0 = (*right)[0]; TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = pow( (*this)[i], r0); } return res; } if( StrictScalar()) { Data_* res = new Data_( right->Dim(), BaseGDL::NOZERO); Ty s0 = (*this)[ 0]; TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (rEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= rEl)) { #pragma omp for for( OMPInt i=0; i < rEl; ++i) (*res)[ i] = pow( s0, (*right)[ i]); } return res; } if( nEl <= rEl) { Data_* res = new Data_( Dim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = pow( (*this)[i], (*right)[i]); } return res; } else { Data_* res = new Data_( right->Dim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (rEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= rEl)) { #pragma omp for for( OMPInt i=0; i < rEl; ++i) (*res)[i] = pow( (*this)[i], (*right)[i]); } return res; } } template<> Data_* Data_::PowIntNew( BaseGDL* r) { DLongGDL* right=static_cast(r); ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); assert( rEl); assert( nEl); if( r->StrictScalar()) { Data_* res = new Data_( Dim(), BaseGDL::NOZERO); DLong r0 = (*right)[0]; TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = pow( (*this)[i], r0); } return res; } if( StrictScalar()) { Data_* res = new Data_( right->Dim(), BaseGDL::NOZERO); Ty s0 = (*this)[ 0]; TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (rEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= rEl)) { #pragma omp for for( OMPInt i=0; i < rEl; ++i) (*res)[ i] = pow( s0, (*right)[ i]); } return res; } if( nEl <= rEl) { Data_* res = new Data_( Dim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = pow( (*this)[i], (*right)[i]); } return res; } else { Data_* res = new Data_( right->Dim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (rEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= rEl)) { #pragma omp for for( OMPInt i=0; i < rEl; ++i) (*res)[i] = pow( (*this)[i], (*right)[i]); } return res; } } // floats power of value: left=left ^ right template<> Data_* Data_::PowNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Data_* res = NewResult(); if( nEl == 1) { (*res)[0] = pow( (*this)[0], (*right)[0]); return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = pow( (*this)[i], (*right)[i]); } return res; } // floats inverse power of value: left=right ^ left template<> Data_* Data_::PowInvNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Data_* res = NewResult(); if( nEl == 1) { (*res)[0] = pow( (*right)[0], (*this)[0]); return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = pow( (*right)[i], (*this)[i]); } //C delete right; return res; } // doubles power of value: left=left ^ right template<> Data_* Data_::PowNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Data_* res = NewResult(); if( nEl == 1) { (*res)[0] = pow( (*this)[0], (*right)[0]); return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = pow( (*this)[i], (*right)[i]); } return res; } // doubles inverse power of value: left=right ^ left template<> Data_* Data_::PowInvNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); Data_* res = NewResult(); assert( nEl); if( nEl == 1) { (*res)[0] = pow( (*right)[0], (*this)[0]); return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = pow( (*right)[i], (*this)[i]); } //C delete right; return res; } // complex power of value: left=left ^ right // complex is special here template<> Data_* Data_::PowNew( BaseGDL* r) { SizeT nEl = N_Elements(); assert( nEl > 0); assert( r->N_Elements() > 0); if( r->Type() == GDL_FLOAT) { Data_* right=static_cast* >(r); DFloat s; // note: changes here have to be reflected in POWNCNode::Eval() (dnode.cpp) // (concerning when a new variable is created vs. using this) // (must also be consistent with ComplexDbl) if( right->StrictScalar(s)) { DComplexGDL* res = new DComplexGDL( this->Dim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; iN_Elements(); if( nEl < rEl) { DComplex s; if( StrictScalar(s)) { DComplexGDL* res = new DComplexGDL( right->Dim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (rEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= rEl)) { #pragma omp for for( OMPInt i=0; iDim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; iDim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (rEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= rEl)) { #pragma omp for for( OMPInt i=0; iType() == GDL_LONG) { Data_* right=static_cast* >(r); DLong s; // note: changes here have to be reflected in POWNCNode::Eval() (dnode.cpp) // (concerning when a new variable is created vs. using this) // (must also be consistent with ComplexDbl) if( right->StrictScalar(s)) { DComplexGDL* res = new DComplexGDL( this->Dim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; iN_Elements(); if( nEl < rEl) { DComplex s; if( StrictScalar(s)) { DComplexGDL* res = new DComplexGDL( right->Dim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (rEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= rEl)) { #pragma omp for for( OMPInt i=0; iDim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; iDim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (rEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= rEl)) { #pragma omp for for( OMPInt i=0; i(r); // ULong rEl=right->N_Elements(); // ULong nEl=N_Elements(); Data_* res = NewResult(); // if( !rEl || !nEl) throw GDLException("Variable is undefined."); Ty s; if( right->StrictScalar(s)) { DComplexGDL* res = new DComplexGDL( this->Dim(), BaseGDL::NOZERO); //#if (__GNUC__ == 3) && (__GNUC_MINOR__ <= 2) TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; iDim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = pow( (*this)[i], (*right)[i]); } return res; } } // complex inverse power of value: left=right ^ left template<> Data_* Data_::PowInvNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Data_* res = NewResult(); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = pow( (*right)[i], (*this)[i]); } return res; } // double complex power of value: left=left ^ right template<> Data_* Data_::PowNew( BaseGDL* r) { SizeT nEl = N_Elements(); assert( nEl > 0); assert( r->N_Elements() > 0); if( r->Type() == GDL_DOUBLE) { Data_* right=static_cast* >(r); DDouble s; // note: changes here have to be reflected in POWNCNode::Eval() (dnode.cpp) // (concerning when a new variable is created vs. using this) // (must also be consistent with ComplexDbl) if( right->StrictScalar(s)) { DComplexDblGDL* res = new DComplexDblGDL( this->Dim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; iN_Elements(); if( nEl < rEl) { DComplexDbl s; if( StrictScalar(s)) { DComplexDblGDL* res = new DComplexDblGDL( right->Dim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (rEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= rEl)) { #pragma omp for for( OMPInt i=0; iDim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; iDim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (rEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= rEl)) { #pragma omp for for( OMPInt i=0; iType() == GDL_LONG) { Data_* right=static_cast* >(r); DLong s; // note: changes here have to be reflected in POWNCNode::Eval() (dnode.cpp) // (concerning when a new variable is created vs. using this) // (must also be consistent with ComplexDbl) if( right->StrictScalar(s)) { DComplexDblGDL* res = new DComplexDblGDL( this->Dim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; iN_Elements(); if( nEl < rEl) { DComplexDbl s; if( StrictScalar(s)) { DComplexDblGDL* res = new DComplexDblGDL( right->Dim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (rEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= rEl)) { #pragma omp for for( OMPInt i=0; iDim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; iDim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (rEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= rEl)) { #pragma omp for for( OMPInt i=0; i(r); Ty s; if( right->StrictScalar(s)) { DComplexDblGDL* res = new DComplexDblGDL( this->Dim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; iDim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = pow( (*this)[i], (*right)[i]); } return res; } } // double complex inverse power of value: left=right ^ left template<> Data_* Data_::PowInvNew( BaseGDL* r) { Data_* right=static_cast(r); ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); assert( rEl); assert( nEl); Data_* res = NewResult(); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = pow( (*right)[i], (*this)[i]); } return res; } // invalid types template<> Data_* Data_::PowNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::PowInvNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::PowNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::PowInvNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::PowNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } template<> Data_* Data_::PowInvNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } // scalar versions template Data_* Data_::PowSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); Data_* res = NewResult(); assert( nEl); Ty s = (*right)[0]; if( nEl == 1) { (*res)[0] = pow( (*this)[0], s); return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = pow( (*this)[i], s); } //C delete right; return res; } // inverse power of value: left=right ^ left template Data_* Data_::PowInvSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Ty s = (*right)[0]; Data_* res = NewResult(); if( nEl == 1) { (*res)[0] = pow( s, (*this)[0]); return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*res)[i] = pow( s, (*this)[i]); } //C delete right; return res; } // complex power of value: left=left ^ right // complex is special here template<> Data_* Data_::PowSNew( BaseGDL* r) { SizeT nEl = N_Elements(); assert( nEl > 0); assert( r->N_Elements() > 0); if( r->Type() == GDL_FLOAT) { Data_* right=static_cast* >(r); DFloat s; // note: changes here have to be reflected in POWNCNode::Eval() (dnode.cpp) // (concerning when a new variable is created vs. using this) // (must also be consistent with ComplexDbl) if( right->StrictScalar(s)) { Data_* res = NewResult(); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; iN_Elements(); if( nEl < rEl) { DComplex s; if( StrictScalar(s)) { DComplexGDL* res = new DComplexGDL( right->Dim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (rEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= rEl)) { #pragma omp for for( OMPInt i=0; i= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; iDim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (rEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= rEl)) { #pragma omp for for( OMPInt i=0; iType() == GDL_LONG) { Data_* right=static_cast* >(r); DLong s; // note: changes here have to be reflected in POWNCNode::Eval() (dnode.cpp) // (concerning when a new variable is created vs. using this) // (must also be consistent with ComplexDbl) if( right->StrictScalar(s)) { Data_* res = NewResult(); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; iN_Elements(); if( nEl < rEl) { DComplex s; if( StrictScalar(s)) { DComplexGDL* res = new DComplexGDL( right->Dim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (rEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= rEl)) { #pragma omp for for( OMPInt i=0; i= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; iDim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (rEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= rEl)) { #pragma omp for for( OMPInt i=0; iType() == GDL_COMPLEX Data_* right=static_cast(r); Ty s = (*right)[0]; Data_* res = NewResult(); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i Data_* Data_::PowInvSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); assert( right->N_Elements()); Ty s = (*right)[0]; Data_* res = NewResult(); if( nEl == 1) { (*res)[0] = pow( s, (*this)[0]); return res; } TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i Data_* Data_::PowSNew( BaseGDL* r) { SizeT nEl = N_Elements(); assert( nEl > 0); if( r->Type() == GDL_DOUBLE) { Data_* right=static_cast* >(r); assert( right->N_Elements() > 0); DDouble s; // note: changes here have to be reflected in POWNCNode::Eval() (dnode.cpp) // (concerning when a new variable is created vs. using this) if( right->StrictScalar(s)) { Data_* res = NewResult(); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; iN_Elements(); if( nEl < rEl) { DComplexDbl s; if( StrictScalar(s)) { DComplexDblGDL* res = new DComplexDblGDL( right->Dim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (rEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= rEl)) { #pragma omp for for( OMPInt i=0; i= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; iDim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (rEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= rEl)) { #pragma omp for for( OMPInt i=0; iType() == GDL_LONG) { Data_* right=static_cast* >(r); assert( right->N_Elements() > 0); DLong s; // note: changes here have to be reflected in POWNCNode::Eval() (dnode.cpp) // (concerning when a new variable is created vs. using this) if( right->StrictScalar(s)) { Data_* res = NewResult(); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; iN_Elements(); if( nEl < rEl) { DComplexDbl s; if( StrictScalar(s)) { DComplexDblGDL* res = new DComplexDblGDL( right->Dim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (rEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= rEl)) { #pragma omp for for( OMPInt i=0; i= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; iDim(), BaseGDL::NOZERO); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (rEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= rEl)) { #pragma omp for for( OMPInt i=0; i(r); const Ty s = (*right)[0]; Data_* res = NewResult(); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i Data_* Data_::PowInvSNew( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); Ty s = (*right)[0]; Data_* res = NewResult(); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i Data_* Data_::PowSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::PowInvSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return NULL; } template<> Data_* Data_::PowSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::PowInvSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return NULL; } template<> Data_* Data_::PowSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } template<> Data_* Data_::PowInvSNew( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return NULL; } //#include "instantiate_templates.hpp" #endif gdl-0.9.4/src/dstructdesc.cpp0000664000175000017500000002157212162135655014561 0ustar marcmarc/*************************************************************************** dstructdesc.cpp - GDL struct descriptor ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" #include #include "datatypes.hpp" #include "dstructdesc.hpp" #include "GDLInterpreter.hpp" #include "dstructgdl.hpp" using namespace std; // store vtable in this obj file DStructBase::~DStructBase() { SizeT nTags = NTags(); for( SizeT i=0; i < nTags; ++i) { delete tags[ i]; } } // DUStructDesc::~DUStructDesc() // {} DStructDesc::~DStructDesc() { assert( !isUnnamed || (operatorList == NULL)); if( !isUnnamed) // only named structs have members and overloaded operators // (usually they are never deleted only with .RESET_SESSION and .FULL_RESET_SESSION dot commands) { delete operatorList; for(FunListT::iterator i = this->fun.begin(); i != this->fun.end(); ++i) { delete *i;} for(ProListT::iterator i = this->pro.begin(); i != this->pro.end(); ++i) { delete *i;} } } DStructDesc* FindInStructList(StructListT v, const string& s) { StructListT::iterator f=find_if(v.begin(),v.end(),DStruct_eq(s)); if( f == v.end()) return NULL; return *f; } bool DStructBase::ContainsStringPtrObject() { for( SizeT t=0; tType() == GDL_STRING) return true; if( tags[t]->Type() == GDL_PTR) return true; if( tags[t]->Type() == GDL_OBJ) return true; if( tags[t]->Type() == GDL_STRUCT) { if( static_cast( tags[t])->Desc()->ContainsStringPtrObject()) return true; } } return false; } void DUStructDesc::AddTag( const string& tagName, const BaseGDL* data) { for( SizeT i=0; i < tNames.size(); i++) if( tNames[i] == tagName) throw GDLException(tagName+" is already defined " "with a conflicting definition"); tNames.push_back(tagName); Add( data->GetTag()); } void DStructDesc::AddParent( DStructDesc* p) { SizeT nTags=p->NTags(); for( SizeT t=0; t < nTags; t++) AddTag( p->TagName(t), (*p)[t]); parent.push_back(p); OperatorList* parentOperatorList = p->GetOperatorList(); if( parentOperatorList != NULL) { assert( this->operatorList == NULL); // GDL_OBJECT can only be inherited once operatorList = new OperatorList(*parentOperatorList); } } // copy appropiate member subroutines from fun and pro lists void DStructDesc::SetupOperators() { assert( this->operatorList != NULL); for( FunListT::iterator f = this->fun.begin(); f != this->fun.end(); ++f) { int ix = OverloadOperatorIndexFun( (*f)->Name()); if( ix != -1) operatorList->SetOperator(ix,*f); } for( ProListT::iterator p = this->pro.begin(); p != this->pro.end(); ++p) { int ix = OverloadOperatorIndexPro( (*p)->Name()); if( ix != -1) operatorList->SetOperator(ix,*p); } } // more sophisticated error messages than operator== void DStructDesc::AssureIdentical( DStructDesc* d) { // name is the same if( NTags() != d->NTags()) { throw GDLException( "STRUCT: "+name+": redefinition with different " "number of tags."); } if( parent.size() != d->parent.size()) { throw GDLException( "STRUCT: "+name+": redefinition with different " "number of parents."); } // compare all tag names // compare the tags (type and dim) for( SizeT i=0; i < NTags(); i++) { if( TagName(i) != d->TagName(i)) { throw GDLException( "STRUCT: "+name+": "+TagName(i)+ " tag name differs in redefinition."); } if( tags[i]->Dim() != d->tags[i]->Dim()) { throw GDLException( "STRUCT: "+name+": "+TagName(i)+ " tag dimension " "differs in redefinition."); } // tag type is converted for convertable types if( (!ConvertableType( tags[i]->Type()) || !ConvertableType( d->tags[i]->Type())) && tags[i]->Type() != d->tags[i]->Type()) { throw GDLException( "STRUCT: "+name+": "+TagName(i)+ " tag type differs in redefinition."); } if( tags[i]->Type() == GDL_STRUCT) { SpDStruct* castLeft= static_cast(tags[i]); SpDStruct* castRight= static_cast(d->tags[i]); DStructDesc* leftD=castLeft->Desc(); DStructDesc* rightD=castRight->Desc(); if( !(*leftD == *rightD)) { throw GDLException( "STRUCT: "+name+": "+TagName(i)+ " tag struct differs in" " redefinition."); } } } // compare all parents for( SizeT i=0; i < parent.size(); i++) { if( parent[i] != d->parent[i]) { throw GDLException( "STRUCT: "+name+": "+parent[i]->Name()+ " parent class differs in redefinition."); } } } // two structs are equal if the contain the same datatypes in the // same order (although names might differ) bool operator==(const DStructDesc& left, const DStructDesc& right) { // name is the same if( left.NTags() != right.NTags()) return false; // struct layout can be same with different inheritance // if( left.parent.size() != right.parent.size()) return false; // compare all tag names // compare the tags (type and dim) for( SizeT i=0; i < left.NTags(); i++) { // if( left.TagName(i) != right.TagName(i)) return false; if( left.tags[i]->Dim() != right.tags[i]->Dim()) return false; if( left.tags[i]->Type() != right.tags[i]->Type()) return false; if( left.tags[i]->Type() == GDL_STRUCT) { SpDStruct* castLeft= static_cast(left.tags[i]); SpDStruct* castRight= static_cast(right.tags[i]); DStructDesc* leftD=castLeft->Desc(); DStructDesc* rightD=castRight->Desc(); // recursive call of operator == if( (leftD != rightD) && !(*leftD == *rightD)) return false; } } // compare all parents // for( SizeT i=0; i < left.parent.size(); i++) // { // if( left.parent[i] != right.parent[i]) return false; // } return true; } bool operator!=(const DStructDesc& left, const DStructDesc& right) { return !(left == right); } // DStructDesc* DStructDesc::FindEqual( const StructListT& sL) // { // for( SizeT i=0; i search for procedure if( found) { p=FindInProList( pName); if( p != NULL) return p; } else noDirectMembers.push_back(pName); } SizeT nParents=parent.size(); for( SizeT i=0; iGetPro( pName); if( p != NULL) return p; } return NULL; } DFun* DStructDesc::GetFun( const string& pName) { DFun* p; p=FindInFunList( pName); if( p != NULL) return p; int fInIDList=FindInIDList( noDirectMembers, pName); if( fInIDList == -1) { bool found=GDLInterpreter::SearchCompilePro( name+"__"+pName, false); // false -> search for function if( found) { p=FindInFunList( pName); if( p != NULL) return p; } else noDirectMembers.push_back(pName); } SizeT nParents=parent.size(); for( SizeT i=0; iGetFun( pName); if( p != NULL) return p; } return NULL; } DPro* DStructDesc::GetPro( const string& pName, const string& parentName) { if( !IsParent( parentName)) throw GDLException( parentName+" is not a parent of "+name); DStructDesc* d=FindInStructList( structList, parentName); if( d == NULL) throw GDLException("Internal error: Struct "+parentName+" not found."); return d->GetPro( pName); } DFun* DStructDesc::GetFun( const string& pName, const string& parentName) { if( !IsParent( parentName)) throw GDLException( parentName+" is not a parent of "+name); DStructDesc* d=FindInStructList( structList, parentName); if( d == NULL) throw GDLException("Internal error: Struct "+parentName+" not found."); return d->GetFun( pName); } gdl-0.9.4/src/widget.hpp0000664000175000017500000000276112024620306013506 0ustar marcmarc/*************************************************************************** widget.hpp - WxWidgets GDL library function ------------------- begin : Dec 17 2007 copyright : (C) 2007 by Joel Gales email : jomoga@users.sourceforge.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #ifndef WIDGET_HPP_ #define WIDGET_HPP_ namespace lib { BaseGDL* widget_base( EnvT* e); BaseGDL* widget_button( EnvT* e); BaseGDL* widget_droplist( EnvT* e); BaseGDL* widget_list( EnvT* e); BaseGDL* widget_text( EnvT* e); BaseGDL* widget_label( EnvT* e); BaseGDL* widget_info( EnvT* e); BaseGDL* widget_event( EnvT* e); BaseGDL* widget_bgroup( EnvT* e); void widget_control( EnvT* e); } // namespace #endif gdl-0.9.4/src/prognodeexpr.cpp0000664000175000017500000032175112221012667014741 0ustar marcmarc/*************************************************************************** prognodeexpr.cpp - GDL's AST is made of DNodes ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" #include #include #include #include "dinterpreter.hpp" #include "prognodeexpr.hpp" #include "basegdl.hpp" #include "arrayindexlistt.hpp" #include "envt.hpp" #include "gdlexception.hpp" #include "nullgdl.hpp" #include "basic_fun.hpp" #include "basic_fun_jmg.hpp" using namespace std; BinaryExpr::BinaryExpr( const RefDNode& refNode): DefaultNode( refNode) { op1 = GetFirstChild(); op2 = GetFirstChild()->GetNextSibling(); setType( GDLTokenTypes::EXPR); } BinaryExprNC::BinaryExprNC( const RefDNode& refNode): BinaryExpr( refNode) { op1NC = NonCopyNode( op1->getType()); op2NC = NonCopyNode( op2->getType()); } ProgNode::ProgNode(): // for NULLProgNode keepRight( false), keepDown( false), breakTarget( NULL), ttype( antlr::Token::NULL_TREE_LOOKAHEAD), text( "NULLProgNode"), down( NULL), right( NULL), lineNumber( 0), cData( NULL), libPro( NULL), libFun( NULL), var( NULL), labelStart( 0), labelEnd( 0) {} BaseGDL* ProgNode::EvalNC() { throw GDLException( this, "Internal error. " "ProgNode::EvalNC() called.",true,false); } BaseGDL* ProgNode::EvalNCNull() { return this->EvalNC(); } BaseGDL** ProgNode::LEval() { throw GDLException( this, "Internal error. " "ProgNode::LEval() called.",true,false); } BaseGDL** ProgNode::EvalRefCheck( BaseGDL*& rEval) // default like Eval() { rEval = this->Eval(); return NULL; } RetCode ProgNode::Run() { throw GDLException( this, "Internal error. " "ProgNode::Run() called.",true,false); return RC_OK; // silence compiler } void ProgNode::SetRightDown( const ProgNodeP r, const ProgNodeP d) { right = r; down = d; } BaseGDL* ProgNode::Eval() { throw GDLException( this, "Internal error. " "ProgNode::Eval() called.",true,false); // return ProgNode::interpreter->expr( this); } // converts inferior type to superior type // for not (yet) overloaded operators void ProgNode::AdjustTypes(Guard& a, Guard& b) { DType aTy=a->Type(); DType bTy=b->Type(); if( aTy == bTy) return; // Will be checked by Convert2() function // if( DTypeOrder[aTy] > 100 || DTypeOrder[bTy] > 100) // GDL_STRUCT, GDL_PTR, OBJ // { // //exception // throw GDLException( "Expressions of this type cannot be converted."); // } // GDL_COMPLEX op GDL_DOUBLE = GDL_COMPLEXDBL DType cxTy = PromoteComplexOperand( aTy, bTy); if( cxTy != GDL_UNDEF) { a.reset( a.release()->Convert2( cxTy)); b.reset( b.release()->Convert2( cxTy)); return; } // Change > to >= JMG if( DTypeOrder[aTy] >= DTypeOrder[bTy]) { // convert b to a b.reset( b.release()->Convert2( aTy)); } else { // convert a to b a.reset( a.release()->Convert2( bTy)); } } // converts inferior type to superior type // handles overloaded operators void ProgNode::AdjustTypesObj(Guard& a, Guard& b) { DType aTy=a->Type(); DType bTy=b->Type(); if( aTy == bTy) return; // Will be checked by Convert2() function // if( DTypeOrder[aTy] > 100 || DTypeOrder[bTy] > 100) // GDL_STRUCT, GDL_PTR, OBJ // { // //exception // throw GDLException( "Expressions of this type cannot be converted."); // } // GDL_COMPLEX op GDL_DOUBLE = GDL_COMPLEXDBL DType cxTy = PromoteComplexOperand( aTy, bTy); if( cxTy != GDL_UNDEF) { a.reset( a.release()->Convert2( cxTy)); b.reset( b.release()->Convert2( cxTy)); return; } // Change > to >= JMG if( DTypeOrder[aTy] >= DTypeOrder[bTy]) { // convert b to a if( aTy == GDL_OBJ) // only check for aTy is ok because GDL_OBJ has highest order return; // for operator overloading, do not convert other type then b.reset( b.release()->Convert2( aTy)); } else { // convert a to b if( bTy == GDL_OBJ) // only check for bTy is ok because GDL_OBJ has highest order return; // for operator overloading, do not convert other type then a.reset( a.release()->Convert2( bTy)); } } // for not (yet) overloaded operators void BinaryExprNC::AdjustTypesNC(Guard& g1, BaseGDL*& e1, Guard& g2, BaseGDL*& e2) { if( op1NC) { e1 = op1->EvalNC(); } else { e1 = op1->Eval(); g1.reset( e1); } if( op2NC) { e2 = op2->EvalNC(); } else { e2 = op2->Eval(); g2.reset( e2); } DType aTy=e1->Type(); DType bTy=e2->Type(); if( aTy == bTy) return; // Will be checked by Convert2() function // if( DTypeOrder[aTy] > 100 || DTypeOrder[bTy] > 100) // GDL_STRUCT, GDL_PTR, OBJ // { // throw GDLException( "Expressions of this type cannot be converted."); // } DType cxTy = PromoteComplexOperand( aTy, bTy); if( cxTy != GDL_UNDEF) { e2 = e2->Convert2( cxTy, BaseGDL::COPY); g2.reset( e2); // delete former e2 e1 = e1->Convert2( cxTy, BaseGDL::COPY); g1.reset( e1); // delete former e1 return; } // Change > to >= JMG if( DTypeOrder[aTy] >= DTypeOrder[bTy]) { // // GDL_COMPLEX op GDL_DOUBLE = GDL_COMPLEXDBL // if( (aTy == GDL_COMPLEX && bTy == GDL_DOUBLE)) // { // e2 = e2->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g2.reset( e2); // delete former e2 // e1 = e1->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g1.reset( e1); // delete former e1 // return; // } // convert e2 to e1 e2 = e2->Convert2( aTy, BaseGDL::COPY); g2.reset( e2); // delete former e2 } else { // // GDL_COMPLEX op GDL_DOUBLE = GDL_COMPLEXDBL // if( (bTy == GDL_COMPLEX && aTy == GDL_DOUBLE)) // { // e2 = e2->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g2.reset( e2); // delete former e2 // e1 = e1->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g1.reset( e1); // delete former e1 // return; // } // convert e1 to e2 e1 = e1->Convert2( bTy, BaseGDL::COPY); g1.reset( e1); // delete former e1 } } // handles overloaded operators void BinaryExprNC::SetupGuards(Guard& g1, BaseGDL*& e1, Guard& g2, BaseGDL*& e2) { if( op1NC) { e1 = op1->EvalNC(); } else { e1 = op1->Eval(); g1.Init( e1); } if( op2NC) { e2 = op2->EvalNC(); } else { e2 = op2->Eval(); g2.Init( e2); } } // only called from EqOp and NeOp // also handles overloaded operators void BinaryExprNC::AdjustTypesNCNull(Guard& g1, BaseGDL*& e1, Guard& g2, BaseGDL*& e2) { if( op1NC) { e1 = op1->EvalNCNull(); } else { e1 = op1->Eval(); g1.Init( e1); } if( op2NC) { e2 = op2->EvalNCNull(); } else { e2 = op2->Eval(); g2.Init( e2); } // if at least one is !NULL make sure this is e1 if( e1 == NullGDL::GetSingleInstance()) return; if( e2 == NullGDL::GetSingleInstance()) { // e1 is not !NULL (but might be NULL) // BaseGDL* tmp = e1; // e1 = e2; // e2 = tmp; e2 = e1; e1 = NullGDL::GetSingleInstance(); return; } if( e1 == NULL) { // provoke error e1 = op1->EvalNC(); assert( false); // code should never reach here } else if( e2 == NULL) { // provoke error e2 = op2->EvalNC(); assert( false); // code should never reach here } DType aTy=e1->Type(); DType bTy=e2->Type(); if( aTy == bTy) return; // Will be checked by Convert2() function // if( DTypeOrder[aTy] > 100 || DTypeOrder[bTy] > 100) // GDL_STRUCT, GDL_PTR, OBJ // { // throw GDLException( "Expressions of this type cannot be converted."); // } // Change > to >= JMG DType cxTy = PromoteComplexOperand( aTy, bTy); if( cxTy != GDL_UNDEF) { e2 = e2->Convert2( cxTy, BaseGDL::COPY); g2.Reset( e2); // delete former e2 e1 = e1->Convert2( cxTy, BaseGDL::COPY); g1.Reset( e1); // delete former e1 return; } if( DTypeOrder[aTy] >= DTypeOrder[bTy]) { // // GDL_COMPLEX op GDL_DOUBLE = GDL_COMPLEXDBL // if( (aTy == GDL_COMPLEX && bTy == GDL_DOUBLE)) // { // e2 = e2->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g2.Reset( e2); // delete former e2 // e1 = e1->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g1.Reset( e1); // delete former e1 // return; // } // no conversion because of operator overloads if( aTy == GDL_OBJ) // only check for aTy is ok because GDL_OBJ has highest order return; // convert e2 to e1 e2 = e2->Convert2( aTy, BaseGDL::COPY); g2.Reset( e2); // delete former e2 } else { // // GDL_COMPLEX op GDL_DOUBLE = GDL_COMPLEXDBL // if( (bTy == GDL_COMPLEX && aTy == GDL_DOUBLE)) // { // e2 = e2->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g2.Reset( e2); // delete former e2 // e1 = e1->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g1.Reset( e1); // delete former e1 // return; // } // no conversion because of operator overloads if( bTy == GDL_OBJ) // only check for bTy is ok because GDL_OBJ has highest order return; // convert e1 to e2 e1 = e1->Convert2( bTy, BaseGDL::COPY); g1.Reset( e1); // delete former e1 } } BaseGDL* VARNode::Eval() { BaseGDL* vData = this->EvalNC(); if( vData == NULL) { throw GDLException( this, "Variable is undefined: "+this->getText(),true,false); } return vData->Dup(); } BaseGDL* VARPTRNode::Eval() { BaseGDL* vData = this->EvalNC(); if( vData == NULL) { throw GDLException( this, "Common block variable is undefined.",true,false); } return vData->Dup(); } BaseGDL* SYSVARNode::Eval() { return this->EvalNC()->Dup(); } BaseGDL* VARNode::EvalNC() { EnvStackT& callStack=interpreter->CallStack(); BaseGDL* res=static_cast ( callStack.back() )->GetKW ( this->varIx ); if ( res == NULL ) throw GDLException ( this, "Variable is undefined: "+ callStack.back()->GetString ( this->varIx ),true,false ); return res; } BaseGDL* VARNode::EvalNCNull() { EnvStackT& callStack=interpreter->CallStack(); BaseGDL* res=static_cast ( callStack.back() )->GetKW ( this->varIx ); // if ( res == NULL ) // res = NullGDL::GetSingleInstance(); return res; } BaseGDL* VARPTRNode::EvalNC() { BaseGDL* res=this->var->Data(); if( res == NULL) { EnvStackT& callStack=interpreter->CallStack(); throw GDLException( this, "Variable is undefined: "+ callStack.back()->GetString( res),true,false); } return res; } BaseGDL* VARPTRNode::EvalNCNull() { BaseGDL* res=this->var->Data(); // if( res == NULL) // res = NullGDL::GetSingleInstance(); return res; } BaseGDL* CONSTANTNode::EvalNC() { return this->cData; } BaseGDL* CONSTANTNode::Eval() { return this->cData->Dup(); } BaseGDL* SYSVARNode::EvalNC() { if( this->var == NULL) { this->var=FindInVarList(sysVarList,this->getText()); if( this->var == NULL) throw GDLException( this, "Not a legal system variable: !"+ this->getText(),true,false); } // system variables are always defined return this->var->Data(); } BaseGDL** SYSVARNode::EvalRefCheck( BaseGDL*& rEval) { return this->LEval(); } BaseGDL** SYSVARNode::LEval() { const ProgNodeP& sysVar = this; //match(antlr::RefAST(_t),SYSVAR); if( sysVar->var == NULL) { sysVar->var=FindInVarList(sysVarList,sysVar->getText()); if( sysVar->var == NULL) throw GDLException( sysVar, "Not a legal system variable: !"+ sysVar->getText(),true,false); // note: this works, because system variables are never // passed by reference SizeT rdOnlySize = sysVarRdOnlyList.size(); for( SizeT i=0; ivar) throw GDLException( this, "Attempt to write to a readonly variable: !"+ sysVar->getText(),true,false); } // interpreter->SetRetTree( sysVar->getNextSibling()); // system variables are always defined return &sysVar->var->Data(); } BaseGDL* DEREFNode::Eval() { // use new env if set (during parameter parsing) EnvBaseT* actEnv = DInterpreter::CallStackBack()->GetNewEnv(); if( actEnv == NULL) actEnv = DInterpreter::CallStackBack(); assert( actEnv != NULL); Guard e1_guard; BaseGDL* e1; ProgNodeP evalExpr = this->getFirstChild(); if( NonCopyNode( evalExpr->getType())) { e1 = evalExpr->EvalNC(); } // else if( evalExpr->getType() == GDLTokenTypes::FCALL_LIB) // { // // e1=interpreter->lib_function_call(evalExpr); // BaseGDL** retValPtr; // e1 = static_cast(evalExpr)->EvalFCALL_LIB( retValPtr); // // set return tree not needed // if( e1 == NULL) // ROUTINE_NAMES // throw GDLException( evalExpr, "Undefined return value", true, false); // // // if( !DInterpreter::CallStackBack()->Contains( e1)) // if( retValPtr == NULL) // { // e1_guard.Init( e1); // } // } else { // e1 = evalExpr->Eval(); // e1_guard.Init( e1); BaseGDL** ref = evalExpr->EvalRefCheck(e1); if( ref == NULL) e1_guard.Init( e1); else e1 = *ref; } if( e1 == NULL || e1->Type() != GDL_PTR) throw GDLException( evalExpr, "Pointer type required" " in this context: "+interpreter->Name(e1),true,false); DPtrGDL* ptr=static_cast(e1); DPtr sc; if( !ptr->StrictScalar(sc)) throw GDLException( this, "Expression must be a " "scalar in this context: "+interpreter->Name(e1),true,false); if( sc == 0) throw GDLException( this, "Unable to dereference" " NULL pointer: "+interpreter->Name(e1),true,false); BaseGDL** res; try{ res = &interpreter->GetHeap(sc); } catch( DInterpreter::HeapException) { throw GDLException( this, "Invalid pointer: "+interpreter->Name(e1),true,false); } if( *res == NULL) throw GDLException( this, "Variable is undefined: "+ interpreter->Name(res),true,false); return (*res)->Dup(); } BaseGDL* DEREFNode::EvalNC() { Guard e1_guard; BaseGDL* e1; ProgNodeP evalExpr = this->getFirstChild(); if( NonCopyNode( evalExpr->getType())) { e1 = evalExpr->EvalNC(); } else { e1 = evalExpr->Eval(); e1_guard.Reset(e1); } if( e1 == NULL || e1->Type() != GDL_PTR) throw GDLException( this, "Pointer type required" " in this context: "+interpreter->Name(e1),true,false); DPtrGDL* ptr=static_cast(e1); DPtr sc; if( !ptr->Scalar(sc)) throw GDLException( this, "Expression must be a " "scalar in this context: "+interpreter->Name(e1),true,false); if( sc == 0) throw GDLException( this, "Unable to dereference" " NULL pointer: "+interpreter->Name(e1),true,false); try{ return interpreter->GetHeap(sc); } catch( GDLInterpreter::HeapException) { throw GDLException( this, "Invalid pointer: "+interpreter->Name(e1),true,false); } } BaseGDL** DEREFNode::EvalRefCheck( BaseGDL*& rEval) { return this->LEval(); } BaseGDL** DEREFNode::LEval() { // use new env if set (during parameter parsing) EnvBaseT* actEnv = DInterpreter::CallStackBack()->GetNewEnv(); if( actEnv == NULL) actEnv = DInterpreter::CallStackBack(); assert( actEnv != NULL); // Guard e1_guard; BaseGDL* e1; ProgNodeP evalExpr = this->getFirstChild(); if( NonCopyNode( evalExpr->getType())) { e1 = evalExpr->EvalNC(); } // else if( evalExpr->getType() == GDLTokenTypes::FCALL_LIB) // { // // e1=interpreter->lib_function_call(evalExpr); // BaseGDL** retValPtr; // e1 = static_cast(evalExpr)->EvalFCALL_LIB( retValPtr); // // set return tree not needed // if( e1 == NULL) // ROUTINE_NAMES // throw GDLException( evalExpr, "Undefined return value", true, false); // // // if( !DInterpreter::CallStackBack()->Contains( e1)) // if( retValPtr == NULL) // { // // e1_guard.Init( e1); // actEnv->DeleteAtExit( e1); // we need life cycle until end of current subroutine // } // } else { // e1 = evalExpr->Eval(); // // e1_guard.Init( e1); // // in case *(ptr_new(value)), value will be destroyed due to ref counting // // when e1 is deleted // actEnv->DeleteAtExit( e1);// we need life cycle until end of current subroutine BaseGDL** ref = evalExpr->EvalRefCheck(e1); if( ref == NULL) actEnv->DeleteAtExit( e1); else e1 = *ref; } if( e1 == NULL || e1->Type() != GDL_PTR) throw GDLException( evalExpr, "Pointer type required" " in this context: "+interpreter->Name(e1),true,false); DPtrGDL* ptr=static_cast(e1); DPtr sc; if( !ptr->StrictScalar(sc)) throw GDLException( this, "Expression must be a " "scalar in this context: "+interpreter->Name(e1),true,false); if( sc == 0) throw GDLException( this, "Unable to dereference" " NULL pointer: "+interpreter->Name(e1),true,false); BaseGDL** res; try{ res = &interpreter->GetHeap(sc); } catch( DInterpreter::HeapException) { throw GDLException( this, "Invalid pointer: "+interpreter->Name(e1),true,false); } return res; } // trinary operator BaseGDL** QUESTIONNode::EvalRefCheck( BaseGDL*& rEval) { ProgNodeP branch = this->GetBranch(); return branch->EvalRefCheck( rEval); } BaseGDL* QUESTIONNode::Eval() { ProgNodeP branch = this->GetBranch(); return branch->Eval(); // Guard e1_guard; // BaseGDL* e1; // if( NonCopyNode( op1->getType())) // { // e1 = op1->EvalNC(); // } // else // { // // e1 = op1->Eval(); // // e1_guard.Init(e1); // BaseGDL** ref = op1->EvalRefCheck(e1); // if( ref == NULL) // e1_guard.Init(e1); // else // e1 = *ref; // } // // Guard e1( op1->Eval()); // if( e1->True()) // { // return op2->Eval(); // right->down // } // return op3->Eval(); // right->right } ProgNodeP QUESTIONNode::GetThisBranch() { Guard e1_guard; BaseGDL* e1; if( NonCopyNode( op1->getType())) { e1 = op1->EvalNC(); } else { // e1 = op1->Eval(); // e1_guard.Init(e1); BaseGDL** ref = op1->EvalRefCheck(e1); if( ref == NULL) e1_guard.Init(e1); else e1 = *ref; } // Guard e1( op1->Eval()); if( e1->True()) { return op2; } return op3; } // unary operators BaseGDL* UMINUSNode::Eval() { BaseGDL* e1 = down->Eval(); return e1->UMinus(); // might delete e1 (GDL_STRING) } BaseGDL* NOT_OPNode::Eval() { BaseGDL* e1 = down->Eval(); return e1->NotOp(); } BaseGDL* LOG_NEGNode::Eval() { Guard e1( down->Eval()); return e1->LogNeg(); } // binary operators BaseGDL* AND_OPNode::Eval() { BaseGDL* res; Guard e1( op1->Eval()); Guard e2( op2->Eval()); AdjustTypes(e1,e2); if( e1->StrictScalar()) { res= e2->AndOpS(e1.get()); // scalar+scalar or array+scalar e2.release(); } else if( e2->StrictScalar()) { res= e1->AndOpInvS(e2.get()); // array+scalar e1.release(); } else if( e1->N_Elements() <= e2->N_Elements()) { res = e1->AndOpInv(e2.get()); // smaller_array + larger_array or same size e1.release(); } else { res = e2->AndOp(e1.get()); // smaller + larger e2.release(); } return res; } BaseGDL* OR_OPNode::Eval() { BaseGDL* res; Guard e1( op1->Eval()); Guard e2( op2->Eval()); AdjustTypes(e1,e2); if( e1->StrictScalar()) { res= e2->OrOpS(e1.get()); // scalar+scalar or array+scalar e2.release(); } else if( e2->StrictScalar()) { res= e1->OrOpInvS(e2.get()); // array+scalar e1.release(); } else if( e1->N_Elements() <= e2->N_Elements()) { res= e1->OrOpInv(e2.get()); // smaller_array + larger_array or same size e1.release(); } else { res= e2->OrOp(e1.get()); // smaller + larger e2.release(); } return res; } BaseGDL* XOR_OPNode::Eval() { BaseGDL* res; Guard e1( op1->Eval()); Guard e2( op2->Eval()); AdjustTypes(e1,e2); if( e1->N_Elements() <= e2->N_Elements()) { res= e1->XorOp(e2.get()); // smaller_array + larger_array or same size e1.release(); } else { res= e2->XorOp(e1.get()); // smaller + larger e2.release(); } return res; } BaseGDL* LOG_ANDNode::Eval() { BaseGDL* res; Guard e1( op1->Eval()); if( !e1->LogTrue()) return new DByteGDL( 0); Guard e2( op2->Eval()); if( !e2->LogTrue()) return new DByteGDL( 0); return new DByteGDL( 1); } BaseGDL* LOG_ORNode::Eval() { BaseGDL* res; Guard e1( op1->Eval()); if( e1->LogTrue()) return new DByteGDL( 1); Guard e2( op2->Eval()); if( e2->LogTrue()) return new DByteGDL( 1); return new DByteGDL( 0); } BaseGDL* EQ_OPNode::Eval() { Guard e1( op1->Eval()); Guard e2( op2->Eval()); AdjustTypesObj(e1,e2); if( e2->Type() == GDL_OBJ) { if( e1->Type() != GDL_OBJ) { // order is critical: overload might just be defined for one of the object types // use e2 only if e1 is no object BaseGDL* res=e2->EqOp(e1.get()); return res; } } BaseGDL* res=e1->EqOp(e2.get()); return res; } BaseGDL* NE_OPNode::Eval() { Guard e1( op1->Eval()); Guard e2( op2->Eval()); AdjustTypesObj(e1,e2); if( e2->Type() == GDL_OBJ) { if( e1->Type() != GDL_OBJ) { // order is critical: overload might just be defined for one of the object types // use e2 only if e1 is no object BaseGDL* res=e2->NeOp(e1.get()); return res; } } BaseGDL* res=e1->NeOp(e2.get()); return res; } BaseGDL* LE_OPNode::Eval() { BaseGDL* res; Guard e1( op1->Eval()); Guard e2( op2->Eval()); AdjustTypes(e1,e2); res=e1->LeOp(e2.get()); return res; } BaseGDL* LT_OPNode::Eval() { BaseGDL* res; Guard e1( op1->Eval()); Guard e2( op2->Eval()); AdjustTypes(e1,e2); res=e1->LtOp(e2.get()); return res; } BaseGDL* GE_OPNode::Eval() { BaseGDL* res; Guard e1( op1->Eval()); Guard e2( op2->Eval()); AdjustTypes(e1,e2); res=e1->GeOp(e2.get()); return res; } BaseGDL* GT_OPNode::Eval() { BaseGDL* res; Guard e1( op1->Eval()); Guard e2( op2->Eval()); AdjustTypes(e1,e2); res=e1->GtOp(e2.get()); return res; } BaseGDL* PLUSNode::Eval() { BaseGDL* res; Guard e1 ( op1->Eval() ); Guard e2 ( op2->Eval() ); DType aTy=e1->Type(); DType bTy=e2->Type(); if( aTy == bTy) { if( aTy == GDL_OBJ) // we MUST do this here (correct guard handling) return e1->Add( e2.get());; // operator overloading } // GDL_COMPLEX op GDL_DOUBLE = GDL_COMPLEXDBL else { DType cxTy = PromoteComplexOperand( aTy, bTy); if( cxTy != GDL_UNDEF) { e1.reset( e1.release()->Convert2( cxTy)); e2.reset( e2.release()->Convert2( cxTy)); } // Change > to >= JMG else if( DTypeOrder[aTy] >= DTypeOrder[bTy]) { // convert b to a if( aTy == GDL_OBJ) // only check for aTy is ok because GDL_OBJ has highest order return e1->Add( e2.get());; // for operator overloading, do not convert other type then e2.reset( e2.release()->Convert2( aTy)); } else { // convert a to b if( bTy == GDL_OBJ) // only check for bTy is ok because GDL_OBJ has highest order return e2->AddInv( e1.get());; // for operator overloading, do not convert other type then e1.reset( e1.release()->Convert2( bTy)); } } if ( e1->StrictScalar() ) { res= e2->AddInvS ( e1.get() ); // scalar+scalar or array+scalar e2.release(); } else if ( e2->StrictScalar() ) { res= e1->AddS ( e2.get() ); // array+scalar e1.release(); } else if ( e1->N_Elements() <= e2->N_Elements() ) { res= e1->Add ( e2.get() ); // smaller_array + larger_array or same size e1.release(); } else { res= e2->AddInv ( e1.get() ); // smaller + larger e2.release(); } return res; } BaseGDL* MINUSNode::Eval() { BaseGDL* res; Guard e1( op1->Eval()); Guard e2( op2->Eval()); // AdjustTypes(e1,e2); DType aTy=e1->Type(); DType bTy=e2->Type(); if( aTy == bTy) { if( aTy == GDL_OBJ) // we MUST do this here (correct guard handling) return e1->Sub( e2.get());; // operator overloading } // GDL_COMPLEX op GDL_DOUBLE = GDL_COMPLEXDBL else { DType cxTy = PromoteComplexOperand( aTy, bTy); if( cxTy != GDL_UNDEF) { e1.reset( e1.release()->Convert2( cxTy)); e2.reset( e2.release()->Convert2( cxTy)); } // Change > to >= JMG else if( DTypeOrder[aTy] >= DTypeOrder[bTy]) { // convert b to a if( aTy == GDL_OBJ) // only check for aTy is ok because GDL_OBJ has highest order return e1->Sub( e2.get());; // for operator overloading, do not convert other type then e2.reset( e2.release()->Convert2( aTy)); } else { // convert a to b if( bTy == GDL_OBJ) // only check for bTy is ok because GDL_OBJ has highest order return e2->SubInv( e1.get());; // for operator overloading, do not convert other type then e1.reset( e1.release()->Convert2( bTy)); } } if( e1->StrictScalar()) { res= e2->SubInvS(e1.get()); // scalar+scalar or array+scalar e2.release(); } else if( e2->StrictScalar()) { res= e1->SubS(e2.get()); // array+scalar e1.release(); } else if( e1->N_Elements() <= e2->N_Elements()) { res= e1->Sub(e2.get()); // smaller_array + larger_array or same size e1.release(); } else { res= e2->SubInv(e1.get()); // smaller + larger e2.release(); } return res; } BaseGDL* LTMARKNode::Eval() { BaseGDL* res; Guard e1( op1->Eval()); Guard e2( op2->Eval()); AdjustTypes(e1,e2); if( e1->StrictScalar()) { res= e2->LtMarkS(e1.get()); // scalar+scalar or array+scalar e2.release(); } else if( e2->StrictScalar()) { res= e1->LtMarkS(e2.get()); // array+scalar e1.release(); } else if( e1->N_Elements() <= e2->N_Elements()) { res= e1->LtMark(e2.get()); // smaller_array + larger_array or same size e1.release(); } else { res= e2->LtMark(e1.get()); // smaller + larger e2.release(); } return res; } BaseGDL* GTMARKNode::Eval() { BaseGDL* res; Guard e1( op1->Eval()); Guard e2( op2->Eval()); AdjustTypes(e1,e2); if( e1->StrictScalar()) { res= e2->GtMarkS(e1.get()); // scalar+scalar or array+scalar e2.release(); } else if( e2->StrictScalar()) { res= e1->GtMarkS(e2.get()); // array+scalar e1.release(); } else if( e1->N_Elements() <= e2->N_Elements()) { res= e1->GtMark(e2.get()); // smaller_array + larger_array or same size e1.release(); } else { res= e2->GtMark(e1.get()); // smaller + larger e2.release(); } return res; } BaseGDL* ASTERIXNode::Eval() { BaseGDL* res; Guard e1 ( op1->Eval() ); Guard e2 ( op2->Eval() ); AdjustTypes ( e1,e2 ); if ( e1->StrictScalar() ) { res= e2->MultS ( e1.get() ); // scalar+scalar or array+scalar e2.release(); } else if ( e2->StrictScalar() ) { res= e1->MultS ( e2.get() ); // array+scalar e1.release(); } else if ( e1->N_Elements() <= e2->N_Elements() ) { res= e1->Mult ( e2.get() ); // smaller_array + larger_array or same size e1.release(); } else { res= e2->Mult ( e1.get() ); // smaller + larger e2.release(); } return res; } BaseGDL* MATRIX_OP1Node::Eval() { BaseGDL* res; Guard e1( op1->Eval()); Guard e2( op2->Eval()); DType aTy=e1->Type(); DType bTy=e2->Type(); // DType maxTy=(DTypeOrder[aTy] >= DTypeOrder[bTy])? aTy: bTy; // DType cTy=maxTy; // if( maxTy == GDL_BYTE || maxTy == GDL_INT) // cTy=GDL_LONG; // else if( maxTy == GDL_UINT) // cTy=GDL_ULONG; DType cTy = PromoteMatrixOperands( aTy, bTy); if( aTy != cTy) e1.reset( e1.release()->Convert2( cTy)); AdjustTypes(e1,e2); res=e1->MatrixOp(e2.get()); return res; } BaseGDL* MATRIX_OP2Node::Eval() { BaseGDL* res; Guard e1( op1->Eval()); Guard e2( op2->Eval()); DType aTy=e1->Type(); DType bTy=e2->Type(); // DType maxTy=(DTypeOrder[aTy] >= DTypeOrder[bTy])? aTy: bTy; // DType cTy=maxTy; // if( maxTy == GDL_BYTE || maxTy == GDL_INT) // cTy=GDL_LONG; // else if( maxTy == GDL_UINT) // cTy=GDL_ULONG; DType cTy = PromoteMatrixOperands( aTy, bTy); if( aTy != cTy) e1.reset( e1.release()->Convert2( cTy)); AdjustTypes(e1,e2); res=e2->MatrixOp(e1.get()); return res; } BaseGDL* SLASHNode::Eval() { BaseGDL* res; Guard e1( op1->Eval()); Guard e2( op2->Eval()); AdjustTypes(e1,e2); if( e1->StrictScalar()) { res= e2->DivInvS(e1.get()); // scalar+scalar or array+scalar e2.release(); } else if( e2->StrictScalar()) { res= e1->DivS(e2.get()); // array+scalar e1.release(); } else if( e1->N_Elements() <= e2->N_Elements()) { res= e1->Div(e2.get()); // smaller_array + larger_array or same size e1.release(); } else { res= e2->DivInv(e1.get()); // smaller + larger e2.release(); } return res; } BaseGDL* MOD_OPNode::Eval() { BaseGDL* res; Guard e1( op1->Eval()); Guard e2( op2->Eval()); AdjustTypes(e1,e2); if( e1->StrictScalar()) { res= e2->ModInvS(e1.get()); // scalar+scalar or array+scalar e2.release(); } else if( e2->StrictScalar()) { res= e1->ModS(e2.get()); // array+scalar e1.release(); } else if( e1->N_Elements() <= e2->N_Elements()) { res= e1->Mod(e2.get()); // smaller_array + larger_array or same size e1.release(); } else { res= e2->ModInv(e1.get()); // smaller + larger e2.release(); } return res; } BaseGDL* POWNode::Eval() { BaseGDL* res; Guard e1( op1->Eval()); Guard e2( op2->Eval()); // special handling for aTy == complex && bTy != complex DType aTy=e1->Type(); DType bTy=e2->Type(); if( aTy == GDL_STRING) { e1.reset( e1->Convert2( GDL_FLOAT, BaseGDL::COPY)); aTy = GDL_FLOAT; } if( bTy == GDL_STRING) { e2.reset( e2->Convert2( GDL_FLOAT, BaseGDL::COPY)); bTy = GDL_FLOAT; } if( ComplexType( aTy)) { if( IntType( bTy)) { e2.reset( e2.release()->Convert2( GDL_LONG)); res = e1->Pow( e2.get()); if( res == e1.get()) e1.release(); return res; } if( aTy == GDL_COMPLEX) { if( bTy == GDL_DOUBLE) { e1.reset( e1.release()->Convert2( GDL_COMPLEXDBL)); aTy = GDL_COMPLEXDBL; } else if( bTy == GDL_FLOAT) { res = e1->Pow( e2.get()); if( res == e1.get()) e1.release(); return res; } } if( aTy == GDL_COMPLEXDBL) { if( bTy == GDL_FLOAT) { e2.reset( e2.release()->Convert2( GDL_DOUBLE)); bTy = GDL_DOUBLE; } if( bTy == GDL_DOUBLE) { res = e1->Pow( e2.get()); if( res == e1.get()) e1.release(); return res; } } } if( IntType( bTy) && FloatType( aTy)) { e2.reset( e2.release()->Convert2( GDL_LONG)); res = e1->PowInt( e2.get()); if( res == e1.get()) e1.release(); return res; } DType convertBackT; // convert back if( IntType( bTy) && (DTypeOrder[ bTy] > DTypeOrder[ aTy])) // if( IntType( bTy) && (DTypeOrder[ bTy] > DTypeOrder[ aTy])) convertBackT = aTy; else convertBackT = GDL_UNDEF; // first operand determines type JMG // AdjustTypes(e2,e1); // order crucial here (for converting back) AdjustTypes(e1,e2); // order crucial here (for converting back) if( e1->StrictScalar()) { res= e2->PowInvS(e1.get()); // scalar+scalar or array+scalar e2.release(); } else if( e2->StrictScalar()) { res= e1->PowS(e2.get()); // array+scalar e1.release(); } else if( e1->N_Elements() <= e2->N_Elements()) { res= e1->Pow(e2.get()); // smaller_array + larger_array or same size e1.release(); } else { res= e2->PowInv(e1.get()); // smaller + larger e2.release(); } if( convertBackT != GDL_UNDEF) { res = res->Convert2( convertBackT, BaseGDL::CONVERT); } endPOW: return res; } // BaseGDL* DECNode::Eval() // { BaseGDL* res; // return new DECNode( refNode); // } // BaseGDL* INCNode::Eval() // { BaseGDL* res; // return new INCNode( refNode); // } // BaseGDL* POSTDECNode::Eval() // { BaseGDL* res; // return new POSTDECNode( refNode); // } // BaseGDL* POSTINCNode::Eval() // { BaseGDL* res; // return new POSTINCNode( refNode); // } // *********************** // **** nonCopy nodes **** // *********************** BaseGDL* AND_OPNCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; AdjustTypesNC( g1, e1, g2, e2); if( e1->StrictScalar()) { if( g2.get() == NULL) return e2->AndOpSNew( e1); else g2.release(); res= e2->AndOpS(e1); // scalar+scalar or array+scalar } else if( e2->StrictScalar()) { if( g1.get() == NULL) return e1->AndOpInvSNew( e2); else g1.release(); res= e1->AndOpInvS(e2); // array+scalar } else if( e1->N_Elements() == e2->N_Elements()) { if( g1.get() != NULL) { g1.release(); return e1->AndOpInv(e2); } if( g2.get() != NULL) { g2.release(); res = e2->AndOp(e1); res->SetDim( e1->Dim()); return res; } else { return e1->AndOpInvNew(e2); } } else if( e1->N_Elements() < e2->N_Elements()) { if( g1.get() == NULL) return e1->AndOpInvNew( e2); else g1.release(); res = e1->AndOpInv(e2); // smaller_array + larger_array or same size } else { if( g2.get() == NULL) return e2->AndOpNew( e1); else g2.release(); res = e2->AndOp(e1); // smaller + larger } return res; } BaseGDL* OR_OPNCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; AdjustTypesNC( g1, e1, g2, e2); if( e1->StrictScalar()) { if( g2.get() == NULL) return e2->OrOpSNew( e1); else g2.release(); res= e2->OrOpS(e1); // scalar+scalar or array+scalar } else if( e2->StrictScalar()) { if( g1.get() == NULL) return e1->OrOpInvSNew( e2); else g1.release(); res= e1->OrOpInvS(e2); // array+scalar } else if( e1->N_Elements() == e2->N_Elements()) { if( g1.get() != NULL) { g1.release(); return e1->OrOpInv(e2); } if( g2.get() != NULL) { g2.release(); res = e2->OrOp(e1); res->SetDim( e1->Dim()); return res; } else { return e1->OrOpInvNew(e2); } } else if( e1->N_Elements() < e2->N_Elements()) { if( g1.get() == NULL) return e1->OrOpInvNew( e2); else g1.release(); res= e1->OrOpInv(e2); // smaller_array + larger_array or same size } else { if( g2.get() == NULL) return e2->OrOpNew( e1); else g2.release(); res= e2->OrOp(e1); // smaller + larger } return res; } BaseGDL* XOR_OPNCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; AdjustTypesNC( g1, e1, g2, e2); if( e1->StrictScalar()) { if( g2.get() == NULL) return e2->XorOpSNew( e1); else g2.release(); res= e2->XorOpS(e1); // scalar+scalar or array+scalar } else if( e2->StrictScalar()) { if( g1.get() == NULL) return e1->XorOpSNew( e2); else g1.release(); res= e1->XorOpS(e2); // array+scalar } else if( e1->N_Elements() == e2->N_Elements()) { if( g1.get() != NULL) { g1.release(); return e1->XorOp(e2); } if( g2.get() != NULL) { g2.release(); res = e2->XorOp(e1); res->SetDim( e1->Dim()); return res; } else { return e1->XorOpNew(e2); } } else if( e1->N_Elements() < e2->N_Elements()) { if( g1.get() == NULL) return e1->XorOpNew( e2); else g1.release(); res= e1->XorOp(e2); // smaller_array + larger_array or same size } else { if( g2.get() == NULL) return e2->XorOpNew( e1); else g2.release(); res= e2->XorOp(e1); // smaller + larger } return res; } BaseGDL* LOG_ANDNCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; if( op1NC) { e1 = op1->EvalNC(); } else { e1 = op1->Eval(); g1.reset( e1); } if( !e1->LogTrue()) return new DByteGDL( 0); if( op2NC) { e2 = op2->EvalNC(); } else { e2 = op2->Eval(); g2.reset( e2); } if( !e2->LogTrue()) return new DByteGDL( 0); return new DByteGDL( 1); } BaseGDL* LOG_ORNCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; if( op1NC) { e1 = op1->EvalNC(); } else { e1 = op1->Eval(); g1.reset( e1); } if( e1->LogTrue()) return new DByteGDL( 1); if( op2NC) { e2 = op2->EvalNC(); } else { e2 = op2->Eval(); g2.reset( e2); } if( e2->LogTrue()) return new DByteGDL( 1); return new DByteGDL( 0); } BaseGDL* EQ_OPNCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; AdjustTypesNCNull( g1, e1, g2, e2); if( e2->Type() == GDL_OBJ) { if( e1->Type() != GDL_OBJ) { // order is critical: overload might just be defined for one of the object types // use e2 only if e1 is no object BaseGDL* res=e2->EqOp(e1); return res; } } res=e1->EqOp(e2); return res; } BaseGDL* NE_OPNCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; AdjustTypesNCNull( g1, e1, g2, e2); if( e2->Type() == GDL_OBJ) { if( e1->Type() != GDL_OBJ) { // order is critical: overload might just be defined for one of the object types // use e2 only if e1 is no object BaseGDL* res=e2->NeOp(e1); return res; } } res=e1->NeOp(e2); return res; } BaseGDL* LE_OPNCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; AdjustTypesNC( g1, e1, g2, e2); res=e1->LeOp(e2); return res; } BaseGDL* LT_OPNCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; AdjustTypesNC( g1, e1, g2, e2); res=e1->LtOp(e2); return res; } BaseGDL* GE_OPNCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; AdjustTypesNC( g1, e1, g2, e2); res=e1->GeOp(e2); return res; } BaseGDL* GT_OPNCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; AdjustTypesNC( g1, e1, g2, e2); res=e1->GtOp(e2); return res; } BaseGDL* PLUSNC12Node::Eval() { BaseGDL *e1 = op1->EvalNC(); BaseGDL *e2 = op2->EvalNC(); DType aTy=e1->Type(); DType bTy=e2->Type(); if( aTy == bTy) { // as all Add...New() functions are implemented for GDL_OBJ, we can save the if(...) here // (as there are no guards up to here) // if( aTy == GDL_OBJ) // this saves us to implement all Add...New() functions // return e1->Add( e2); if ( e1->StrictScalar() ) { return e2->AddInvSNew( e1 ); // scalar+scalar or array+scalar } else if ( e2->StrictScalar() ) { return e1->AddSNew( e2); // array+scalar } else if ( e1->N_Elements() <= e2->N_Elements() ) { return e1->AddNew ( e2 ); } else // e1->N_Elements() > e2->N_Elements() ) { return e2->AddInvNew( e1); // smaller + larger } } Guard g1; Guard g2; DType cxTy = PromoteComplexOperand( aTy, bTy); if( cxTy != GDL_UNDEF) { e2 = e2->Convert2( cxTy, BaseGDL::COPY); g2.reset( e2); e1 = e1->Convert2( cxTy, BaseGDL::COPY); g1.reset( e1); } else if( DTypeOrder[aTy] >= DTypeOrder[bTy]) { if( aTy == GDL_OBJ) return e1->Add( e2); // // GDL_COMPLEX op GDL_DOUBLE = GDL_COMPLEXDBL // if(aTy == GDL_COMPLEX && bTy == GDL_DOUBLE) // { // e2 = e2->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g2.reset( e2); // e1 = e1->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g1.reset( e1); // } // else { // convert e2 to e1 e2 = e2->Convert2( aTy, BaseGDL::COPY); g2.reset( e2); } } else { if( bTy == GDL_OBJ) return e2->AddInv( e1); // GDL_COMPLEX op GDL_DOUBLE = GDL_COMPLEXDBL // if( (bTy == GDL_COMPLEX && aTy == GDL_DOUBLE)) // { // e2 = e2->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g2.reset( e2); // e1 = e1->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g1.reset( e1); // } // else {// convert e1 to e2 e1 = e1->Convert2( bTy, BaseGDL::COPY); g1.reset( e1); } } // 'classic handling from here BaseGDL* res; if ( e1->StrictScalar() ) { if ( g2.get() == NULL ) { res= e2->AddInvSNew( e1 ); // scalar+scalar or array+scalar } else { g2.release(); res= e2->AddInvS( e1 ); // scalar+scalar or array+scalar } } else if ( e2->StrictScalar() ) { if ( g1.get() == NULL ) res= e1->AddSNew( e2); // array+scalar else { g1.release(); res= e1->AddS( e2); // array+scalar } } else if ( e1->N_Elements() == e2->N_Elements() ) { if ( g1.get() != NULL ) { g1.release(); return e1->Add ( e2 ); } if ( g2.get() != NULL ) { g2.release(); res = e2->AddInv ( e1 ); res->SetDim ( e1->Dim() ); return res; } else { return e1->AddNew ( e2 ); } } else if ( e1->N_Elements() < e2->N_Elements() ) { if ( g1.get() == NULL ) res= e1->AddNew ( e2 ); // smaller_array + larger_array or same size else { g1.release(); res= e1->Add ( e2 ); // smaller_array + larger_array or same size } } else // e1->N_Elements() > e2->N_Elements() ) { if ( g2.get() == NULL ) res= e2->AddInvNew( e1); // smaller + larger else { g2.release(); res= e2->AddInv( e1); // smaller + larger } } return res; } BaseGDL* PLUSNCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; SetupGuards( g1, e1, g2, e2 ); DType aTy=e1->Type(); DType bTy=e2->Type(); if( aTy == bTy) { if( aTy == GDL_OBJ) // we MUST do this here (correct guard handling) return e1->Add( e2); // otherwise continue below } else // aTy != bTy { DType cxTy = PromoteComplexOperand( aTy, bTy); if( cxTy != GDL_UNDEF) { e2 = e2->Convert2( cxTy, BaseGDL::COPY); g2.Reset( e2); // delete former e2 e1 = e1->Convert2( cxTy, BaseGDL::COPY); g1.Reset( e1); // delete former e1 } // Change > to >= JMG else if( DTypeOrder[aTy] >= DTypeOrder[bTy]) { // // GDL_COMPLEX op GDL_DOUBLE = GDL_COMPLEXDBL // if( (aTy == GDL_COMPLEX && bTy == GDL_DOUBLE)) // { // e2 = e2->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g2.Reset( e2); // delete former e2 // e1 = e1->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g1.Reset( e1); // delete former e1 // } // else if( aTy == GDL_OBJ) // only check for aTy is ok because GDL_OBJ has highest order return e1->Add(e2); // for operator overloading, do not convert other type then else { // convert e2 to e1 e2 = e2->Convert2( aTy, BaseGDL::COPY); g2.Reset( e2); // delete former e2 } } else { // // GDL_COMPLEX op GDL_DOUBLE = GDL_COMPLEXDBL // if( (bTy == GDL_COMPLEX && aTy == GDL_DOUBLE)) // { // e2 = e2->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g2.Reset( e2); // delete former e2 // e1 = e1->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g1.Reset( e1); // delete former e1 // } // else if( bTy == GDL_OBJ) // only check for bTy is ok because GDL_OBJ has highest order return e2->AddInv( e1); // for operator overloading, do not convert other type then else { // convert e1 to e2 e1 = e1->Convert2( bTy, BaseGDL::COPY); g1.Reset( e1); // delete former e1 } } } // aTy != bTy if ( e1->StrictScalar() ) { if ( g2.IsNull() ) { res= e2->AddInvSNew( e1 ); // scalar+scalar or array+scalar } else { g2.Release(); res= e2->AddInvS( e1 ); // scalar+scalar or array+scalar } } else if ( e2->StrictScalar() ) { if ( g1.IsNull() ) res= e1->AddSNew( e2); // array+scalar else { g1.Release(); res= e1->AddS( e2); // array+scalar } } else if ( e1->N_Elements() == e2->N_Elements() ) { if ( !g1.IsNull() ) { g1.Release(); return e1->Add ( e2 ); } if ( !g2.IsNull() ) { g2.Release(); res = e2->AddInv ( e1 ); res->SetDim ( e1->Dim() ); return res; } else { return e1->AddNew ( e2 ); } } else if ( e1->N_Elements() < e2->N_Elements() ) { if ( g1.IsNull() ) res= e1->AddNew ( e2 ); // smaller_array + larger_array or same size else { g1.Release(); res= e1->Add ( e2 ); // smaller_array + larger_array or same size } } else // e1->N_Elements() > e2->N_Elements() ) { if ( g2.IsNull() ) res= e2->AddInvNew( e1); // smaller + larger else { g2.Release(); res= e2->AddInv( e1); // smaller + larger } } return res; } BaseGDL* MINUSNC12Node::Eval() { BaseGDL *e1 = op1->EvalNC(); BaseGDL *e2 = op2->EvalNC(); DType aTy=e1->Type(); DType bTy=e2->Type(); if( aTy == bTy) { // as all Sub...New() functions are implemented for GDL_OBJ, we can save the if(...) here // (as there are no guards up to here) // if( aTy == GDL_OBJ) // this saves us to implement all Add...New() functions // return e1->Add( e2); if ( e1->StrictScalar() ) { return e2->SubInvSNew( e1 ); // scalar+scalar or array+scalar } else if ( e2->StrictScalar() ) { return e1->SubSNew( e2); // array+scalar } else if ( e1->N_Elements() <= e2->N_Elements() ) { return e1->SubNew ( e2 ); } else // e1->N_Elements() > e2->N_Elements() ) { return e2->SubInvNew( e1); // smaller + larger } } Guard g1; Guard g2; DType cxTy = PromoteComplexOperand( aTy, bTy); if( cxTy != GDL_UNDEF) { e2 = e2->Convert2( cxTy, BaseGDL::COPY); g2.reset( e2); e1 = e1->Convert2( cxTy, BaseGDL::COPY); g1.reset( e1); } else if( DTypeOrder[aTy] >= DTypeOrder[bTy]) { if( aTy == GDL_OBJ) return e1->Sub( e2); // // GDL_COMPLEX op GDL_DOUBLE = GDL_COMPLEXDBL // if( aTy == GDL_COMPLEX && bTy == GDL_DOUBLE) // { // e2 = e2->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g2.reset( e2); // e1 = e1->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g1.reset( e1); // } // else { // convert e2 to e1 e2 = e2->Convert2( aTy, BaseGDL::COPY); g2.reset( e2); } } else { if( bTy == GDL_OBJ) return e2->SubInv( e1); // // GDL_COMPLEX op GDL_DOUBLE = GDL_COMPLEXDBL // if( (bTy == GDL_COMPLEX && aTy == GDL_DOUBLE)) // { // e2 = e2->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g2.reset( e2); // e1 = e1->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g1.reset( e1); // } // else {// convert e1 to e2 e1 = e1->Convert2( bTy, BaseGDL::COPY); g1.reset( e1); } } // 'classic handling from here BaseGDL* res; if( e1->StrictScalar()) { if( g2.get() == NULL) return e2->SubInvSNew( e1); else g2.release(); res= e2->SubInvS(e1); // scalar+scalar or array+scalar } else if( e2->StrictScalar()) { if( g1.get() == NULL) return e1->SubSNew( e2); else g1.release(); res= e1->SubS(e2); // array+scalar } else if( e1->N_Elements() == e2->N_Elements()) { if( g1.get() != NULL) { g1.release(); return e1->Sub(e2); } if( g2.get() != NULL) { g2.release(); res = e2->SubInv(e1); res->SetDim( e1->Dim()); return res; } else { return e1->SubNew(e2); } } else if( e1->N_Elements() < e2->N_Elements()) { if( g1.get() == NULL) return e1->SubNew( e2); else g1.release(); res= e1->Sub(e2); // smaller_array + larger_array or same size } else { if( g2.get() == NULL) return e2->SubInvNew( e1); else g2.release(); res= e2->SubInv(e1); // smaller + larger } return res; } BaseGDL* MINUSNCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; // AdjustTypesNC( g1, e1, g2, e2); SetupGuards( g1, e1, g2, e2 ); DType aTy=e1->Type(); DType bTy=e2->Type(); if( aTy == bTy) { if( aTy == GDL_OBJ) // we MUST do this here (correct guard handling) return e1->Sub( e2); // otherwise continue below } else // aTy != bTy { DType cxTy = PromoteComplexOperand( aTy, bTy); if( cxTy != GDL_UNDEF) { e2 = e2->Convert2( cxTy, BaseGDL::COPY); g2.Reset( e2); // delete former e2 e1 = e1->Convert2( cxTy, BaseGDL::COPY); g1.Reset( e1); // delete former e1 } // Change > to >= JMG else if( DTypeOrder[aTy] >= DTypeOrder[bTy]) { // // GDL_COMPLEX op GDL_DOUBLE = GDL_COMPLEXDBL // if( (aTy == GDL_COMPLEX && bTy == GDL_DOUBLE)) // { // e2 = e2->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g2.Reset( e2); // delete former e2 // e1 = e1->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g1.Reset( e1); // delete former e1 // } // else if( aTy == GDL_OBJ) // only check for aTy is ok because GDL_OBJ has highest order return e1->Sub(e2); // for operator overloading, do not convert other type then else { // convert e2 to e1 e2 = e2->Convert2( aTy, BaseGDL::COPY); g2.Reset( e2); // delete former e2 } } else { // // GDL_COMPLEX op GDL_DOUBLE = GDL_COMPLEXDBL // if( (bTy == GDL_COMPLEX && aTy == GDL_DOUBLE)) // { // e2 = e2->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g2.Reset( e2); // delete former e2 // e1 = e1->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g1.Reset( e1); // delete former e1 // } // else if( bTy == GDL_OBJ) // only check for bTy is ok because GDL_OBJ has highest order return e2->SubInv( e1); // for operator overloading, do not convert other type then else { // convert e1 to e2 e1 = e1->Convert2( bTy, BaseGDL::COPY); g1.Reset( e1); // delete former e1 } } } // aTy != bTy if( e1->StrictScalar()) { if( g2.Get() == NULL) return e2->SubInvSNew( e1); else g2.Release(); res= e2->SubInvS(e1); // scalar+scalar or array+scalar } else if( e2->StrictScalar()) { if( g1.Get() == NULL) return e1->SubSNew( e2); else g1.Release(); res= e1->SubS(e2); // array+scalar } else if( e1->N_Elements() == e2->N_Elements()) { if( g1.Get() != NULL) { g1.Release(); return e1->Sub(e2); } if( g2.Get() != NULL) { g2.Release(); res = e2->SubInv(e1); res->SetDim( e1->Dim()); return res; } else { return e1->SubNew(e2); } } else if( e1->N_Elements() < e2->N_Elements()) { if( g1.Get() == NULL) return e1->SubNew( e2); else g1.Release(); res= e1->Sub(e2); // smaller_array + larger_array or same size } else { if( g2.Get() == NULL) return e2->SubInvNew( e1); else g2.Release(); res= e2->SubInv(e1); // smaller + larger } return res; } BaseGDL* LTMARKNCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; AdjustTypesNC( g1, e1, g2, e2); if( e1->StrictScalar()) { if( g2.get() == NULL) return e2->LtMarkSNew( e1); else g2.release(); res= e2->LtMarkS(e1); // scalar+scalar or array+scalar } else if( e2->StrictScalar()) { if( g1.get() == NULL) return e1->LtMarkSNew( e2); else g1.release(); res= e1->LtMarkS(e2); // array+scalar } else if( e1->N_Elements() == e2->N_Elements()) { if( g1.get() != NULL) { g1.release(); return e1->LtMark(e2); } if( g2.get() != NULL) { g2.release(); res = e2->LtMark(e1); res->SetDim( e1->Dim()); return res; } else { return e1->LtMarkNew(e2); } } else if( e1->N_Elements() < e2->N_Elements()) { if( g1.get() == NULL) return e1->LtMarkNew( e2); else g1.release(); res= e1->LtMark(e2); // smaller_array + larger_array or same size } else { if( g2.get() == NULL) return e2->LtMarkNew( e1); else g2.release(); res= e2->LtMark(e1); // smaller + larger } return res; } BaseGDL* GTMARKNCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; AdjustTypesNC( g1, e1, g2, e2); if( e1->StrictScalar()) { if( g2.get() == NULL) return e2->GtMarkSNew( e1); else g2.release(); res= e2->GtMarkS(e1); // scalar+scalar or array+scalar } else if( e2->StrictScalar()) { if( g1.get() == NULL) return e1->GtMarkSNew( e2); else g1.release(); res= e1->GtMarkS(e2); // array+scalar } else if( e1->N_Elements() == e2->N_Elements()) { if( g1.get() != NULL) { g1.release(); return e1->GtMark(e2); } if( g2.get() != NULL) { g2.release(); res = e2->GtMark(e1); res->SetDim( e1->Dim()); return res; } else { return e1->GtMarkNew(e2); } } else if( e1->N_Elements() < e2->N_Elements()) { if( g1.get() == NULL) return e1->GtMarkNew( e2); else g1.release(); res= e1->GtMark(e2); // smaller_array + larger_array or same size } else { if( g2.get() == NULL) return e2->GtMarkNew( e1); else g2.release(); res= e2->GtMark(e1); // smaller + larger } return res; } BaseGDL* ASTERIXNC12Node::Eval() { BaseGDL *e1 = op1->EvalNC(); BaseGDL *e2 = op2->EvalNC(); DType aTy=e1->Type(); DType bTy=e2->Type(); if( aTy == bTy) { if ( e1->StrictScalar() ) { return e2->MultSNew( e1 ); // scalar+scalar or array+scalar } else if ( e2->StrictScalar() ) { return e1->MultSNew( e2); // array+scalar } else if ( e1->N_Elements() <= e2->N_Elements() ) { return e1->MultNew ( e2 ); } else // e1->N_Elements() > e2->N_Elements() ) { return e2->MultNew( e1); // smaller + larger } } Guard g1; Guard g2; DType cxTy = PromoteComplexOperand( aTy, bTy); if( cxTy != GDL_UNDEF) { e2 = e2->Convert2( cxTy, BaseGDL::COPY); g2.reset( e2); e1 = e1->Convert2( cxTy, BaseGDL::COPY); g1.reset( e1); } else if( DTypeOrder[aTy] >= DTypeOrder[bTy]) { // // GDL_COMPLEX op GDL_DOUBLE = GDL_COMPLEXDBL // if( aTy == GDL_COMPLEX && bTy == GDL_DOUBLE) // { // e2 = e2->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g2.reset( e2); // e1 = e1->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g1.reset( e1); // } // else { // convert e2 to e1 e2 = e2->Convert2( aTy, BaseGDL::COPY); g2.reset( e2); } } else { // // GDL_COMPLEX op GDL_DOUBLE = GDL_COMPLEXDBL // if( (bTy == GDL_COMPLEX && aTy == GDL_DOUBLE)) // { // e2 = e2->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g2.reset( e2); // e1 = e1->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g1.reset( e1); // } // else {// convert e1 to e2 e1 = e1->Convert2( bTy, BaseGDL::COPY); g1.reset( e1); } } // 'classic handling from here BaseGDL* res; if ( e1->StrictScalar() ) { if ( g2.get() == NULL ) { res= e2->MultSNew( e1); // scalar+scalar or array+scalar } else { g2.release(); res= e2->MultS( e1); // scalar+scalar or array+scalar } } else if ( e2->StrictScalar() ) { if ( g1.get() == NULL ) { // return e1->New( e2); res= e1->MultSNew( e2); // array+scalar } else { g1.release(); res= e1->MultS( e2); // array+scalar } } else if ( e1->N_Elements() == e2->N_Elements() ) { if ( g1.get() != NULL ) { g1.release(); return e1->Mult( e2); } else if ( g2.get() != NULL ) { g2.release(); res = e2->Mult( e1); res->SetDim( e1->Dim()); return res; } else { return e1->MultNew( e2); // return e1->Dup()->Mult ( e2 ); } } else if ( e1->N_Elements() < e2->N_Elements() ) { if ( g1.get() == NULL ) { // return e1->New( e2); res= e1->MultNew( e2); // smaller_array + larger_array or same size } else { g1.release(); res= e1->Mult( e2); // smaller_array + larger_array or same size } } else { if ( g2.get() == NULL ) { res = e2->MultNew( e1); // smaller + larger } else { g2.release(); res= e2->Mult( e1); // smaller + larger } } return res; } BaseGDL* ASTERIXNCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; AdjustTypesNC ( g1, e1, g2, e2 ); if ( e1->StrictScalar() ) { if ( g2.get() == NULL ) { res= e2->MultSNew( e1); // scalar+scalar or array+scalar } else { g2.release(); res= e2->MultS( e1); // scalar+scalar or array+scalar } } else if ( e2->StrictScalar() ) { if ( g1.get() == NULL ) { // return e1->New( e2); res= e1->MultSNew( e2); // array+scalar } else { g1.release(); res= e1->MultS( e2); // array+scalar } } else if ( e1->N_Elements() == e2->N_Elements() ) { if ( g1.get() != NULL ) { g1.release(); return e1->Mult( e2); } else if ( g2.get() != NULL ) { g2.release(); res = e2->Mult( e1); res->SetDim( e1->Dim()); return res; } else { return e1->MultNew( e2); // return e1->Dup()->Mult ( e2 ); } } else if ( e1->N_Elements() < e2->N_Elements() ) { if ( g1.get() == NULL ) { // return e1->New( e2); res= e1->MultNew( e2); // smaller_array + larger_array or same size } else { g1.release(); res= e1->Mult( e2); // smaller_array + larger_array or same size } } else { if ( g2.get() == NULL ) { res = e2->MultNew( e1); // smaller + larger } else { g2.release(); res= e2->Mult( e1); // smaller + larger } } return res; } BaseGDL* MATRIX_OP1NCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; if( op1NC) { e1 = op1->EvalNC(); } else { e1 = op1->Eval(); g1.reset( e1); } if( op2NC) { e2 = op2->EvalNC(); } else { e2 = op2->Eval(); g2.reset( e2); } DType aTy=e1->Type(); DType bTy=e2->Type(); // DType maxTy=(DTypeOrder[aTy] >= DTypeOrder[bTy])? aTy: bTy; // if( maxTy > 100) // { // throw GDLException( "Expressions of this type cannot be converted."); // } // DType cTy=maxTy; // if( maxTy == GDL_BYTE || maxTy == GDL_INT) // cTy=GDL_LONG; // else if( maxTy == GDL_UINT) // cTy=GDL_ULONG; DType cTy = PromoteMatrixOperands( aTy, bTy); if( aTy != cTy) { e1 = e1->Convert2( cTy, BaseGDL::COPY); g1.reset( e1); } if( bTy != cTy) { e2 = e2->Convert2( cTy, BaseGDL::COPY); g2.reset( e2); } res=e1->MatrixOp(e2); return res; } BaseGDL* MATRIX_OP2NCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; if( op1NC) { e1 = op1->EvalNC(); } else { e1 = op1->Eval(); g1.reset( e1); } if( op2NC) { e2 = op2->EvalNC(); } else { e2 = op2->Eval(); g2.reset( e2); } DType aTy=e1->Type(); DType bTy=e2->Type(); // DType maxTy=(DTypeOrder[aTy] >= DTypeOrder[bTy])? aTy: bTy; // if( maxTy > 100) // { // throw GDLException( "Expressions of this type cannot be converted."); // } // DType cTy=maxTy; // if( maxTy == GDL_BYTE || maxTy == GDL_INT) // cTy=GDL_LONG; // else if( maxTy == GDL_UINT) // cTy=GDL_ULONG; DType cTy = PromoteMatrixOperands( aTy, bTy); if( aTy != cTy) { e1 = e1->Convert2( cTy, BaseGDL::COPY); g1.reset( e1); } if( bTy != cTy) { e2 = e2->Convert2( cTy, BaseGDL::COPY); g2.reset( e2); } res=e2->MatrixOp(e1); return res; } BaseGDL* SLASHNC12Node::Eval() { BaseGDL *e1 = op1->EvalNC(); BaseGDL *e2 = op2->EvalNC(); DType aTy=e1->Type(); DType bTy=e2->Type(); if( aTy == bTy) { if ( e1->StrictScalar() ) { return e2->DivInvSNew( e1 ); // scalar+scalar or array+scalar } else if ( e2->StrictScalar() ) { return e1->DivSNew( e2); // array+scalar } else if ( e1->N_Elements() <= e2->N_Elements() ) { return e1->DivNew ( e2 ); } else // e1->N_Elements() > e2->N_Elements() ) { return e2->DivInvNew( e1); // smaller + larger } } Guard g1; Guard g2; DType cxTy = PromoteComplexOperand( aTy, bTy); if( cxTy != GDL_UNDEF) { e2 = e2->Convert2( cxTy, BaseGDL::COPY); g2.reset( e2); e1 = e1->Convert2( cxTy, BaseGDL::COPY); g1.reset( e1); } else if( DTypeOrder[aTy] >= DTypeOrder[bTy]) { // // GDL_COMPLEX op GDL_DOUBLE = GDL_COMPLEXDBL // if( aTy == GDL_COMPLEX && bTy == GDL_DOUBLE) // { // e2 = e2->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g2.reset( e2); // e1 = e1->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g1.reset( e1); // } // else { // convert e2 to e1 e2 = e2->Convert2( aTy, BaseGDL::COPY); g2.reset( e2); } } else { // // GDL_COMPLEX op GDL_DOUBLE = GDL_COMPLEXDBL // if( (bTy == GDL_COMPLEX && aTy == GDL_DOUBLE)) // { // e2 = e2->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g2.reset( e2); // e1 = e1->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); // g1.reset( e1); // } // else {// convert e1 to e2 e1 = e1->Convert2( bTy, BaseGDL::COPY); g1.reset( e1); } } // 'classic handling from here BaseGDL* res; if( e1->StrictScalar()) { if( g2.get() == NULL) return e2->DivInvSNew( e1); else g2.release(); res= e2->DivInvS(e1); // scalar+scalar or array+scalar } else if( e2->StrictScalar()) { if( g1.get() == NULL) return e1->DivSNew( e2); else g1.release(); res= e1->DivS(e2); // array+scalar } else if( e1->N_Elements() == e2->N_Elements()) { if( g1.get() != NULL) { g1.release(); return e1->Div(e2); } if( g2.get() != NULL) { g2.release(); res = e2->DivInv(e1); res->SetDim( e1->Dim()); return res; } else { return e1->DivNew(e2); } } else if( e1->N_Elements() < e2->N_Elements()) { if( g1.get() == NULL) return e1->DivNew( e2); else g1.release(); res= e1->Div(e2); // smaller_array + larger_array or same size } else { if( g2.get() == NULL) return e2->DivInvNew( e1); else g2.release(); res= e2->DivInv(e1); // smaller + larger } return res; } BaseGDL* SLASHNCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; AdjustTypesNC( g1, e1, g2, e2); if( e1->StrictScalar()) { if( g2.get() == NULL) return e2->DivInvSNew( e1); else g2.release(); res= e2->DivInvS(e1); // scalar+scalar or array+scalar } else if( e2->StrictScalar()) { if( g1.get() == NULL) return e1->DivSNew( e2); else g1.release(); res= e1->DivS(e2); // array+scalar } else if( e1->N_Elements() == e2->N_Elements()) { if( g1.get() != NULL) { g1.release(); return e1->Div(e2); } if( g2.get() != NULL) { g2.release(); res = e2->DivInv(e1); res->SetDim( e1->Dim()); return res; } else { return e1->DivNew(e2); } } else if( e1->N_Elements() < e2->N_Elements()) { if( g1.get() == NULL) return e1->DivNew( e2); else g1.release(); res= e1->Div(e2); // smaller_array + larger_array or same size } else { if( g2.get() == NULL) return e2->DivInvNew( e1); else g2.release(); res= e2->DivInv(e1); // smaller + larger } return res; } BaseGDL* MOD_OPNCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; AdjustTypesNC( g1, e1, g2, e2); if( e1->StrictScalar()) { if( g2.get() == NULL) return e2->ModInvSNew( e1); else g2.release(); res= e2->ModInvS(e1); // scalar+scalar or array+scalar } else if( e2->StrictScalar()) { if( g1.get() == NULL) return e1->ModSNew( e2); else g1.release(); res= e1->ModS(e2); // array+scalar } else if( e1->N_Elements() == e2->N_Elements()) { if( g1.get() != NULL) { g1.release(); return e1->Mod(e2); } if( g2.get() != NULL) { g2.release(); res = e2->ModInv(e1); res->SetDim( e1->Dim()); return res; } else { return e1->ModNew(e2); } } else if( e1->N_Elements() < e2->N_Elements()) { if( g1.get() == NULL) return e1->ModNew( e2); else g1.release(); res= e1->Mod(e2); // smaller_array + larger_array or same size } else { if( g2.get() == NULL) return e2->ModInvNew( e1); else g2.release(); res= e2->ModInv(e1); // smaller + larger } return res; } BaseGDL* POWNCNode::Eval() { BaseGDL* res; Guard g1; Guard g2; BaseGDL *e1, *e2; if( op1NC) { e1 = op1->EvalNC(); } else { e1 = op1->Eval(); g1.reset( e1); } if( op2NC) { e2 = op2->EvalNC(); } else { e2 = op2->Eval(); g2.reset( e2); } DType aTy=e1->Type(); DType bTy=e2->Type(); if( aTy == GDL_STRING) { e1 = e1->Convert2( GDL_FLOAT, BaseGDL::COPY); g1.reset( e1); // deletes old e1 aTy = GDL_FLOAT; } if( bTy == GDL_STRING) { e2 = e2->Convert2( GDL_FLOAT, BaseGDL::COPY); g2.reset( e2); // deletes old e2 bTy = GDL_FLOAT; } if( ComplexType(aTy)) { if( IntType( bTy)) { if( bTy != GDL_LONG) { e2 = e2->Convert2( GDL_LONG, BaseGDL::COPY); g2.reset( e2); } if( g1.get() == NULL) { return e1->PowNew( e2); } else { res = g1->Pow( e2); if( res == g1.get()) g1.release(); return res; } } if( aTy == GDL_COMPLEX) { if( bTy == GDL_DOUBLE) { e1 = e1->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY); g1.reset( e1); aTy = GDL_COMPLEXDBL; } else if( bTy == GDL_FLOAT) { if( g1.get() == NULL) { return e1->PowNew( e2); } else { res = g1->Pow( e2); if( res == g1.get()) g1.release(); return res; } } } if( aTy == GDL_COMPLEXDBL) { if( bTy == GDL_FLOAT) { e2 = e2->Convert2( GDL_DOUBLE, BaseGDL::COPY); g2.reset( e2); bTy = GDL_DOUBLE; } if( bTy == GDL_DOUBLE) { if( g1.get() == NULL) { return e1->PowNew( e2); } else { res = g1->Pow( e2); if( res == g1.get()) g1.release(); return res; } } } } if( IntType( bTy) && FloatType( aTy)) { if( bTy != GDL_LONG) { e2 = e2->Convert2( GDL_LONG, BaseGDL::COPY); g2.reset( e2); } if( g1.get() == NULL) res = e1->PowIntNew( e2); else { res = g1->PowInt( e2); if( res == g1.get()) g1.release(); } return res; } DType convertBackT; bool aTyGEbTy = DTypeOrder[aTy] >= DTypeOrder[bTy]; // convert back if( IntType( bTy) && !aTyGEbTy) convertBackT = aTy; else convertBackT = GDL_UNDEF; if( aTy != bTy) { if( aTyGEbTy) // crucial: '>' -> '>=' { if( DTypeOrder[aTy] > 100) { throw GDLException( "Expressions of this type cannot be converted."); } // convert e2 to e1 e2 = e2->Convert2( aTy, BaseGDL::COPY); g2.reset( e2); // delete former e2 } else // bTy > aTy (order) { if( DTypeOrder[bTy] > 100) { throw GDLException( "Expressions of this type cannot be converted."); } // convert e1 to e2 e1 = e1->Convert2( bTy, BaseGDL::COPY); g1.reset( e1); // delete former e1 } } // AdjustTypes(e2,e1); // order crucial here (for converting back) if( e1->StrictScalar()) { if( g2.get() == NULL) res = e2->PowInvSNew( e1); else { g2.release(); res = e2->PowInvS(e1); // scalar+scalar or array+scalar } } else if( e2->StrictScalar()) { if( g1.get() == NULL) { res = e1->PowSNew( e2); // res = e1->PowS(e2); // array+scalar } else { g1.release(); res= e1->PowS(e2); // array+scalar } } else if( e1->N_Elements() == e2->N_Elements()) { if( g1.get() != NULL) { g1.release(); res = e1->Pow(e2); } else if( g2.get() != NULL) { g2.release(); res = e2->PowInv(e1); res->SetDim( e1->Dim()); } else { res = e1->PowNew( e2); // res = e1->Pow(e2); } } else if( e1->N_Elements() < e2->N_Elements()) { if( g1.get() == NULL) { res = e1->PowNew( e2); // res= e1->Pow(e2); // smaller_array + larger_array or same size } else { g1.release(); res= e1->Pow(e2); // smaller_array + larger_array or same size } } else { if( g2.get() == NULL) res = e2->PowInvNew( e1); else { g2.release(); res= e2->PowInv(e1); // smaller + larger } } if( convertBackT != GDL_UNDEF) { res = res->Convert2( convertBackT, BaseGDL::CONVERT); } return res; } // BaseGDL* DECNCNode::Eval() // { BaseGDL* res; // return new DECNode( refNode); // } // BaseGDL* INCNCNode::Eval() // { BaseGDL* res; // return new INCNode( refNode); // } // BaseGDL* POSTDECNCNode::Eval() // { BaseGDL* res; // return new POSTDECNode( refNode); // } // BaseGDL* POSTINCNCNode::Eval() // { BaseGDL* res; // return new POSTINCNode( refNode); // } BaseGDL** FCALL_LIB_N_ELEMENTSNode::LEval() { // better than auto_ptr: auto_ptr wouldn't remove newEnv from the stack StackGuard guard(ProgNode::interpreter->CallStack()); throw GDLException(this,"Internal error: N_ELEMENTS called as left expr."); } BaseGDL* FCALL_LIB_N_ELEMENTSNode::Eval() { try { BaseGDL* param; bool isReference = static_cast(this->getFirstChild())->ParameterDirect( param); Guard guard; if( !isReference) guard.Reset( param); if( param == NULL) return new DLongGDL( 0); return new DLongGDL( param->N_Elements()); } catch( GDLException& e) { // an error occured -> parameter is undefined return new DLongGDL( 0); } } BaseGDL** FCALL_LIB_RETNEWNode::LEval() { throw GDLException(this,"Internal error: FCALL_LIB_RETNEW as left expr."); } BaseGDL* FCALL_LIB_RETNEWNode::Eval() { // match(antlr::RefAST(_t),FCALL_LIB_RETNEW); EnvT* newEnv=new EnvT( this, this->libFun); ProgNode::interpreter->parameter_def_nocheck(this->getFirstChild(), newEnv); Guard guardEnv( newEnv); BaseGDL* res = this->libFunFun(newEnv); //*** MUST always return a defined expression assert( res != NULL); return res; } BaseGDL** FCALL_LIB_DIRECTNode::LEval() { throw GDLException(this,"Internal error: FCALL_LIB_DIRECTNode as left expr."); } BaseGDL* FCALL_LIB_DIRECTNode::Eval() { BaseGDL* param; bool isReference = static_cast(this->getFirstChild())->ParameterDirect( param); Guard guard; if( !isReference) guard.Init( param); // check already here to keep functions leaner if( param == NULL) { assert( isReference); // unfortunately we cannot retrieve the variable's name here without some effort throw GDLException(this, this->libFun->ObjectName()+": Variable is undefined.", false,false); } try { BaseGDL* res = this->libFunDirectFun(param, isReference); // static_cast(this->libFun)->FunDirect()(param, isReference); assert( res != NULL); //*** MUST always return a defined expression if( res == param) guard.release(); return res; } catch( GDLException& ex) { // annotate exception throw GDLException(this, this->libFun->ObjectName()+": "+ ex.getMessage(),false,false); } } BaseGDL** FCALL_LIBNode::EvalRefCheck( BaseGDL*& rEval) { EnvT* newEnv=new EnvT( this, this->libFun);//libFunList[fl->funIx]); ProgNode::interpreter->parameter_def_nocheck(this->getFirstChild(), newEnv); Guard guardEnv( newEnv); // make the call // rEval = static_cast(newEnv->GetPro())->Fun()(newEnv); rEval = this->libFunFun(newEnv); // BaseGDL** res = ProgNode::interpreter->CallStackBack()->GetPtrTo( rEval); BaseGDL** res = newEnv->GetPtrToReturnValue(); return res; // NULL ok, rEval set properly } BaseGDL** FCALL_LIBNode::LEval() { EnvT* newEnv=new EnvT( this, this->libFun);//libFunList[fl->funIx]); ProgNode::interpreter->parameter_def_nocheck(this->getFirstChild(), newEnv); Guard guardEnv( newEnv); // make the call static DSub* scopeVarfetchPro = libFunList[ LibFunIx("SCOPE_VARFETCH")]; if( scopeVarfetchPro == this->libFun)//newEnv->GetPro()) { BaseGDL** sV = lib::scope_varfetch_reference( newEnv); if( sV != NULL) return sV; // should never happen throw GDLException( this, "SCOPE_VARFETCH returned no l-value: "+this->getText()); } static DSub* routine_namesPro = libFunList[ LibFunIx("ROUTINE_NAMES")]; if( routine_namesPro == this->libFun)// newEnv->GetPro()) { BaseGDL** sV = lib::routine_names_reference( newEnv); if( sV != NULL) return sV; // should never happen throw GDLException( this, "ROUTINE_NAMES returned no l-value: "+this->getText()); } // BaseGDL* libRes = static_cast(newEnv->GetPro())->Fun()(newEnv); BaseGDL* libRes = this->libFunFun(newEnv); // this is correct: l-value in current environment // BaseGDL** res = ProgNode::interpreter->CallStackBack()->GetPtrTo( libRes); BaseGDL** res = newEnv->GetPtrToReturnValue(); // wrong: would return ptr to local // BaseGDL** res = newEnv->GetPtrTo( libRes); if( res == NULL) { GDLDelete( libRes); throw GDLException( this, "Library function must return a " "l-value in this context: "+this->getText()); } return res; } // returns new or existing variable BaseGDL* FCALL_LIBNode::EvalFCALL_LIB(BaseGDL**& retValPtr) { EnvT* newEnv=new EnvT( this, this->libFun);//libFunList[fl->funIx]); ProgNode::interpreter->parameter_def_nocheck(this->getFirstChild(), newEnv); Guard guardEnv( newEnv); // assert( dynamic_cast(ProgNode::interpreter->CallStackBack()) != NULL); // EnvUDT* callStackBack = static_cast(ProgNode::interpreter->CallStackBack()); // BaseGDL* res=static_cast(newEnv->GetPro())->Fun()(newEnv); BaseGDL* res=this->libFunFun(newEnv); // if( newEnv->Contains( res)) // { // // now what to do? returned input parameter // // but caller will never know // // we need another solution // } // *** MUST always return a defined expression assert( res != NULL); // ProgNode::interpreter->CallStackBack()->SetPtrToReturnValue( newEnv->GetPtrToReturnValueNull()); retValPtr = newEnv->GetPtrToReturnValue(); return res; } // returns always a new variable - see EvalFCALL_LIB BaseGDL* FCALL_LIBNode::Eval() { // match(antlr::RefAST(_t),FCALL_LIB); EnvT* newEnv=new EnvT( this, this->libFun);//libFunList[fl->funIx]); ProgNode::interpreter->parameter_def_nocheck(this->getFirstChild(), newEnv); Guard guardEnv( newEnv); // // push id.pro onto call stack // ProgNode::interpreter->CallStack().push_back(newEnv); // make the call BaseGDL* res=this->libFunFun(newEnv); // *** MUST always return a defined expression assert( res != NULL); // throw GDLException( _t, ""); // assert( dynamic_cast(ProgNode::interpreter->CallStackBack()) != NULL); // EnvUDT* callStackBack = static_cast(ProgNode::interpreter->CallStackBack()); // if( callStackBack->Contains( res)) if( newEnv->GetPtrToReturnValue() != NULL) return res->Dup(); // static DSub* scopeVarfetchPro = libFunList[ LibFunIx("SCOPE_VARFETCH")]; // if( scopeVarfetchPro == newEnv->GetPro()) // return res->Dup(); //ProgNode::interpreter->SetRetTree( this->getNextSibling()); return res; } BaseGDL** MFCALLNode::EvalRefCheck( BaseGDL*& rEval) { StackGuard guard(ProgNode::interpreter->CallStack()); ProgNodeP _t = this->getFirstChild(); BaseGDL* self=_t->Eval(); //ProgNode::interpreter->expr(_t); Guard self_guard(self); _t = _t->getNextSibling(); //match(antlr::RefAST(_t),IDENTIFIER); EnvUDT* newEnv=new EnvUDT( self, _t, "", EnvUDT::LRFUNCTION); self_guard.release(); _t = _t->getNextSibling(); ProgNode::interpreter->parameter_def(_t, newEnv); // temporary owns newEnv (-> no guard necessary) // push environment onto call stack ProgNode::interpreter->CallStack().push_back(newEnv); // now guarded by "guard" // make the call rEval=ProgNode::interpreter->call_fun(static_cast(newEnv->GetPro())->GetTree()); // BaseGDL** res = ProgNode::interpreter->CallStackBack()->GetPtrTo( rEval); BaseGDL** res = newEnv->GetPtrToGlobalReturnValue(); return res; // NULL ok, rEval set properly } BaseGDL** MFCALLNode::LEval() { // better than auto_ptr: auto_ptr wouldn't remove newEnv from the stack StackGuard guard(ProgNode::interpreter->CallStack()); // match(antlr::RefAST(_t),MFCALL); ProgNodeP _t = this->getFirstChild(); BaseGDL* self=_t->Eval(); //ProgNode::interpreter->expr(_t); Guard self_guard(self); ProgNodeP mp = _t->getNextSibling(); // match(antlr::RefAST(_t),IDENTIFIER); _t = mp->getNextSibling(); EnvUDT* newEnv=new EnvUDT( self, mp, "", EnvUDT::LFUNCTION); self_guard.release(); ProgNode::interpreter->parameter_def(_t, newEnv); // push environment onto call stack ProgNode::interpreter->CallStack().push_back(newEnv); // make the call BaseGDL** res=ProgNode::interpreter-> call_lfun(static_cast(newEnv->GetPro())->GetTree()); //ProgNode::interpreter->SetRetTree( this->getNextSibling()); return res; } BaseGDL* MFCALLNode::Eval() { // better than auto_ptr: auto_ptr wouldn't remove newEnv from the stack StackGuard guard(ProgNode::interpreter->CallStack()); ProgNodeP _t = this->getFirstChild(); BaseGDL* self=_t->Eval(); //ProgNode::interpreter->expr(_t); Guard self_guard(self); _t = _t->getNextSibling(); //match(antlr::RefAST(_t),IDENTIFIER); EnvUDT* newEnv=new EnvUDT( self, _t); self_guard.release(); _t = _t->getNextSibling(); ProgNode::interpreter->parameter_def(_t, newEnv); // push environment onto call stack ProgNode::interpreter->CallStack().push_back(newEnv); // make the call BaseGDL* res=ProgNode::interpreter->call_fun(static_cast(newEnv->GetPro())->GetTree()); //ProgNode::interpreter->SetRetTree( this->getNextSibling()); return res; } BaseGDL** MFCALL_PARENTNode::EvalRefCheck( BaseGDL*& rEval) { StackGuard guard(ProgNode::interpreter->CallStack()); // match(antlr::RefAST(_t),MFCALL_PARENT); ProgNodeP _t = this->getFirstChild(); BaseGDL* self=_t->Eval(); //ProgNode::interpreter->expr(_t); Guard self_guard(self); _t = _t->getNextSibling(); ProgNodeP parent = _t; // match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); ProgNodeP p = _t; // match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); EnvUDT* newEnv=new EnvUDT( self, p, parent->getText(), EnvUDT::LRFUNCTION); self_guard.release(); ProgNode::interpreter->parameter_def(_t, newEnv); // push environment onto call stack ProgNode::interpreter->CallStack().push_back(newEnv); // make the call rEval=ProgNode::interpreter->call_fun(static_cast(newEnv->GetPro())->GetTree()); // BaseGDL** res = ProgNode::interpreter->CallStackBack()->GetPtrTo( rEval); BaseGDL** res = newEnv->GetPtrToGlobalReturnValue(); return res; // NULL ok, rEval set properly } BaseGDL** MFCALL_PARENTNode::LEval() { // better than auto_ptr: auto_ptr wouldn't remove newEnv from the stack StackGuard guard(ProgNode::interpreter->CallStack()); // match(antlr::RefAST(_t),MFCALL_PARENT); ProgNodeP _t = this->getFirstChild(); BaseGDL* self=_t->Eval(); //ProgNode::interpreter->expr(_t); Guard self_guard(self); _t = _t->getNextSibling(); ProgNodeP parent = _t; // match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); ProgNodeP p = _t; // match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); EnvUDT* newEnv=new EnvUDT( self, p, parent->getText(), EnvUDT::LFUNCTION); self_guard.release(); ProgNode::interpreter->parameter_def(_t, newEnv); // push environment onto call stack ProgNode::interpreter->CallStack().push_back(newEnv); // make the call BaseGDL** res=ProgNode::interpreter-> call_lfun(static_cast(newEnv->GetPro())->GetTree()); //ProgNode::interpreter->SetRetTree( this->getNextSibling()); return res; } BaseGDL* MFCALL_PARENTNode::Eval() { // better than auto_ptr: auto_ptr wouldn't remove newEnv from the stack StackGuard guard(ProgNode::interpreter->CallStack()); // match(antlr::RefAST(_t),MFCALL_PARENT); ProgNodeP _t = this->getFirstChild(); BaseGDL* self=_t->Eval(); //ProgNode::interpreter->expr(_t); Guard self_guard(self); _t = _t->getNextSibling(); ProgNodeP parent = _t; // match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); ProgNodeP p = _t; // match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); EnvUDT* newEnv=new EnvUDT( self, p, parent->getText()); self_guard.release(); ProgNode::interpreter->parameter_def(_t, newEnv); // push environment onto call stack ProgNode::interpreter->CallStack().push_back(newEnv); // make the call BaseGDL* res=ProgNode::interpreter->call_fun(static_cast(newEnv->GetPro())->GetTree()); //ProgNode::interpreter->SetRetTree( this->getNextSibling()); return res; } BaseGDL** FCALLNode::EvalRefCheck( BaseGDL*& rEval) { StackGuard guard(ProgNode::interpreter->CallStack()); ProgNode::interpreter->SetFunIx( this); EnvUDT* newEnv=new EnvUDT( this, funList[this->funIx], EnvUDT::LRFUNCTION); ProgNode::interpreter->parameter_def(this->getFirstChild(), newEnv); // push environment onto call stack ProgNode::interpreter->CallStack().push_back(newEnv); // make the call rEval=ProgNode::interpreter->call_fun(static_cast(newEnv->GetPro())->GetTree()); // BaseGDL** res = ProgNode::interpreter->CallStackBack()->GetPtrTo( rEval); BaseGDL** res = newEnv->GetPtrToGlobalReturnValue(); return res; // NULL ok, rEval set properly } BaseGDL** ARRAYEXPR_FCALLNode::EvalRefCheck( BaseGDL*& rEval) { if( fcallNodeFunIx >= 0) return fcallNode->FCALLNode::EvalRefCheck( rEval); else if( fcallNodeFunIx == -2) { rEval = arrayExprNode->ARRAYEXPRNode::Eval(); return NULL; } assert( fcallNodeFunIx == -1); // 1st try arrayexpr try{ rEval = arrayExprNode->ARRAYEXPRNode::Eval(); assert( rEval != NULL); fcallNodeFunIx = -2; // mark as ARRAYEXPR succeeded return NULL; } catch( GDLException& ex) { if( !ex.GetArrayexprIndexeeFailed()) { fcallNodeFunIx = -2; // mark as ARRAYEXPR succeeded throw ex; } // then try fcall try{ BaseGDL** res = fcallNode->FCALLNode::EvalRefCheck( rEval); fcallNodeFunIx = fcallNode->funIx; return res; } catch( GDLException& innerEx) { // keep FCALL if already compiled (but runtime error) if(fcallNode->funIx >= 0) { fcallNodeFunIx = fcallNode->funIx; throw innerEx; } string msg = "Ambiguous: " + ex.ANTLRException::toString() + " or: " + innerEx.ANTLRException::toString(); throw GDLException(this,msg,true,false); } } } BaseGDL** FCALLNode::LEval() { // better than auto_ptr: auto_ptr wouldn't remove newEnv from the stack StackGuard guard(ProgNode::interpreter->CallStack()); // match(antlr::RefAST(_t),FCALL); ProgNodeP _t = this->getFirstChild(); ProgNode::interpreter->SetFunIx( this); EnvUDT* newEnv=new EnvUDT( this, funList[this->funIx], EnvUDT::LFUNCTION); ProgNode::interpreter->parameter_def(_t, newEnv); // push environment onto call stack ProgNode::interpreter->CallStack().push_back(newEnv); // make the call BaseGDL** res= ProgNode::interpreter->call_lfun(static_cast(newEnv->GetPro())->GetTree()); //ProgNode::interpreter->SetRetTree( this->getNextSibling()); return res; } BaseGDL** ARRAYEXPR_FCALLNode::LEval() { // already succeeded if( fcallNodeFunIx >= 0) return fcallNode->FCALLNode::LEval(); else if( fcallNodeFunIx == -2) { return arrayExprNode->ARRAYEXPRNode::LEval(); } // both possible assert( fcallNodeFunIx == -1); // 1st try arrayexpr try{ BaseGDL** res = arrayExprNode->ARRAYEXPRNode::LEval(); fcallNodeFunIx = -2; // mark as ARRAYEXPR succeeded return res; } catch( GDLException& ex) { if( !ex.GetArrayexprIndexeeFailed()) { fcallNodeFunIx = -2; // mark as ARRAYEXPR succeeded throw ex; } // then try fcall try { BaseGDL** res = fcallNode->FCALLNode::LEval(); fcallNodeFunIx = fcallNode->funIx; return res; } catch( GDLException& innerEx) { // keep FCALL if already compiled (but runtime error) if(fcallNode->funIx >= 0) { fcallNodeFunIx = fcallNode->funIx; throw innerEx; } string msg = "Ambiguous: " + ex.ANTLRException::toString() + " or: " + innerEx.ANTLRException::toString(); throw GDLException(this,msg,true,false); } } } BaseGDL* FCALLNode::Eval() { // better than auto_ptr: auto_ptr wouldn't remove newEnv from the stack StackGuard guard(ProgNode::interpreter->CallStack()); ProgNode::interpreter->SetFunIx( this); EnvUDT* newEnv=new EnvUDT( this, funList[this->funIx]); ProgNode::interpreter->parameter_def(this->getFirstChild(), newEnv); // push environment onto call stack ProgNode::interpreter->CallStack().push_back(newEnv); // make the call BaseGDL* res=ProgNode::interpreter->call_fun(static_cast(newEnv->GetPro())->GetTree()); //ProgNode::interpreter->SetRetTree( this->getNextSibling()); return res; } BaseGDL* ARRAYEXPR_FCALLNode::Eval() { if( fcallNodeFunIx >= 0) return fcallNode->FCALLNode::Eval(); else if( fcallNodeFunIx == -2) { return arrayExprNode->ARRAYEXPRNode::Eval(); } assert( fcallNodeFunIx == -1); // 1st try arrayexpr try{ BaseGDL* res = arrayExprNode->ARRAYEXPRNode::Eval(); fcallNodeFunIx = -2; // mark as ARRAYEXPR succeeded return res; } catch( GDLException& ex) { // then try fcall // Problem here: we don't know, why arrayexpr failed // if it is just because of the index, we should not // try the function here if( !ex.GetArrayexprIndexeeFailed()) { fcallNodeFunIx = -2; // mark as ARRAYEXPR succeeded throw ex; } try{ BaseGDL* res = fcallNode->FCALLNode::Eval(); fcallNodeFunIx = fcallNode->funIx; return res; } catch( GDLException& innerEx) { // keep FCALL if already compiled (but runtime error) if(fcallNode->funIx >= 0) { fcallNodeFunIx = fcallNode->funIx; throw innerEx; } string msg = "Ambiguous: " + ex.ANTLRException::toString() + " or: " + innerEx.ANTLRException::toString(); throw GDLException(this,msg,true,false); } } } BaseGDL** ARRAYEXPR_MFCALLNode::EvalRefCheck( BaseGDL*& rEval) { StackGuard guard(ProgNode::interpreter->CallStack()); // match(antlr::RefAST(_t),ARRAYEXPR_MFCALL); ProgNodeP mark = this->getFirstChild(); ProgNodeP _t = mark->getNextSibling(); // skip DOT BaseGDL* self=_t->Eval(); //ProgNode::interpreter->expr(_t); Guard self_guard(self); ProgNodeP mp2 = _t->getNextSibling(); //match(antlr::RefAST(_t),IDENTIFIER); _t = mp2->getNextSibling(); BaseGDL** res; EnvUDT* newEnv; try { newEnv=new EnvUDT( self, mp2, "", EnvUDT::LRFUNCTION); self_guard.release(); } catch( GDLException& ex) { goto tryARRAYEXPR; } ProgNode::interpreter->parameter_def(_t, newEnv); // push environment onto call stack ProgNode::interpreter->CallStack().push_back(newEnv); // make the call rEval= ProgNode::interpreter-> call_fun(static_cast(newEnv->GetPro())->GetTree()); // res = ProgNode::interpreter->CallStackBack()->GetPtrTo( rEval); res = newEnv->GetPtrToGlobalReturnValue(); return res; // NULL ok, rEval set properly tryARRAYEXPR:; //_t = mark; ProgNodeP dot = mark; // match(antlr::RefAST(_t),DOT); _t = mark->getFirstChild(); SizeT nDot=dot->nDot; Guard aD( new DotAccessDescT(nDot+1)); ProgNode::interpreter->r_dot_array_expr(_t, aD.get()); _t = _t->getNextSibling(); for (; _t != NULL;) { ProgNode::interpreter->tag_array_expr(_t, aD.get()); _t = _t->getNextSibling(); } rEval= aD->ADResolve(); return NULL; // always r-value } // from l_arrayexpr_mfcall_as_mfcall BaseGDL** ARRAYEXPR_MFCALLNode::LEval() { // better than auto_ptr: auto_ptr wouldn't remove newEnv from the stack StackGuard guard(ProgNode::interpreter->CallStack()); BaseGDL *self; EnvUDT* newEnv; ProgNodeP _t = this->getFirstChild(); _t = _t->getNextSibling(); // skip DOT self= _t->Eval(); //interpreter->expr(_t); ProgNodeP mp2 = _t->getNextSibling(); // interpreter->GetRetTree(); //match(antlr::RefAST(_t),IDENTIFIER); Guard self_guard(self); newEnv=new EnvUDT( self, mp2, "", EnvUDT::LFUNCTION); self_guard.release(); ProgNode::interpreter->parameter_def( mp2->getNextSibling(), newEnv); // push environment onto call stack ProgNode::interpreter->CallStack().push_back(newEnv); // make the call return ProgNode::interpreter->call_lfun(static_cast(newEnv->GetPro())->GetTree()); } BaseGDL* ARRAYEXPR_MFCALLNode::Eval() { // better than auto_ptr: auto_ptr wouldn't remove newEnv from the stack StackGuard guard(ProgNode::interpreter->CallStack()); // match(antlr::RefAST(_t),ARRAYEXPR_MFCALL); ProgNodeP mark = this->getFirstChild(); ProgNodeP _t = mark->getNextSibling(); // skip DOT BaseGDL* self=_t->Eval(); //ProgNode::interpreter->expr(_t); Guard self_guard(self); ProgNodeP mp2 = _t->getNextSibling(); //match(antlr::RefAST(_t),IDENTIFIER); _t = mp2->getNextSibling(); BaseGDL* res; EnvUDT* newEnv; try { newEnv=new EnvUDT( self, mp2); self_guard.release(); } catch( GDLException& ex) { goto tryARRAYEXPR; } ProgNode::interpreter->parameter_def(_t, newEnv); // push environment onto call stack ProgNode::interpreter->CallStack().push_back(newEnv); // make the call res= ProgNode::interpreter-> call_fun(static_cast(newEnv->GetPro())->GetTree()); //ProgNode::interpreter->SetRetTree( this->getNextSibling()); return res; tryARRAYEXPR:; //_t = mark; ProgNodeP dot = mark; // match(antlr::RefAST(_t),DOT); _t = mark->getFirstChild(); SizeT nDot=dot->nDot; Guard aD( new DotAccessDescT(nDot+1)); ProgNode::interpreter->r_dot_array_expr(_t, aD.get()); _t = _t->getNextSibling(); for (; _t != NULL;) { ProgNode::interpreter->tag_array_expr(_t, aD.get()); _t = _t->getNextSibling(); } res= aD->ADResolve(); //ProgNode::interpreter->SetRetTree( this->getNextSibling()); return res; } // BaseGDL** ARRAYEXPR_MFCALLNode::LEval() // { // // better than auto_ptr: auto_ptr wouldn't remove newEnv from the stack // StackGuard guard(ProgNode::interpreter->CallStack()); // } BaseGDL** VARNode::EvalRefCheck( BaseGDL*& rEval) { return this->LEval(); } BaseGDL** VARNode::LEval() { // ProgNode::interpreter->SetRetTree( this->getNextSibling()); return &ProgNode::interpreter->CallStackBack()->GetKW(this->varIx); } BaseGDL** VARPTRNode::EvalRefCheck( BaseGDL*& rEval) { return this->LEval(); } BaseGDL** VARPTRNode::LEval() { // ProgNode::interpreter->SetRetTree( this->getNextSibling()); return &this->var->Data(); } BaseGDL** EXPRNode::EvalRefCheck( BaseGDL*& rEval) { return this->LEval(); } BaseGDL** EXPRNode::LEval() { return this->getFirstChild()->LExpr( NULL); //interpreter->l_expr( this->getFirstChild(), NULL); } BaseGDL* DOTNode::Eval() { BaseGDL* r; // clears aL when destroyed ArrayIndexListGuard guard; DotAccessDescT aD( nDot+1); ProgNodeP _t = this->getFirstChild(); if( _t->getType() == GDLTokenTypes::ARRAYEXPR) { _t = _t->getFirstChild(); // r = interpreter->r_dot_indexable_expr(_t, &aD); // _t = interpreter->GetRetTree(); if( _t->getType() == GDLTokenTypes::EXPR) { r = _t->getFirstChild()->Eval(); aD.SetOwner( true); _t = _t->getNextSibling(); } else if( _t->getType() == GDLTokenTypes::SYSVAR) { r = _t->EvalNC(); _t = _t->getNextSibling(); } else { assert( _t->getType() == GDLTokenTypes::VAR || _t->getType() == GDLTokenTypes::VARPTR); BaseGDL** e = _t->LEval(); if( *e == NULL) { if( _t->getType() == GDLTokenTypes::VAR) throw GDLException( _t, "Variable is undefined: "+ interpreter->CallStackBack()->GetString(_t->GetVarIx()),true,false); else throw GDLException( _t, "Common block variable is undefined: "+ interpreter->CallStackBack()->GetString( /* reference! */ *e),true,false); } r = *e; _t = _t->getNextSibling(); } bool handled = false; if( !r->IsAssoc() && r->Type() == GDL_OBJ && r->StrictScalar()) { // check for _overloadBracketsRightSide DObj s = (*static_cast(r))[0]; // is StrictScalar() // if( s != 0) // no overloads for null object // { // DStructGDL* oStructGDL= GDLInterpreter::GetObjHeapNoThrow( s); // if( oStructGDL != NULL) // if object not valid -> default behaviour // { // DStructDesc* desc = oStructGDL->Desc(); // // DFun* bracketsRightSideOverload = static_cast(desc->GetOperator( OOBracketsRightSide)); DSubUD* bracketsRightSideOverload = static_cast(GDLInterpreter::GetObjHeapOperator( s, OOBracketsRightSide)); if( bracketsRightSideOverload != NULL) { // _overloadBracketsRightSide bool internalDSubUD = bracketsRightSideOverload->GetTree()->IsWrappedNode(); DObjGDL* self = static_cast(r); Guard selfGuard; if( aD.IsOwner()) { aD.SetOwner( false); // WE are now the proud owner of 'self' selfGuard.Init( self); // so it might be overwritten } else { if( !internalDSubUD) // internal beahve well { self = self->Dup(); // res should be not changeable via SELF selfGuard.Init( self); } } IxExprListT indexList; // uses arrIxListNoAssoc interpreter->arrayindex_list_overload( _t, indexList); ArrayIndexListGuard guard(_t->arrIxListNoAssoc); // hidden SELF is counted as well int nParSub = bracketsRightSideOverload->NPar(); assert( nParSub >= 1); // SELF // indexList.size() > regular paramters w/o SELF if( indexList.size() > nParSub - 1) { indexList.Cleanup(); throw GDLException( this, bracketsRightSideOverload->ObjectName() + ": Incorrect number of arguments.", false, false); } // adds already SELF parameter EnvUDT* newEnv= new EnvUDT( this, bracketsRightSideOverload, &self); // no guarding of newEnv here (no exceptions until push_back()) // parameters for( SizeT p=0; pSetNextParUnchecked( indexList[p]); // takes ownership StackGuard stackGuard(interpreter->CallStack()); interpreter->CallStack().push_back( newEnv); // make the call, return the result BaseGDL* res = interpreter->call_fun(static_cast(newEnv->GetPro())->GetTree()); if( selfGuard.Get() != NULL && self != selfGuard.Get()) { // always put out warning first, in case of a later crash Warning( "WARNING: " + bracketsRightSideOverload->ObjectName() + ": Assignment to SELF detected (GDL session still ok)."); // assignment to SELF -> self was deleted and points to new variable // which it owns selfGuard.Release(); if( static_cast(self) != NullGDL::GetSingleInstance()) selfGuard.Reset(self); } aD.SetOwner( true); // aD owns res here interpreter->SetRootR( this, &aD, res, NULL); handled = true; } } if( !handled) { // regular (non-object) case ArrayIndexListT* aL = interpreter->arrayindex_list(_t); guard.reset(aL); // check here for object and get struct //structR=dynamic_cast(r); // this is much faster than a dynamic_cast interpreter->SetRootR( this, &aD, r, aL); } _t = this->getFirstChild()->getNextSibling(); } else // ! ARRAYEXPR // case EXPR: // case SYSVAR: // case VAR: // case VARPTR: { // r=interpreter->r_dot_indexable_expr(_t, &aD); // _t = interpreter->GetRetTree(); if( _t->getType() == GDLTokenTypes::EXPR) { r = _t->getFirstChild()->Eval(); aD.SetOwner( true); _t = _t->getNextSibling(); } else if( _t->getType() == GDLTokenTypes::SYSVAR) { r = _t->EvalNC(); _t = _t->getNextSibling(); } else { assert( _t->getType() == GDLTokenTypes::VAR || _t->getType() == GDLTokenTypes::VARPTR); BaseGDL** e = _t->LEval(); if( *e == NULL) { if( _t->getType() == GDLTokenTypes::VAR) throw GDLException( _t, "Variable is undefined: "+ interpreter->CallStackBack()->GetString(_t->GetVarIx()),true,false); else throw GDLException( _t, "Common block variable is undefined: "+ interpreter->CallStackBack()->GetString( /* reference */ *e),true,false); } r = *e; _t = _t->getNextSibling(); } interpreter->SetRootR( this, &aD, r, NULL); } for (; _t != NULL;) { interpreter->tag_array_expr(_t, &aD); // nDot times _t = interpreter->GetRetTree(); } return aD.ADResolve(); } // DOTNode::Eval BaseGDL* ARRAYEXPRNode::Eval() { BaseGDL* res; ExprListT exprList; // for cleanup IxExprListT ixExprList; SizeT nExpr; BaseGDL* s; // match(antlr::RefAST(_t),ARRAYEXPR); ProgNodeP _t = this->getFirstChild(); BaseGDL* r; Guard rGuard; try { if( NonCopyNode(_t->getType())) { r=_t->EvalNC(); //r=indexable_expr(_t); } // else if( _t->getType() == GDLTokenTypes::FCALL_LIB) // { // // better than Eval(): no copying here if not necessary // // r=ProgNode::interpreter->lib_function_call(_t); // BaseGDL** retValPtr; // r = static_cast(_t)->EvalFCALL_LIB( retValPtr); // // // if( !ProgNode::interpreter->CallStack().back()->Contains( r)) // if( retValPtr == NULL) // rGuard.Init( r); // guard if no global data // } else { // r=_t->Eval(); BaseGDL** ref =_t->EvalRefCheck(r); if( ref == NULL) rGuard.Init( r); else r = *ref; } } catch( GDLException& ex) { ex.SetArrayexprIndexeeFailed( true); throw ex; } ProgNodeP ixListNode = _t->getNextSibling(); if( r->Type() == GDL_OBJ && r->StrictScalar()) { // check for _overloadBracketsRightSide DObj s = (*static_cast(r))[0]; // is StrictScalar() // if( s != 0) // no overloads for null object // { // DStructGDL* oStructGDL= GDLInterpreter::GetObjHeapNoThrow( s); // if( oStructGDL != NULL) // if object not valid -> default behaviour // { // DStructDesc* desc = oStructGDL->Desc(); // // DFun* bracketsRightSideOverload = static_cast(desc->GetOperator( OOBracketsRightSide)); DSubUD* bracketsRightSideOverload = static_cast(GDLInterpreter::GetObjHeapOperator( s, OOBracketsRightSide)); if( bracketsRightSideOverload != NULL) { // _overloadBracketsRightSide DObjGDL* self = static_cast(rGuard.Get()); if( self == NULL) { self = static_cast(r->Dup()); // not set -> not owner rGuard.Reset( self); } // we are now the proud owner of 'self' IxExprListT indexList; // uses arrIxListNoAssoc interpreter->arrayindex_list_overload( ixListNode, indexList); ArrayIndexListGuard guard(ixListNode->arrIxListNoAssoc); // hidden SELF is counted as well int nParSub = bracketsRightSideOverload->NPar(); assert( nParSub >= 1); // SELF // indexList.size() > regular paramters w/o SELF if( indexList.size() > nParSub - 1) { indexList.Cleanup(); throw GDLException( this, bracketsRightSideOverload->ObjectName() + ": Incorrect number of arguments.", false, false); } // adds already SELF parameter EnvUDT* newEnv= new EnvUDT( this, bracketsRightSideOverload, &self); // no guarding of newEnv here (no exceptions until push_back()) // parameters for( SizeT p=0; pSetNextParUnchecked( indexList[p]); // takes ownership StackGuard stackGuard(interpreter->CallStack()); interpreter->CallStack().push_back( newEnv); // make the call, return the result BaseGDL* res = interpreter->call_fun(static_cast(newEnv->GetPro())->GetTree()); if( self != rGuard.Get()) { // always put out warning first, in case of a later crash Warning( "WARNING: " + bracketsRightSideOverload->ObjectName() + ": Assignment to SELF detected (GDL session still ok)."); // assignment to SELF -> self was deleted and points to new variable // which it owns rGuard.Release(); if( static_cast(self) != NullGDL::GetSingleInstance()) rGuard.Reset(self); } return res; } // } // } } // first use NoAssoc case ArrayIndexListT* aL = ixListNode->arrIxListNoAssoc; assert( aL != NULL); nExpr = aL->NParam(); _t = ixListNode->getFirstChild(); if( nExpr == 0) { goto empty; } while( true) { if( NonCopyNode(_t->getType())) { s=_t->EvalNC();//indexable_expr(_t); assert(s != NULL); assert( s->Type() != GDL_UNDEF); } // else if( _t->getType() == GDLTokenTypes::FCALL_LIB) // { // // s=ProgNode::interpreter->lib_function_call(_t); // BaseGDL** retValPtr; // s = static_cast(_t)->EvalFCALL_LIB( retValPtr); // // if( !ProgNode::interpreter->CallStack().back()->Contains( s)) // if( retValPtr == NULL) // exprList.push_back( s); // assert(s != NULL); // } else { BaseGDL** ref =_t->EvalRefCheck(s); //ProgNode::interpreter->indexable_tmp_expr(_t); if( ref == NULL) exprList.push_back( s); else s = *ref; assert(s != NULL); assert( s->Type() != GDL_UNDEF); } ixExprList.push_back( s); if( ixExprList.size() == nExpr) break; // while( true) -> finish _t = _t->getNextSibling(); // set to next index } // while( true) empty: if( r->IsAssoc()) { ArrayIndexListT* aLAssoc = ixListNode->arrIxList; assert( aLAssoc != NULL); ArrayIndexListGuard guardAssoc(aLAssoc); return aLAssoc->Index( r, ixExprList); } else { ArrayIndexListGuard guard(aL); return aL->Index( r, ixExprList); } assert( false); return NULL; } gdl-0.9.4/src/fmtnode.hpp0000664000175000017500000000627711506425056013676 0ustar marcmarc/*************************************************************************** FMTNode.hpp - node for formatted io processing ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifndef FMTNode_hpp__ #define FMTNode_hpp__ #include "typedefs.hpp" #include "FMTTokenTypes.hpp" #include "antlr/CommonAST.hpp" //ANTLR_USING_NAMESPACE(std) //ANTLR_USING_NAMESPACE(antlr) class FMTNode; typedef antlr::ASTRefCount RefFMTNode; class FMTNode : public antlr::CommonAST { public: ~FMTNode(); FMTNode(): CommonAST(), down(), right(), w(-1), d(-1), rep(1), fill(' ') { } FMTNode( antlr::RefToken t) : CommonAST(t), down(), right(), w(-1), d(-1), rep(1), fill(' ') { } void initialize(int t, const std::string& txt) { CommonAST::setType(t); CommonAST::setText(txt); } // used by FMTNodeFactory void initialize( RefFMTNode t ); // we deal only with RefFMTNode here void initialize( antlr::RefAST t ) { // CommonAST::initialize(t); initialize(static_cast(t)); } void initialize( antlr::RefToken t ) { CommonAST::initialize(t); } void setText(const std::string& txt) { CommonAST::setText(txt); } void setType(int type) { CommonAST::setType(type); } void addChild( RefFMTNode c ) { BaseAST::addChild( static_cast(c) ); } static antlr::RefAST factory() { antlr::RefAST ret = static_cast(RefFMTNode(new FMTNode)); return ret; } // RefFMTNode getFirstChild() const // { // return static_cast(BaseAST::getFirstChild()); // } // RefFMTNode getNextSibling() const // { // return static_cast(BaseAST::getNextSibling()); // } void setW( const int w_) { w=w_; } int getW() { return w; } void setD( const int d_) { d=d_; } int getD() { return d; } void setRep( const int rep_) { rep=rep_; } int getRep() { return rep; } void setFill( const char fill_) { fill=fill_; } char getFill() { return fill; } private: RefFMTNode down; RefFMTNode right; int w; int d; int rep; char fill; // fill (for zero padding) // private: // // forbid usage of these // FMTNode& operator=( const FMTNode& r) // { return *this;} // make compiler shut up // FMTNode( const FMTNode& cp) // {} }; #endif gdl-0.9.4/src/dpro.hpp0000664000175000017500000003127112174226377013205 0ustar marcmarc/*************************************************************************** dpro.hpp - GDL procedure/function ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifndef DPRO_HPP_ #define DPRO_HPP_ // #include #include #include #include //#include #include "basegdl.hpp" #include "dcommon.hpp" #include "dvar.hpp" #include "prognode.hpp" #include "str.hpp" #include "antlr/Token.hpp" template class Is_eq: public std::unary_function { std::string name; public: explicit Is_eq(const std::string& n): name(n) {} bool operator() (const T* p) const { return (p->Name() == name);} }; // for jumps (goto, on_ioerror) struct LabelT { std::string label; ProgNodeP target; LabelT( const std::string& l, ProgNodeP t): label( l), target( t) {} }; class LabelListT { std::vector list; public: LabelListT(): list() {} ~LabelListT() {} void Add( const std::string& l, ProgNodeP t) { list.push_back( LabelT( l, t)); } SizeT Size() { return list.size();} int Find( const std::string& s) { SizeT nEl = list.size(); for( SizeT i=0; i(i); return -1; } ProgNodeP Get( SizeT ix) { return list[ ix].target; } void SetLabelNode( ProgNodeP t) { int ix = Find( t->getText()); // already checked for presence list[ ix].target = t; } const std::string& GetLabel( SizeT ix) { return list[ ix].label; } void Clear() { list.clear(); } }; // Fun/Pro classes ***************************************************** // Base class ********************************************************** class DSub { public: enum ExtraType { NONE=0, EXTRA, REFEXTRA }; protected: std::string name; // name (of procedure/function) std::string object; // name of class for methods (might not be defined // when method is compiled) // keywords are pushed in front so they are first // followed by the parameters // (which are pushed back, // but due to the syntax are first, // so the layout is: // keyVar_N (ID in key[0]),..,keyVar_1 (key[n-1]), // par_1,..,par_nPar, var1,..,varK // N=size(key) // K=size(var)-nPar-N KeyVarListT key; // keyword names (IDList: typedefs.hpp) // (KEYWORD_NAME=keyword_value) int nPar; // number of parameters (-1 = infinite) int nParMin; // minimum number of parameters (-1 = infinite) ExtraType extra; int extraIx; // index of extra keyword IDList warnKey; // keyword names to accept but warn // (IDList: typedefs.hpp) public: DSub( const std::string& n, const std::string& o=""): name(n), object(o), key(), nPar(0), nParMin(0), extra(NONE), extraIx(-1), warnKey() {} virtual ~DSub(); // polymorphism const std::string& Name() const { return name;} const std::string& Object() const { return object;} std::string ObjectName() const { if( object == "") return name; return object+"::"+name; } std::string ObjectFileName() const { if( object == "") return name; return object+"__"+name; } ExtraType Extra() { return extra; } int ExtraIx() { return extraIx; } // returns the (abbreviated) keyword value index int FindKey(const std::string& s) { String_abbref_eq searchKey(s); int ix=0; for(KeyVarListT::iterator i=key.begin(); i != key.end(); i++, ix++) if( searchKey(*i)) { return ix; } return -1; } int NKey() const { return key.size();} int NPar() const { return nPar;} int NParMin() const { return nParMin;} // bool AKey() { return aKey;} // additional keywords allowed friend class EnvBaseT; friend class EnvT; friend class ExtraT; friend void SetupOverloadSubroutines(); // overload base class methods }; // Lib pro/fun ******************************************************** // moved to prognode.hpp // class EnvT; // // typedef void (*LibPro)(EnvT*); // typedef BaseGDL* (*LibFun)(EnvT*); // typedef BaseGDL* (*LibFunDirect)(BaseGDL* param,bool canGrab); // library procedure/function (in cases both are handled the same way) class DLib: public DSub { bool hideHelp; // if set HELP,/LIB will not list this subroutine public: DLib( const std::string& n, const std::string& o, const int nPar_, const std::string keyNames[], const std::string warnKeyNames[], const int nParMin_); virtual const std::string ToString() = 0; bool GetHideHelp() const { return hideHelp;} void SetHideHelp( bool v) { hideHelp = v;} }; // library procedure class DLibPro: public DLib { LibPro pro; public: // warnKeyNames are keywords wich are not supported, but which // should not make the compilation fail. // A warning will be issued. // use this for keywords which are truly optional and don't // change the results. // Note that due to their nature, there should never be keywords // on which a value is returned. DLibPro( LibPro p, const std::string& n, const int nPar_=0, const std::string keyNames[]=NULL, const std::string warnKeyNames[]=NULL, const int nParMin_=0); DLibPro( LibPro p, const std::string& n, const std::string& o, const int nPar_=0, const std::string keyNames[]=NULL, const std::string warnKeyNames[]=NULL, const int nParMin_=0); LibPro Pro() { return pro;} const std::string ToString(); }; // library function class DLibFun: public DLib { LibFun fun; public: DLibFun( LibFun f, const std::string& n, const int nPar_=0, const std::string keyNames[]=NULL, const std::string warnKeyNames[]=NULL, const int nParMin_=0); DLibFun( LibFun f, const std::string& n, const std::string& o, const int nPar_=0, const std::string keyNames[]=NULL, const std::string warnKeyNames[]=NULL, const int nParMin_=0); LibFun Fun() { return fun;} const std::string ToString(); virtual bool RetNew() { return false;} virtual bool DirectCall() { return false;} }; // library function which ALWAYS return a new value // (as opposite to returning an input value) class DLibFunRetNew: public DLibFun { bool retConstant; // means: can be pre-evaluated with constant input public: DLibFunRetNew( LibFun f, const std::string& n, const int nPar_=0, const std::string keyNames[]=NULL, const std::string warnKeyNames[]=NULL, bool rConstant=false, const int nParMin_=0); DLibFunRetNew( LibFun f, const std::string& n, const std::string& o, const int nPar_=0, const std::string keyNames[]=NULL, const std::string warnKeyNames[]=NULL, const int nParMin_=0); bool RetNew() { return true;} bool RetConstant() { return this->retConstant;} }; // direct call functions must have: // ony one parameter, no keywords // these functions are called "direct", no environment is created class DLibFunDirect: public DLibFunRetNew { LibFunDirect funDirect; public: DLibFunDirect( LibFunDirect f, const std::string& n, bool retConstant_=true); LibFunDirect FunDirect() { return funDirect;} // bool RetNew() { return true;} bool DirectCall() { return true;} }; // UD pro/fun ******************************************************** // function/procedure (differ because they are in different lists) // User Defined class DSubUD: public DSub { std::string file; // filename were procedure is defined in KeyVarListT var; // keyword values, parameters, local variables CommonBaseListT common; // common blocks or references ProgNodeP tree; // the 'code' unsigned int compileOpt; // e.g. hidden or obsolete LabelListT labelList; void ResolveLabel( ProgNodeP); protected: int nForLoops; public: DSubUD(const std::string&,const std::string& o="",const std::string& f=""); ~DSubUD(); void Reset(); void DelTree(); void SetTree( ProgNodeP t) { tree = t;} void AddCommon(DCommonBase* c) { common.push_back(c);} void ResolveAllLabels(); LabelListT& LabelList() { return labelList;} ProgNodeP GotoTarget( int ix) { if( ix >= labelList.Size()) throw GDLException( "Undefined label."); return labelList.Get( ix); } // int LabelOrd( int ix) { return labelList.GetOrd( ix);} int NDefLabel() { return labelList.Size();} std::string GetFilename() { return file; } // add variables DSubUD* AddPar(const std::string&); // add paramter unsigned AddVar(const std::string&); // add local variable DSubUD* AddKey(const std::string&, const std::string&); // add keyword=value void DelVar(const int ix) {var.erase(var.begin() + ix);} SizeT Size() { return var.size();} int NForLoops() const { return nForLoops;} // search for variable returns true if its found in var or common blocks bool Find(const std::string& n) { KeyVarListT::iterator f=std::find(var.begin(),var.end(),n); if( f != var.end()) return true; CommonBaseListT::iterator c= std::find_if(common.begin(),common.end(),DCommon_contains_var(n)); return (c != common.end()); } // returns common block with name n DCommon* Common(const std::string& n) { CommonBaseListT::iterator c = common.begin(); for(; c != common.end(); ++c) if( dynamic_cast< DCommon*>( *c) != NULL && (*c)->Name() == n) return static_cast< DCommon*>( *c); return NULL; } // returns common block which holds variable n DCommonBase* FindCommon(const std::string& n) { CommonBaseListT::iterator c= std::find_if(common.begin(),common.end(),DCommon_contains_var(n)); return (c != common.end())? *c : NULL; } const std::string& GetVarName( SizeT ix) { return var[ix]; } const std::string& GetKWName( SizeT ix) { return key[ix]; } bool GetCommonVarName(const BaseGDL* p, std::string& varName) { for( CommonBaseListT::iterator c=common.begin(); c != common.end(); c++) { int vIx = (*c)->Find( p); if( vIx >= 0) { varName=(*c)->VarName( vIx); return true; } } return false; } BaseGDL** GetCommonVarPtr(const BaseGDL* p) { for( CommonBaseListT::iterator c=common.begin(); c != common.end(); c++) { int vIx = (*c)->Find( p); if( vIx >= 0) { DVar* var = (*c)->Var( vIx); return &(var->Data()); } } return NULL; } // returns the variable index (-1 if not found) int FindVar(const std::string& s) { return FindInKeyVarListT(var,s); } // returns ptr to common variable (NULL if not found) DVar* FindCommonVar(const std::string& s) { for(CommonBaseListT::iterator c=common.begin(); c != common.end(); c++) { DVar* v=(*c)->Find(s); if( v) return v; } return NULL; } // the final "compilation" takes part here void SetTree( RefDNode n); // { // // // // Converter Translation Transcription Rewrite RefDNode ProgNode ProgNodeP // // // // here the conversion RefDNode -> ProgNode is done // // // tree = ProgNode::NewProgNode( n); // } ProgNodeP GetTree() { return tree; } unsigned int GetCompileOpt() { return compileOpt; } void SetCompileOpt(const unsigned int n) { compileOpt = n; } bool isObsolete(); bool isHidden(); friend class EnvUDT; }; class DPro: public DSubUD { public: // for main function, not inserted into proList // should be fine (way too much): 32 NESTED loops in $MAIN$ (elswhere: unlimited) DPro(): DSubUD("$MAIN$","","") { this->nForLoops = 32;} DPro(const std::string& n,const std::string& o="",const std::string& f=""): DSubUD(n,o,f) {} ~DPro() {}; }; class DFun: public DSubUD { public: DFun(const std::string& n,const std::string& o="",const std::string& f=""): DSubUD(n,o,f) {} ~DFun() {}; }; typedef std::vector FunListT; typedef std::vector ProListT; typedef std::vector LibFunListT; typedef std::vector LibProListT; #endif gdl-0.9.4/src/io.cpp0000664000175000017500000005727012217457527012653 0ustar marcmarc/*************************************************************************** io.cpp - GDL classes for file io ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /* ************************************************************************* * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" #include // std::remove(...) #include "objects.hpp" #include "io.hpp" #ifdef _MSC_VER #define NS_INT16SZ 2 #define NS_INADDRSZ 4 #define NS_IN6ADDRSZ 16 static int inet_pton4( const char *src, unsigned char *dst ) { static const char digits[] = "0123456789"; int saw_digit, octets, ch; unsigned char tmp[NS_INADDRSZ], *tp; saw_digit = 0; octets = 0; *(tp = tmp) = 0; while( (ch = *src++) != ' ' ) { const char *pch; if( (pch = strchr(digits, ch)) != NULL ) { unsigned int iNew = (unsigned int)(*tp * 10 + (pch - digits)); if( iNew > 255 ) return (0); *tp = iNew; if( !saw_digit ) { if( ++octets > 4 ) return (0); saw_digit = 1; } } else if( ch == '.' && saw_digit ) { if( octets == 4 ) return (0); *++tp = 0; saw_digit = 0; } else { return (0); } } if( octets < 4 ) return (0); memcpy( dst, tmp, NS_INADDRSZ ); return (1); } static int inet_pton6( const char *src, unsigned char * dst ) { static const char xdigits_l[] = "0123456789abcdef", xdigits_u[] = "0123456789ABCDEF"; unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; const char *xdigits, *curtok; int ch, saw_xdigit; unsigned int val; memset((tp = tmp), ' ', NS_IN6ADDRSZ); endp = tp + NS_IN6ADDRSZ; colonp = NULL; // Leading :: requires some special handling. if( *src == ':' && *++src != ':' ) return (0); curtok = src; saw_xdigit = 0; val = 0; while( ( ch = *src++ ) != ' ' ) { const char *pch; if( ( pch = strchr( ( xdigits = xdigits_l ), ch ) ) == NULL ) pch = strchr( (xdigits = xdigits_u), ch ); if( pch != NULL ) { val <<= 4; val |= (pch - xdigits); if( val > 0xffff ) return (0); saw_xdigit = 1; continue; } if( ch == ':' ) { curtok = src; if( !saw_xdigit ) { if( colonp ) return (0); colonp = tp; continue; } if( tp + NS_INT16SZ > endp ) return (0); *tp++ = (unsigned char) (val >> 8) & 0xff; *tp++ = (unsigned char) val & 0xff; saw_xdigit = 0; val = 0; continue; } if( ch == '.' && ((tp + NS_INADDRSZ) <= endp) && inet_pton4(curtok, tp) > 0 ) { tp += NS_INADDRSZ; saw_xdigit = 0; break; /* ' ' was seen by inet_pton4(). */ } return (0); } if( saw_xdigit ) { if( tp + NS_INT16SZ > endp ) return (0); *tp++ = (unsigned char) (val >> 8) & 0xff; *tp++ = (unsigned char) val & 0xff; } if( colonp != NULL ) { // Since some memmove()'s erroneously fail to handle overlapping regions, we'll do the shift by hand. const int n = (int)(tp - colonp); int i; for( i = 1; i <= n; i++ ) { endp[- i] = colonp[n - i]; colonp[n - i] = 0; } tp = endp; } if( tp != endp ) return (0); memcpy(dst, tmp, NS_IN6ADDRSZ); return (1); } int inet_pton( int af, const char *src, void *dst ) { switch (af) { case AF_INET: return inet_pton4( src, (unsigned char *)dst ); case AF_INET6: return inet_pton6( src, (unsigned char *)dst ); default: errno = EAFNOSUPPORT; return (-1); } } // This source code is from http://blog.naver.com/PostView.nhn?blogId=websearch&logNo=70089324416&parentCategoryNo=4&viewDate=¤tPage=1&listtype=0 #endif using namespace std; const string StreamInfo( ios* searchStream) { if( dynamic_cast( searchStream) != NULL) return "Unit: 0, (redirected)"; if( searchStream == &cin) return "Unit: 0, "; if( searchStream == &cout) return "Unit: -1, "; if( searchStream == &cerr) return "Unit: -2, "; for( SizeT i=0; iFStream() == searchStream) { return "Unit: "+i2s(i+1)+", File: "+fileUnits[ i].Name(); } } return "Internal error: Stream not found."; } void AnyStream::Close() { if( fStream != NULL && fStream->is_open()) { fStream->close(); fStream->clear(); } if( igzStream != NULL && igzStream->rdbuf()->is_open()) { igzStream->close(); igzStream->clear(); } if( ogzStream != NULL && ogzStream->rdbuf()->is_open()) { ogzStream->close(); ogzStream->clear(); } } void AnyStream::Open(const std::string& name_, ios_base::openmode mode_ , bool compress_) { if (compress_) { delete fStream; fStream = NULL; if( (mode_ & std::ios::out)) { if( ogzStream == NULL) ogzStream = new ogzstream(); ogzStream->open( name_.c_str(), mode_ & ~std::ios::in); if( ogzStream->fail()) { delete ogzStream; ogzStream = NULL; throw GDLIOException("Error opening compressed file for output."); } } else { delete ogzStream; ogzStream = NULL; } if( (mode_ & std::ios::in) && !(mode_ & std::ios::out)) { if( igzStream == NULL) igzStream = new igzstream(); igzStream->open( name_.c_str(), mode_ & ~std::ios::out); if( igzStream->fail()) { delete igzStream; igzStream = NULL; throw GDLIOException("Error opening compressed file for input."); } } else { delete igzStream; igzStream = NULL; } } else { delete igzStream; igzStream = NULL; delete ogzStream; ogzStream = NULL; if( fStream == NULL) fStream = new fstream(); fStream->open( name_.c_str(), mode_); if( fStream->fail()) { delete fStream; fStream = NULL; if( ((mode_ | ios_base::in) != 0) && ((mode_ | ios_base::out) == 0)) throw GDLIOException(-265,"Error opening file for reading."); throw GDLIOException(-1,"Error opening file."); } } } void GDLStream::Open( const string& name_, ios_base::openmode mode_, bool swapEndian_, bool dOC, bool xdr_, SizeT width_, bool f77_, bool compress_) { string expName = name_; WordExp( expName); f77 = f77_; // if( f77_) // throw GDLException("F77_UNFORMATTED format not supported."); // if( (fStream != NULL && fStream->is_open()) || (igzStream != NULL && igzStream->rdbuf()->is_open()) || (ogzStream != NULL && ogzStream->rdbuf()->is_open())) if( anyStream != NULL && anyStream->IsOpen()) throw GDLIOException("File unit is already open."); if( anyStream == NULL) anyStream = new AnyStream(); name=expName; mode=mode_; compress = compress_; anyStream->Open(expName,mode_,compress_); swapEndian = swapEndian_; deleteOnClose = dOC; if( xdr_) xdrs = new XDR; lastSeekPos = 0; lastRecord = 0; lastRecordStart = 0; width = width_; } void GDLStream::Socket( const string& host, DUInt port, bool swapEndian_, DDouble c_timeout_, DDouble r_timeout_, DDouble w_timeout_) { if( iSocketStream == NULL) iSocketStream = new istringstream; if( recvBuf == NULL) recvBuf = new string; name=host; sockNum = socket( AF_INET, SOCK_STREAM, 0); c_timeout = c_timeout_; r_timeout = r_timeout_; w_timeout = w_timeout_; int on = 1; if (setsockopt( sockNum, SOL_SOCKET, SO_REUSEADDR, (const char*) &on, sizeof (on)) == -1) { throw GDLIOException("Error opening file."); } sockaddr_in m_addr; m_addr.sin_family = AF_INET; m_addr.sin_port = htons ( port); // Convert host to IPv4 format struct hostent *h; if ((h=gethostbyname( host.c_str())) == NULL) { // get the host info throw GDLIOException("Unable to lookup host."); } // cout << inet_ntoa(*((struct in_addr *)h->h_addr)) << endl; int status = inet_pton( AF_INET, inet_ntoa(*((struct in_addr *)h->h_addr)), &m_addr.sin_addr ); status = connect( sockNum, ( sockaddr * ) &m_addr, sizeof (m_addr)); swapEndian = swapEndian_; // BIG limit on socket send width to avoid leading \n in CheckNL width = 32768; } void AnyStream::Flush() { if( fStream != NULL) { fStream->flush(); } if( ogzStream != NULL) { ogzStream->flush(); } } void GDLStream::Flush() { if( anyStream != NULL) { anyStream->Flush(); } } void GDLStream::Close() { if( anyStream != NULL) { anyStream->Close(); if( deleteOnClose) std::remove(name.c_str()); } name=""; f77=false; swapEndian=false; compress=false; deleteOnClose=false; delete xdrs; xdrs = NULL; width = defaultStreamWidth; sockNum = -1; c_timeout = 0.0; r_timeout = 0.0; w_timeout = 0.0; #ifdef HAVE_EXT_STDIO_FILEBUF_H // GGH: ggh hack to implement SPAWN keyword UNIT // Do housekeeping before closure if (readbuf_frb_destroy_on_close_p != NULL) { readbuf_frb_destroy_on_close_p->~stdio_filebuf(); readbuf_frb_destroy_on_close_p = NULL; } if (readbuf_bsrb_destroy_on_close_p != NULL) { readbuf_bsrb_destroy_on_close_p->~basic_streambuf(); readbuf_bsrb_destroy_on_close_p = NULL; } if (fd_close_on_close != -1) { close(fd_close_on_close); fd_close_on_close = -1; } #endif } void GDLStream::Free() { Close(); delete anyStream; anyStream = NULL; delete iSocketStream; iSocketStream = NULL; delete recvBuf; recvBuf = NULL; getLunLock = false; } igzstream& GDLStream::IgzStream() { if( anyStream == NULL || anyStream->IgzStream() == NULL || !anyStream->IsOpen()) throw GDLIOException("File unit is not open for compressed reading or writing."); if( !(mode & ios::in)) throw GDLIOException("File unit is not open for reading."); return *anyStream->IgzStream(); } ogzstream& GDLStream::OgzStream() { if( anyStream == NULL || anyStream->OgzStream() == NULL || !anyStream->IsOpen()) throw GDLIOException("File unit is not open for compressed reading or writing."); if( !(mode & ios::out)) throw GDLIOException("File unit is not open for compressed writing."); return *anyStream->OgzStream(); } fstream& GDLStream::IStream() { if( anyStream == NULL || anyStream->FStream() == NULL || !anyStream->IsOpen()) throw GDLIOException("File unit is not open."); if( !(mode & ios::in)) throw GDLIOException("File unit is not open for reading."); return *anyStream->FStream(); } fstream& GDLStream::OStream() { if( anyStream == NULL || anyStream->FStream() == NULL || !anyStream->IsOpen()) throw GDLIOException("File unit is not open."); if( !(mode & ios::out)) throw GDLIOException("File unit is not open for writing."); return *anyStream->FStream(); } istringstream& GDLStream::ISocketStream() { if( iSocketStream == NULL) throw GDLIOException("Socket unit is not open."); return *iSocketStream; } void GDLStream::Pad( std::streamsize nBytes) { if( anyStream != NULL) anyStream->Pad( nBytes); } void AnyStream::Pad( std::streamsize nBytes) { const std::streamsize bufSize = 1024; static char buf[ bufSize]; SizeT nBuf = nBytes / bufSize; std::streamsize lastBytes = nBytes % bufSize; if( fStream != NULL) { for( SizeT i=0; iwrite( buf, bufSize); if( lastBytes > 0) fStream->write( buf, lastBytes); } else if( ogzStream != NULL) { for( SizeT i=0; iwrite( buf, bufSize); if( lastBytes > 0) ogzStream->write( buf, lastBytes); } } void GDLStream::F77Write( DULong tCount) { anyStream->ClearEof(); assert( sizeof( DULong) == 4); if( swapEndian) { char swapTCount[ sizeof( DULong)]; for( SizeT i=0; i(&tCount)[ sizeof( DULong)-1-i]; anyStream->Write(swapTCount,sizeof( DULong)); } else { anyStream->Write(reinterpret_cast(&tCount),sizeof( DULong)); } if( !anyStream->Good()) { throw GDLIOException("Error writing F77_UNFORMATTED record data."); } } DULong GDLStream::F77ReadStart() { if( anyStream->EofRaw()) throw GDLIOException("End of file encountered."); assert( sizeof( DULong) == 4); DULong tCountRd; if( swapEndian) { char swapTCount[ sizeof( DULong)]; anyStream->Read( swapTCount, sizeof( DULong)); for( SizeT i=0; i(&tCountRd)[ sizeof( DULong)-1-i] = swapTCount[i]; } else { anyStream->Read(reinterpret_cast(&tCountRd),sizeof( DULong)); } if( anyStream->EofRaw()) throw GDLIOException("End of file encountered."); if( !anyStream->Good()) { throw GDLIOException("Error reading F77_UNFORMATTED record data."); } lastRecord = tCountRd; lastRecordStart = Tell(); return tCountRd; } void GDLStream::F77ReadEnd() { if( anyStream->EofRaw()) throw GDLIOException("End of file encountered."); std::streampos actPos = Tell(); if( actPos > (lastRecordStart+lastRecord)) throw GDLIOException( "Read past end of Record of F77_UNFORAMTTED file."); if( actPos < (lastRecordStart+lastRecord)) Seek( lastRecordStart+lastRecord); DULong tCountRd; if( swapEndian) { char swapTCount[ sizeof( DULong)]; anyStream->Read( swapTCount, sizeof( DULong)); for( SizeT i=0; i(&tCountRd)[ sizeof( DULong)-1-i] = swapTCount[i]; } else { anyStream->Read(reinterpret_cast(&tCountRd),sizeof( DULong)); } if( anyStream->EofRaw()) throw GDLIOException("End of file encountered."); if( !anyStream->Good()) { throw GDLIOException("Error reading F77_UNFORMATTED record data."); } if( lastRecord !=static_cast( tCountRd)) throw GDLIOException( "Logical error in F77_UNFORAMTTED file."); } // ============================================================================ #ifdef HAVE_EXT_STDIO_FILEBUF_H // GGH ggh hack to implement SPAWN keyword UNIT std::basic_streambuf *GDLStream::get_stream_readbuf_bsrb() { return anyStream->fStream->std::ios::rdbuf(); } int GDLStream::set_stream_readbuf_bsrb_from_frb(__gnu_cxx::stdio_filebuf *frb_p) { anyStream->fStream->std::ios::rdbuf(frb_p); return 0; } int GDLStream::set_readbuf_frb_destroy_on_close(__gnu_cxx::stdio_filebuf *frb_p) { readbuf_frb_destroy_on_close_p = frb_p; return 0; } int GDLStream::set_readbuf_bsrb_destroy_on_close(std::basic_streambuf *bsrb_p) { readbuf_bsrb_destroy_on_close_p = bsrb_p; return 0; } int GDLStream::set_fd_close_on_close(int fd) { fd_close_on_close = fd; return 0; } #endif // gzstream, C++ iostream classes wrapping the zlib compression library. // Copyright (C) 2001 Deepak Bandyopadhyay, Lutz Kettner // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library 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 // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser 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 // ============================================================================ // // File : gzstream.C // Author(s) : Deepak Bandyopadhyay, Lutz Kettner // // Standard streambuf implementation following Nicolai Josuttis, "The // Standard C++ Library". // ============================================================================ #ifdef GZSTREAM_NAMESPACE namespace GZSTREAM_NAMESPACE { #endif // ---------------------------------------------------------------------------- // Internal classes to implement gzstream. See header file for user classes. // ---------------------------------------------------------------------------- // -------------------------------------- // class gzstreambuf: // -------------------------------------- gzstreambuf* gzstreambuf::open( const char* name, int open_mode) { if ( is_open()) return (gzstreambuf*)0; mode = open_mode; // no append nor read/write mode if ((mode & std::ios::ate) || (mode & std::ios::app) || ((mode & std::ios::in) && (mode & std::ios::out))) return (gzstreambuf*)0; char fmode[10]; char* fmodeptr = fmode; if ( mode & std::ios::in) *fmodeptr++ = 'r'; else if ( mode & std::ios::out) *fmodeptr++ = 'w'; *fmodeptr++ = 'b'; *fmodeptr = '\0'; file = gzopen( name, fmode); if (file == 0) return (gzstreambuf*)0; opened = 1; return this; } gzstreambuf * gzstreambuf::close() { if ( is_open()) { sync(); opened = 0; if ( gzclose( file) == Z_OK) return this; } return (gzstreambuf*)0; } int gzstreambuf::underflow() { // used for input buffer only if ( gptr() && ( gptr() < egptr())) return * reinterpret_cast( gptr()); if ( ! (mode & std::ios::in) || ! opened) return EOF; // Josuttis' implementation of inbuf int n_putback = gptr() - eback(); if ( n_putback > buf4) n_putback = buf4; memcpy( buffer + (buf4 - n_putback), gptr() - n_putback, n_putback); int num = gzread( file, buffer+buf4, bufferSize-buf4); if (num <= 0) // ERROR or EOF return EOF; // reset buffer pointers setg( buffer + (buf4 - n_putback), // beginning of putback area buffer + buf4, // read position buffer + buf4 + num); // end of buffer // return next character return * reinterpret_cast( gptr()); } int gzstreambuf::flush_buffer() { // Separate the writing of the buffer from overflow() and // sync() operation. int w = pptr() - pbase(); if ( gzwrite( file, pbase(), w) != w) return EOF; pbump( -w); return w; } int gzstreambuf::overflow( int c) { // used for output buffer only if ( ! ( mode & std::ios::out) || ! opened) return EOF; if (c != EOF) { *pptr() = c; pbump(1); } if ( flush_buffer() == EOF) return EOF; return c; } int gzstreambuf::sync() { // Changed to use flush_buffer() instead of overflow( EOF) // which caused improper behavior with std::endl and flush(), // bug reported by Vincent Ricard. if ( pptr() && pptr() > pbase()) { if ( flush_buffer() == EOF) return -1; } return 0; } std::streampos gzstreambuf::pubseekpos(std::streampos sp, std::ios_base::openmode which) { if(is_open()) { if((which==std::ios_base::in && this->mode & std::ios::in) || /* read mode : ok */ (which==std::ios_base::out && this->mode & std::ios::out && static_cast(sp)>=gztell(this->file))) /* write mode : seek forward only */ { z_off_t off=gzseek(this->file,static_cast(sp),SEEK_SET); if(which==std::ios_base::in) setg(buffer+buf4,buffer+buf4,buffer+buf4); return off; } else return static_cast(gztell(this->file)); /* Just don't Seek, no error */ } return -1; } std::streampos gzstreambuf::pubseekoff(std::streamoff offIn, std::ios_base::seekdir way, std::ios_base::openmode which) { if(is_open() && way!=std::ios_base::end) /* No seek with SEEK_END */ { if((which==std::ios_base::in && this->mode & std::ios::in) || /* read mode : ok */ (which==std::ios_base::out && this->mode & std::ios::out && /* write mode : ok if */ ((way==std::ios_base::cur && offIn>=0) || /* SEEK_CUR with positive offset */ (way==std::ios_base::beg && static_cast(offIn)>=gztell(this->file))))) /* or SEEK_SET which go forward */ { z_off_t off=gzseek(this->file,static_cast(offIn),(way==std::ios_base::beg?SEEK_SET:SEEK_CUR)); if(which==std::ios_base::in) setg(buffer+buf4,buffer+buf4,buffer+buf4); return off; } else return static_cast(gztell(this->file)); /* Just don't Seek, no error */ } return -1; } // -------------------------------------- // class gzstreambase: // -------------------------------------- gzstreambase::gzstreambase( const char* name, int mode) { init( &buf); open( name, mode); } gzstreambase::~gzstreambase() { buf.close(); } void gzstreambase::open( const char* name, int open_mode) { if ( ! buf.open( name, open_mode)) clear( rdstate() | std::ios::badbit); } void gzstreambase::close() { if ( buf.is_open()) if ( ! buf.close()) clear( rdstate() | std::ios::badbit); } // -------------------------------------- // class igzstream: // -------------------------------------- igzstream& igzstream::seekg(std::streampos pos) { if(rdbuf()->pubseekpos(pos,ios_base::in)==std::streampos(-1)) this->setstate(std::ios_base::badbit); else this->setstate(std::ios_base::goodbit); return *this; } igzstream& igzstream::seekg(std::streamoff off, std::ios_base::seekdir dir) { if(rdbuf()->pubseekoff(off,dir,ios_base::in)==std::streampos(-1)) this->setstate(std::ios_base::badbit); else this->setstate(std::ios_base::goodbit); return *this; } // -------------------------------------- // class ogzstream: // -------------------------------------- ogzstream& ogzstream::seekp(std::streampos pos) { if(rdbuf()->pubseekpos(pos,ios_base::out)==std::streampos(-1)) this->setstate(std::ios_base::badbit); else this->setstate(std::ios_base::goodbit); return *this; } ogzstream& ogzstream::seekp(std::streamoff off, std::ios_base::seekdir dir) { if(rdbuf()->pubseekoff(off,dir,ios_base::out)==std::streampos(-1)) this->setstate(std::ios_base::badbit); else this->setstate(std::ios_base::goodbit); return *this; } #ifdef GZSTREAM_NAMESPACE } // namespace GZSTREAM_NAMESPACE #endif // ============================================================================ // EOF // gdl-0.9.4/src/graphics.cpp0000664000175000017500000001267212155661241014030 0ustar marcmarc/* ************************************************************************* graphics.cpp - GDL base class for all graphic devices ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /* ************************************************************************* * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" #include #include "objects.hpp" #include "graphics.hpp" #ifdef _MSC_VER # include "devicewin.hpp" #else # include "devicex.hpp" #endif #include "deviceps.hpp" #include "devicesvg.hpp" #include "devicez.hpp" #include "initsysvar.hpp" #include "color.hpp" using namespace std; bool GDLCT::Get( PLINT r_[], PLINT g_[], PLINT b_[], UInt nCol) const { if( nCol > ctSize) return false; for(UInt i=0; i(r[i]); g_[i] = static_cast(g[i]); b_[i] = static_cast(b[i]); } return true; } bool GDLCT::Get( UInt ix, DByte& r_, DByte& g_, DByte& b_) const { if( ix >= ctSize) return false; r_ = r[ix]; g_ = g[ix]; b_ = b[ix]; return true; } bool GDLCT::Set( UInt ix, DByte r_, DByte g_, DByte b_) { if( ix >= ctSize) return false; r[ix] = r_; g[ix] = g_; b[ix] = b_; return true; } bool GDLCT::SetHLS( UInt ix, DFloat h, DFloat l, DFloat s) { if( ix >= ctSize) return false; DByte r_, g_, b_; HLS2RGB( h, l, s, r_, g_, b_); r[ix] = r_; g[ix] = g_; b[ix] = b_; return true; } bool GDLCT::SetHSV( UInt ix, DFloat h, DFloat s, DFloat v) { if( ix >= ctSize) return false; DByte r_, g_, b_; HSV2RGB( h, s, v, r_, g_, b_); r[ix] = r_; g[ix] = g_; b[ix] = b_; return true; } std::vector Graphics::CT; // predefined colortables GDLCT Graphics::actCT; // actual used colortable DeviceListT Graphics::deviceList; Graphics* Graphics::actDevice = NULL; int Graphics::wTag; int Graphics::xSTag; int Graphics::ySTag; int Graphics::xVSTag; int Graphics::yVSTag; int Graphics::n_colorsTag; Graphics::~Graphics() { // actDevice's dStruct is or will be deleted from sysVarList if( actDevice != this) delete dStruct; } // v-table instatiation Graphics::Graphics(): dStruct( NULL) { } bool Graphics::SetDevice( const string& device) { int size = deviceList.size(); for( int i=0; iName() == device) { actDevice = deviceList[ i]; // update !D SysVar::SetD( actDevice->DStruct()); return true; } } return false; } void Graphics::Init() { InitCT(); DefineDStructDesc(); #ifdef _MSC_VER deviceList.push_back( new DeviceWIN()); #else # ifndef HAVE_X # else deviceList.push_back( new DeviceX()); # endif #endif deviceList.push_back( new DevicePS()); deviceList.push_back( new DeviceSVG()); deviceList.push_back( new DeviceZ()); #ifdef _MSC_VER if( !SetDevice( "WIN")) #else # ifndef HAVE_X # else if( !SetDevice( "X")) # endif #endif # ifndef HAVE_X {} # else { cerr << "Error initializing graphics." << endl; exit( EXIT_FAILURE); } # endif } void Graphics::DestroyDevices() { PurgeContainer( deviceList); actDevice = NULL; } void Graphics::DefineDStructDesc() { DStructDesc* dSysVarDesc = FindInStructList( structList, "!DEVICE"); if( dSysVarDesc != NULL) return; dSysVarDesc = new DStructDesc( "!DEVICE"); SpDString aString; SpDLong aLong; SpDLong aLongArr2( dimension(2)); SpDFloat aFloat; dSysVarDesc->AddTag("NAME", &aString); dSysVarDesc->AddTag("X_SIZE", &aLong); dSysVarDesc->AddTag("Y_SIZE", &aLong); dSysVarDesc->AddTag("X_VSIZE", &aLong); dSysVarDesc->AddTag("Y_VSIZE", &aLong); dSysVarDesc->AddTag("X_CH_SIZE", &aLong); dSysVarDesc->AddTag("Y_CH_SIZE", &aLong); dSysVarDesc->AddTag("X_PX_CM", &aFloat); dSysVarDesc->AddTag("Y_PX_CM", &aFloat); dSysVarDesc->AddTag("N_COLORS", &aLong); dSysVarDesc->AddTag("TABLE_SIZE", &aLong); dSysVarDesc->AddTag("FILL_DIST", &aLong); dSysVarDesc->AddTag("WINDOW", &aLong); dSysVarDesc->AddTag("UNIT", &aLong); dSysVarDesc->AddTag("FLAGS", &aLong); dSysVarDesc->AddTag("ORIGIN", &aLongArr2); dSysVarDesc->AddTag("ZOOM", &aLongArr2); structList.push_back( dSysVarDesc); // !D tag indices wTag = dSysVarDesc->TagIndex( "WINDOW"); xSTag = dSysVarDesc->TagIndex( "X_SIZE"); ySTag = dSysVarDesc->TagIndex( "Y_SIZE"); xVSTag = dSysVarDesc->TagIndex( "X_VSIZE"); yVSTag = dSysVarDesc->TagIndex( "Y_VSIZE"); n_colorsTag = dSysVarDesc->TagIndex( "N_COLORS"); } void Graphics::HandleEvents() { DeviceListT::iterator i; for( i=deviceList.begin(); i != deviceList.end(); ++i) { (*i)->EventHandler(); } } void Graphics::LoadCT( UInt iCT) { actCT = CT[iCT]; } gdl-0.9.4/src/basic_fun_cl.hpp0000664000175000017500000000252310625610245014634 0ustar marcmarc/*************************************************************************** basic_fun.hpp - basic GDL library functions ------------------- begin : March 14 2004 copyright : (C) 2004 by Christopher Lee email : leec_gdl@publius.co.uk ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifndef BASIC_FUN_HPP_CL #define BASIC_FUN_HPP_CL namespace lib { double Gregorian2Julian(struct tm ts); BaseGDL* systime(EnvT* e); BaseGDL* legendre(EnvT* e); BaseGDL* interpol(EnvT* e); BaseGDL* gsl_exp(EnvT* e); BaseGDL* ncdf_exists(EnvT* e); BaseGDL* magick_exists(EnvT* e); } // namespace #endif gdl-0.9.4/src/pythongdl.cpp0000664000175000017500000003340312174440670014235 0ustar marcmarc/*************************************************************************** pythongdl.cpp - GDL embedded in python too be included by gdlpython ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sourceforge.net ***************************************************************************/ /*************************************************************************** * * * 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 has to be included from gdlpython because python // (here numarray) duplicates the C API for each compilation unit module // which includes it and hence numarray does not feel initialized in // gdlpython.cpp // and as topython.cpp has to be included from datatypes, // they all have to be included from datatypes #ifdef INCLUDE_PYTHONGDL_CPP //#include "includefirst.hpp" // if build as a python module //#ifdef PYTHON_MODULE // already included from includefirst //#include //#include // auto_ptr //#include //#include "datatypes.hpp" //#include "envt.hpp" //#include "sigfpehandler.hpp" //#include "terminfo.hpp" //#include "dinterpreter.hpp" #include "gdleventhandler.hpp" // SA fix based on: // http://synopsis.fresco.org/viewsvn/Synopsis/branches/Synopsis_0_8/src/Synopsis/Python/Object.hh?r2=1792&rev=1792&r1=1657&sortdir=down #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #endif void LibInit(); // defined in libinit.cpp using namespace std; // everything is executed within this interpreter // initialized in the initGDL function DInterpreter* interpreter; PyObject* gdlError; bool GetScript( PyObject *argTuple, DString& name) { if( argTuple == NULL) { PyErr_SetString( gdlError, "No input."); return false; } int nArg = PyTuple_Size( argTuple); if( nArg == 0) { PyErr_SetString( gdlError, "No input."); return false; } PyObject* proPy = PyTuple_GetItem(argTuple, 0); BaseGDL* proGDL = FromPython( proPy); // throws if( proGDL->Type() != GDL_STRING) { PyErr_SetString( gdlError, "Script must be a tuple of strings."); GDLDelete(proGDL); return false; } name = StrUpCase((*(static_cast< DStringGDL*>( proGDL)))[ 0]); GDLDelete(proGDL); return true; } bool GetFirstString( PyObject *argTuple, DString& name) { if( argTuple == NULL) { PyErr_SetString( gdlError, "No argument."); return false; } int nArg = PyTuple_Size( argTuple); if( nArg == 0) { PyErr_SetString( gdlError, "No argument."); return false; } PyObject* proPy = PyTuple_GetItem(argTuple, 0); BaseGDL* proGDL = FromPython( proPy); // throws if( proGDL->Type() != GDL_STRING || proGDL->N_Elements() != 1) { PyErr_SetString( gdlError, "First argument must be a scalar string"); GDLDelete(proGDL); return false; } name = (*(static_cast< DStringGDL*>( proGDL)))[ 0]; GDLDelete(proGDL); return true; } bool CheckSub( DSub* sub, PyObject *argTuple, PyObject *kwDict) { int nKey = sub->NKey(); int nPar = sub->NPar(); int nArg = PyTuple_Size( argTuple); // check args and keywords if( nPar != -1 && (nArg-1) > nPar) { string errString = "Only " + i2s(nPar) + " arguments are allowed in call to: " + sub->ObjectName(); PyErr_SetString( gdlError, errString.c_str()); return false; } if( kwDict == NULL) return true; // finish int nKW = PyDict_Size( kwDict); if( nKW > nKey) { string errString = "Only " + i2s(nKey) + " keywords are allowed in call to: " + sub->ObjectName(); PyErr_SetString( gdlError, errString.c_str()); return false; } return true; } bool CopyArgFromPython( vector& parRef, vector& kwRef, EnvBaseT& e, PyObject *argTuple, PyObject *kwDict) { int nArg = PyTuple_Size( argTuple); if( nArg > 1) parRef.reserve( nArg-1); // copy arguments for( SizeT p=1; pToStream( cout); cout << endl; // cout << pP << " " << parRef.back() << " &" << &parRef.back() << endl; } } if( kwDict != NULL) { PyObject *key, *value; Py_ssize_t dictPos = 0; int nKW = PyDict_Size( kwDict); parRef.reserve( nKW); for( SizeT k=0; kFindKey( keyString); if( kwIx == -1) { string errString = "Keyword " + string(keyChar) + " not allowed in call to: " + e.GetPro()->ObjectName(); PyErr_SetString( gdlError, errString.c_str()); return false; } if( PyTuple_Check( value)) // local keyword (no cpy back) { BaseGDL* pP = FromPython( PyTuple_GetItem( value, 0)); // throws kwRef.push_back( NULL); e.SetKeyword( keyString, pP); } else { BaseGDL* pP = FromPython( value); // throws kwRef.push_back( pP); e.SetKeyword( keyString, &kwRef.back()); } } } e.ResolveExtra(); // expand _EXTRA return true; } bool CopyArgToPython( vector& parRef, vector& kwRef, EnvBaseT& e, PyObject *argTuple, PyObject *kwDict) { int nArg = PyTuple_Size( argTuple); for( SizeT p=1; pToPython(); // throws int success0 = PyTuple_SetItem( argTuple, p, pyObj); // Py_DECREF(pyObj); not needed: PyTuple_SetItem steals } } if( kwDict != NULL) { PyObject *key, *value; Py_ssize_t dictPos = 0; int nKW = PyDict_Size( kwDict); for( SizeT k=0; kToPython(); // throws int success0 = PyDict_SetItem( kwDict, key, pyObj); Py_DECREF( pyObj); } } } return true; } int (*oldInputHook)(); int GDLEventHandlerPy() { GDLEventHandler(); if( oldInputHook != NULL) (*oldInputHook)(); } // Execute a GDL subroutine PyObject *GDLSub( PyObject *self, PyObject *argTuple, PyObject *kwDict, bool functionCall) { feclearexcept(FE_ALL_EXCEPT); PyOS_sighandler_t oldControlCHandler = PyOS_setsig(SIGINT,ControlCHandler); PyOS_sighandler_t oldSigFPEHandler = PyOS_setsig(SIGFPE,SigFPEHandler); PyObject *retVal = NULL; // init to error indicator vector parRef; vector kwRef; bool success; DString pro; // handle GDL exceptions try { success = GetFirstString( argTuple, pro); if( !success) goto ret; pro = StrUpCase( pro); DSub* sub; bool libCall = false; if( functionCall) { // search for function pro // first search library functions int proIx = LibFunIx( pro); if( proIx != -1) { // PCALL_LIB sub = libFunList[ proIx]; libCall = true; } else { // FCALL - user defined procedures proIx = FunIx( pro); if( proIx == -1) { /*bool found=*/ interpreter->SearchCompilePro( pro, false); proIx = FunIx( pro); if( proIx == -1) { string errString = "Function " + pro + " not found."; PyErr_SetString( gdlError, errString.c_str()); goto ret; } } sub = proList[ proIx]; } } else { // search for procedure pro // first search library procedures int proIx = LibProIx( pro); if( proIx != -1) { // PCALL_LIB sub = libProList[ proIx]; libCall = true; } else { // PCALL - user defined procedures proIx = ProIx( pro); if( proIx == -1) { /*bool found=*/ interpreter->SearchCompilePro( pro, true); proIx = ProIx( pro); if( proIx == -1) { string errString = "Procedure " + pro + " not found."; PyErr_SetString( gdlError, errString.c_str()); goto ret; } } sub = proList[ proIx]; } } success = CheckSub( sub, argTuple, kwDict); if( !success) goto ret; // build the environment EnvBaseT* e; if( libCall) e = new EnvT( NULL, sub); else e = new EnvUDT( NULL, sub); Guard< EnvBaseT> e_guard( e); // copy arguments success = CopyArgFromPython( parRef, kwRef, *e, argTuple, kwDict); if( !success) goto ret; // make the call StackSizeGuard guard( GDLInterpreter::CallStack()); if( !libCall) { GDLInterpreter::CallStack().push_back( static_cast(e)); e_guard.release(); } BaseGDL* retValGDL = NULL; Guard retValGDL_guard; if( functionCall) { if( libCall) retValGDL = static_cast(static_cast(e)-> GetPro())->Fun()( static_cast(e)); else retValGDL = interpreter->call_fun(static_cast (static_cast(e) ->GetPro())->GetTree()); retValGDL_guard.Reset( retValGDL); } else { if( libCall) static_cast(e->GetPro())->Pro()(static_cast(e)); // throws else interpreter->call_pro(static_cast (e->GetPro())->GetTree()); //throws } // copy back args and keywords success = CopyArgToPython( parRef, kwRef, *e, argTuple, kwDict); if( !success) goto ret; if( retValGDL != NULL) { retVal = retValGDL->ToPython(); } } catch ( GDLException ex) { // ERROR GDL exception string errString = "Calling " + pro + ": " + ex.toString(); PyErr_SetString( gdlError, errString.c_str()); goto ret; } if( retVal == NULL) { // no error: return Py_None from procedure Py_INCREF(Py_None); retVal = Py_None; } ret: // free GDL parameters and keywords PurgeContainer( parRef); PurgeContainer( kwRef); // restore old signal handlers PyOS_setsig(SIGINT,oldControlCHandler); PyOS_setsig(SIGFPE,oldSigFPEHandler); return retVal; } // GDL is a C++ program extern "C" { // Execute a GDL procedure PyObject *GDL_script(PyObject *self, PyObject *argTuple, PyObject *kwDict) { PyOS_sighandler_t oldControlCHandler = PyOS_setsig(SIGINT,ControlCHandler); PyOS_sighandler_t oldSigFPEHandler = PyOS_setsig(SIGFPE,SigFPEHandler); PyObject *retVal = NULL; // init to error indicator bool success; DString file; success = GetFirstString( argTuple, file); if( !success) goto ret; { ifstream in(file.c_str()); if( !in.good()) { string errString = "Error opening file: "+file; PyErr_SetString( gdlError, errString.c_str()); goto ret; } success = interpreter->RunBatch( &in); if( !success) { string errString = "Error in batch file: "+file; PyErr_SetString( gdlError, errString.c_str()); goto ret; } } Py_INCREF(Py_None); retVal = Py_None; ret: // restore old signal handlers PyOS_setsig(SIGINT,oldControlCHandler); PyOS_setsig(SIGFPE,oldSigFPEHandler); return retVal; } // Execute a GDL procedure PyObject *GDL_function(PyObject *self, PyObject *argTuple, PyObject *kwDict) { return GDLSub( self, argTuple, kwDict, true); } // Execute a GDL procedure PyObject *GDL_pro(PyObject *self, PyObject *argTuple, PyObject *kwDict) { return GDLSub( self, argTuple, kwDict, false); } // python GDL module method table PyMethodDef GDLMethods[] = { {"pro", (PyCFunction) GDL_pro, METH_VARARGS | METH_KEYWORDS, "Execute a GDL procedure."}, {"function", (PyCFunction) GDL_function, METH_VARARGS | METH_KEYWORDS, "Execute a GDL function."}, {"script", (PyCFunction) GDL_script, METH_VARARGS | METH_KEYWORDS, "Run a GDL script (sequence of commands)."}, {NULL, NULL, 0, NULL} // Sentinel }; // python GDL module init function PyMODINIT_FUNC initGDL() { // http://docs.scipy.org/doc/numpy/reference/c-api.array.html#miscellaneous import_array(); // note: we don't use atexit here // ncurses blurs the output, initialize TermWidth here TermWidth(); // initializations InitObjects(); // init library functions LibInit(); // instantiate the interpreter (creates $MAIN$ environment) interpreter = new DInterpreter(); PyObject* m = Py_InitModule("GDL", GDLMethods); gdlError = PyErr_NewException((char*)"GDL.error", NULL, NULL); Py_INCREF(gdlError); PyModule_AddObject(m, "error", gdlError); // GDL event handling oldInputHook = PyOS_InputHook; PyOS_InputHook = GDLEventHandlerPy; } } // extern "C" //#endif #endif // INCLUDE_PYTHONGDL_CPP gdl-0.9.4/src/plotting_xyouts.cpp0000664000175000017500000003557712216132371015527 0ustar marcmarc/*************************************************************************** plotting.cpp - GDL routines for plotting ------------------- begin : July 22 2002 copyright : (C) 2002-2011 by Marc Schellens et al. email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" #include "plotting.hpp" #include "math_utl.hpp" #define DPI (double)(4*atan(1.0)) #define DEGTORAD DPI/180.0 namespace lib { using namespace std; static DDouble lastTextPosX=0.0; static DDouble lastTextPosY=0.0; class xyouts_call: public plotting_routine_call { PLFLT currentBoxXmin, currentBoxXmax, currentBoxYmin, currentBoxYmax, currentBoxZmin, currentBoxZmax; PLFLT vpXmin, vpXmax, vpYmin, vpYmax; DDoubleGDL* yVal, *xVal, *zVal; Guard xval_guard, yval_guard, zval_guard; DStringGDL* strVal; SizeT xEl, yEl, zEl, strEl; bool xLog, yLog, zLog; bool doClip, restoreClipBox; PLFLT savebox[4]; bool kwWidth; PLFLT width; DLong minEl; DLongGDL *color; DFloatGDL *spacing,*orientation,*charthick,*alignement,*size; Guard alignement_guard, orientation_guard,size_guard; bool doT3d; DDoubleGDL* t3dMatrix; Guard t3dMatrix_guard; DDoubleGDL *xValou; DDoubleGDL *yValou; Guard xvalou_guard, yvalou_guard; bool singleArg; private: bool handle_args(EnvT* e) { // KEYWORDS are: CLIP(YES), COLOR(YES), DATA(YES) , DEVICE(YES) , // NORMAL(YES) , FONT(NO), ORIENTATION(YES), /NOCLIP(YES), T3D(YES), Z(YES) static int zvIx = e->KeywordIx( "Z"); DDouble zValue=0.0; e->AssureDoubleScalarKWIfPresent ( zvIx, zValue ); singleArg=false; if ( nParam()==1 ) { singleArg=true; //string only... xVal=new DDoubleGDL(1, BaseGDL::ZERO); xval_guard.Reset(xVal); // delete upon exit yVal=new DDoubleGDL(1, BaseGDL::ZERO); yval_guard.Reset(yVal); // delete upon exit xEl=yEl=xVal->N_Elements(); strVal=e->GetParAs(0); strEl=strVal->N_Elements(); zVal=new DDoubleGDL(1); zval_guard.Reset(zVal); // delete upon exit (*zVal)[0]=zValue; minEl=strEl; //in this case only } else if ( nParam()==3 ) { xVal=e->GetParAs< DDoubleGDL>(0); xEl=xVal->N_Elements(); yVal=e->GetParAs< DDoubleGDL>(1); yEl=yVal->N_Elements(); strVal=e->GetParAs(2); strEl=strVal->N_Elements(); //z will be set at Zero unless Z=value is given zEl=xEl; zVal=new DDoubleGDL(dimension(zEl)); zval_guard.Reset(zVal); // delete upon exit for (SizeT i=0; i< zEl ; ++i) (*zVal)[i]=zValue; minEl=(xElThrow("Not enough parameters. Either 1 parameter or 3 " "parameters valid."); } return true; } private: void getTextPos(GDLGStream *a, DDouble &wx, DDouble &wy) { a->DeviceToWorld(lastTextPosX, lastTextPosY, wx, wy); if (GDL_DEBUG_PLSTREAM) fprintf(stderr,"getTextPos: Got norm: %lf %lf giving %lf %lf world\n", lastTextPosX, lastTextPosY, wx, wy); } void old_body(EnvT* e, GDLGStream* actStream) { int clippingix=e->KeywordIx("CLIP"); DFloatGDL* clipBox=NULL; //T3D static int t3dIx = e->KeywordIx( "T3D"); doT3d=(e->KeywordSet(t3dIx)|| T3Denabled(e)); // WIDTH keyword (read, write) static int widthIx=e->KeywordIx("WIDTH"); kwWidth=e->KeywordPresent(widthIx); width=0.; enum { DATA=0, NORMAL, DEVICE } coordinateSystem=DATA; //check presence of DATA,DEVICE and NORMAL options if ( e->KeywordSet("DATA") ) coordinateSystem=DATA; if ( e->KeywordSet("DEVICE") ) coordinateSystem=DEVICE; if ( e->KeywordSet("NORMAL") ) coordinateSystem=NORMAL; // get_axis_type gdlGetAxisType("X", xLog); gdlGetAxisType("Y", yLog); gdlGetAxisType("Z", zLog); bool mapSet=false; #ifdef USE_LIBPROJ4 get_mapset(mapSet); if ( mapSet ) { ref=map_init(); if ( ref==NULL ) { e->Throw("Projection initialization failed."); } } #endif restoreClipBox=false; int noclipvalue=1; e->AssureLongScalarKWIfPresent( "NOCLIP", noclipvalue); doClip=(noclipvalue==0); //XYOUTS by default does not clip, even if clip is defined by CLIP= or !P.CLIP. clipBox=e->IfDefGetKWAs(clippingix); if(doClip && clipBox!=NULL && clipBox->N_Elements()>=4 ) //clipbox exist, will be used: convert to device coords //and save in !P.CLIP... { restoreClipBox=true; //restore later // save current !P.CLIP box, replace by our current clipbox in whatever coordinates, will // give back the !P.CLIP box at end... static DStructGDL* pStruct=SysVar::P(); static unsigned clipTag=pStruct->Desc()->TagIndex("CLIP"); //must be in device coordinates static PLFLT tempbox[4]; for ( int i=0; i<4; ++i ) savebox[i]=(*static_cast(pStruct->GetTag(clipTag, 0)))[i]; if ( coordinateSystem==DEVICE ) { for ( int i=0; i<4; ++i ) tempbox[i]=(*clipBox)[i]; } else if ( coordinateSystem==DATA ) { //handle log: if existing box is already in log, use log of clipbox values. PLFLT worldbox[4]; for ( int i=0; i<4; ++i ) worldbox[i]=(*clipBox)[i]; if (xLog) {worldbox[0]=log10(worldbox[0]); worldbox[2]=log10(worldbox[2]);} if (yLog) {worldbox[1]=log10(worldbox[1]); worldbox[3]=log10(worldbox[3]);} bool okClipBox=true; for ( int i=0; i<4; ++i ) { if (!(isfinite(worldbox[i]))) //NaN { okClipBox=false;restoreClipBox=false;doClip=false; } } if (okClipBox) { actStream->WorldToDevice(worldbox[0], worldbox[1], tempbox[0], tempbox[1]); actStream->WorldToDevice(worldbox[2], worldbox[3], tempbox[2], tempbox[3]); } } else { actStream->NormedDeviceToDevice((*clipBox)[0],(*clipBox)[1], tempbox[0], tempbox[1]); actStream->NormedDeviceToDevice((*clipBox)[2],(*clipBox)[3], tempbox[2], tempbox[3]); } //place in !P.CLIP for ( int i=0; i<4; ++i ) (*static_cast(pStruct->GetTag(clipTag, 0)))[i]=tempbox[i]; } PLFLT wun, wdeux, wtrois, wquatre; actStream->pageWorldCoordinates(wun, wdeux, wtrois, wquatre); actStream->OnePageSaveLayout(); // one page actStream->vpor(0, 1, 0, 1); //set full viewport if ( coordinateSystem==DEVICE ) { actStream->wind(0.0, actStream->xPageSize(), 0.0, actStream->yPageSize()); xLog=false; yLog=false; } else if ( coordinateSystem==NORMAL ) { actStream->wind(0.0, 1.0, 0.0, 1.0); xLog=false; yLog=false; } else //with XYOUTS, we can plot *outside* the box(e)s in DATA coordinates. { actStream->wind(wun, wdeux, wtrois, wquatre); } PLFLT x,y,aspectw,aspectd; aspectw=actStream->boxAspectWorld(); aspectd=actStream->boxAspectDevice(); int colorIx=e->KeywordIx ( "COLOR" ); bool docolor=false; int charthickIx=e->KeywordIx ( "CHARTHICK" ); bool docharthick=false; int charsizeIx=e->KeywordIx ( "CHARSIZE" ); bool docharsize=false; if ( e->GetKW ( colorIx )!=NULL ) { color=e->GetKWAs( colorIx ); docolor=true; } if ( e->GetKW ( charthickIx )!=NULL ) { charthick=e->GetKWAs( charthickIx ); docharthick=true; } if ( e->GetKW ( charsizeIx )!=NULL ) { size=e->GetKWAs( charsizeIx ); docharsize=true; } else //for security in future conditional evaluation... { size=new DFloatGDL ( dimension (1), BaseGDL::ZERO ); size_guard.Init ( size); (*size)[0]=1.0; } int orientationIx=e->KeywordIx ( "ORIENTATION" ); if ( e->GetKW ( orientationIx )!=NULL ) { orientation=e->GetKWAs( orientationIx ); } else { orientation=new DFloatGDL ( dimension (1), BaseGDL::ZERO ); orientation_guard.Init ( orientation); (*orientation)[0]=0; } int alignIx=e->KeywordIx ( "ALIGNMENT" ); if ( e->GetKW ( alignIx )!=NULL ) { alignement=e->GetKWAs( alignIx ); } else { alignement=new DFloatGDL ( dimension (1), BaseGDL::ZERO ); alignement_guard.Init (alignement); (*alignement)[0]=0; } // make all clipping computations BEFORE setting graphic properties (color, size) bool stopClip=false; if ( doClip ) if ( startClipping(e, actStream, true)==TRUE ) stopClip=true; // *** start drawing by defalut values gdlSetGraphicsForegroundColorFromKw(e, actStream); gdlSetPlotCharthick(e, actStream); gdlSetPlotCharsize(e, actStream, true); //accept SIZE kw! if ( doT3d ) //convert X,Y,Z in X',Y' as per T3D perspective. { DDoubleGDL* t3dMatrix=gdlGetT3DMatrix(); //the original one t3dMatrix_guard.Reset(t3dMatrix); DDouble *sx, *sy, *sz; GetSFromPlotStructs(&sx, &sy, &sz); xValou=new DDoubleGDL(dimension(xEl)); yValou=new DDoubleGDL(dimension(yEl)); Guard xval_guard, yval_guard; xval_guard.reset(xValou); yval_guard.reset(yValou); gdlProject3dCoordinatesIn2d(t3dMatrix, xVal, sx, yVal, sy, zVal, sz, xValou, yValou); xVal=xValou; yVal=yValou; } // Get decomposed value for colors DLong decomposed=Graphics::GetDevice()->GetDecomposed(); for ( SizeT i=0; i((*xVal)[i%xVal->N_Elements ( )]); //insure even 1 parameter, string array y=static_cast((*yVal)[i%xVal->N_Elements ( )]); //following obviously wrong if T3D... #ifdef USE_LIBPROJ4 if ( mapSet&& coordinateSystem==DATA ) { LPTYPE idata; XYTYPE odata; idata.lam=x * DEG_TO_RAD; idata.phi=y * DEG_TO_RAD; odata=PJ_FWD(idata, ref); x=odata.x; y=odata.y; } #endif if( xLog ) x=log10(x); if( yLog ) y=log10(y); if ( !isfinite(x)|| !isfinite(y) ) continue; //no plot if ( docharsize && ( *size )[i%size->N_Elements ( )] < 0) continue; //no plot either //plot! if (docharsize) actStream->sizeChar(( *size )[i%size->N_Elements ( )]); if (docolor) actStream->Color ( ( *color )[i%color->N_Elements ( )], decomposed, 2); if (docharthick) actStream->wid ( ( *charthick )[i%charthick->N_Elements ( )]); //orientation word is not orientation page depending on axes increment direction [0..1] vs. [1..0] PLFLT oriD=(( *orientation )[i%orientation->N_Elements ( )]); //ori DEVICE PLFLT oriW=oriD; //ori WORLD oriD *= DEGTORAD; if ((wdeux-wun)<0) oriW=180.0-oriW; if ((wquatre-wtrois)<0) oriW*=-1; oriW *= DEGTORAD; PLFLT cosOriD=cos(oriD); PLFLT sinOriD=sin(oriD); PLFLT cosOriW=cos(oriW); PLFLT sinOriW=sin(oriW); PLFLT align=( *alignement )[i%alignement->N_Elements ( )]; align=max(align,0.0); align=min(align,1.0); PLFLT dispx,dispy, chsize, dx, dy; // displacement due to offset (reference in IDL is baseline, // in plplot it's the half-height) is best computed in device coords chsize=actStream->dCharHeight()*0.5; actStream->WorldToDevice(x, y, dx, dy); actStream->DeviceToWorld(dx-chsize*sinOriD,dy+chsize*cosOriD,dispx,dispy); string out=(*strVal)[i%strVal->N_Elements ( )]; actStream->ptex(dispx, dispy, cosOriW, sinOriW*aspectw/aspectd, align, out.c_str()); if (singleArg || (i==minEl-1 ) ) //then x and y are not given and whatever the number of strings, are retrieved // from lastTextPos. We must thus remember lastTextPos. { width=actStream->gdlGetmmStringLength(out.c_str()); //in mm //we want normed size: width=actStream->m2dx(width); //save position - compute must be in DEVICE coords, or in normed*aspect! actStream->WorldToNormedDevice(x, y, dx, dy); //normed actStream->NormedDeviceToWorld(dx+(1.0-align)*width*cosOriD,dy+(1.0-align)*width*sinOriD/aspectd,dispx,dispy); actStream->WorldToDevice(dispx, dispy, lastTextPosX, lastTextPosY); } } if (stopClip) stopClipping(actStream); if ( kwWidth ) { // width is in "normalized coordinates" e->SetKW(widthIx, new DFloatGDL(width)); } } private: void call_plplot(EnvT* e, GDLGStream* actStream) // {{{ { } private: virtual void post_call(EnvT* e, GDLGStream* actStream) // {{{ { actStream->RestoreLayout(); if (restoreClipBox) { static DStructGDL* pStruct=SysVar::P(); static unsigned clipTag=pStruct->Desc()->TagIndex("CLIP"); //must be in device coordinates for ( int i=0; i<4; ++i ) (*static_cast(pStruct->GetTag(clipTag, 0)))[i]=savebox[i]; } actStream->sizeChar(1.0); } }; void xyouts(EnvT* e) { xyouts_call xyouts; xyouts.call(e, 1); } } // namespace gdl-0.9.4/src/FMTLexer.cpp0000664000175000017500000010460212162632106013645 0ustar marcmarc/* $ANTLR 2.7.7 (20120518): "format.g" -> "FMTLexer.cpp"$ */ #include "includefirst.hpp" #include "FMTLexer.hpp" #include #include #include #include #include #include #include FMTLexer::FMTLexer(std::istream& in) : antlr::CharScanner(new antlr::CharBuffer(in),true) { initLiterals(); } FMTLexer::FMTLexer(antlr::InputBuffer& ib) : antlr::CharScanner(ib,true) { initLiterals(); } FMTLexer::FMTLexer(const antlr::LexerSharedInputState& state) : antlr::CharScanner(state,true) { initLiterals(); } void FMTLexer::initLiterals() { literals["cyi"] = 64; literals["csi"] = 66; literals["cmi"] = 65; literals["tl"] = 33; literals["tr"] = 34; literals["cdi"] = 63; literals["cmoi"] = 62; literals["csf"] = 67; } antlr::RefToken FMTLexer::nextToken() { antlr::RefToken theRetToken; for (;;) { antlr::RefToken theRetToken; int _ttype = antlr::Token::INVALID_TYPE; resetText(); try { // for lexical and char stream error handling switch ( LA(1)) { case 0x22 /* '\"' */ : case 0x27 /* '\'' */ : { mSTRING(true); theRetToken=_returnToken; break; } case 0x28 /* '(' */ : { mLBRACE(true); theRetToken=_returnToken; break; } case 0x29 /* ')' */ : { mRBRACE(true); theRetToken=_returnToken; break; } case 0x2f /* '/' */ : { mSLASH(true); theRetToken=_returnToken; break; } case 0x2c /* ',' */ : { mCOMMA(true); theRetToken=_returnToken; break; } case 0x41 /* 'A' */ : case 0x61 /* 'a' */ : { mA(true); theRetToken=_returnToken; break; } case 0x3a /* ':' */ : { mTERM(true); theRetToken=_returnToken; break; } case 0x24 /* '$' */ : { mNONL(true); theRetToken=_returnToken; break; } case 0x46 /* 'F' */ : case 0x66 /* 'f' */ : { mF(true); theRetToken=_returnToken; break; } case 0x44 /* 'D' */ : case 0x64 /* 'd' */ : { mD(true); theRetToken=_returnToken; break; } case 0x45 /* 'E' */ : case 0x65 /* 'e' */ : { mE(true); theRetToken=_returnToken; break; } case 0x47 /* 'G' */ : case 0x67 /* 'g' */ : { mG(true); theRetToken=_returnToken; break; } case 0x49 /* 'I' */ : case 0x69 /* 'i' */ : { mI(true); theRetToken=_returnToken; break; } case 0x4f /* 'O' */ : case 0x6f /* 'o' */ : { mO(true); theRetToken=_returnToken; break; } case 0x42 /* 'B' */ : case 0x62 /* 'b' */ : { mB(true); theRetToken=_returnToken; break; } case 0x5a /* 'Z' */ : { mZ(true); theRetToken=_returnToken; break; } case 0x7a /* 'z' */ : { mZZ(true); theRetToken=_returnToken; break; } case 0x51 /* 'Q' */ : case 0x71 /* 'q' */ : { mQ(true); theRetToken=_returnToken; break; } case 0x48 /* 'H' */ : case 0x68 /* 'h' */ : { mH(true); theRetToken=_returnToken; break; } case 0x54 /* 'T' */ : case 0x74 /* 't' */ : { mT(true); theRetToken=_returnToken; break; } case 0x4c /* 'L' */ : case 0x6c /* 'l' */ : { mL(true); theRetToken=_returnToken; break; } case 0x52 /* 'R' */ : case 0x72 /* 'r' */ : { mR(true); theRetToken=_returnToken; break; } case 0x58 /* 'X' */ : case 0x78 /* 'x' */ : { mX(true); theRetToken=_returnToken; break; } case 0x2e /* '.' */ : { mDOT(true); theRetToken=_returnToken; break; } case 0x9 /* '\t' */ : case 0x20 /* ' ' */ : { mWHITESPACE(true); theRetToken=_returnToken; break; } case 0x2d /* '-' */ : case 0x30 /* '0' */ : case 0x31 /* '1' */ : case 0x32 /* '2' */ : case 0x33 /* '3' */ : case 0x34 /* '4' */ : case 0x35 /* '5' */ : case 0x36 /* '6' */ : case 0x37 /* '7' */ : case 0x38 /* '8' */ : case 0x39 /* '9' */ : { mNUMBER(true); theRetToken=_returnToken; break; } default: if ((LA(1) == 0x43 /* 'C' */ || LA(1) == 0x63 /* 'c' */ ) && (LA(2) == 0x4d /* 'M' */ ) && (LA(3) == 0x4f /* 'O' */ )) { mCMOA(true); theRetToken=_returnToken; } else if ((LA(1) == 0x43 /* 'C' */ || LA(1) == 0x63 /* 'c' */ ) && (LA(2) == 0x4d /* 'M' */ ) && (LA(3) == 0x6f /* 'o' */ )) { mCMoA(true); theRetToken=_returnToken; } else if ((LA(1) == 0x43 /* 'C' */ || LA(1) == 0x63 /* 'c' */ ) && (LA(2) == 0x44 /* 'D' */ ) && (LA(3) == 0x57 /* 'W' */ )) { mCDWA(true); theRetToken=_returnToken; } else if ((LA(1) == 0x43 /* 'C' */ || LA(1) == 0x63 /* 'c' */ ) && (LA(2) == 0x44 /* 'D' */ ) && (LA(3) == 0x77 /* 'w' */ )) { mCDwA(true); theRetToken=_returnToken; } else if ((LA(1) == 0x43 /* 'C' */ || LA(1) == 0x63 /* 'c' */ ) && (LA(2) == 0x41 /* 'A' */ ) && (LA(3) == 0x50 /* 'P' */ )) { mCAPA(true); theRetToken=_returnToken; } else if ((LA(1) == 0x43 /* 'C' */ || LA(1) == 0x63 /* 'c' */ ) && (LA(2) == 0x41 /* 'A' */ ) && (LA(3) == 0x70 /* 'p' */ )) { mCApA(true); theRetToken=_returnToken; } else if ((LA(1) == 0x25 /* '%' */ ) && (LA(2) == 0x22 /* '\"' */ || LA(2) == 0x27 /* '\'' */ )) { mCSTRING(true); theRetToken=_returnToken; } else if ((LA(1) == 0x43 /* 'C' */ || LA(1) == 0x63 /* 'c' */ ) && (LA(2) == 0x6d /* 'm' */ )) { mCmoA(true); theRetToken=_returnToken; } else if ((LA(1) == 0x43 /* 'C' */ || LA(1) == 0x63 /* 'c' */ ) && (LA(2) == 0x68 /* 'h' */ )) { mCHI(true); theRetToken=_returnToken; } else if ((LA(1) == 0x43 /* 'C' */ || LA(1) == 0x63 /* 'c' */ ) && (LA(2) == 0x48 /* 'H' */ )) { mChI(true); theRetToken=_returnToken; } else if ((LA(1) == 0x43 /* 'C' */ || LA(1) == 0x63 /* 'c' */ ) && (LA(2) == 0x64 /* 'd' */ )) { mCdwA(true); theRetToken=_returnToken; } else if ((LA(1) == 0x43 /* 'C' */ || LA(1) == 0x63 /* 'c' */ ) && (LA(2) == 0x61 /* 'a' */ )) { mCapA(true); theRetToken=_returnToken; } else if ((LA(1) == 0x43 /* 'C' */ || LA(1) == 0x63 /* 'c' */ ) && (true)) { mC(true); theRetToken=_returnToken; } else if ((LA(1) == 0x25 /* '%' */ ) && (true)) { mPERCENT(true); theRetToken=_returnToken; } else { if (LA(1)==EOF_CHAR) { uponEOF(); _returnToken = makeToken(antlr::Token::EOF_TYPE); } else {throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} } } if ( !_returnToken ) goto tryAgain; // found SKIP token _ttype = _returnToken->getType(); _ttype = testLiteralsTable(_ttype); _returnToken->setType(_ttype); return _returnToken; } catch (antlr::RecognitionException& e) { throw antlr::TokenStreamRecognitionException(e); } catch (antlr::CharStreamIOException& csie) { throw antlr::TokenStreamIOException(csie.io); } catch (antlr::CharStreamException& cse) { throw antlr::TokenStreamException(cse.getMessage()); } tryAgain:; } } void FMTLexer::mSTRING(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = STRING; std::string::size_type _saveIndex; switch ( LA(1)) { case 0x22 /* '\"' */ : { _saveIndex = text.length(); match('\"' /* charlit */ ); text.erase(_saveIndex); { // ( ... )* for (;;) { if ((LA(1) == 0x22 /* '\"' */ ) && (LA(2) == 0x22 /* '\"' */ )) { match('\"' /* charlit */ ); _saveIndex = text.length(); match('\"' /* charlit */ ); text.erase(_saveIndex); } else if ((_tokenSet_0.member(LA(1)))) { { match(_tokenSet_0); } } else { goto _loop47; } } _loop47:; } // ( ... )* _saveIndex = text.length(); match('\"' /* charlit */ ); text.erase(_saveIndex); break; } case 0x27 /* '\'' */ : { _saveIndex = text.length(); match('\'' /* charlit */ ); text.erase(_saveIndex); { // ( ... )* for (;;) { if ((LA(1) == 0x27 /* '\'' */ ) && (LA(2) == 0x27 /* '\'' */ )) { match('\'' /* charlit */ ); _saveIndex = text.length(); match('\'' /* charlit */ ); text.erase(_saveIndex); } else if ((_tokenSet_1.member(LA(1)))) { { match(_tokenSet_1); } } else { goto _loop50; } } _loop50:; } // ( ... )* _saveIndex = text.length(); match('\'' /* charlit */ ); text.erase(_saveIndex); break; } default: { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mCSTRING(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = CSTRING; std::string::size_type _saveIndex; if ((LA(1) == 0x25 /* '%' */ ) && (LA(2) == 0x22 /* '\"' */ )) { _saveIndex = text.length(); match('%' /* charlit */ ); text.erase(_saveIndex); _saveIndex = text.length(); match('\"' /* charlit */ ); text.erase(_saveIndex); cLexer->DoubleQuotes( true); selector->push( cLexer); selector->retry(); } else if ((LA(1) == 0x25 /* '%' */ ) && (LA(2) == 0x27 /* '\'' */ )) { _saveIndex = text.length(); match('%' /* charlit */ ); text.erase(_saveIndex); _saveIndex = text.length(); match('\'' /* charlit */ ); text.erase(_saveIndex); cLexer->DoubleQuotes( false); selector->push( cLexer); selector->retry(); } else { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mLBRACE(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = LBRACE; std::string::size_type _saveIndex; match('(' /* charlit */ ); if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mRBRACE(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = RBRACE; std::string::size_type _saveIndex; match(')' /* charlit */ ); if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mSLASH(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = SLASH; std::string::size_type _saveIndex; match('/' /* charlit */ ); if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mCOMMA(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = COMMA; std::string::size_type _saveIndex; match(',' /* charlit */ ); if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mA(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = A; std::string::size_type _saveIndex; { switch ( LA(1)) { case 0x41 /* 'A' */ : { match('A' /* charlit */ ); break; } case 0x61 /* 'a' */ : { match('a' /* charlit */ ); break; } default: { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } } } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mTERM(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = TERM; std::string::size_type _saveIndex; match(':' /* charlit */ ); if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mNONL(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = NONL; std::string::size_type _saveIndex; match('$' /* charlit */ ); if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mF(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = F; std::string::size_type _saveIndex; { switch ( LA(1)) { case 0x66 /* 'f' */ : { match('f' /* charlit */ ); break; } case 0x46 /* 'F' */ : { match('F' /* charlit */ ); break; } default: { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } } } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mD(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = D; std::string::size_type _saveIndex; { switch ( LA(1)) { case 0x64 /* 'd' */ : { match('d' /* charlit */ ); break; } case 0x44 /* 'D' */ : { match('D' /* charlit */ ); break; } default: { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } } } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mE(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = E; std::string::size_type _saveIndex; { switch ( LA(1)) { case 0x65 /* 'e' */ : { match('e' /* charlit */ ); break; } case 0x45 /* 'E' */ : { match('E' /* charlit */ ); break; } default: { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } } } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mG(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = G; std::string::size_type _saveIndex; { switch ( LA(1)) { case 0x67 /* 'g' */ : { match('g' /* charlit */ ); break; } case 0x47 /* 'G' */ : { match('G' /* charlit */ ); break; } default: { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } } } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mI(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = I; std::string::size_type _saveIndex; { switch ( LA(1)) { case 0x69 /* 'i' */ : { match('i' /* charlit */ ); break; } case 0x49 /* 'I' */ : { match('I' /* charlit */ ); break; } default: { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } } } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mO(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = O; std::string::size_type _saveIndex; { switch ( LA(1)) { case 0x6f /* 'o' */ : { match('o' /* charlit */ ); break; } case 0x4f /* 'O' */ : { match('O' /* charlit */ ); break; } default: { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } } } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mB(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = B; std::string::size_type _saveIndex; { switch ( LA(1)) { case 0x62 /* 'b' */ : { match('b' /* charlit */ ); break; } case 0x42 /* 'B' */ : { match('B' /* charlit */ ); break; } default: { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } } } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mZ(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = Z; std::string::size_type _saveIndex; { match('Z' /* charlit */ ); } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mZZ(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = ZZ; std::string::size_type _saveIndex; { match('z' /* charlit */ ); } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mQ(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = Q; std::string::size_type _saveIndex; { switch ( LA(1)) { case 0x71 /* 'q' */ : { match('q' /* charlit */ ); break; } case 0x51 /* 'Q' */ : { match('Q' /* charlit */ ); break; } default: { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } } } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mH(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = H; std::string::size_type _saveIndex; { switch ( LA(1)) { case 0x68 /* 'h' */ : { match('h' /* charlit */ ); break; } case 0x48 /* 'H' */ : { match('H' /* charlit */ ); break; } default: { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } } } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mT(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = T; std::string::size_type _saveIndex; { switch ( LA(1)) { case 0x74 /* 't' */ : { match('t' /* charlit */ ); break; } case 0x54 /* 'T' */ : { match('T' /* charlit */ ); break; } default: { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } } } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mL(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = L; std::string::size_type _saveIndex; { switch ( LA(1)) { case 0x6c /* 'l' */ : { match('l' /* charlit */ ); break; } case 0x4c /* 'L' */ : { match('L' /* charlit */ ); break; } default: { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } } } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mR(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = R; std::string::size_type _saveIndex; { switch ( LA(1)) { case 0x72 /* 'r' */ : { match('r' /* charlit */ ); break; } case 0x52 /* 'R' */ : { match('R' /* charlit */ ); break; } default: { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } } } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mX(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = X; std::string::size_type _saveIndex; { switch ( LA(1)) { case 0x78 /* 'x' */ : { match('x' /* charlit */ ); break; } case 0x58 /* 'X' */ : { match('X' /* charlit */ ); break; } default: { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } } } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mC(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = C; std::string::size_type _saveIndex; { switch ( LA(1)) { case 0x63 /* 'c' */ : { match('c' /* charlit */ ); break; } case 0x43 /* 'C' */ : { match('C' /* charlit */ ); break; } default: { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } } } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mCMOA(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = CMOA; std::string::size_type _saveIndex; { mC(false); match('M' /* charlit */ ); match('O' /* charlit */ ); mA(false); } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mCMoA(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = CMoA; std::string::size_type _saveIndex; { mC(false); match('M' /* charlit */ ); match('o' /* charlit */ ); mA(false); } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mCmoA(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = CmoA; std::string::size_type _saveIndex; { mC(false); match('m' /* charlit */ ); match('o' /* charlit */ ); mA(false); } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mCHI(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = CHI; std::string::size_type _saveIndex; { mC(false); match('h' /* charlit */ ); mI(false); } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mChI(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = ChI; std::string::size_type _saveIndex; { mC(false); match('H' /* charlit */ ); mI(false); } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mCDWA(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = CDWA; std::string::size_type _saveIndex; { mC(false); match('D' /* charlit */ ); match('W' /* charlit */ ); mA(false); } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mCDwA(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = CDwA; std::string::size_type _saveIndex; { mC(false); match('D' /* charlit */ ); match('w' /* charlit */ ); mA(false); } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mCdwA(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = CdwA; std::string::size_type _saveIndex; { mC(false); match('d' /* charlit */ ); match('w' /* charlit */ ); mA(false); } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mCAPA(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = CAPA; std::string::size_type _saveIndex; { mC(false); match('A' /* charlit */ ); match('P' /* charlit */ ); mA(false); } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mCApA(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = CApA; std::string::size_type _saveIndex; { mC(false); match('A' /* charlit */ ); match('p' /* charlit */ ); mA(false); } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mCapA(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = CapA; std::string::size_type _saveIndex; { mC(false); match('a' /* charlit */ ); match('p' /* charlit */ ); mA(false); } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mPERCENT(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = PERCENT; std::string::size_type _saveIndex; match('%' /* charlit */ ); if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mDOT(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = DOT; std::string::size_type _saveIndex; match('.' /* charlit */ ); if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mW(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = W; std::string::size_type _saveIndex; { switch ( LA(1)) { case 0x20 /* ' ' */ : { match(' ' /* charlit */ ); break; } case 0x9 /* '\t' */ : { match('\t' /* charlit */ ); break; } default: { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } } } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mWHITESPACE(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = WHITESPACE; std::string::size_type _saveIndex; { // ( ... )+ int _cnt120=0; for (;;) { if ((LA(1) == 0x9 /* '\t' */ || LA(1) == 0x20 /* ' ' */ )) { mW(false); } else { if ( _cnt120>=1 ) { goto _loop120; } else {throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} } _cnt120++; } _loop120:; } // ( ... )+ _ttype=antlr::Token::SKIP; if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mDIGITS(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = DIGITS; std::string::size_type _saveIndex; { // ( ... )+ int _cnt123=0; for (;;) { if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { matchRange('0','9'); } else { if ( _cnt123>=1 ) { goto _loop123; } else {throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} } _cnt123++; } _loop123:; } // ( ... )+ if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mCHAR(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = CHAR; std::string::size_type _saveIndex; { matchRange('\3',static_cast('\377')); } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } void FMTLexer::mNUMBER(bool _createToken) { int _ttype; antlr::RefToken _token; std::string::size_type _begin = text.length(); _ttype = NUMBER; std::string::size_type _saveIndex; antlr::RefToken num; SizeT n; SizeT i = 0; bool uMinus = false; { switch ( LA(1)) { case 0x2d /* '-' */ : { match('-' /* charlit */ ); uMinus = true; break; } case 0x30 /* '0' */ : case 0x31 /* '1' */ : case 0x32 /* '2' */ : case 0x33 /* '3' */ : case 0x34 /* '4' */ : case 0x35 /* '5' */ : case 0x36 /* '6' */ : case 0x37 /* '7' */ : case 0x38 /* '8' */ : case 0x39 /* '9' */ : { break; } default: { throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } } } mDIGITS(true); num=_returnToken; if( uMinus) num->setText( "-" + num->getText()); { if ((LA(1) == 0x48 /* 'H' */ )) { _ttype = STRING; std::istringstream s(num->getText()); s >> n; { text.erase(_begin); text += ""; }; // clear string (remove number) _saveIndex = text.length(); match('H' /* charlit */ ); text.erase(_saveIndex); { // ( ... )+ int _cnt130=0; for (;;) { // init action gets executed even in guessing mode if( i == n ) break; i++; // count chars here so that guessing mode works if (((LA(1) >= 0x3 /* '\3' */ && LA(1) <= 0xff))) { mCHAR(false); } else { if ( _cnt130>=1 ) { goto _loop130; } else {throw antlr::NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} } _cnt130++; } _loop130:; } // ( ... )+ } else { } } if ( _createToken && _token==antlr::nullToken && _ttype!=antlr::Token::SKIP ) { _token = makeToken(_ttype); _token->setText(text.substr(_begin, text.length()-_begin)); } _returnToken = _token; _saveIndex=0; } const unsigned long FMTLexer::_tokenSet_0_data_[] = { 4294967288UL, 4294967291UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10 0x11 0x12 0x13 // 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f ! # $ // % & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F // G H I J K L M const antlr::BitSet FMTLexer::_tokenSet_0(_tokenSet_0_data_,16); const unsigned long FMTLexer::_tokenSet_1_data_[] = { 4294967288UL, 4294967167UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10 0x11 0x12 0x13 // 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f ! \" # // $ % & ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F // G H I J K L M const antlr::BitSet FMTLexer::_tokenSet_1(_tokenSet_1_data_,16); gdl-0.9.4/src/dinterpreter.hpp0000664000175000017500000000750312155705525014745 0ustar marcmarc/*************************************************************************** dinterpreter.hpp - main class which controls it all ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifndef DINTERPRETER_HPP_ #define DINTERPRETER_HPP_ #ifdef HAVE_CONFIG_H #include #endif #include #include #ifdef __cplusplus extern "C" { #if defined(__OpenBSD__) // SA: based on http://ftp2.cz.freesbie.org/pub/FreeBSD-cvs/gnats/i386/75862 # include # define feclearexcept(e) (void)fpsetsticky(~((fp_except)(e))) # define fetestexcept(e) ((int)(fpgetsticky() & (fp_except)(e))) # define FE_ALL_EXCEPT (FP_X_INV | FP_X_DNML | FP_X_DZ | FP_X_OFL | FP_X_UFL | FP_X_IMP) # define FE_DIVBYZERO FP_X_DZ # define FE_INEXACT FP_X_IMP # define FE_INVALID FP_X_INV # define FE_OVERFLOW FP_X_OFL # define FE_UNDERFLOW FP_X_UFL #elif defined(_MSC_VER) # include #else # include #endif # if defined(__FreeBSD__) # pragma STDC FENV_ACCESS ON # endif } #endif //#include "initsysvar.hpp" //#include "objects.hpp" #include "GDLLexer.hpp" #include "GDLParser.hpp" #include "GDLTreeParser.hpp" #include "GDLInterpreter.hpp" //#include "gdleventhandler.hpp" #ifdef HAVE_LIBREADLINE #include #include #endif #include #include void ControlCHandler(int); extern bool lineEdit; // = false; extern bool historyIntialized; extern std::string actualPrompt; class DInterpreter: public GDLInterpreter { public: enum CommandCode { CC_OK=0, CC_CONTINUE, CC_STEP, CC_SKIP, CC_RETURN }; char* NoReadline(const std::string&); private: // execute GDL command (.run, .step, ...) CommandCode ExecuteCommand(const std::string& command); CommandCode CmdCompile(const std::string& command); CommandCode CmdRun(const std::string& command); CommandCode CmdReset(); CommandCode CmdFullReset(); // execute OS shell command (interactive shell if command == "") static void ExecuteShellCommand(const std::string& command); std::string GetLine(); // get one line of input, trims it void RunDelTree(); public: ~DInterpreter() { #ifdef HAVE_LIBREADLINE // seems to cause valgrind to complain clear_history(); // for testing of memory leaks (in GDL) #endif } // this is executed at the beginning (gdl.cpp) DInterpreter(); // execute one line of code CommandCode ExecuteLine( std::istream* in = NULL, SizeT lineOffset = 0); // execute a whole file (used by @ and for batch files specified as arguments to gdl) void ExecuteFile( const std::string& file); // run a list of commands from 'in'. Used by python module. Returns success bool RunBatch( std::istream* in); // the main program for interactive mode RetCode InterpreterLoop( const std::string& startup, std::vector& batch_files, const std::string& statement); // called within InterpreterLoop() RetCode InnerInterpreterLoop(SizeT lineOffset); }; #endif gdl-0.9.4/src/fmtnode.cpp0000664000175000017500000000242111176414034013651 0ustar marcmarc/*************************************************************************** fmtnode.cpp - instantiate the vtable ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" #include "fmtnode.hpp" FMTNode::~FMTNode() {} // used by FMTNodeFactory void FMTNode::initialize( RefFMTNode t ) { CommonAST::setType( t->getType()); CommonAST::setText( t->getText()); w = t->w; d = t->d; rep = t->rep; } gdl-0.9.4/src/FMTInTokenTypes.txt0000664000175000017500000000125412162632106015216 0ustar marcmarc// $ANTLR 2.7.7 (20120518): format.in.g -> FMTInTokenTypes.txt$ FMTIn // output token vocab name ALL=4 CSTR=5 CSTR1=6 CSTR2=7 ESC=8 OCTESC=9 ODIGIT=10 HEXESC=11 HDIGIT=12 CD=13 CE=14 CI=15 CF=16 CG=17 CO=18 CB=19 CS=20 CX=21 CZ=22 CDOT=23 DIGITS=24 CNUMBER=25 CWS=26 FORMAT=27 LBRACE=28 COMMA=29 RBRACE=30 SLASH=31 STRING=32 TL="tl"=33 TR="tr"=34 TERM=35 NONL=36 Q=37 T=38 X=39 A=40 F=41 D=42 E=43 G=44 I=45 O=46 B=47 Z=48 ZZ=49 C=50 CMOA=51 CMoA=52 CmoA=53 CHI=54 ChI=55 CDWA=56 CDwA=57 CdwA=58 CAPA=59 CApA=60 CapA=61 CMOI="cmoi"=62 CDI="cdi"=63 CYI="cyi"=64 CMI="cmi"=65 CSI="csi"=66 CSF="csf"=67 NUMBER=68 DOT=69 CSTRING=70 H=71 L=72 R=73 PERCENT=74 W=75 WHITESPACE=76 CHAR=77 gdl-0.9.4/src/prognode_lexpr.cpp0000664000175000017500000006240612221423465015255 0ustar marcmarc/*************************************************************************** prognode_lexpr.cpp - LExpr functions ------------------- begin : July 22 2002 copyright : (C) 2011 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" // from GDLInterpreter::l_expr #include #include #include "dinterpreter.hpp" #include "prognodeexpr.hpp" #include "basegdl.hpp" #include "arrayindexlistt.hpp" //#include "envt.hpp" #include "gdlexception.hpp" #include "nullgdl.hpp" // illegal BaseGDL** ProgNode::LExpr( BaseGDL* right) // default: { // case ARRAYDEF: // case EXPR: // case NSTRUC: // case NSTRUC_REF: // case POSTDEC: // case POSTINC: // case STRUC: // case DEC: // case INC: // case CONSTANT: throw GDLException( this, "Expression not allowed as l-value.", true,false); return NULL; // avoid compiler warning } BaseGDL** QUESTIONNode::LExpr( BaseGDL* right) //case QUESTION: { ProgNodeP branch = this->GetBranch(); return branch->LExpr( right); // ProgNodeP _t = this->getFirstChild(); // // Guard e1_guard; // BaseGDL* e1; // if( NonCopyNode( _t->getType())) // { // e1 = _t->EvalNC(); // } // else // { // BaseGDL** ref = _t->EvalRefCheck(e1); // if( ref == NULL) // e1_guard.Init(e1); // else // e1 = *ref; // } // // BaseGDL* e1=interpreter->expr(_t); // _t = _t->GetNextSibling(); // // Guard e1_guard(e1); // if( e1->True()) // { // return _t->LExpr( right); //l_expr(_t, right); // } // else // { // _t=_t->GetNextSibling(); // jump over 1st expression // return _t->LExpr( right); //l_expr(_t, right); // } // //SetRetTree( tIn->getNextSibling()); // //return res; } BaseGDL** ARRAYEXPRNode::LExpr( BaseGDL* right) // 'right' is not owned //case ARRAYEXPR: { //res=l_array_expr(_t, right); if( right == NULL) throw GDLException( this, "Indexed expression not allowed in this context.", true,false); ArrayIndexListT* aL; ArrayIndexListGuard guard; BaseGDL** res; // try{ // res=interpreter->l_indexable_expr( this->getFirstChild()); res = this->getFirstChild()->LEval(); // throws if( *res == NULL) { // ERROR // check not needed for SYSVAR ProgNodeP _t = this->getFirstChild(); assert( _t->getType() != GDLTokenTypes::SYSVAR); if( _t->getType() == GDLTokenTypes::VARPTR) { GDLException ex( _t, "Common block variable is undefined: "+ interpreter->CallStackBack()->GetString( *res),true,false); ex.SetArrayexprIndexeeFailed( true); throw ex; } if( _t->getType() == GDLTokenTypes::VAR) { GDLException ex( _t, "Variable is undefined: "+ interpreter->CallStackBack()->GetString(_t->varIx),true,false); ex.SetArrayexprIndexeeFailed( true); throw ex; } GDLException ex( _t, "Variable is undefined: "+interpreter->Name(res),true,false); ex.SetArrayexprIndexeeFailed( true); throw ex; } // } // catch( GDLException& ex) // { // ex.SetArrayexprIndexeeFailed( true); // throw ex; // } if( (*res)->IsAssoc()) aL=interpreter->arrayindex_list( this->getFirstChild()->getNextSibling()); else { if( (*res)->Type() == GDL_OBJ && (*res)->StrictScalar()) { // check for _overloadBracketsLeftSide DObj s = (*static_cast(*res))[0]; // is StrictScalar() // if( s != 0) // no overloads for null object // { // DStructGDL* oStructGDL= GDLInterpreter::GetObjHeapNoThrow( s); // if( oStructGDL != NULL) // if object not valid -> default behaviour // { // DStructDesc* desc = oStructGDL->Desc(); // DPro* bracketsLeftSideOverload = static_cast(desc->GetOperator( OOBracketsLeftSide)); DSubUD* bracketsLeftSideOverload = static_cast(GDLInterpreter::GetObjHeapOperator( s, OOBracketsLeftSide)); if( bracketsLeftSideOverload != NULL) { bool internalDSubUD = bracketsLeftSideOverload->GetTree()->IsWrappedNode(); // _overloadBracketsLeftSide IxExprListT indexList; interpreter->arrayindex_list_overload( this->getFirstChild()->getNextSibling(), indexList); ArrayIndexListGuard guard(this->getFirstChild()->getNextSibling()->arrIxListNoAssoc); // hidden SELF is counted as well int nParSub = bracketsLeftSideOverload->NPar(); assert( nParSub >= 1); // SELF // int indexListSizeDebug = indexList.size(); // indexList.size() + OBJREF + RVALUE > regular paramters w/o SELF if( (indexList.size() + 2) > nParSub - 1) { indexList.Cleanup(); throw GDLException( this, bracketsLeftSideOverload->ObjectName() + ": Incorrect number of arguments.", false, false); } DObjGDL* self; Guard selfGuard; if( internalDSubUD) { self = static_cast(*res); // internal subroutines behave well } else { self = static_cast(*res)->Dup(); // res should be not changeable via SELF selfGuard.Reset( self); } // adds already SELF parameter EnvUDT* newEnv= new EnvUDT( this, bracketsLeftSideOverload, &self); // Guard newEnvGuard( newEnv); // parameters newEnv->SetNextParUnchecked( res); // OBJREF parameter // Dup() here is not optimal // avoid at least for internal overload routines (which do/must not change RVALUE) if( internalDSubUD) newEnv->SetNextParUnchecked( &right); // RVALUE parameter, as reference to prevent cleanup in newEnv else newEnv->SetNextParUnchecked( right->Dup()); // RVALUE parameter, as value // pass as reference would be more efficient, but as the data might // be deleted in bracketsLeftSideOverload it is not possible. // BaseGDL* rightCopy = right; // newEnv->SetNextParUnchecked( &rightCopy); // RVALUE parameter for( SizeT p=0; pSetNextParUnchecked( indexList[p]); // takes ownership StackGuard stackGuard(interpreter->CallStack()); interpreter->CallStack().push_back( newEnv); // make the call interpreter->call_pro(static_cast(newEnv->GetPro())->GetTree()); if( !internalDSubUD && self != selfGuard.Get()) { // always put out warning first, in case of a later crash Warning( "WARNING: " + bracketsLeftSideOverload->ObjectName() + ": Assignment to SELF detected (GDL session still ok)."); // assignment to SELF -> self was deleted and points to new variable // which it owns selfGuard.Release(); if( static_cast(self) != NullGDL::GetSingleInstance()) selfGuard.Reset(self); } return res; } // } // } } // aL=interpreter->arrayindex_list_noassoc( this->getFirstChild()->getNextSibling()); { // IxExprListT cleanupList; // for cleanup IxExprListT ixExprList; SizeT nExpr; BaseGDL* s; ProgNodeP ax = this->getFirstChild()->getNextSibling(); // match(antlr::RefAST(_t),ARRAYIX); ProgNodeP _t = ax->getFirstChild(); aL = ax->arrIxListNoAssoc; assert( aL != NULL); nExpr = aL->NParam(); if( nExpr == 0) { aL->Init(); } else { IxExprListT* cleanupList = aL->GetCleanupIx(); // for cleanup while( true) { assert( _t != NULL); if( NonCopyNode( _t->getType())) { s= _t->EvalNC(); //indexable_expr(_t); } // else if( _t->getType() == GDLTokenTypes::FCALL_LIB) // { // // s = interpreter->lib_function_call(_t); // BaseGDL** retValPtr; // s = static_cast(_t)->EvalFCALL_LIB(retValPtr); // // // if( !interpreter->CallStackBack()->Contains( s)) // if( retValPtr == NULL) // cleanupList->push_back( s); // } else { BaseGDL** ref =_t->EvalRefCheck(s); if( ref == NULL) cleanupList->push_back( s); else s = *ref; // s=_t->Eval(); //indexable_tmp_expr(_t); // cleanupList->push_back( s); } ixExprList.push_back( s); if( ixExprList.size() == nExpr) break; // allows some manual tuning _t = _t->getNextSibling(); } aL->Init( ixExprList);//, &cleanupList); } } } guard.reset(aL); try { aL->AssignAt( *res, right); } catch( GDLException& ex) { ex.SetErrorNodeP( this); throw ex; } //_retTree = _t->getNextSibling(); return res; } // default ...Grab version BaseGDL** SYSVARNode::LExpr( BaseGDL* right) //case SYSVAR: { if( right == NULL) throw GDLException( this, "System variable not allowed in this context.", true,false); BaseGDL** res=this->LEval(); //l_sys_var(this); Guard conv_guard; //( rConv); BaseGDL* rConv = right; if( !(*res)->EqType( right)) { rConv = right->Convert2( (*res)->Type(), BaseGDL::COPY); conv_guard.Reset( rConv); } if( right->N_Elements() != 1 && ((*res)->N_Elements() != right->N_Elements())) { throw GDLException( this, "Conflicting data structures: <"+ right->TypeStr()+" "+right->Dim().ToString()+">, !"+ this->getText(),true,false); } (*res)->AssignAt( rConv); // linear copy return res; } // default ...Grab version // BaseGDL** XXXNode::LExpr( BaseGDL* right) // // case FCALL: // // case FCALL_LIB: // // case MFCALL: // // case MFCALL_PARENT: // // case DEREF: // // case VAR: // // case VARPTR: // { // BaseGDL** res=this->LEval(); //l_simple_var(_t); // //_retTree = _t->getNextSibling(); // if( right != NULL && right != (*res)) // { // delete *res; // *res = right->Dup(); // } // return res; // } // #define LEXPRGRAB \ // { BaseGDL** res=this->LEval(); \ // if( right != NULL && right != (*res)) \ // { delete *res; *res = right;} \ // return res;} // // BaseGDL** FCALLNode::LExprGrab( BaseGDL* right) // LEXPRGRAB // BaseGDL** MFCALLNode::LExprGrab( BaseGDL* right) // LEXPRGRAB // BaseGDL** MFCALL_PARENTNode::LExprGrab( BaseGDL* right) // LEXPRGRAB // BaseGDL** FCALL_LIBNode::LExprGrab( BaseGDL* right) // LEXPRGRAB // BaseGDL** DEREFNode::LExprGrab( BaseGDL* right) // LEXPRGRAB // BaseGDL** VARNode::LExprGrab( BaseGDL* right) // LEXPRGRAB // BaseGDL** VARPTRNode::LExprGrab( BaseGDL* right) // LEXPRGRAB // #undef LEXPRGRAB #define LEXPR \ { BaseGDL** res=this->LEval(); \ if( right != NULL && right != (*res)) \ { GDLDelete(*res); *res = right->Dup();} \ return res;} BaseGDL** FCALLNode::LExpr( BaseGDL* right) LEXPR BaseGDL** MFCALLNode::LExpr( BaseGDL* right) LEXPR BaseGDL** MFCALL_PARENTNode::LExpr( BaseGDL* right) LEXPR BaseGDL** FCALL_LIBNode::LExpr( BaseGDL* right) LEXPR BaseGDL** DEREFNode::LExpr( BaseGDL* right) LEXPR BaseGDL** VARNode::LExpr( BaseGDL* right) LEXPR BaseGDL** VARPTRNode::LExpr( BaseGDL* right) LEXPR #undef LEXPR BaseGDL** ARRAYEXPR_FCALLNode::LExpr( BaseGDL* right) { if( fcallNodeFunIx >= 0) return fcallNode->FCALLNode::LExpr( right); else if( fcallNodeFunIx == -2) { return arrayExprNode->ARRAYEXPRNode::LExpr( right); } assert( fcallNodeFunIx == -1); try{ BaseGDL** res = arrayExprNode->ARRAYEXPRNode::LExpr( right); fcallNodeFunIx = -2; // mark as ARRAYEXPR succeeded return res; } catch( GDLException& ex) { if( !ex.GetArrayexprIndexeeFailed()) { fcallNodeFunIx = -2; // mark as ARRAYEXPR succeeded throw ex; } try{ BaseGDL** res = fcallNode->FCALLNode::LExpr( right); fcallNodeFunIx = fcallNode->funIx; return res; } // keep FCALL if already compiled (but runtime error) catch( GDLException& innerEx) { if(fcallNode->funIx >= 0) { fcallNodeFunIx = fcallNode->funIx; throw innerEx; } std::string msg = "Ambiguous: " + ex.ANTLRException::toString() + " or: " + innerEx.ANTLRException::toString(); throw GDLException(this,msg,true,false); } } } BaseGDL** ARRAYEXPR_MFCALLNode::LExpr( BaseGDL* right) //case ARRAYEXPR_MFCALL: { return interpreter->l_arrayexpr_mfcall(this, right); } // default ...Grab version BaseGDL** DOTNode::LExpr( BaseGDL* right) //case DOT: { if( right == NULL) throw GDLException( this, "Struct expression not allowed in this context.", true,false); ProgNodeP _t = this->getFirstChild(); //SizeT nDot = tIn->nDot; Guard aD( new DotAccessDescT(nDot+1)); //interpreter->l_dot_array_expr(_t, aD.get()); ArrayIndexListT* aL; BaseGDL** rP; if( _t->getType() == GDLTokenTypes::ARRAYEXPR) { // rP=l_indexable_expr(_t->getFirstChild()); rP = _t->getFirstChild()->LEval(); // throws if( *rP == NULL) { // ERROR BaseGDL** res = rP; _t = _t->getFirstChild(); // check not needed for SYSVAR assert( _t->getType() != GDLTokenTypes::SYSVAR); if( _t->getType() == GDLTokenTypes::VARPTR) { GDLException ex( _t, "Common block variable is undefined: "+ interpreter->CallStackBack()->GetString( *res),true,false); ex.SetArrayexprIndexeeFailed( true); throw ex; } if( _t->getType() == GDLTokenTypes::VAR) { GDLException ex( _t, "Variable is undefined: "+ interpreter->CallStackBack()->GetString(_t->GetVarIx()),true,false); ex.SetArrayexprIndexeeFailed( true); throw ex; } GDLException ex( _t, "Variable is undefined: "+interpreter->Name(res),true,false); ex.SetArrayexprIndexeeFailed( true); throw ex; } // aL=arrayindex_list(_t->getFirstChild()->getNextSibling()); bool handled = false; if( !(*rP)->IsAssoc() && (*rP)->Type() == GDL_OBJ && (*rP)->StrictScalar()) { // check for _overloadBracketsLeftSide DObj s = (*static_cast(*rP))[0]; // is StrictScalar() DSubUD* bracketsLeftSideOverload = static_cast(GDLInterpreter::GetObjHeapOperator( s, OOBracketsLeftSide)); if( bracketsLeftSideOverload != NULL) { bool internalDSubUD = bracketsLeftSideOverload->GetTree()->IsWrappedNode(); // _overloadBracketsLeftSide IxExprListT indexList; interpreter->arrayindex_list_overload( _t->getFirstChild()->getNextSibling(), indexList); ArrayIndexListGuard guard(_t->getFirstChild()->getNextSibling()->arrIxListNoAssoc); // hidden SELF is counted as well int nParSub = bracketsLeftSideOverload->NPar(); assert( nParSub >= 1); // SELF // indexList.size() + OBJREF + RVALUE > regular paramters w/o SELF if( (indexList.size() + 2) > nParSub - 1) { indexList.Cleanup(); throw GDLException( this, bracketsLeftSideOverload->ObjectName() + ": Incorrect number of arguments.", false, false); } DObjGDL* self; Guard selfGuard; if( internalDSubUD) { self = static_cast(*rP); // internal subroutines behave well } else { self = static_cast(*rP)->Dup(); // res should be not changeable via SELF selfGuard.Reset( self); } // adds already SELF parameter EnvUDT* newEnv= new EnvUDT( this, bracketsLeftSideOverload, &self); // Guard newEnvGuard( newEnv); // parameters // special: we are in dot access here // signal to _overloadBracketsLeftSide by setting OBJREF to NULL BaseGDL* returnOBJREF = NULL; newEnv->SetNextParUnchecked( &returnOBJREF); // OBJREF parameter // Dup() here is not optimal // avoid at least for internal overload routines (which do/must not change RVALUE) BaseGDL* rValueNull = NULL; newEnv->SetNextParUnchecked( rValueNull); // RVALUE parameter NULL, as value // if( internalDSubUD) // newEnv->SetNextParUnchecked( &right); // RVALUE parameter, as reference to prevent cleanup in newEnv // else // newEnv->SetNextParUnchecked( right->Dup()); // RVALUE parameter, as value // pass as reference would be more efficient, but as the data might // be deleted in bracketsLeftSideOverload it is not possible. // BaseGDL* rightCopy = right; // newEnv->SetNextParUnchecked( &rightCopy); // RVALUE parameter // // signal dot access: // // set ISRANGE[0] from 0/1 to 2/3 // assert( indexList.size() > 0); // assert( indexList[0]->Type() == GDL_LONG); // assert( indexList[0]->N_Elements() > 0); // *(static_cast(indexList))[0] += 2; for( SizeT p=0; pSetNextParUnchecked( indexList[p]); // takes ownership StackGuard stackGuard(interpreter->CallStack()); interpreter->CallStack().push_back( newEnv); // make the call interpreter->call_pro(static_cast(newEnv->GetPro())->GetTree()); if( !internalDSubUD && self != selfGuard.Get()) { // always put out warning first, in case of a later crash Warning( "WARNING: " + bracketsLeftSideOverload->ObjectName() + ": Assignment to SELF detected (GDL session still ok)."); // assignment to SELF -> self was deleted and points to new variable // which it owns selfGuard.Release(); if( static_cast(self) != NullGDL::GetSingleInstance()) selfGuard.Reset(self); } if( returnOBJREF == NULL || returnOBJREF->Type() != GDL_PTR) GDLException ex( _t, "OBJREF must return a PTR to the STRUCT to access.",true,false); DPtr vID = (*static_cast(returnOBJREF))[0]; delete returnOBJREF; BaseGDL* structToAccess = interpreter->GetHeap( vID); interpreter->SetRootL( _t, aD.get(), structToAccess, NULL); handled = true; } } // if( (*rP)->Type() == GDL_OBJ && (*rP)->StrictScalar()) if( !handled) { // regular (non-object) case aL=interpreter->arrayindex_list( _t->getFirstChild()->getNextSibling()); interpreter->SetRootL( _t, aD.get(), *rP, aL); } } else // case ARRAYEXPR_MFCALL: // case DEREF: // case EXPR: // case FCALL: // case FCALL_LIB: // case MFCALL: // case MFCALL_PARENT: // case SYSVAR: // case VAR: // case VARPTR: { // rP=l_indexable_expr(_t); rP = _t->LEval(); // throws if( *rP == NULL) { // ERROR BaseGDL** res = rP; // check not needed for SYSVAR assert( _t->getType() != GDLTokenTypes::SYSVAR); if( _t->getType() == GDLTokenTypes::VARPTR) { GDLException ex( _t, "Common block variable is undefined: "+ interpreter->CallStackBack()->GetString( *res),true,false); ex.SetArrayexprIndexeeFailed( true); throw ex; } if( _t->getType() == GDLTokenTypes::VAR) { GDLException ex( _t, "Variable is undefined: "+ interpreter->CallStackBack()->GetString(_t->GetVarIx()),true,false); ex.SetArrayexprIndexeeFailed( true); throw ex; } GDLException ex( _t, "Variable is undefined: "+interpreter->Name(res),true,false); ex.SetArrayexprIndexeeFailed( true); throw ex; } interpreter->SetRootL( _t, aD.get(), *rP, NULL); } _t = _t->getNextSibling(); for( int d=0; dgetType() == ARRAYEXPR || _t->getType() == EXPR || // _t->getType() == IDENTIFIER)) { interpreter->tag_array_expr(_t, aD.get()); _t = interpreter->GetRetTree(); // } // else { // break; // } } aD->ADAssign( right); //res=NULL; //SetRetTree( tIn->getNextSibling()); return NULL; } // default ...Grab version BaseGDL** ASSIGNNode::LExpr( BaseGDL* right) //case ASSIGN: { ProgNodeP _t = this->getFirstChild(); if( NonCopyNode(_t->getType())) { // BaseGDL* e1=interpreter->indexable_expr(_t); // _t = interpreter->GetRetTree(); BaseGDL* e1 = _t->EvalNC(); _t = _t->getNextSibling(); } // else if( _t->getType() == GDLTokenTypes::FCALL_LIB) // { // // BaseGDL* e1=interpreter->lib_function_call(_t); // // _t = interpreter->GetRetTree(); // BaseGDL** retValPtr; // BaseGDL* e1 = static_cast(_t)->EvalFCALL_LIB( retValPtr); // _t = _t->getNextSibling(); // // if( !interpreter->CallStackBack()->Contains( e1)) // if( retValPtr == NULL) // GDLDelete(e1); // guard if no global data // } else { // case ASSIGN: // case ASSIGN_REPLACE: // case ASSIGN_ARRAYEXPR_MFCALL: // case ARRAYDEF: // case ARRAYEXPR: // case ARRAYEXPR_MFCALL: // case EXPR: // case FCALL: // case FCALL_LIB_RETNEW: // case MFCALL: // case MFCALL_PARENT: // case NSTRUC: // case NSTRUC_REF: // case POSTDEC: // case POSTINC: // case STRUC: // case DEC: // case INC: // case DOT: // case QUESTION: // BaseGDL* e1=interpreter->indexable_tmp_expr(_t); // _t = interpreter->GetRetTree(); // BaseGDL* e1 = _t->Eval(); // //lib_function_call_retnew(_t); // GDLDelete(e1); BaseGDL* e1; BaseGDL** ref =_t->EvalRefCheck(e1); if( ref == NULL) GDLDelete(e1); _t = _t->getNextSibling(); } //SetRetTree( tIn->getNextSibling()); return _t->LExpr( right); //l_expr(_t, right); } // something like: (( ((aFUNorVAR(aVAR))) =e1 ))=right BaseGDL** ASSIGN_ARRAYEXPR_MFCALLNode::LExpr( BaseGDL* right) //case ASSIGN_ARRAYEXPR_MFCALL: { ProgNodeP _t = this->getFirstChild(); if( NonCopyNode(_t->getType())) { BaseGDL* e1 = _t->EvalNC(); _t = _t->getNextSibling(); } else { // e1 must be calculated due to possible side effects, but the result isn't used or even accessible BaseGDL* e1; BaseGDL** ref =_t->EvalRefCheck(e1); if( ref == NULL) GDLDelete(e1); // BaseGDL* e1 = _t->Eval(); // //lib_function_call_retnew(_t); // GDLDelete(e1); _t = _t->getNextSibling(); } ProgNodeP l = _t; BaseGDL** res; // try MFCALL try { res=interpreter->l_arrayexpr_mfcall_as_mfcall( l); if( right != (*res)) { GDLDelete(*res); *res = right->Dup(); } } catch( GDLException& ex) { // try ARRAYEXPR try { res=interpreter->l_arrayexpr_mfcall_as_arrayexpr(l, right); } catch( GDLException& ex2) { throw GDLException(ex.toString() + " or "+ex2.toString()); } } //SetRetTree( tIn->getNextSibling()); return res; } BaseGDL** ASSIGN_REPLACENode::LExpr( BaseGDL* right) // case ASSIGN_REPLACE: { ProgNodeP _t = this->getFirstChild(); BaseGDL** res; // if( _t->getType() == GDLTokenTypes::FCALL_LIB) // { // // BaseGDL* e1=interpreter->lib_function_call(_t); // // _t = interpreter->GetRetTree(); // BaseGDL** retValPtr; // BaseGDL* e1 = static_cast(_t)->EvalFCALL_LIB( retValPtr); // _t = _t->getNextSibling(); // res =_t->LEval(); //l_function_call(_t); // // if( *res != e1 && !interpreter->CallStackBack()->Contains( e1)) // if( *res != e1 && retValPtr == NULL) // GDLDelete(e1); // } // else { // case ASSIGN: // case ASSIGN_REPLACE: // case ASSIGN_ARRAYEXPR_MFCALL: // case ARRAYDEF: // case ARRAYEXPR: // case ARRAYEXPR_MFCALL: // case CONSTANT: // case DEREF: // case EXPR: // case FCALL: // case FCALL_LIB_RETNEW: // case MFCALL: // case MFCALL_PARENT: // case NSTRUC: // case NSTRUC_REF: // case POSTDEC: // case POSTINC: // case STRUC: // case SYSVAR: // case VAR: // case VARPTR: // case DEC: // case INC: // case DOT: // case QUESTION: // BaseGDL* e1=interpreter->tmp_expr(_t); BaseGDL* e1; BaseGDL** ref =_t->EvalRefCheck(e1); if( ref != NULL) e1 = *ref; _t =_t->getNextSibling(); res =_t->LEval(); //l_function_call(_t); if( *res != e1 && ref == NULL) GDLDelete(e1); // BaseGDL* e1 = _t->Eval(); // _t =_t->getNextSibling(); // res =_t->LEval(); //l_function_call(_t); // if( *res != e1) // GDLDelete(e1); } // switch ( _t->getType()) { // case DEREF: // // { // // res=_t->LEval(); //l_deref(_t); // // _t = _retTree; // // break; // // } // case VAR: // case VARPTR: // // { // // res=_t->LEval(); //l_simple_var(_t); // // _retTree = tIn->getNextSibling(); // // //_t = _retTree; // // break; // // } // default: // // case FCALL: // // case FCALL_LIB: // // case MFCALL: // // case MFCALL_PARENT: // { // BaseGDL** res=_t->LEval(); //l_function_call(_t); //_retTree = tIn->getNextSibling(); //_t = _retTree; // break; // } // } if( right != (*res)) { GDLDelete(*res); assert( right != NULL); *res = right->Dup(); } // SetRetTree( this->getNextSibling()); return res; } // l_expr finish ///////////////////////////////////////////// gdl-0.9.4/src/getfmtast.cpp0000664000175000017500000000500110252310342014177 0ustar marcmarc/*************************************************************************** getfmtast.cpp - returns the AST for formatted IO ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ //#define FMT_DEBUG #undef FMT_DEBUG #include "includefirst.hpp" #include "basegdl.hpp" #include "fmtnode.hpp" #include "print_tree.hpp" #include "FMTLexer.hpp" #include "FMTParser.hpp" #include "antlr/ASTFactory.hpp" using namespace std; antlr::ASTFactory FMTNodeFactory("FMTNode",FMTNode::factory); RefFMTNode GetFMTAST( DString fmtString) { istringstream istr(fmtString); //+"\n"); RefFMTNode fmtAST; try { antlr::TokenStreamSelector selector; FMTLexer lexer( istr); lexer.SetSelector( selector); CFMTLexer cLexer( lexer.getInputState()); cLexer.SetSelector( selector); lexer.SetCLexer( cLexer); selector.select( &lexer); FMTParser parser( selector); // because we use the standard (ANTLR generated) constructor here // we cannot do it in the constructor parser.initializeASTFactory( FMTNodeFactory); parser.setASTFactory( &FMTNodeFactory ); parser.format( 1); fmtAST=parser.getAST(); #ifdef FMT_DEBUG antlr::print_tree pt; pt.pr_tree(static_cast(fmtAST)); cout << endl; #endif } catch( GDLException ex) { throw GDLException("Format: "+ex.getMessage()); } catch( antlr::ANTLRException ex) { throw GDLException("Format parser: "+ex.getMessage()); } catch( exception ex) { throw GDLException("Format exception: "+string(ex.what())); } catch(...) { throw GDLException("Format: general exception."); } return fmtAST; } gdl-0.9.4/src/convol_inc0.cpp0000664000175000017500000000611710200440227014422 0ustar marcmarc/*************************************************************************** convol_inc0.cpp - convol function edgemode = 0 (skip) ------------------- begin : Sep 19 2004 copyright : (C) 2004 by Marc Schellens email : m_schellens@users.sourceforge.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ // to be included from convol.cpp #ifdef INCLUDE_CONVOL_INC_CPP // for all result elements for( SizeT a=0; adim[ aSp]) { regArr[ aSp] = aInitIx[aSp] >= aBeg[aSp] && aInitIx[aSp] < aEnd[ aSp]; if( regular) for(; aSp 0) if( res_a < 255) (*res)[ a] = res_a; else (*res)[ a] = 255; else (*res)[ a] = 0; #endif } else for( long aInitIx0 = aBeg0; aInitIx0 < aEnd0; ++aInitIx0, ++a) { #ifdef CONVOL_BYTE__ DInt res_a = 0; #else Ty& res_a = (*res)[ a]; #endif long* kIx = kIxArr; for( SizeT k=0; k 0) if( res_a < 255) (*res)[ a] = res_a; else (*res)[ a] = 255; else (*res)[ a] = 0; #endif } a += dim0_aEnd0; } // if( regular) // in dim 1-n else { a += dim0; // update a } } // for(...) #endif gdl-0.9.4/src/plotting_plot.cpp0000664000175000017500000004151612174514611015124 0ustar marcmarc/*************************************************************************** plotting_plot.cpp - GDL routines for plotting ------------------- begin : July 22 2002 copyright : (C) 2002-2011 by Marc Schellens et al. email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" #include "plotting.hpp" #ifdef _MSC_VER #define isnan _isnan #endif namespace lib { using namespace std; // using std::isinf; using std::isnan; class plot_call : public plotting_routine_call { DDoubleGDL *yVal, *xVal, *zVal, *xTemp, *yTemp; SizeT xEl, yEl, zEl; DDouble minVal, maxVal, xStart, xEnd, yStart, yEnd, zValue; bool doMinMax; bool xLog, yLog, wasBadxLog, wasBadyLog; Guard xval_guard, yval_guard, zval_guard, xtemp_guard; DLong iso; bool doT3d; private: bool handle_args(EnvT* e) { //T3D ? static int t3dIx = e->KeywordIx( "T3D"); doT3d=(e->KeywordSet(t3dIx)|| T3Denabled(e)); //note: Z (VALUE) will be used uniquely if Z is not effectively defined. static int zvIx = e->KeywordIx( "ZVALUE"); zValue=0.0; e->AssureDoubleScalarKWIfPresent ( zvIx, zValue ); zValue=min(zValue,0.999999); //to avoid problems with plplot zValue=max(zValue,0.0); // system variable !P.NSUM first DLong nsum=(*static_cast(SysVar::P()-> GetTag(SysVar::P()->Desc()->TagIndex("NSUM"), 0)))[0]; e->AssureLongScalarKWIfPresent("NSUM", nsum); bool polar = (e->KeywordSet("POLAR")); DDoubleGDL *yValBis, *xValBis; Guard xvalBis_guard, yvalBis_guard; //test and transform eventually if POLAR and/or NSUM! if (nParam() == 1) { yTemp = e->GetParAs< DDoubleGDL > (0); if (yTemp->Rank() == 0) e->Throw("Expression must be an array in this context: " + e->GetParString(0)); yEl=yTemp->N_Elements(); xEl=yEl; xTemp = new DDoubleGDL(dimension(xEl), BaseGDL::INDGEN); xtemp_guard.Reset(xTemp); // delete upon exit } else { xTemp = e->GetParAs< DDoubleGDL > (0); if (xTemp->Rank() == 0) e->Throw("Expression must be an array in this context: " + e->GetParString(0)); xEl=xTemp->N_Elements(); yTemp = e->GetParAs< DDoubleGDL > (1); if (yTemp->Rank() == 0) e->Throw("Expression must be an array in this context: " + e->GetParString(1)); yEl=yTemp->N_Elements(); //silently drop unmatched values if (yEl!= xEl) { SizeT size; size = min(xEl, yEl); xEl = size; yEl = size; } } //check nsum validity nsum = max(1, nsum); nsum = min(nsum, (DLong)xEl); if (nsum == 1) { if (polar) { xVal = new DDoubleGDL(dimension(xEl), BaseGDL::NOZERO); xval_guard.Reset(xVal); // delete upon exit yVal = new DDoubleGDL(dimension(yEl), BaseGDL::NOZERO); yval_guard.Reset(yVal); // delete upon exit for (int i = 0; i < xEl; i++) (*xVal)[i] = (*xTemp)[i] * cos((*yTemp)[i]); for (int i = 0; i < yEl; i++) (*yVal)[i] = (*xTemp)[i] * sin((*yTemp)[i]); } else { //careful about previously set autopointers! if (nParam() == 1) xval_guard.Init( xtemp_guard.release()); xVal = xTemp; yVal = yTemp; } } else { int i, j, k; DLong size = (DLong)xEl / nsum; xVal = new DDoubleGDL(size, BaseGDL::ZERO); //SHOULD BE ZERO, IS NOT! xval_guard.Reset(xVal); // delete upon exit yVal = new DDoubleGDL(size, BaseGDL::ZERO); //IDEM yval_guard.Reset(yVal); // delete upon exit for (i = 0, k = 0; i < size; i++) { (*xVal)[i] = 0.0; (*yVal)[i] = 0.0; for (j = 0; j < nsum; j++, k++) { (*xVal)[i] += (*xTemp)[k]; (*yVal)[i] += (*yTemp)[k]; } } for (i = 0; i < size; i++) (*xVal)[i] /= nsum; for (i = 0; i < size; i++) (*yVal)[i] /= nsum; if (polar) { DDouble x, y; for (i = 0; i < size; i++) { x = (*xVal)[i] * cos((*yVal)[i]); y = (*xVal)[i] * sin((*yVal)[i]); (*xVal)[i] = x; (*yVal)[i] = y; } } } // handle Log options int xLogIx = e->KeywordIx("XLOG"); int yLogIx = e->KeywordIx("YLOG"); xLog = e->KeywordSet(xLogIx); yLog = e->KeywordSet(yLogIx); // compute adequate values for log scale, warn adequately... wasBadxLog = FALSE; wasBadyLog = FALSE; if (xLog) { DLong minEl, maxEl; xVal->MinMax(&minEl, &maxEl, NULL, NULL, true); if ((*xVal)[minEl] <= 0.0) wasBadxLog = TRUE; xValBis = new DDoubleGDL(dimension(xEl), BaseGDL::NOZERO); xvalBis_guard.Reset(xValBis); // delete upon exit for (int i = 0; i < xEl; i++) (*xValBis)[i] = log10((*xVal)[i]); } else xValBis = xVal; if (yLog) { DLong minEl, maxEl; yVal->MinMax(&minEl, &maxEl, NULL, NULL, true); if ((*yVal)[minEl] <= 0.0) wasBadyLog = TRUE; yValBis = new DDoubleGDL(dimension(yEl), BaseGDL::NOZERO); yvalBis_guard.Reset(yValBis); // delete upon exit for (int i = 0; i < yEl; i++) (*yValBis)[i] = log10((*yVal)[i]); } else yValBis = yVal; #define UNDEF_RANGE_VALUE 1E-12 { DLong minEl, maxEl; xValBis->MinMax(&minEl, &maxEl, NULL, NULL, true); xStart = (*xVal)[minEl]; xEnd = (*xVal)[maxEl]; if (isnan(xStart)) xStart = UNDEF_RANGE_VALUE; if (isnan(xEnd)) xEnd = 1.0; if (xStart==xEnd) xStart=xEnd-UNDEF_RANGE_VALUE; yValBis->MinMax(&minEl, &maxEl, NULL, NULL, true); yStart = (*yVal)[minEl]; yEnd = (*yVal)[maxEl]; if (isnan(yStart)) yStart = UNDEF_RANGE_VALUE; if (isnan(yEnd)) yEnd = 1.0; if (yStart==yEnd) yStart=yEnd-UNDEF_RANGE_VALUE; } //MIN_VALUE and MAX_VALUE overwrite yStart/yEnd eventually (note: the points will not be "seen" at all in plots) minVal = yStart; //to give a reasonable value... maxVal = yEnd; //idem doMinMax = false; //although we will not use it... if( e->KeywordSet( "MIN_VALUE") || e->KeywordSet( "MAX_VALUE")) doMinMax = true; //...unless explicitely required e->AssureDoubleScalarKWIfPresent( "MIN_VALUE", minVal); e->AssureDoubleScalarKWIfPresent( "MAX_VALUE", maxVal); yStart=gdlPlot_Max(yStart,minVal); yEnd=gdlPlot_Min(yEnd,maxVal); //XRANGE and YRANGE overrides all that, but Start/End should be recomputed accordingly DDouble xAxisStart, xAxisEnd, yAxisStart, yAxisEnd; bool setx=gdlGetDesiredAxisRange(e, "X", xAxisStart, xAxisEnd); bool sety=gdlGetDesiredAxisRange(e, "Y", yAxisStart, yAxisEnd); if(setx && sety) { xStart=xAxisStart; xEnd=xAxisEnd; yStart=yAxisStart; yEnd=yAxisEnd; } else if (sety) { yStart=yAxisStart; yEnd=yAxisEnd; // wrong behaviour: x axis limits do not depend from Y values // //must compute min-max for other axis! // { // gdlDoRangeExtrema(yVal,xVal,xStart,xEnd,yStart,yEnd); // } } else if (setx) { xStart=xAxisStart; xEnd=xAxisEnd; //must compute min-max for other axis! { gdlDoRangeExtrema(xVal,yVal,yStart,yEnd,xStart,xEnd,doMinMax,minVal,maxVal); } } //handle Nozero option after all that! if(!gdlYaxisNoZero(e) && yStart >0 && !yLog ) yStart=0.0; #undef UNDEF_RANGE_VALUE //ISOTROPIC iso=0; e->AssureLongScalarKWIfPresent( "ISOTROPIC", iso); if (doT3d) { //make zVal zEl=xVal->N_Elements(); zVal=new DDoubleGDL(dimension(zEl), BaseGDL::NOZERO); zval_guard.Reset(zVal); // delete upon exit for (SizeT i=0; i< zEl ; ++i) (*zVal)[i]=zValue; } return false; } private: void old_body( EnvT* e, GDLGStream* actStream) { // background BEFORE next plot since it is the only place plplot may redraw the background... gdlSetGraphicsBackgroundColorFromKw(e, actStream); //start a plot gdlNextPlotHandlingNoEraseOption(e, actStream); //NOERASE // [XY]STYLE DLong xStyle=0, yStyle=0; gdlGetDesiredAxisStyle(e, "X", xStyle); gdlGetDesiredAxisStyle(e, "Y", yStyle); //xStyle and yStyle apply on range values if ((xStyle & 1) != 1) { PLFLT intv = AutoIntvAC(xStart, xEnd, xLog); } if ((yStyle & 1) != 1) { PLFLT intv = AutoIntvAC(yStart, yEnd, yLog); } // MARGIN DFloat xMarginL, xMarginR, yMarginB, yMarginT; gdlGetDesiredAxisMargin(e, "X", xMarginL, xMarginR); gdlGetDesiredAxisMargin(e, "Y", yMarginB, yMarginT); // viewport and world coordinates // use POSITION int positionIx = e->KeywordIx( "POSITION"); DFloatGDL* boxPosition = e->IfDefGetKWAs( positionIx); if (boxPosition == NULL) boxPosition = (DFloatGDL*) 0xF; // set the PLOT charsize before setting viewport (margin depend on charsize) gdlSetPlotCharsize(e, actStream); static DDouble x0,y0,xs,ys; //conversion to normalized coords x0=(xLog)?-log10(xStart):-xStart; y0=(yLog)?-log10(yStart):-yStart; xs=(xLog)?(log10(xEnd)-log10(xStart)):xEnd-xStart;xs=1.0/xs; ys=(yLog)?(log10(yEnd)-log10(yStart)):yEnd-yStart;ys=1.0/ys; if (doT3d) { DDoubleGDL* plplot3d; DDouble az, alt, ay, scale; ORIENTATION3D axisExchangeCode; plplot3d = gdlConvertT3DMatrixToPlplotRotationMatrix( zValue, az, alt, ay, scale, axisExchangeCode); if (plplot3d == NULL) { e->Throw("Illegal 3D transformation. (FIXME)"); } if (gdlSet3DViewPortAndWorldCoordinates(e, actStream, plplot3d, xLog, yLog, xStart, xEnd, yStart, yEnd) == FALSE) return; gdlSetGraphicsForegroundColorFromKw(e, actStream); gdlSetPlotCharthick(e, actStream); DDouble t3xStart, t3xEnd, t3yStart, t3yEnd, t3zStart, t3zEnd; switch (axisExchangeCode) { case NORMAL: //X->X Y->Y plane XY t3xStart=(xLog)?log10(xStart):xStart, t3xEnd=(xLog)?log10(xEnd):xEnd, t3yStart=(yLog)?log10(yStart):yStart, t3yEnd=(yLog)?log10(yEnd):yEnd, t3zStart=0; t3zEnd=1.0; actStream->w3d(scale, scale, scale*(1.0 - zValue), t3xStart,t3xEnd,t3yStart,t3yEnd,t3zStart,t3zEnd, alt, az); gdlAxis3(e, actStream, "X", xStart, xEnd, xLog); gdlAxis3(e, actStream, "Y", yStart, yEnd, yLog); break; case XY: // X->Y Y->X plane XY t3yStart=(xLog)?log10(xStart):xStart, t3yEnd=(xLog)?log10(xEnd):xEnd, t3xStart=(yLog)?log10(yStart):yStart, t3xEnd=(yLog)?log10(yEnd):yEnd, t3zStart=0; t3zEnd=1.0; actStream->w3d(scale, scale, scale*(1.0 - zValue), t3xStart,t3xEnd,t3yStart,t3yEnd,t3zStart,t3zEnd, alt, az); gdlAxis3(e, actStream, "Y", xStart, xEnd, xLog); gdlAxis3(e, actStream, "X", yStart, yEnd, yLog); break; case XZ: // Y->Y X->Z plane YZ t3zStart=(xLog)?log10(xStart):xStart, t3zEnd=(xLog)?log10(xEnd):xEnd, t3yStart=(yLog)?log10(yStart):yStart, t3yEnd=(yLog)?log10(yEnd):yEnd, t3xStart=0; t3xEnd=1.0; actStream->w3d(scale, scale, scale, t3xStart,t3xEnd,t3yStart,t3yEnd,t3zStart,t3zEnd, alt, az); gdlAxis3(e, actStream, "Z", xStart, xEnd, xLog, 0); gdlAxis3(e, actStream, "Y", yStart, yEnd, yLog); break; case YZ: // X->X Y->Z plane XZ t3xStart=(xLog)?log10(xStart):xStart, t3xEnd=(xLog)?log10(xEnd):xEnd, t3zStart=(yLog)?log10(yStart):yStart, t3zEnd=(yLog)?log10(yEnd):yEnd, t3yStart=0; t3yEnd=1.0; actStream->w3d(scale, scale, scale, t3xStart,t3xEnd,t3yStart,t3yEnd,t3zStart,t3zEnd, alt, az); gdlAxis3(e, actStream, "X", xStart, xEnd, xLog); gdlAxis3(e, actStream, "Z", yStart, yEnd, yLog,1); break; case XZXY: //X->Y Y->Z plane YZ t3yStart=(xLog)?log10(xStart):xStart, t3yEnd=(xLog)?log10(xEnd):xEnd, t3zStart=(yLog)?log10(yStart):yStart, t3zEnd=(yLog)?log10(yEnd):yEnd, t3xStart=0; t3xEnd=1.0; actStream->w3d(scale, scale, scale, t3xStart,t3xEnd,t3yStart,t3yEnd,t3zStart,t3zEnd, alt, az); gdlAxis3(e, actStream, "Y", xStart, xEnd, xLog); gdlAxis3(e, actStream, "Z", yStart, yEnd, yLog); break; case XZYZ: //X->Z Y->X plane XZ t3zStart=(xLog)?log10(xStart):xStart, t3zEnd=(xLog)?log10(xEnd):xEnd, t3xStart=(yLog)?log10(yStart):yStart, t3xEnd=(yLog)?log10(yEnd):yEnd, t3yStart=0; t3yEnd=1.0; actStream->w3d(scale, scale, scale, t3xStart,t3xEnd,t3yStart,t3yEnd,t3zStart,t3zEnd, alt, az); gdlAxis3(e, actStream, "Z", xStart, xEnd, xLog,1); gdlAxis3(e, actStream, "X", yStart, yEnd, yLog); break; } // title and sub title gdlWriteTitleAndSubtitle(e, actStream); //data: will plot using coordinates transform. //TODO: unless PSYM=0 (optimize) Data3d.zValue = zValue; Data3d.Matrix = plplot3d; //try to change for !P.T in future? switch (axisExchangeCode) { case NORMAL: //X->X Y->Y plane XY Data3d.x0=x0; Data3d.y0=y0; Data3d.xs=xs; Data3d.ys=ys; Data3d.code = code012; break; case XY: // X->Y Y->X plane XY Data3d.x0=0; Data3d.y0=x0; Data3d.xs=ys; Data3d.ys=xs; Data3d.code = code102; break; case XZ: // Y->Y X->Z plane YZ Data3d.x0=x0; Data3d.y0=y0; Data3d.xs=xs; Data3d.ys=ys; Data3d.code = code210; break; case YZ: // X->X Y->Z plane XZ Data3d.x0=x0; Data3d.y0=y0; Data3d.xs=xs; Data3d.ys=ys; Data3d.code = code021; break; case XZXY: //X->Y Y->Z plane YZ Data3d.x0=x0; Data3d.y0=y0; Data3d.xs=xs; Data3d.ys=ys; Data3d.code = code120; break; case XZYZ: //X->Z Y->X plane XZ Data3d.x0=x0; Data3d.y0=y0; Data3d.xs=xs; Data3d.ys=ys; Data3d.code = code201; break; } actStream->stransform(gdl3dTo2dTransform, &Data3d); } else { //fix viewport and coordinates for box if (gdlSetViewPortAndWorldCoordinates(e, actStream, boxPosition, xLog, yLog, xMarginL, xMarginR, yMarginB, yMarginT, xStart, xEnd, yStart, yEnd, iso)==FALSE) return; //no good: should catch an exception to get out of this mess. //current pen color... gdlSetGraphicsForegroundColorFromKw(e, actStream); gdlSetPlotCharthick(e, actStream); gdlBox(e, actStream, xStart, xEnd, yStart, yEnd, xLog, yLog); } } private: void call_plplot(EnvT* e, GDLGStream* actStream) { DLong psym; // plot the data int nodataIx = e->KeywordIx( "NODATA"); if ( !e->KeywordSet(nodataIx) ) { //get psym gdlGetPsym(e, psym); //PSYM //handle clipping bool doClip=(e->KeywordSet("CLIP")||e->KeywordSet("NOCLIP")); // make all clipping computations BEFORE setting graphic properties (color, size) bool stopClip=false; if ( doClip ) if ( startClipping(e, actStream, false)==TRUE ) stopClip=true; // here graphic properties gdlSetPenThickness(e, actStream); gdlSetSymsize(e, actStream); gdlSetLineStyle(e, actStream); // TODO: handle "valid"! bool valid=draw_polyline(e, actStream, xVal, yVal, minVal, maxVal, doMinMax, xLog, yLog, psym, FALSE); if (stopClip) stopClipping(actStream); } } private: void post_call(EnvT* e, GDLGStream* actStream) { if (doT3d) actStream->stransform(NULL,NULL); actStream->lsty(1);//reset linestyle actStream->sizeChar(1.0); } }; void plot(EnvT* e) { plot_call plot; plot.call(e, 1); } } // namespace gdl-0.9.4/src/GDLTreeParser.cpp0000664000175000017500000063675312221270776014652 0ustar marcmarc/* $ANTLR 2.7.7 (20120518): "gdlc.tree.g" -> "GDLTreeParser.cpp"$ */ #include "includefirst.hpp" #include "GDLTreeParser.hpp" #include #include #include #include #include #include #include #include // **** #include "print_tree.hpp" using namespace std; // print out AST tree //#define GDL_DEBUG //#undef GDL_DEBUG GDLTreeParser::GDLTreeParser() : antlr::TreeParser() { } void GDLTreeParser::translation_unit(RefDNode _t) { RefDNode translation_unit_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode translation_unit_AST = RefDNode(antlr::nullAST); RefDNode retAST_AST = RefDNode(antlr::nullAST); RefDNode retAST = RefDNode(antlr::nullAST); // returnProgNodeP = _t; bool mainStarted = false; try { // for error handling { // ( ... )* for (;;) { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case PRO: { procedure_def(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); break; } case FUNCTION: { function_def(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); break; } default: if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; if ((_t->getType() == FORWARD)) { forward_function(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); } else if ((_t->getType() == COMMONDECL || _t->getType() == COMMONDEF)) { EnvBaseT* envBefore = comp.GetEnv(); if( !mainStarted) { comp.StartPro( "$MAIN$"); mainStarted = true; } comp.ContinueMainPro(); common_block(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); comp.EndInteractiveStatement(); comp.SetEnv( envBefore); } else { goto _loop3; } } } _loop3:; } // ( ... )* { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ASSIGN: case BLOCK: case BREAK: case CONTINUE: case COMMONDECL: case COMMONDEF: case FOR: case FOREACH: case MPCALL: case MPCALL_PARENT: case PCALL: case REPEAT: case RETURN: case WHILE: case IDENTIFIER: case CASE: case FORWARD: case GOTO: case IF: case ON_IOERROR: case SWITCH: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: { if( !mainStarted) { comp.StartPro( "$MAIN$"); mainStarted = true; } comp.ContinueMainPro(); retAST = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; statement_list(_t); _t = _retTree; retAST_AST = returnAST; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); comp.SetTree( retAST_AST); comp.EndPro(); #ifdef GDL_DEBUG cout << "TreeParser output:" << endl; antlr::print_tree pt; pt.pr_tree(static_cast(retAST)); cout << "CompileFile: TreeParser end." << endl; #endif break; } case 3: { break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } translation_unit_AST = RefDNode(currentAST.root); } catch ( GDLException& e) { throw; } catch ( antlr::NoViableAltException& e) { // SYNTAX ERROR throw GDLException( e.getLine(), e.getColumn(), "Compiler syntax error: "+e.getMessage()); } catch ( antlr::RecognitionException& e) { // SYNTAX ERROR throw GDLException( e.getLine(), e.getColumn(), "General syntax error: "+e.getMessage()); } returnAST = translation_unit_AST; _retTree = _t; } void GDLTreeParser::procedure_def(RefDNode _t) { RefDNode procedure_def_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode procedure_def_AST = RefDNode(antlr::nullAST); RefDNode p = RefDNode(antlr::nullAST); RefDNode p_AST = RefDNode(antlr::nullAST); RefDNode name = RefDNode(antlr::nullAST); RefDNode name_AST = RefDNode(antlr::nullAST); RefDNode obj = RefDNode(antlr::nullAST); RefDNode obj_AST = RefDNode(antlr::nullAST); RefDNode __t19 = _t; p = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode p_AST_in = RefDNode(antlr::nullAST); p_AST = astFactory->create(antlr::RefAST(p)); antlr::ASTPair __currentAST19 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),PRO); _t = _t->getFirstChild(); name = _t; RefDNode name_AST_in = RefDNode(antlr::nullAST); name_AST = astFactory->create(antlr::RefAST(name)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case METHOD: { RefDNode tmp1_AST = RefDNode(antlr::nullAST); RefDNode tmp1_AST_in = RefDNode(antlr::nullAST); tmp1_AST = astFactory->create(antlr::RefAST(_t)); tmp1_AST_in = _t; match(antlr::RefAST(_t),METHOD); _t = _t->getNextSibling(); obj = _t; RefDNode obj_AST_in = RefDNode(antlr::nullAST); obj_AST = astFactory->create(antlr::RefAST(obj)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); comp.StartPro(name->getText(),p_AST->GetCompileOpt(),obj->getText()); break; } case 3: case ASSIGN: case BLOCK: case BREAK: case CONTINUE: case COMMONDECL: case COMMONDEF: case FOR: case FOREACH: case MPCALL: case MPCALL_PARENT: case PCALL: case PARADECL: case REPEAT: case RETURN: case WHILE: case IDENTIFIER: case CASE: case FORWARD: case GOTO: case IF: case ON_IOERROR: case SWITCH: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: { comp.StartPro(name->getText(),p_AST->GetCompileOpt()); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case PARADECL: { parameter_declaration(_t); _t = _retTree; break; } case 3: case ASSIGN: case BLOCK: case BREAK: case CONTINUE: case COMMONDECL: case COMMONDEF: case FOR: case FOREACH: case MPCALL: case MPCALL_PARENT: case PCALL: case REPEAT: case RETURN: case WHILE: case IDENTIFIER: case CASE: case FORWARD: case GOTO: case IF: case ON_IOERROR: case SWITCH: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: { break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ASSIGN: case BLOCK: case BREAK: case CONTINUE: case COMMONDECL: case COMMONDEF: case FOR: case FOREACH: case MPCALL: case MPCALL_PARENT: case PCALL: case REPEAT: case RETURN: case WHILE: case IDENTIFIER: case CASE: case FORWARD: case GOTO: case IF: case ON_IOERROR: case SWITCH: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: { statement_list(_t); _t = _retTree; comp.SetTree( returnAST); break; } case 3: { break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } if( NCompileErrors() > 0) throw GDLException( i2s(NCompileErrors()) + " compilation error(s) in module " + name->getText() + "."); comp.EndPro(); currentAST = __currentAST19; _t = __t19; _t = _t->getNextSibling(); returnAST = procedure_def_AST; _retTree = _t; } void GDLTreeParser::function_def(RefDNode _t) { RefDNode function_def_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode function_def_AST = RefDNode(antlr::nullAST); RefDNode f = RefDNode(antlr::nullAST); RefDNode f_AST = RefDNode(antlr::nullAST); RefDNode name = RefDNode(antlr::nullAST); RefDNode name_AST = RefDNode(antlr::nullAST); RefDNode obj = RefDNode(antlr::nullAST); RefDNode obj_AST = RefDNode(antlr::nullAST); RefDNode __t24 = _t; f = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode f_AST_in = RefDNode(antlr::nullAST); f_AST = astFactory->create(antlr::RefAST(f)); antlr::ASTPair __currentAST24 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),FUNCTION); _t = _t->getFirstChild(); name = _t; RefDNode name_AST_in = RefDNode(antlr::nullAST); name_AST = astFactory->create(antlr::RefAST(name)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case METHOD: { RefDNode tmp2_AST = RefDNode(antlr::nullAST); RefDNode tmp2_AST_in = RefDNode(antlr::nullAST); tmp2_AST = astFactory->create(antlr::RefAST(_t)); tmp2_AST_in = _t; match(antlr::RefAST(_t),METHOD); _t = _t->getNextSibling(); obj = _t; RefDNode obj_AST_in = RefDNode(antlr::nullAST); obj_AST = astFactory->create(antlr::RefAST(obj)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); comp.StartFun(name->getText(),f_AST->GetCompileOpt(),obj->getText()); break; } case 3: case ASSIGN: case BLOCK: case BREAK: case CONTINUE: case COMMONDECL: case COMMONDEF: case FOR: case FOREACH: case MPCALL: case MPCALL_PARENT: case PCALL: case PARADECL: case REPEAT: case RETURN: case WHILE: case IDENTIFIER: case CASE: case FORWARD: case GOTO: case IF: case ON_IOERROR: case SWITCH: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: { comp.StartFun(name->getText(),f_AST->GetCompileOpt()); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case PARADECL: { parameter_declaration(_t); _t = _retTree; break; } case 3: case ASSIGN: case BLOCK: case BREAK: case CONTINUE: case COMMONDECL: case COMMONDEF: case FOR: case FOREACH: case MPCALL: case MPCALL_PARENT: case PCALL: case REPEAT: case RETURN: case WHILE: case IDENTIFIER: case CASE: case FORWARD: case GOTO: case IF: case ON_IOERROR: case SWITCH: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: { break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ASSIGN: case BLOCK: case BREAK: case CONTINUE: case COMMONDECL: case COMMONDEF: case FOR: case FOREACH: case MPCALL: case MPCALL_PARENT: case PCALL: case REPEAT: case RETURN: case WHILE: case IDENTIFIER: case CASE: case FORWARD: case GOTO: case IF: case ON_IOERROR: case SWITCH: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: { statement_list(_t); _t = _retTree; comp.SetTree( returnAST); break; } case 3: { break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } if( NCompileErrors() > 0) throw GDLException( i2s(NCompileErrors()) + " compilation error(s) in module " + name->getText() + "."); comp.EndFun(); currentAST = __currentAST24; _t = __t24; _t = _t->getNextSibling(); returnAST = function_def_AST; _retTree = _t; } void GDLTreeParser::forward_function(RefDNode _t) { RefDNode forward_function_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode forward_function_AST = RefDNode(antlr::nullAST); RefDNode id = RefDNode(antlr::nullAST); RefDNode id_AST = RefDNode(antlr::nullAST); RefDNode __t9 = _t; RefDNode tmp3_AST = RefDNode(antlr::nullAST); RefDNode tmp3_AST_in = RefDNode(antlr::nullAST); tmp3_AST = astFactory->create(antlr::RefAST(_t)); tmp3_AST_in = _t; antlr::ASTPair __currentAST9 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),FORWARD); _t = _t->getFirstChild(); { // ( ... )+ int _cnt11=0; for (;;) { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; if ((_t->getType() == IDENTIFIER)) { id = _t; RefDNode id_AST_in = RefDNode(antlr::nullAST); id_AST = astFactory->create(antlr::RefAST(id)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); comp.ForwardFunction(id->getText()); } else { if ( _cnt11>=1 ) { goto _loop11; } else {throw antlr::NoViableAltException(antlr::RefAST(_t));} } _cnt11++; } _loop11:; } // ( ... )+ currentAST = __currentAST9; _t = __t9; _t = _t->getNextSibling(); returnAST = forward_function_AST; _retTree = _t; } void GDLTreeParser::common_block(RefDNode _t) { RefDNode common_block_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode common_block_AST = RefDNode(antlr::nullAST); RefDNode id = RefDNode(antlr::nullAST); RefDNode id_AST = RefDNode(antlr::nullAST); RefDNode cv = RefDNode(antlr::nullAST); RefDNode cv_AST = RefDNode(antlr::nullAST); RefDNode id2 = RefDNode(antlr::nullAST); RefDNode id2_AST = RefDNode(antlr::nullAST); if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case COMMONDEF: { RefDNode __t29 = _t; RefDNode tmp4_AST = RefDNode(antlr::nullAST); RefDNode tmp4_AST_in = RefDNode(antlr::nullAST); tmp4_AST = astFactory->create(antlr::RefAST(_t)); tmp4_AST_in = _t; antlr::ASTPair __currentAST29 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),COMMONDEF); _t = _t->getFirstChild(); id = _t; RefDNode id_AST_in = RefDNode(antlr::nullAST); id_AST = astFactory->create(antlr::RefAST(id)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); DCommonBase* actCommon=comp.CommonDef(id->getText()); { // ( ... )+ int _cnt31=0; for (;;) { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; if ((_t->getType() == IDENTIFIER)) { cv = _t; RefDNode cv_AST_in = RefDNode(antlr::nullAST); cv_AST = astFactory->create(antlr::RefAST(cv)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); comp.CommonVar(actCommon,cv->getText()); } else { if ( _cnt31>=1 ) { goto _loop31; } else {throw antlr::NoViableAltException(antlr::RefAST(_t));} } _cnt31++; } _loop31:; } // ( ... )+ currentAST = __currentAST29; _t = __t29; _t = _t->getNextSibling(); break; } case COMMONDECL: { RefDNode __t32 = _t; RefDNode tmp5_AST = RefDNode(antlr::nullAST); RefDNode tmp5_AST_in = RefDNode(antlr::nullAST); tmp5_AST = astFactory->create(antlr::RefAST(_t)); tmp5_AST_in = _t; antlr::ASTPair __currentAST32 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),COMMONDECL); _t = _t->getFirstChild(); id2 = _t; RefDNode id2_AST_in = RefDNode(antlr::nullAST); id2_AST = astFactory->create(antlr::RefAST(id2)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); comp.CommonDecl(id2->getText()); currentAST = __currentAST32; _t = __t32; _t = _t->getNextSibling(); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } returnAST = common_block_AST; _retTree = _t; } void GDLTreeParser::statement_list(RefDNode _t) { RefDNode statement_list_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode statement_list_AST = RefDNode(antlr::nullAST); { // ( ... )+ int _cnt57=0; for (;;) { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ASSIGN: case BLOCK: case BREAK: case CONTINUE: case COMMONDECL: case COMMONDEF: case FOR: case FOREACH: case MPCALL: case MPCALL_PARENT: case PCALL: case REPEAT: case RETURN: case WHILE: case CASE: case FORWARD: case GOTO: case IF: case ON_IOERROR: case SWITCH: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: { statement(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); break; } case IDENTIFIER: { label(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); break; } default: { if ( _cnt57>=1 ) { goto _loop57; } else {throw antlr::NoViableAltException(antlr::RefAST(_t));} } } _cnt57++; } _loop57:; } // ( ... )+ statement_list_AST = RefDNode(currentAST.root); returnAST = statement_list_AST; _retTree = _t; } void GDLTreeParser::interactive(RefDNode _t) { RefDNode interactive_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode interactive_AST = RefDNode(antlr::nullAST); try { // for error handling { // ( ... )+ int _cnt7=0; for (;;) { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; if ((_tokenSet_0.member(_t->getType()))) { statement(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); comp.EndInteractiveStatement(); } else { if ( _cnt7>=1 ) { goto _loop7; } else {throw antlr::NoViableAltException(antlr::RefAST(_t));} } _cnt7++; } _loop7:; } // ( ... )+ interactive_AST = RefDNode(currentAST.root); } catch ( GDLException& e) { throw; } catch ( antlr::NoViableAltException& e) { // SYNTAX ERROR throw GDLException( e.getLine(), e.getColumn(), "Compiler syntax error: "+e.getMessage()); } catch ( antlr::RecognitionException& e) { // SYNTAX ERROR throw GDLException( e.getLine(), e.getColumn(), "General syntax error: "+e.getMessage()); } returnAST = interactive_AST; _retTree = _t; } void GDLTreeParser::statement(RefDNode _t) { RefDNode statement_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode statement_AST = RefDNode(antlr::nullAST); if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ASSIGN: { assign_expr_statement(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); statement_AST = RefDNode(currentAST.root); break; } case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: { comp_assign_expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); statement_AST = RefDNode(currentAST.root); break; } case MPCALL: case MPCALL_PARENT: case PCALL: { procedure_call(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); statement_AST = RefDNode(currentAST.root); break; } case FOR: { for_statement(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); statement_AST = RefDNode(currentAST.root); break; } case FOREACH: { foreach_statement(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); statement_AST = RefDNode(currentAST.root); break; } case REPEAT: { repeat_statement(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); statement_AST = RefDNode(currentAST.root); break; } case WHILE: { while_statement(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); statement_AST = RefDNode(currentAST.root); break; } case RETURN: case GOTO: case ON_IOERROR: { jump_statement(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); statement_AST = RefDNode(currentAST.root); break; } case IF: { if_statement(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); statement_AST = RefDNode(currentAST.root); break; } case CASE: { case_statement(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); statement_AST = RefDNode(currentAST.root); break; } case SWITCH: { switch_statement(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); statement_AST = RefDNode(currentAST.root); break; } case FORWARD: { forward_function(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); statement_AST = RefDNode(currentAST.root); break; } case COMMONDECL: case COMMONDEF: { common_block(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); statement_AST = RefDNode(currentAST.root); break; } case BLOCK: { block(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); statement_AST = RefDNode(currentAST.root); break; } case DEC: { RefDNode __t59 = _t; RefDNode tmp6_AST = RefDNode(antlr::nullAST); RefDNode tmp6_AST_in = RefDNode(antlr::nullAST); tmp6_AST = astFactory->create(antlr::RefAST(_t)); tmp6_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp6_AST)); antlr::ASTPair __currentAST59 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),DEC); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST59; _t = __t59; _t = _t->getNextSibling(); statement_AST = RefDNode(currentAST.root); break; } case INC: { RefDNode __t60 = _t; RefDNode tmp7_AST = RefDNode(antlr::nullAST); RefDNode tmp7_AST_in = RefDNode(antlr::nullAST); tmp7_AST = astFactory->create(antlr::RefAST(_t)); tmp7_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp7_AST)); antlr::ASTPair __currentAST60 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),INC); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST60; _t = __t60; _t = _t->getNextSibling(); statement_AST = RefDNode(currentAST.root); break; } case BREAK: { RefDNode tmp8_AST = RefDNode(antlr::nullAST); RefDNode tmp8_AST_in = RefDNode(antlr::nullAST); tmp8_AST = astFactory->create(antlr::RefAST(_t)); tmp8_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp8_AST)); match(antlr::RefAST(_t),BREAK); _t = _t->getNextSibling(); statement_AST = RefDNode(currentAST.root); break; } case CONTINUE: { RefDNode tmp9_AST = RefDNode(antlr::nullAST); RefDNode tmp9_AST_in = RefDNode(antlr::nullAST); tmp9_AST = astFactory->create(antlr::RefAST(_t)); tmp9_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp9_AST)); match(antlr::RefAST(_t),CONTINUE); _t = _t->getNextSibling(); statement_AST = RefDNode(currentAST.root); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } returnAST = statement_AST; _retTree = _t; } void GDLTreeParser::parameter_declaration(RefDNode _t) { RefDNode parameter_declaration_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode parameter_declaration_AST = RefDNode(antlr::nullAST); RefDNode id = RefDNode(antlr::nullAST); RefDNode id_AST = RefDNode(antlr::nullAST); RefDNode __t13 = _t; RefDNode tmp10_AST = RefDNode(antlr::nullAST); RefDNode tmp10_AST_in = RefDNode(antlr::nullAST); tmp10_AST = astFactory->create(antlr::RefAST(_t)); tmp10_AST_in = _t; antlr::ASTPair __currentAST13 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),PARADECL); _t = _t->getFirstChild(); { // ( ... )+ int _cnt15=0; for (;;) { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case IDENTIFIER: { id = _t; RefDNode id_AST_in = RefDNode(antlr::nullAST); id_AST = astFactory->create(antlr::RefAST(id)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); comp.AddPar(id->getText()); break; } case KEYDECL: { keyword_declaration(_t); _t = _retTree; break; } default: { if ( _cnt15>=1 ) { goto _loop15; } else {throw antlr::NoViableAltException(antlr::RefAST(_t));} } } _cnt15++; } _loop15:; } // ( ... )+ currentAST = __currentAST13; _t = __t13; _t = _t->getNextSibling(); returnAST = parameter_declaration_AST; _retTree = _t; } void GDLTreeParser::keyword_declaration(RefDNode _t) { RefDNode keyword_declaration_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode keyword_declaration_AST = RefDNode(antlr::nullAST); RefDNode key = RefDNode(antlr::nullAST); RefDNode key_AST = RefDNode(antlr::nullAST); RefDNode val = RefDNode(antlr::nullAST); RefDNode val_AST = RefDNode(antlr::nullAST); RefDNode __t17 = _t; RefDNode tmp11_AST = RefDNode(antlr::nullAST); RefDNode tmp11_AST_in = RefDNode(antlr::nullAST); tmp11_AST = astFactory->create(antlr::RefAST(_t)); tmp11_AST_in = _t; antlr::ASTPair __currentAST17 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),KEYDECL); _t = _t->getFirstChild(); key = _t; RefDNode key_AST_in = RefDNode(antlr::nullAST); key_AST = astFactory->create(antlr::RefAST(key)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); val = _t; RefDNode val_AST_in = RefDNode(antlr::nullAST); val_AST = astFactory->create(antlr::RefAST(val)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); currentAST = __currentAST17; _t = __t17; _t = _t->getNextSibling(); comp.AddKey(key->getText(),val->getText()); returnAST = keyword_declaration_AST; _retTree = _t; } void GDLTreeParser::caseswitch_body(RefDNode _t) { RefDNode caseswitch_body_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode caseswitch_body_AST = RefDNode(antlr::nullAST); RefDNode b = RefDNode(antlr::nullAST); RefDNode b_AST = RefDNode(antlr::nullAST); if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case BLOCK: { RefDNode __t34 = _t; b = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode b_AST_in = RefDNode(antlr::nullAST); b_AST = astFactory->create(antlr::RefAST(b)); astFactory->addASTChild(currentAST, antlr::RefAST(b_AST)); antlr::ASTPair __currentAST34 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),BLOCK); _t = _t->getFirstChild(); b_AST->setType(CSBLOCK);b_AST->setText("csblock"); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ASSIGN: case BLOCK: case BREAK: case CONTINUE: case COMMONDECL: case COMMONDEF: case FOR: case FOREACH: case MPCALL: case MPCALL_PARENT: case PCALL: case REPEAT: case RETURN: case WHILE: case IDENTIFIER: case CASE: case FORWARD: case GOTO: case IF: case ON_IOERROR: case SWITCH: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: { statement_list(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); break; } case 3: { break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } currentAST = __currentAST34; _t = __t34; _t = _t->getNextSibling(); caseswitch_body_AST = RefDNode(currentAST.root); break; } case ELSEBLK: { RefDNode __t36 = _t; RefDNode tmp12_AST = RefDNode(antlr::nullAST); RefDNode tmp12_AST_in = RefDNode(antlr::nullAST); tmp12_AST = astFactory->create(antlr::RefAST(_t)); tmp12_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp12_AST)); antlr::ASTPair __currentAST36 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),ELSEBLK); _t = _t->getFirstChild(); { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ASSIGN: case BLOCK: case BREAK: case CONTINUE: case COMMONDECL: case COMMONDEF: case FOR: case FOREACH: case MPCALL: case MPCALL_PARENT: case PCALL: case REPEAT: case RETURN: case WHILE: case IDENTIFIER: case CASE: case FORWARD: case GOTO: case IF: case ON_IOERROR: case SWITCH: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: { statement_list(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); break; } case 3: { break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } currentAST = __currentAST36; _t = __t36; _t = _t->getNextSibling(); caseswitch_body_AST = RefDNode(currentAST.root); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } returnAST = caseswitch_body_AST; _retTree = _t; } void GDLTreeParser::expr(RefDNode _t) { RefDNode expr_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode expr_AST = RefDNode(antlr::nullAST); if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ARRAYEXPR: case EXPR: case SYSVAR: case VAR: { array_expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr_AST = RefDNode(currentAST.root); break; } case DOT: { RefDNode __t207 = _t; RefDNode tmp13_AST = RefDNode(antlr::nullAST); RefDNode tmp13_AST_in = RefDNode(antlr::nullAST); tmp13_AST = astFactory->create(antlr::RefAST(_t)); tmp13_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp13_AST)); antlr::ASTPair __currentAST207 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),DOT); _t = _t->getFirstChild(); tag_array_expr_1st(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); { // ( ... )+ int _cnt209=0; for (;;) { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; if ((_t->getType() == ARRAYEXPR || _t->getType() == EXPR || _t->getType() == IDENTIFIER)) { tag_array_expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); } else { if ( _cnt209>=1 ) { goto _loop209; } else {throw antlr::NoViableAltException(antlr::RefAST(_t));} } _cnt209++; } _loop209:; } // ( ... )+ currentAST = __currentAST207; _t = __t207; _t = _t->getNextSibling(); expr_AST = RefDNode(currentAST.root); break; } case DEREF: { RefDNode __t210 = _t; RefDNode tmp14_AST = RefDNode(antlr::nullAST); RefDNode tmp14_AST_in = RefDNode(antlr::nullAST); tmp14_AST = astFactory->create(antlr::RefAST(_t)); tmp14_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp14_AST)); antlr::ASTPair __currentAST210 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),DEREF); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST210; _t = __t210; _t = _t->getNextSibling(); expr_AST = RefDNode(currentAST.root); break; } case ASSIGN: case ARRAYDEF: case ARRAYDEF_CONST: case ARRAYEXPR_FCALL: case ARRAYEXPR_MFCALL: case CONSTANT: case FCALL: case GDLNULL: case MFCALL: case MFCALL_PARENT: case NSTRUC_REF: case POSTDEC: case POSTINC: case STRUC: case UMINUS: case AND_OP: case EQ_OP: case GE_OP: case GT_OP: case LE_OP: case LT_OP: case MOD_OP: case NE_OP: case NOT_OP: case OR_OP: case XOR_OP: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: case SLASH: case ASTERIX: case POW: case MATRIX_OP1: case MATRIX_OP2: case PLUS: case MINUS: case LTMARK: case GTMARK: case LOG_NEG: case LOG_AND: case LOG_OR: case QUESTION: { op_expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr_AST = RefDNode(currentAST.root); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } returnAST = expr_AST; _retTree = _t; } void GDLTreeParser::switch_statement(RefDNode _t) { RefDNode switch_statement_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode switch_statement_AST = RefDNode(antlr::nullAST); RefDNode s = RefDNode(antlr::nullAST); RefDNode s_AST = RefDNode(antlr::nullAST); int labelStart = comp.NDefLabel(); RefDNode __t39 = _t; s = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode s_AST_in = RefDNode(antlr::nullAST); s_AST = astFactory->create(antlr::RefAST(s)); astFactory->addASTChild(currentAST, antlr::RefAST(s_AST)); antlr::ASTPair __currentAST39 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),SWITCH); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); { // ( ... )* for (;;) { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; if ((_t->getType() == BLOCK || _t->getType() == ELSEBLK)) { caseswitch_body(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); } else { goto _loop41; } } _loop41:; } // ( ... )* currentAST = __currentAST39; _t = __t39; _t = _t->getNextSibling(); s_AST->SetLabelRange( labelStart, comp.NDefLabel()); switch_statement_AST = RefDNode(currentAST.root); returnAST = switch_statement_AST; _retTree = _t; } void GDLTreeParser::case_statement(RefDNode _t) { RefDNode case_statement_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode case_statement_AST = RefDNode(antlr::nullAST); RefDNode c = RefDNode(antlr::nullAST); RefDNode c_AST = RefDNode(antlr::nullAST); int labelStart = comp.NDefLabel(); RefDNode __t43 = _t; c = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode c_AST_in = RefDNode(antlr::nullAST); c_AST = astFactory->create(antlr::RefAST(c)); astFactory->addASTChild(currentAST, antlr::RefAST(c_AST)); antlr::ASTPair __currentAST43 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),CASE); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); { // ( ... )* for (;;) { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; if ((_t->getType() == BLOCK || _t->getType() == ELSEBLK)) { caseswitch_body(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); } else { goto _loop45; } } _loop45:; } // ( ... )* currentAST = __currentAST43; _t = __t43; _t = _t->getNextSibling(); c_AST->SetLabelRange( labelStart, comp.NDefLabel()); case_statement_AST = RefDNode(currentAST.root); returnAST = case_statement_AST; _retTree = _t; } void GDLTreeParser::block(RefDNode _t) { RefDNode block_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode block_AST = RefDNode(antlr::nullAST); RefDNode b = RefDNode(antlr::nullAST); RefDNode b_AST = RefDNode(antlr::nullAST); // int labelStart = comp.NDefLabel(); RefDNode __t47 = _t; b = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode b_AST_in = RefDNode(antlr::nullAST); b_AST = astFactory->create(antlr::RefAST(b)); astFactory->addASTChild(currentAST, antlr::RefAST(b_AST)); antlr::ASTPair __currentAST47 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),BLOCK); _t = _t->getFirstChild(); { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ASSIGN: case BLOCK: case BREAK: case CONTINUE: case COMMONDECL: case COMMONDEF: case FOR: case FOREACH: case MPCALL: case MPCALL_PARENT: case PCALL: case REPEAT: case RETURN: case WHILE: case IDENTIFIER: case CASE: case FORWARD: case GOTO: case IF: case ON_IOERROR: case SWITCH: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: { statement_list(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); break; } case 3: { break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } currentAST = __currentAST47; _t = __t47; _t = _t->getNextSibling(); // #b->SetLabelRange( labelStart, comp.NDefLabel()); block_AST = RefDNode(currentAST.root); returnAST = block_AST; _retTree = _t; } void GDLTreeParser::unblock(RefDNode _t) { RefDNode unblock_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode unblock_AST = RefDNode(antlr::nullAST); RefDNode b = RefDNode(antlr::nullAST); RefDNode b_AST = RefDNode(antlr::nullAST); RefDNode s_AST = RefDNode(antlr::nullAST); RefDNode s = RefDNode(antlr::nullAST); RefDNode __t50 = _t; b = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode b_AST_in = RefDNode(antlr::nullAST); b_AST = astFactory->create(antlr::RefAST(b)); antlr::ASTPair __currentAST50 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),BLOCK); _t = _t->getFirstChild(); { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ASSIGN: case BLOCK: case BREAK: case CONTINUE: case COMMONDECL: case COMMONDEF: case FOR: case FOREACH: case MPCALL: case MPCALL_PARENT: case PCALL: case REPEAT: case RETURN: case WHILE: case IDENTIFIER: case CASE: case FORWARD: case GOTO: case IF: case ON_IOERROR: case SWITCH: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: { s = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; statement_list(_t); _t = _retTree; s_AST = returnAST; unblock_AST = RefDNode(currentAST.root); unblock_AST = s_AST; currentAST.root = unblock_AST; if ( unblock_AST!=RefDNode(antlr::nullAST) && unblock_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = unblock_AST->getFirstChild(); else currentAST.child = unblock_AST; currentAST.advanceChildToEnd(); break; } case 3: { unblock_AST = RefDNode(currentAST.root); unblock_AST = b_AST; currentAST.root = unblock_AST; if ( unblock_AST!=RefDNode(antlr::nullAST) && unblock_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = unblock_AST->getFirstChild(); else currentAST.child = unblock_AST; currentAST.advanceChildToEnd(); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } currentAST = __currentAST50; _t = __t50; _t = _t->getNextSibling(); returnAST = unblock_AST; _retTree = _t; } void GDLTreeParser::unblock_empty(RefDNode _t) { RefDNode unblock_empty_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode unblock_empty_AST = RefDNode(antlr::nullAST); RefDNode b = RefDNode(antlr::nullAST); RefDNode b_AST = RefDNode(antlr::nullAST); RefDNode s_AST = RefDNode(antlr::nullAST); RefDNode s = RefDNode(antlr::nullAST); RefDNode __t53 = _t; b = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode b_AST_in = RefDNode(antlr::nullAST); b_AST = astFactory->create(antlr::RefAST(b)); antlr::ASTPair __currentAST53 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),BLOCK); _t = _t->getFirstChild(); { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ASSIGN: case BLOCK: case BREAK: case CONTINUE: case COMMONDECL: case COMMONDEF: case FOR: case FOREACH: case MPCALL: case MPCALL_PARENT: case PCALL: case REPEAT: case RETURN: case WHILE: case IDENTIFIER: case CASE: case FORWARD: case GOTO: case IF: case ON_IOERROR: case SWITCH: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: { s = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; statement_list(_t); _t = _retTree; s_AST = returnAST; unblock_empty_AST = RefDNode(currentAST.root); unblock_empty_AST = s_AST; currentAST.root = unblock_empty_AST; if ( unblock_empty_AST!=RefDNode(antlr::nullAST) && unblock_empty_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = unblock_empty_AST->getFirstChild(); else currentAST.child = unblock_empty_AST; currentAST.advanceChildToEnd(); break; } case 3: { break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } currentAST = __currentAST53; _t = __t53; _t = _t->getNextSibling(); returnAST = unblock_empty_AST; _retTree = _t; } void GDLTreeParser::label(RefDNode _t) { RefDNode label_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode label_AST = RefDNode(antlr::nullAST); RefDNode i = RefDNode(antlr::nullAST); RefDNode i_AST = RefDNode(antlr::nullAST); RefDNode __t72 = _t; i = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode i_AST_in = RefDNode(antlr::nullAST); i_AST = astFactory->create(antlr::RefAST(i)); antlr::ASTPair __currentAST72 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getFirstChild(); RefDNode tmp15_AST = RefDNode(antlr::nullAST); RefDNode tmp15_AST_in = RefDNode(antlr::nullAST); tmp15_AST = astFactory->create(antlr::RefAST(_t)); tmp15_AST_in = _t; match(antlr::RefAST(_t),COLON); _t = _t->getNextSibling(); currentAST = __currentAST72; _t = __t72; _t = _t->getNextSibling(); label_AST = RefDNode(currentAST.root); label_AST=astFactory->create(LABEL,i->getText()); label_AST->SetLine( i->getLine()); comp.Label(label_AST); currentAST.root = label_AST; if ( label_AST!=RefDNode(antlr::nullAST) && label_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = label_AST->getFirstChild(); else currentAST.child = label_AST; currentAST.advanceChildToEnd(); returnAST = label_AST; _retTree = _t; } void GDLTreeParser::assign_expr_statement(RefDNode _t) { RefDNode assign_expr_statement_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode assign_expr_statement_AST = RefDNode(antlr::nullAST); RefDNode a = RefDNode(antlr::nullAST); RefDNode a_AST = RefDNode(antlr::nullAST); RefDNode l_AST = RefDNode(antlr::nullAST); RefDNode l = RefDNode(antlr::nullAST); RefDNode r_AST = RefDNode(antlr::nullAST); RefDNode r = RefDNode(antlr::nullAST); RefDNode __t122 = _t; a = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a_AST_in = RefDNode(antlr::nullAST); a_AST = astFactory->create(antlr::RefAST(a)); antlr::ASTPair __currentAST122 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),ASSIGN); _t = _t->getFirstChild(); l = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l_AST = returnAST; r = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r_AST = returnAST; currentAST = __currentAST122; _t = __t122; _t = _t->getNextSibling(); assign_expr_statement_AST = RefDNode(currentAST.root); if( !SelfAssignment( l_AST, r_AST)) { AssignReplace( l_AST, a_AST); // int lT = #l->getType(); // if( lT == FCALL || lT == MFCALL || lT == MFCALL_PARENT || // lT == FCALL_LIB || lT == MFCALL_LIB || lT == MFCALL_PARENT_LIB || // lT == DEREF || lT == VAR || lT == VARPTR) // #a->setType( ASSIGN_REPLACE); assign_expr_statement_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(a_AST))->add(antlr::RefAST(r_AST))->add(antlr::RefAST(l_AST)))); } else { assign_expr_statement_AST=RefDNode(astFactory->make((new antlr::ASTArray(1))->add(antlr::RefAST(astFactory->create(BLOCK,"block"))))); } currentAST.root = assign_expr_statement_AST; if ( assign_expr_statement_AST!=RefDNode(antlr::nullAST) && assign_expr_statement_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = assign_expr_statement_AST->getFirstChild(); else currentAST.child = assign_expr_statement_AST; currentAST.advanceChildToEnd(); returnAST = assign_expr_statement_AST; _retTree = _t; } void GDLTreeParser::comp_assign_expr(RefDNode _t) { RefDNode comp_assign_expr_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode comp_assign_expr_AST = RefDNode(antlr::nullAST); RefDNode a1 = RefDNode(antlr::nullAST); RefDNode a1_AST = RefDNode(antlr::nullAST); RefDNode l1_AST = RefDNode(antlr::nullAST); RefDNode l1 = RefDNode(antlr::nullAST); RefDNode r1_AST = RefDNode(antlr::nullAST); RefDNode r1 = RefDNode(antlr::nullAST); RefDNode a2 = RefDNode(antlr::nullAST); RefDNode a2_AST = RefDNode(antlr::nullAST); RefDNode l2_AST = RefDNode(antlr::nullAST); RefDNode l2 = RefDNode(antlr::nullAST); RefDNode r2_AST = RefDNode(antlr::nullAST); RefDNode r2 = RefDNode(antlr::nullAST); RefDNode a3 = RefDNode(antlr::nullAST); RefDNode a3_AST = RefDNode(antlr::nullAST); RefDNode l3_AST = RefDNode(antlr::nullAST); RefDNode l3 = RefDNode(antlr::nullAST); RefDNode r3_AST = RefDNode(antlr::nullAST); RefDNode r3 = RefDNode(antlr::nullAST); RefDNode a4 = RefDNode(antlr::nullAST); RefDNode a4_AST = RefDNode(antlr::nullAST); RefDNode l4_AST = RefDNode(antlr::nullAST); RefDNode l4 = RefDNode(antlr::nullAST); RefDNode r4_AST = RefDNode(antlr::nullAST); RefDNode r4 = RefDNode(antlr::nullAST); RefDNode a5 = RefDNode(antlr::nullAST); RefDNode a5_AST = RefDNode(antlr::nullAST); RefDNode l5_AST = RefDNode(antlr::nullAST); RefDNode l5 = RefDNode(antlr::nullAST); RefDNode r5_AST = RefDNode(antlr::nullAST); RefDNode r5 = RefDNode(antlr::nullAST); RefDNode a6 = RefDNode(antlr::nullAST); RefDNode a6_AST = RefDNode(antlr::nullAST); RefDNode l6_AST = RefDNode(antlr::nullAST); RefDNode l6 = RefDNode(antlr::nullAST); RefDNode r6_AST = RefDNode(antlr::nullAST); RefDNode r6 = RefDNode(antlr::nullAST); RefDNode a7 = RefDNode(antlr::nullAST); RefDNode a7_AST = RefDNode(antlr::nullAST); RefDNode l7_AST = RefDNode(antlr::nullAST); RefDNode l7 = RefDNode(antlr::nullAST); RefDNode r7_AST = RefDNode(antlr::nullAST); RefDNode r7 = RefDNode(antlr::nullAST); RefDNode a8 = RefDNode(antlr::nullAST); RefDNode a8_AST = RefDNode(antlr::nullAST); RefDNode l8_AST = RefDNode(antlr::nullAST); RefDNode l8 = RefDNode(antlr::nullAST); RefDNode r8_AST = RefDNode(antlr::nullAST); RefDNode r8 = RefDNode(antlr::nullAST); RefDNode a9 = RefDNode(antlr::nullAST); RefDNode a9_AST = RefDNode(antlr::nullAST); RefDNode l9_AST = RefDNode(antlr::nullAST); RefDNode l9 = RefDNode(antlr::nullAST); RefDNode r9_AST = RefDNode(antlr::nullAST); RefDNode r9 = RefDNode(antlr::nullAST); RefDNode a10 = RefDNode(antlr::nullAST); RefDNode a10_AST = RefDNode(antlr::nullAST); RefDNode l10_AST = RefDNode(antlr::nullAST); RefDNode l10 = RefDNode(antlr::nullAST); RefDNode r10_AST = RefDNode(antlr::nullAST); RefDNode r10 = RefDNode(antlr::nullAST); RefDNode a11 = RefDNode(antlr::nullAST); RefDNode a11_AST = RefDNode(antlr::nullAST); RefDNode l11_AST = RefDNode(antlr::nullAST); RefDNode l11 = RefDNode(antlr::nullAST); RefDNode r11_AST = RefDNode(antlr::nullAST); RefDNode r11 = RefDNode(antlr::nullAST); RefDNode a12 = RefDNode(antlr::nullAST); RefDNode a12_AST = RefDNode(antlr::nullAST); RefDNode l12_AST = RefDNode(antlr::nullAST); RefDNode l12 = RefDNode(antlr::nullAST); RefDNode r12_AST = RefDNode(antlr::nullAST); RefDNode r12 = RefDNode(antlr::nullAST); RefDNode a13 = RefDNode(antlr::nullAST); RefDNode a13_AST = RefDNode(antlr::nullAST); RefDNode l13_AST = RefDNode(antlr::nullAST); RefDNode l13 = RefDNode(antlr::nullAST); RefDNode r13_AST = RefDNode(antlr::nullAST); RefDNode r13 = RefDNode(antlr::nullAST); RefDNode a14 = RefDNode(antlr::nullAST); RefDNode a14_AST = RefDNode(antlr::nullAST); RefDNode l14_AST = RefDNode(antlr::nullAST); RefDNode l14 = RefDNode(antlr::nullAST); RefDNode r14_AST = RefDNode(antlr::nullAST); RefDNode r14 = RefDNode(antlr::nullAST); RefDNode a15 = RefDNode(antlr::nullAST); RefDNode a15_AST = RefDNode(antlr::nullAST); RefDNode l15_AST = RefDNode(antlr::nullAST); RefDNode l15 = RefDNode(antlr::nullAST); RefDNode r15_AST = RefDNode(antlr::nullAST); RefDNode r15 = RefDNode(antlr::nullAST); RefDNode a16 = RefDNode(antlr::nullAST); RefDNode a16_AST = RefDNode(antlr::nullAST); RefDNode l16_AST = RefDNode(antlr::nullAST); RefDNode l16 = RefDNode(antlr::nullAST); RefDNode r16_AST = RefDNode(antlr::nullAST); RefDNode r16 = RefDNode(antlr::nullAST); RefDNode a17 = RefDNode(antlr::nullAST); RefDNode a17_AST = RefDNode(antlr::nullAST); RefDNode l17_AST = RefDNode(antlr::nullAST); RefDNode l17 = RefDNode(antlr::nullAST); RefDNode r17_AST = RefDNode(antlr::nullAST); RefDNode r17 = RefDNode(antlr::nullAST); RefDNode a18 = RefDNode(antlr::nullAST); RefDNode a18_AST = RefDNode(antlr::nullAST); RefDNode l18_AST = RefDNode(antlr::nullAST); RefDNode l18 = RefDNode(antlr::nullAST); RefDNode r18_AST = RefDNode(antlr::nullAST); RefDNode r18 = RefDNode(antlr::nullAST); RefDNode a19 = RefDNode(antlr::nullAST); RefDNode a19_AST = RefDNode(antlr::nullAST); RefDNode l19_AST = RefDNode(antlr::nullAST); RefDNode l19 = RefDNode(antlr::nullAST); RefDNode r19_AST = RefDNode(antlr::nullAST); RefDNode r19 = RefDNode(antlr::nullAST); RefDNode l; { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case AND_OP_EQ: { RefDNode __t125 = _t; a1 = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a1_AST_in = RefDNode(antlr::nullAST); a1_AST = astFactory->create(antlr::RefAST(a1)); antlr::ASTPair __currentAST125 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),AND_OP_EQ); _t = _t->getFirstChild(); l1 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l1_AST = returnAST; r1 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r1_AST = returnAST; currentAST = __currentAST125; _t = __t125; _t = _t->getNextSibling(); comp_assign_expr_AST = RefDNode(currentAST.root); l=l1_AST; comp_assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ASSIGN,":=")))->add(antlr::RefAST(RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(AND_OP,"and")))->add(antlr::RefAST(l1_AST))->add(antlr::RefAST(r1_AST))))))->add(antlr::RefAST(RemoveNextSibling(l1_AST))))); currentAST.root = comp_assign_expr_AST; if ( comp_assign_expr_AST!=RefDNode(antlr::nullAST) && comp_assign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = comp_assign_expr_AST->getFirstChild(); else currentAST.child = comp_assign_expr_AST; currentAST.advanceChildToEnd(); break; } case ASTERIX_EQ: { RefDNode __t126 = _t; a2 = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a2_AST_in = RefDNode(antlr::nullAST); a2_AST = astFactory->create(antlr::RefAST(a2)); antlr::ASTPair __currentAST126 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),ASTERIX_EQ); _t = _t->getFirstChild(); l2 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l2_AST = returnAST; r2 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r2_AST = returnAST; currentAST = __currentAST126; _t = __t126; _t = _t->getNextSibling(); comp_assign_expr_AST = RefDNode(currentAST.root); l=l2_AST; comp_assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ASSIGN,":=")))->add(antlr::RefAST(RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ASTERIX,"*")))->add(antlr::RefAST(l2_AST))->add(antlr::RefAST(r2_AST))))))->add(antlr::RefAST(RemoveNextSibling(l2_AST))))); currentAST.root = comp_assign_expr_AST; if ( comp_assign_expr_AST!=RefDNode(antlr::nullAST) && comp_assign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = comp_assign_expr_AST->getFirstChild(); else currentAST.child = comp_assign_expr_AST; currentAST.advanceChildToEnd(); break; } case EQ_OP_EQ: { RefDNode __t127 = _t; a3 = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a3_AST_in = RefDNode(antlr::nullAST); a3_AST = astFactory->create(antlr::RefAST(a3)); antlr::ASTPair __currentAST127 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),EQ_OP_EQ); _t = _t->getFirstChild(); l3 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l3_AST = returnAST; r3 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r3_AST = returnAST; currentAST = __currentAST127; _t = __t127; _t = _t->getNextSibling(); comp_assign_expr_AST = RefDNode(currentAST.root); l=l3_AST; comp_assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ASSIGN,":=")))->add(antlr::RefAST(RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(EQ_OP,"eq")))->add(antlr::RefAST(l3_AST))->add(antlr::RefAST(r3_AST))))))->add(antlr::RefAST(RemoveNextSibling(l3_AST))))); currentAST.root = comp_assign_expr_AST; if ( comp_assign_expr_AST!=RefDNode(antlr::nullAST) && comp_assign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = comp_assign_expr_AST->getFirstChild(); else currentAST.child = comp_assign_expr_AST; currentAST.advanceChildToEnd(); break; } case GE_OP_EQ: { RefDNode __t128 = _t; a4 = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a4_AST_in = RefDNode(antlr::nullAST); a4_AST = astFactory->create(antlr::RefAST(a4)); antlr::ASTPair __currentAST128 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),GE_OP_EQ); _t = _t->getFirstChild(); l4 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l4_AST = returnAST; r4 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r4_AST = returnAST; currentAST = __currentAST128; _t = __t128; _t = _t->getNextSibling(); comp_assign_expr_AST = RefDNode(currentAST.root); l=l4_AST; comp_assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ASSIGN,":=")))->add(antlr::RefAST(RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(GE_OP,"ge")))->add(antlr::RefAST(l4_AST))->add(antlr::RefAST(r4_AST))))))->add(antlr::RefAST(RemoveNextSibling(l4_AST))))); currentAST.root = comp_assign_expr_AST; if ( comp_assign_expr_AST!=RefDNode(antlr::nullAST) && comp_assign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = comp_assign_expr_AST->getFirstChild(); else currentAST.child = comp_assign_expr_AST; currentAST.advanceChildToEnd(); break; } case GTMARK_EQ: { RefDNode __t129 = _t; a5 = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a5_AST_in = RefDNode(antlr::nullAST); a5_AST = astFactory->create(antlr::RefAST(a5)); antlr::ASTPair __currentAST129 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),GTMARK_EQ); _t = _t->getFirstChild(); l5 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l5_AST = returnAST; r5 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r5_AST = returnAST; currentAST = __currentAST129; _t = __t129; _t = _t->getNextSibling(); comp_assign_expr_AST = RefDNode(currentAST.root); l=l5_AST; comp_assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ASSIGN,":=")))->add(antlr::RefAST(RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(GTMARK,">")))->add(antlr::RefAST(l5_AST))->add(antlr::RefAST(r5_AST))))))->add(antlr::RefAST(RemoveNextSibling(l5_AST))))); currentAST.root = comp_assign_expr_AST; if ( comp_assign_expr_AST!=RefDNode(antlr::nullAST) && comp_assign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = comp_assign_expr_AST->getFirstChild(); else currentAST.child = comp_assign_expr_AST; currentAST.advanceChildToEnd(); break; } case GT_OP_EQ: { RefDNode __t130 = _t; a6 = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a6_AST_in = RefDNode(antlr::nullAST); a6_AST = astFactory->create(antlr::RefAST(a6)); antlr::ASTPair __currentAST130 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),GT_OP_EQ); _t = _t->getFirstChild(); l6 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l6_AST = returnAST; r6 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r6_AST = returnAST; currentAST = __currentAST130; _t = __t130; _t = _t->getNextSibling(); comp_assign_expr_AST = RefDNode(currentAST.root); l=l6_AST; comp_assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ASSIGN,":=")))->add(antlr::RefAST(RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(GT_OP,"gt")))->add(antlr::RefAST(l6_AST))->add(antlr::RefAST(r6_AST))))))->add(antlr::RefAST(RemoveNextSibling(l6_AST))))); currentAST.root = comp_assign_expr_AST; if ( comp_assign_expr_AST!=RefDNode(antlr::nullAST) && comp_assign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = comp_assign_expr_AST->getFirstChild(); else currentAST.child = comp_assign_expr_AST; currentAST.advanceChildToEnd(); break; } case LE_OP_EQ: { RefDNode __t131 = _t; a7 = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a7_AST_in = RefDNode(antlr::nullAST); a7_AST = astFactory->create(antlr::RefAST(a7)); antlr::ASTPair __currentAST131 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),LE_OP_EQ); _t = _t->getFirstChild(); l7 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l7_AST = returnAST; r7 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r7_AST = returnAST; currentAST = __currentAST131; _t = __t131; _t = _t->getNextSibling(); comp_assign_expr_AST = RefDNode(currentAST.root); l=l7_AST; comp_assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ASSIGN,":=")))->add(antlr::RefAST(RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(LE_OP,"le")))->add(antlr::RefAST(l7_AST))->add(antlr::RefAST(r7_AST))))))->add(antlr::RefAST(RemoveNextSibling(l7_AST))))); currentAST.root = comp_assign_expr_AST; if ( comp_assign_expr_AST!=RefDNode(antlr::nullAST) && comp_assign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = comp_assign_expr_AST->getFirstChild(); else currentAST.child = comp_assign_expr_AST; currentAST.advanceChildToEnd(); break; } case LTMARK_EQ: { RefDNode __t132 = _t; a8 = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a8_AST_in = RefDNode(antlr::nullAST); a8_AST = astFactory->create(antlr::RefAST(a8)); antlr::ASTPair __currentAST132 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),LTMARK_EQ); _t = _t->getFirstChild(); l8 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l8_AST = returnAST; r8 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r8_AST = returnAST; currentAST = __currentAST132; _t = __t132; _t = _t->getNextSibling(); comp_assign_expr_AST = RefDNode(currentAST.root); l=l8_AST; comp_assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ASSIGN,":=")))->add(antlr::RefAST(RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(LTMARK,"<")))->add(antlr::RefAST(l8_AST))->add(antlr::RefAST(r8_AST))))))->add(antlr::RefAST(RemoveNextSibling(l8_AST))))); currentAST.root = comp_assign_expr_AST; if ( comp_assign_expr_AST!=RefDNode(antlr::nullAST) && comp_assign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = comp_assign_expr_AST->getFirstChild(); else currentAST.child = comp_assign_expr_AST; currentAST.advanceChildToEnd(); break; } case LT_OP_EQ: { RefDNode __t133 = _t; a9 = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a9_AST_in = RefDNode(antlr::nullAST); a9_AST = astFactory->create(antlr::RefAST(a9)); antlr::ASTPair __currentAST133 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),LT_OP_EQ); _t = _t->getFirstChild(); l9 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l9_AST = returnAST; r9 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r9_AST = returnAST; currentAST = __currentAST133; _t = __t133; _t = _t->getNextSibling(); comp_assign_expr_AST = RefDNode(currentAST.root); l=l9_AST; comp_assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ASSIGN,":=")))->add(antlr::RefAST(RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(LT_OP,"lt")))->add(antlr::RefAST(l9_AST))->add(antlr::RefAST(r9_AST))))))->add(antlr::RefAST(RemoveNextSibling(l9_AST))))); currentAST.root = comp_assign_expr_AST; if ( comp_assign_expr_AST!=RefDNode(antlr::nullAST) && comp_assign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = comp_assign_expr_AST->getFirstChild(); else currentAST.child = comp_assign_expr_AST; currentAST.advanceChildToEnd(); break; } case MATRIX_OP1_EQ: { RefDNode __t134 = _t; a10 = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a10_AST_in = RefDNode(antlr::nullAST); a10_AST = astFactory->create(antlr::RefAST(a10)); antlr::ASTPair __currentAST134 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),MATRIX_OP1_EQ); _t = _t->getFirstChild(); l10 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l10_AST = returnAST; r10 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r10_AST = returnAST; currentAST = __currentAST134; _t = __t134; _t = _t->getNextSibling(); comp_assign_expr_AST = RefDNode(currentAST.root); l=l10_AST; comp_assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ASSIGN,":=")))->add(antlr::RefAST(RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(MATRIX_OP1,"#")))->add(antlr::RefAST(l10_AST))->add(antlr::RefAST(r10_AST))))))->add(antlr::RefAST(RemoveNextSibling(l10_AST))))); currentAST.root = comp_assign_expr_AST; if ( comp_assign_expr_AST!=RefDNode(antlr::nullAST) && comp_assign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = comp_assign_expr_AST->getFirstChild(); else currentAST.child = comp_assign_expr_AST; currentAST.advanceChildToEnd(); break; } case MATRIX_OP2_EQ: { RefDNode __t135 = _t; a11 = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a11_AST_in = RefDNode(antlr::nullAST); a11_AST = astFactory->create(antlr::RefAST(a11)); antlr::ASTPair __currentAST135 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),MATRIX_OP2_EQ); _t = _t->getFirstChild(); l11 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l11_AST = returnAST; r11 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r11_AST = returnAST; currentAST = __currentAST135; _t = __t135; _t = _t->getNextSibling(); comp_assign_expr_AST = RefDNode(currentAST.root); l=l11_AST; comp_assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ASSIGN,":=")))->add(antlr::RefAST(RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(MATRIX_OP2,"##")))->add(antlr::RefAST(l11_AST))->add(antlr::RefAST(r11_AST))))))->add(antlr::RefAST(RemoveNextSibling(l11_AST))))); currentAST.root = comp_assign_expr_AST; if ( comp_assign_expr_AST!=RefDNode(antlr::nullAST) && comp_assign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = comp_assign_expr_AST->getFirstChild(); else currentAST.child = comp_assign_expr_AST; currentAST.advanceChildToEnd(); break; } case MINUS_EQ: { RefDNode __t136 = _t; a12 = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a12_AST_in = RefDNode(antlr::nullAST); a12_AST = astFactory->create(antlr::RefAST(a12)); antlr::ASTPair __currentAST136 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),MINUS_EQ); _t = _t->getFirstChild(); l12 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l12_AST = returnAST; r12 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r12_AST = returnAST; currentAST = __currentAST136; _t = __t136; _t = _t->getNextSibling(); comp_assign_expr_AST = RefDNode(currentAST.root); l=l12_AST; comp_assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ASSIGN,":=")))->add(antlr::RefAST(RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(MINUS,"-")))->add(antlr::RefAST(l12_AST))->add(antlr::RefAST(r12_AST))))))->add(antlr::RefAST(RemoveNextSibling(l12_AST))))); currentAST.root = comp_assign_expr_AST; if ( comp_assign_expr_AST!=RefDNode(antlr::nullAST) && comp_assign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = comp_assign_expr_AST->getFirstChild(); else currentAST.child = comp_assign_expr_AST; currentAST.advanceChildToEnd(); break; } case MOD_OP_EQ: { RefDNode __t137 = _t; a13 = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a13_AST_in = RefDNode(antlr::nullAST); a13_AST = astFactory->create(antlr::RefAST(a13)); antlr::ASTPair __currentAST137 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),MOD_OP_EQ); _t = _t->getFirstChild(); l13 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l13_AST = returnAST; r13 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r13_AST = returnAST; currentAST = __currentAST137; _t = __t137; _t = _t->getNextSibling(); comp_assign_expr_AST = RefDNode(currentAST.root); l=l13_AST; comp_assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ASSIGN,":=")))->add(antlr::RefAST(RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(MOD_OP,"mod")))->add(antlr::RefAST(l13_AST))->add(antlr::RefAST(r13_AST))))))->add(antlr::RefAST(RemoveNextSibling(l13_AST))))); currentAST.root = comp_assign_expr_AST; if ( comp_assign_expr_AST!=RefDNode(antlr::nullAST) && comp_assign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = comp_assign_expr_AST->getFirstChild(); else currentAST.child = comp_assign_expr_AST; currentAST.advanceChildToEnd(); break; } case NE_OP_EQ: { RefDNode __t138 = _t; a14 = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a14_AST_in = RefDNode(antlr::nullAST); a14_AST = astFactory->create(antlr::RefAST(a14)); antlr::ASTPair __currentAST138 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),NE_OP_EQ); _t = _t->getFirstChild(); l14 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l14_AST = returnAST; r14 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r14_AST = returnAST; currentAST = __currentAST138; _t = __t138; _t = _t->getNextSibling(); comp_assign_expr_AST = RefDNode(currentAST.root); l=l14_AST; comp_assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ASSIGN,":=")))->add(antlr::RefAST(RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(NE_OP,"ne")))->add(antlr::RefAST(l14_AST))->add(antlr::RefAST(r14_AST))))))->add(antlr::RefAST(RemoveNextSibling(l14_AST))))); currentAST.root = comp_assign_expr_AST; if ( comp_assign_expr_AST!=RefDNode(antlr::nullAST) && comp_assign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = comp_assign_expr_AST->getFirstChild(); else currentAST.child = comp_assign_expr_AST; currentAST.advanceChildToEnd(); break; } case OR_OP_EQ: { RefDNode __t139 = _t; a15 = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a15_AST_in = RefDNode(antlr::nullAST); a15_AST = astFactory->create(antlr::RefAST(a15)); antlr::ASTPair __currentAST139 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),OR_OP_EQ); _t = _t->getFirstChild(); l15 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l15_AST = returnAST; r15 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r15_AST = returnAST; currentAST = __currentAST139; _t = __t139; _t = _t->getNextSibling(); comp_assign_expr_AST = RefDNode(currentAST.root); l=l15_AST; comp_assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ASSIGN,":=")))->add(antlr::RefAST(RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(OR_OP,"or")))->add(antlr::RefAST(l15_AST))->add(antlr::RefAST(r15_AST))))))->add(antlr::RefAST(RemoveNextSibling(l15_AST))))); currentAST.root = comp_assign_expr_AST; if ( comp_assign_expr_AST!=RefDNode(antlr::nullAST) && comp_assign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = comp_assign_expr_AST->getFirstChild(); else currentAST.child = comp_assign_expr_AST; currentAST.advanceChildToEnd(); break; } case PLUS_EQ: { RefDNode __t140 = _t; a16 = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a16_AST_in = RefDNode(antlr::nullAST); a16_AST = astFactory->create(antlr::RefAST(a16)); antlr::ASTPair __currentAST140 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),PLUS_EQ); _t = _t->getFirstChild(); l16 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l16_AST = returnAST; r16 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r16_AST = returnAST; currentAST = __currentAST140; _t = __t140; _t = _t->getNextSibling(); comp_assign_expr_AST = RefDNode(currentAST.root); l=l16_AST; comp_assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ASSIGN,":=")))->add(antlr::RefAST(RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(PLUS,"+")))->add(antlr::RefAST(l16_AST))->add(antlr::RefAST(r16_AST))))))->add(antlr::RefAST(RemoveNextSibling(l16_AST))))); currentAST.root = comp_assign_expr_AST; if ( comp_assign_expr_AST!=RefDNode(antlr::nullAST) && comp_assign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = comp_assign_expr_AST->getFirstChild(); else currentAST.child = comp_assign_expr_AST; currentAST.advanceChildToEnd(); break; } case POW_EQ: { RefDNode __t141 = _t; a17 = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a17_AST_in = RefDNode(antlr::nullAST); a17_AST = astFactory->create(antlr::RefAST(a17)); antlr::ASTPair __currentAST141 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),POW_EQ); _t = _t->getFirstChild(); l17 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l17_AST = returnAST; r17 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r17_AST = returnAST; currentAST = __currentAST141; _t = __t141; _t = _t->getNextSibling(); comp_assign_expr_AST = RefDNode(currentAST.root); l=l17_AST; comp_assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ASSIGN,":=")))->add(antlr::RefAST(RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(POW,"^")))->add(antlr::RefAST(l17_AST))->add(antlr::RefAST(r17_AST))))))->add(antlr::RefAST(RemoveNextSibling(l17_AST))))); currentAST.root = comp_assign_expr_AST; if ( comp_assign_expr_AST!=RefDNode(antlr::nullAST) && comp_assign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = comp_assign_expr_AST->getFirstChild(); else currentAST.child = comp_assign_expr_AST; currentAST.advanceChildToEnd(); break; } case SLASH_EQ: { RefDNode __t142 = _t; a18 = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a18_AST_in = RefDNode(antlr::nullAST); a18_AST = astFactory->create(antlr::RefAST(a18)); antlr::ASTPair __currentAST142 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),SLASH_EQ); _t = _t->getFirstChild(); l18 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l18_AST = returnAST; r18 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r18_AST = returnAST; currentAST = __currentAST142; _t = __t142; _t = _t->getNextSibling(); comp_assign_expr_AST = RefDNode(currentAST.root); l=l18_AST; comp_assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ASSIGN,":=")))->add(antlr::RefAST(RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(SLASH,"/")))->add(antlr::RefAST(l18_AST))->add(antlr::RefAST(r18_AST))))))->add(antlr::RefAST(RemoveNextSibling(l18_AST))))); currentAST.root = comp_assign_expr_AST; if ( comp_assign_expr_AST!=RefDNode(antlr::nullAST) && comp_assign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = comp_assign_expr_AST->getFirstChild(); else currentAST.child = comp_assign_expr_AST; currentAST.advanceChildToEnd(); break; } case XOR_OP_EQ: { RefDNode __t143 = _t; a19 = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a19_AST_in = RefDNode(antlr::nullAST); a19_AST = astFactory->create(antlr::RefAST(a19)); antlr::ASTPair __currentAST143 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),XOR_OP_EQ); _t = _t->getFirstChild(); l19 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l19_AST = returnAST; r19 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r19_AST = returnAST; currentAST = __currentAST143; _t = __t143; _t = _t->getNextSibling(); comp_assign_expr_AST = RefDNode(currentAST.root); l=l19_AST; comp_assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ASSIGN,":=")))->add(antlr::RefAST(RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(XOR_OP,"xor")))->add(antlr::RefAST(l19_AST))->add(antlr::RefAST(r19_AST))))))->add(antlr::RefAST(RemoveNextSibling(l19_AST))))); currentAST.root = comp_assign_expr_AST; if ( comp_assign_expr_AST!=RefDNode(antlr::nullAST) && comp_assign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = comp_assign_expr_AST->getFirstChild(); else currentAST.child = comp_assign_expr_AST; currentAST.advanceChildToEnd(); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } comp_assign_expr_AST = RefDNode(currentAST.root); AssignReplace( l, comp_assign_expr_AST); returnAST = comp_assign_expr_AST; _retTree = _t; } void GDLTreeParser::procedure_call(RefDNode _t) { RefDNode procedure_call_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode procedure_call_AST = RefDNode(antlr::nullAST); RefDNode p = RefDNode(antlr::nullAST); RefDNode p_AST = RefDNode(antlr::nullAST); RefDNode id = RefDNode(antlr::nullAST); RefDNode id_AST = RefDNode(antlr::nullAST); RefDNode para_AST = RefDNode(antlr::nullAST); RefDNode para = RefDNode(antlr::nullAST); if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case MPCALL: { RefDNode __t82 = _t; RefDNode tmp16_AST = RefDNode(antlr::nullAST); RefDNode tmp16_AST_in = RefDNode(antlr::nullAST); tmp16_AST = astFactory->create(antlr::RefAST(_t)); tmp16_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp16_AST)); antlr::ASTPair __currentAST82 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),MPCALL); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); RefDNode tmp17_AST = RefDNode(antlr::nullAST); RefDNode tmp17_AST_in = RefDNode(antlr::nullAST); tmp17_AST = astFactory->create(antlr::RefAST(_t)); tmp17_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp17_AST)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); parameter_def(_t, false); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST82; _t = __t82; _t = _t->getNextSibling(); procedure_call_AST = RefDNode(currentAST.root); break; } case MPCALL_PARENT: { RefDNode __t83 = _t; RefDNode tmp18_AST = RefDNode(antlr::nullAST); RefDNode tmp18_AST_in = RefDNode(antlr::nullAST); tmp18_AST = astFactory->create(antlr::RefAST(_t)); tmp18_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp18_AST)); antlr::ASTPair __currentAST83 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),MPCALL_PARENT); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); RefDNode tmp19_AST = RefDNode(antlr::nullAST); RefDNode tmp19_AST_in = RefDNode(antlr::nullAST); tmp19_AST = astFactory->create(antlr::RefAST(_t)); tmp19_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp19_AST)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); RefDNode tmp20_AST = RefDNode(antlr::nullAST); RefDNode tmp20_AST_in = RefDNode(antlr::nullAST); tmp20_AST = astFactory->create(antlr::RefAST(_t)); tmp20_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp20_AST)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); parameter_def(_t, false); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST83; _t = __t83; _t = _t->getNextSibling(); procedure_call_AST = RefDNode(currentAST.root); break; } case PCALL: { RefDNode __t84 = _t; p = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode p_AST_in = RefDNode(antlr::nullAST); p_AST = astFactory->create(antlr::RefAST(p)); astFactory->addASTChild(currentAST, antlr::RefAST(p_AST)); antlr::ASTPair __currentAST84 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),PCALL); _t = _t->getFirstChild(); id = _t; RefDNode id_AST_in = RefDNode(antlr::nullAST); id_AST = astFactory->create(antlr::RefAST(id)); astFactory->addASTChild(currentAST, antlr::RefAST(id_AST)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); // first search library procedures int i=LibProIx(id_AST->getText()); para = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; parameter_def(_t, i != -1 && libProList[ i]->NPar() == -1); _t = _retTree; para_AST = returnAST; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); if( i != -1) { int nParam = 0; if( para_AST != RefDNode(antlr::nullAST)) nParam = para_AST->GetNParam(); int libParam = libProList[i]->NPar(); int libParamMin = libProList[i]->NParMin(); if( libParam != -1 && nParam > libParam) throw GDLException( p, libProList[i]->Name() + ": Too many arguments."); if( libParam != -1 && nParam < libParamMin) throw GDLException( p, libProList[i]->Name() + ": Too few arguments."); p_AST->setType(PCALL_LIB); p_AST->setText("pcall_lib"); id_AST->SetLibPro( libProList[i]); } else { // then search user defined procedures i=ProIx(id_AST->getText()); id_AST->SetProIx(i); } currentAST = __currentAST84; _t = __t84; _t = _t->getNextSibling(); procedure_call_AST = RefDNode(currentAST.root); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } returnAST = procedure_call_AST; _retTree = _t; } void GDLTreeParser::for_statement(RefDNode _t) { RefDNode for_statement_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode for_statement_AST = RefDNode(antlr::nullAST); RefDNode f = RefDNode(antlr::nullAST); RefDNode f_AST = RefDNode(antlr::nullAST); RefDNode i = RefDNode(antlr::nullAST); RefDNode i_AST = RefDNode(antlr::nullAST); StackSizeGuard guard( loopVarStack); int labelStart = comp.NDefLabel(); RefDNode __t66 = _t; f = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode f_AST_in = RefDNode(antlr::nullAST); f_AST = astFactory->create(antlr::RefAST(f)); astFactory->addASTChild(currentAST, antlr::RefAST(f_AST)); antlr::ASTPair __currentAST66 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),FOR); _t = _t->getFirstChild(); i = _t; RefDNode i_AST_in = RefDNode(antlr::nullAST); i_AST = astFactory->create(antlr::RefAST(i)); astFactory->addASTChild(currentAST, antlr::RefAST(i_AST)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); i_AST->setType(VAR); comp.Var(i_AST); loopVarStack.push_back(i_AST->getText()); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ASSIGN: case ARRAYDEF: case ARRAYDEF_CONST: case ARRAYEXPR: case ARRAYEXPR_FCALL: case ARRAYEXPR_MFCALL: case CONSTANT: case DEREF: case EXPR: case FCALL: case GDLNULL: case MFCALL: case MFCALL_PARENT: case NSTRUC_REF: case POSTDEC: case POSTINC: case STRUC: case SYSVAR: case UMINUS: case VAR: case AND_OP: case EQ_OP: case GE_OP: case GT_OP: case LE_OP: case LT_OP: case MOD_OP: case NE_OP: case NOT_OP: case OR_OP: case XOR_OP: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: case SLASH: case ASTERIX: case DOT: case POW: case MATRIX_OP1: case MATRIX_OP2: case PLUS: case MINUS: case LTMARK: case GTMARK: case LOG_NEG: case LOG_AND: case LOG_OR: case QUESTION: { expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); f_AST->setType(FOR_STEP); f_AST->setText("for_step"); break; } case BLOCK: { break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } unblock_empty(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST66; _t = __t66; _t = _t->getNextSibling(); f_AST->SetLabelRange( labelStart, comp.NDefLabel()); for_statement_AST = RefDNode(currentAST.root); returnAST = for_statement_AST; _retTree = _t; } void GDLTreeParser::foreach_statement(RefDNode _t) { RefDNode foreach_statement_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode foreach_statement_AST = RefDNode(antlr::nullAST); RefDNode f = RefDNode(antlr::nullAST); RefDNode f_AST = RefDNode(antlr::nullAST); RefDNode i = RefDNode(antlr::nullAST); RefDNode i_AST = RefDNode(antlr::nullAST); RefDNode l = RefDNode(antlr::nullAST); RefDNode l_AST = RefDNode(antlr::nullAST); StackSizeGuard guard( loopVarStack); int labelStart = comp.NDefLabel(); RefDNode __t69 = _t; f = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode f_AST_in = RefDNode(antlr::nullAST); f_AST = astFactory->create(antlr::RefAST(f)); astFactory->addASTChild(currentAST, antlr::RefAST(f_AST)); antlr::ASTPair __currentAST69 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),FOREACH); _t = _t->getFirstChild(); i = _t; RefDNode i_AST_in = RefDNode(antlr::nullAST); i_AST = astFactory->create(antlr::RefAST(i)); astFactory->addASTChild(currentAST, antlr::RefAST(i_AST)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); i_AST->setType(VAR); comp.Var(i_AST); loopVarStack.push_back(i_AST->getText()); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case IDENTIFIER: { l = _t; RefDNode l_AST_in = RefDNode(antlr::nullAST); l_AST = astFactory->create(antlr::RefAST(l)); astFactory->addASTChild(currentAST, antlr::RefAST(l_AST)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); l_AST->setType(VAR); comp.Var(l_AST); loopVarStack.push_back(l_AST->getText()); f_AST->setType(FOREACH_INDEX); f_AST->setText("foreach_index"); break; } case BLOCK: { break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } unblock_empty(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST69; _t = __t69; _t = _t->getNextSibling(); f_AST->SetLabelRange( labelStart, comp.NDefLabel()); foreach_statement_AST = RefDNode(currentAST.root); returnAST = foreach_statement_AST; _retTree = _t; } void GDLTreeParser::repeat_statement(RefDNode _t) { RefDNode repeat_statement_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode repeat_statement_AST = RefDNode(antlr::nullAST); RefDNode r = RefDNode(antlr::nullAST); RefDNode r_AST = RefDNode(antlr::nullAST); RefDNode b_AST = RefDNode(antlr::nullAST); RefDNode b = RefDNode(antlr::nullAST); RefDNode e_AST = RefDNode(antlr::nullAST); RefDNode e = RefDNode(antlr::nullAST); int labelStart = comp.NDefLabel(); RefDNode __t62 = _t; r = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode r_AST_in = RefDNode(antlr::nullAST); r_AST = astFactory->create(antlr::RefAST(r)); antlr::ASTPair __currentAST62 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),REPEAT); _t = _t->getFirstChild(); b = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; unblock_empty(_t); _t = _retTree; b_AST = returnAST; e = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; e_AST = returnAST; currentAST = __currentAST62; _t = __t62; _t = _t->getNextSibling(); repeat_statement_AST = RefDNode(currentAST.root); r_AST->SetLabelRange( labelStart, comp.NDefLabel()); repeat_statement_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(r_AST))->add(antlr::RefAST(e_AST))->add(antlr::RefAST(b_AST)))); if( b_AST == static_cast(antlr::nullAST)) Warning( "Warning: Empty REPEAT UNTIL loop detected."); currentAST.root = repeat_statement_AST; if ( repeat_statement_AST!=RefDNode(antlr::nullAST) && repeat_statement_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = repeat_statement_AST->getFirstChild(); else currentAST.child = repeat_statement_AST; currentAST.advanceChildToEnd(); returnAST = repeat_statement_AST; _retTree = _t; } void GDLTreeParser::while_statement(RefDNode _t) { RefDNode while_statement_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode while_statement_AST = RefDNode(antlr::nullAST); RefDNode w = RefDNode(antlr::nullAST); RefDNode w_AST = RefDNode(antlr::nullAST); RefDNode e_AST = RefDNode(antlr::nullAST); RefDNode e = RefDNode(antlr::nullAST); RefDNode s_AST = RefDNode(antlr::nullAST); RefDNode s = RefDNode(antlr::nullAST); int labelStart = comp.NDefLabel(); RefDNode __t64 = _t; w = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode w_AST_in = RefDNode(antlr::nullAST); w_AST = astFactory->create(antlr::RefAST(w)); antlr::ASTPair __currentAST64 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),WHILE); _t = _t->getFirstChild(); e = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; e_AST = returnAST; s = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; statement(_t); _t = _retTree; s_AST = returnAST; currentAST = __currentAST64; _t = __t64; _t = _t->getNextSibling(); while_statement_AST = RefDNode(currentAST.root); w_AST->SetLabelRange( labelStart, comp.NDefLabel()); // swap e <-> s for easier access in interpreter while_statement_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(w_AST))->add(antlr::RefAST(e_AST))->add(antlr::RefAST(s_AST)))); currentAST.root = while_statement_AST; if ( while_statement_AST!=RefDNode(antlr::nullAST) && while_statement_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = while_statement_AST->getFirstChild(); else currentAST.child = while_statement_AST; currentAST.advanceChildToEnd(); returnAST = while_statement_AST; _retTree = _t; } void GDLTreeParser::jump_statement(RefDNode _t) { RefDNode jump_statement_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode jump_statement_AST = RefDNode(antlr::nullAST); RefDNode g = RefDNode(antlr::nullAST); RefDNode g_AST = RefDNode(antlr::nullAST); RefDNode i1 = RefDNode(antlr::nullAST); RefDNode i1_AST = RefDNode(antlr::nullAST); RefDNode r = RefDNode(antlr::nullAST); RefDNode r_AST = RefDNode(antlr::nullAST); RefDNode e_AST = RefDNode(antlr::nullAST); RefDNode e = RefDNode(antlr::nullAST); RefDNode o = RefDNode(antlr::nullAST); RefDNode o_AST = RefDNode(antlr::nullAST); RefDNode i2 = RefDNode(antlr::nullAST); RefDNode i2_AST = RefDNode(antlr::nullAST); if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case GOTO: { RefDNode __t74 = _t; g = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode g_AST_in = RefDNode(antlr::nullAST); g_AST = astFactory->create(antlr::RefAST(g)); antlr::ASTPair __currentAST74 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),GOTO); _t = _t->getFirstChild(); i1 = _t; RefDNode i1_AST_in = RefDNode(antlr::nullAST); i1_AST = astFactory->create(antlr::RefAST(i1)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); currentAST = __currentAST74; _t = __t74; _t = _t->getNextSibling(); jump_statement_AST = RefDNode(currentAST.root); jump_statement_AST=astFactory->create(GOTO,i1->getText()); jump_statement_AST->SetLine(g->getLine()); // #jump_statement=#[GOTO,i1->getText()]; // doesn't work // comp.Goto(#jump_statement); currentAST.root = jump_statement_AST; if ( jump_statement_AST!=RefDNode(antlr::nullAST) && jump_statement_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = jump_statement_AST->getFirstChild(); else currentAST.child = jump_statement_AST; currentAST.advanceChildToEnd(); break; } case RETURN: { RefDNode __t75 = _t; r = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode r_AST_in = RefDNode(antlr::nullAST); r_AST = astFactory->create(antlr::RefAST(r)); antlr::ASTPair __currentAST75 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),RETURN); _t = _t->getFirstChild(); bool exprThere=false; { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ASSIGN: case ARRAYDEF: case ARRAYDEF_CONST: case ARRAYEXPR: case ARRAYEXPR_FCALL: case ARRAYEXPR_MFCALL: case CONSTANT: case DEREF: case EXPR: case FCALL: case GDLNULL: case MFCALL: case MFCALL_PARENT: case NSTRUC_REF: case POSTDEC: case POSTINC: case STRUC: case SYSVAR: case UMINUS: case VAR: case AND_OP: case EQ_OP: case GE_OP: case GT_OP: case LE_OP: case LT_OP: case MOD_OP: case NE_OP: case NOT_OP: case OR_OP: case XOR_OP: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: case SLASH: case ASTERIX: case DOT: case POW: case MATRIX_OP1: case MATRIX_OP2: case PLUS: case MINUS: case LTMARK: case GTMARK: case LOG_NEG: case LOG_AND: case LOG_OR: case QUESTION: { e = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; e_AST = returnAST; exprThere=true; break; } case 3: { break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } currentAST = __currentAST75; _t = __t75; _t = _t->getNextSibling(); jump_statement_AST = RefDNode(currentAST.root); if( comp.IsFun()) { if( !exprThere) throw GDLException( r, "Return statement in functions " "must have 1 value."); // // wrong: this is only true for l_function as return value // // a ARRAYEXPR_MFCALL can only be a MFCALL here -> change tree // if( #e->getType() == ARRAYEXPR_MFCALL) // { // #e->setType( MFCALL); // #e->setText( "mfcall"); // RefDNode mfc; // mfc = #e->getFirstChild(); // mfc = mfc->getNextSibling(); // #e->setFirstChild( antlr::RefAST(mfc)); // } jump_statement_AST=RefDNode(astFactory->make((new antlr::ASTArray(2))->add(antlr::RefAST(astFactory->create(RETF,"retf")))->add(antlr::RefAST(e_AST)))); jump_statement_AST->SetLine(r->getLine()); } else { if( exprThere) throw GDLException( _t, "Return statement in " "procedures cannot have values."); jump_statement_AST=astFactory->create(RETP,"retp"); // astFactory.create(RETP,"retp"); jump_statement_AST->SetLine(r->getLine()); } currentAST.root = jump_statement_AST; if ( jump_statement_AST!=RefDNode(antlr::nullAST) && jump_statement_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = jump_statement_AST->getFirstChild(); else currentAST.child = jump_statement_AST; currentAST.advanceChildToEnd(); break; } case ON_IOERROR: { RefDNode __t77 = _t; o = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode o_AST_in = RefDNode(antlr::nullAST); o_AST = astFactory->create(antlr::RefAST(o)); antlr::ASTPair __currentAST77 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),ON_IOERROR); _t = _t->getFirstChild(); i2 = _t; RefDNode i2_AST_in = RefDNode(antlr::nullAST); i2_AST = astFactory->create(antlr::RefAST(i2)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); currentAST = __currentAST77; _t = __t77; _t = _t->getNextSibling(); jump_statement_AST = RefDNode(currentAST.root); if( i2->getText() == "NULL") { jump_statement_AST=astFactory->create(ON_IOERROR_NULL, "on_ioerror_null"); jump_statement_AST->SetLine(o->getLine()); } else { jump_statement_AST=astFactory->create(ON_IOERROR,i2->getText()); jump_statement_AST->SetLine(o->getLine()); // #jump_statement=#[ON_IOERROR,i2->getText()]; // comp.Goto(#jump_statement); // same handling } currentAST.root = jump_statement_AST; if ( jump_statement_AST!=RefDNode(antlr::nullAST) && jump_statement_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = jump_statement_AST->getFirstChild(); else currentAST.child = jump_statement_AST; currentAST.advanceChildToEnd(); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } returnAST = jump_statement_AST; _retTree = _t; } void GDLTreeParser::if_statement(RefDNode _t) { RefDNode if_statement_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode if_statement_AST = RefDNode(antlr::nullAST); RefDNode i = RefDNode(antlr::nullAST); RefDNode i_AST = RefDNode(antlr::nullAST); RefDNode e_AST = RefDNode(antlr::nullAST); RefDNode e = RefDNode(antlr::nullAST); RefDNode s1_AST = RefDNode(antlr::nullAST); RefDNode s1 = RefDNode(antlr::nullAST); RefDNode s2_AST = RefDNode(antlr::nullAST); RefDNode s2 = RefDNode(antlr::nullAST); // int labelStart = comp.NDefLabel(); RefDNode block; RefDNode __t79 = _t; i = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode i_AST_in = RefDNode(antlr::nullAST); i_AST = astFactory->create(antlr::RefAST(i)); antlr::ASTPair __currentAST79 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),IF); _t = _t->getFirstChild(); e = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; e_AST = returnAST; s1 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; statement(_t); _t = _retTree; s1_AST = returnAST; { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case 3: { if_statement_AST = RefDNode(currentAST.root); // #i->SetLabelRange( labelStart, comp.NDefLabel()); if_statement_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(i_AST))->add(antlr::RefAST(e_AST))->add(antlr::RefAST(s1_AST)))); currentAST.root = if_statement_AST; if ( if_statement_AST!=RefDNode(antlr::nullAST) && if_statement_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = if_statement_AST->getFirstChild(); else currentAST.child = if_statement_AST; currentAST.advanceChildToEnd(); break; } case ASSIGN: case BLOCK: case BREAK: case CONTINUE: case COMMONDECL: case COMMONDEF: case FOR: case FOREACH: case MPCALL: case MPCALL_PARENT: case PCALL: case REPEAT: case RETURN: case WHILE: case CASE: case FORWARD: case GOTO: case IF: case ON_IOERROR: case SWITCH: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: { s2 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; statement(_t); _t = _retTree; s2_AST = returnAST; if_statement_AST = RefDNode(currentAST.root); i_AST->setText( "if_else"); i_AST->setType( IF_ELSE); // #i->SetLabelRange( labelStart, comp.NDefLabel()); if( s1_AST->getType() != BLOCK) { block = astFactory->create(BLOCK,"block"); block->SetLine( s1_AST->getLine()); if_statement_AST=RefDNode(astFactory->make((new antlr::ASTArray(4))->add(antlr::RefAST(i_AST))->add(antlr::RefAST(e_AST))->add(antlr::RefAST(RefDNode(astFactory->make((new antlr::ASTArray(2))->add(antlr::RefAST(block))->add(antlr::RefAST(s1_AST))))))->add(antlr::RefAST(s2_AST)))); } else if_statement_AST=RefDNode(astFactory->make((new antlr::ASTArray(4))->add(antlr::RefAST(i_AST))->add(antlr::RefAST(e_AST))->add(antlr::RefAST(s1_AST))->add(antlr::RefAST(s2_AST)))); currentAST.root = if_statement_AST; if ( if_statement_AST!=RefDNode(antlr::nullAST) && if_statement_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = if_statement_AST->getFirstChild(); else currentAST.child = if_statement_AST; currentAST.advanceChildToEnd(); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } currentAST = __currentAST79; _t = __t79; _t = _t->getNextSibling(); returnAST = if_statement_AST; _retTree = _t; } void GDLTreeParser::parameter_def(RefDNode _t, bool varNum ) { RefDNode parameter_def_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode parameter_def_AST = RefDNode(antlr::nullAST); // count positional parameters int nKey = 0; int nPar = 0; { // ( ... )* for (;;) { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case KEYDEF: { key_parameter(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); ++nKey; break; } case ASSIGN: case ARRAYDEF: case ARRAYDEF_CONST: case ARRAYEXPR: case ARRAYEXPR_FCALL: case ARRAYEXPR_MFCALL: case CONSTANT: case DEREF: case EXPR: case FCALL: case GDLNULL: case MFCALL: case MFCALL_PARENT: case NSTRUC_REF: case POSTDEC: case POSTINC: case STRUC: case SYSVAR: case UMINUS: case VAR: case AND_OP: case EQ_OP: case GE_OP: case GT_OP: case LE_OP: case LT_OP: case MOD_OP: case NE_OP: case NOT_OP: case OR_OP: case XOR_OP: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: case SLASH: case ASTERIX: case DOT: case POW: case MATRIX_OP1: case MATRIX_OP2: case PLUS: case MINUS: case LTMARK: case GTMARK: case LOG_NEG: case LOG_AND: case LOG_OR: case QUESTION: { pos_parameter(_t, varNum); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); ++nPar; break; } default: { goto _loop87; } } } _loop87:; } // ( ... )* if( nPar > 0 || nKey > 0) { RefDNode(currentAST.root)->SetNParam( nPar); } parameter_def_AST = RefDNode(currentAST.root); returnAST = parameter_def_AST; _retTree = _t; } void GDLTreeParser::key_parameter(RefDNode _t) { RefDNode key_parameter_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode key_parameter_AST = RefDNode(antlr::nullAST); RefDNode d = RefDNode(antlr::nullAST); RefDNode d_AST = RefDNode(antlr::nullAST); RefDNode i = RefDNode(antlr::nullAST); RefDNode i_AST = RefDNode(antlr::nullAST); RefDNode k_AST = RefDNode(antlr::nullAST); RefDNode k = RefDNode(antlr::nullAST); RefDNode variable; RefDNode __t89 = _t; d = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode d_AST_in = RefDNode(antlr::nullAST); d_AST = astFactory->create(antlr::RefAST(d)); antlr::ASTPair __currentAST89 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),KEYDEF); _t = _t->getFirstChild(); i = _t; RefDNode i_AST_in = RefDNode(antlr::nullAST); i_AST = astFactory->create(antlr::RefAST(i)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); k = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; k_AST = returnAST; key_parameter_AST = RefDNode(currentAST.root); variable=comp.ByReference(k_AST); if( variable != static_cast(antlr::nullAST)) { int vT = variable->getType(); if( IsREF_CHECK(vT)) { d_AST=astFactory->create(KEYDEF_REF_CHECK,"keydef_ref_check"); key_parameter_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(d_AST))->add(antlr::RefAST(i_AST))->add(antlr::RefAST(k_AST)))); } else if( variable == k_AST) { d_AST=astFactory->create(KEYDEF_REF,"keydef_ref"); key_parameter_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(d_AST))->add(antlr::RefAST(i_AST))->add(antlr::RefAST(variable)))); } else { d_AST=astFactory->create(KEYDEF_REF_EXPR,"keydef_ref_expr"); key_parameter_AST=RefDNode(astFactory->make((new antlr::ASTArray(4))->add(antlr::RefAST(d_AST))->add(antlr::RefAST(i_AST))->add(antlr::RefAST(k_AST))->add(antlr::RefAST(variable)))); } } else { int t = k_AST->getType(); // Note: Right now there are no MFCALL_LIB or MFCALL_PARENT_LIB nodes if( IsREF_CHECK(t)) // t == FCALL_LIB // || t == MFCALL_LIB // || t == FCALL_LIB_N_ELEMENTS // || t == MFCALL_PARENT_LIB // || t == QUESTION // || t == FCALL || t == MFCALL || t == MFCALL_PARENT // || t == ARRAYEXPR_FCALL // || t == ARRAYEXPR_MFCALL // // t == FCALL_LIB_RETNEW || t == MFCALL_LIB_RETNEW || // // t == MFCALL_PARENT_LIB_RETNEW //|| // // t == ARRARYEXPR_MFCALL_LIB // MFCALL_LIB or VAR or DEREF // // ) { d_AST=astFactory->create(KEYDEF_REF_CHECK,"keydef_ref_check"); key_parameter_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(d_AST))->add(antlr::RefAST(i_AST))->add(antlr::RefAST(k_AST)))); } // else if( t == FCALL_LIB_RETNEW || t == MFCALL_LIB_RETNEW) // { // // #d=#[KEYDEF_REF,"keydef_ref"]; // #key_parameter=#(d,i,k); // } else { key_parameter_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(d_AST))->add(antlr::RefAST(i_AST))->add(antlr::RefAST(k_AST)))); } } currentAST.root = key_parameter_AST; if ( key_parameter_AST!=RefDNode(antlr::nullAST) && key_parameter_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = key_parameter_AST->getFirstChild(); else currentAST.child = key_parameter_AST; currentAST.advanceChildToEnd(); currentAST = __currentAST89; _t = __t89; _t = _t->getNextSibling(); returnAST = key_parameter_AST; _retTree = _t; } void GDLTreeParser::pos_parameter(RefDNode _t, bool varNum ) { RefDNode pos_parameter_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode pos_parameter_AST = RefDNode(antlr::nullAST); RefDNode e_AST = RefDNode(antlr::nullAST); RefDNode e = RefDNode(antlr::nullAST); RefDNode variable; e = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; e_AST = returnAST; pos_parameter_AST = RefDNode(currentAST.root); variable=comp.ByReference(e_AST); if( variable != static_cast(antlr::nullAST)) { int vT = variable->getType(); if( IsREF_CHECK(vT)) { if( varNum) pos_parameter_AST=RefDNode(astFactory->make((new antlr::ASTArray(2))->add(antlr::RefAST(astFactory->create(REF_CHECK_VN,"ref_check_vn")))->add(antlr::RefAST(e_AST)))); else pos_parameter_AST=RefDNode(astFactory->make((new antlr::ASTArray(2))->add(antlr::RefAST(astFactory->create(REF_CHECK,"ref_check")))->add(antlr::RefAST(e_AST)))); } else if( variable == e_AST) { if( varNum) pos_parameter_AST=RefDNode(astFactory->make((new antlr::ASTArray(2))->add(antlr::RefAST(astFactory->create(REF_VN,"ref_vn")))->add(antlr::RefAST(variable)))); else pos_parameter_AST=RefDNode(astFactory->make((new antlr::ASTArray(2))->add(antlr::RefAST(astFactory->create(REF,"ref")))->add(antlr::RefAST(variable)))); } else { if( varNum) pos_parameter_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(REF_EXPR_VN,"ref_expr_vn")))->add(antlr::RefAST(e_AST))->add(antlr::RefAST(variable)))); else pos_parameter_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(REF_EXPR,"ref_expr")))->add(antlr::RefAST(e_AST))->add(antlr::RefAST(variable)))); } } else { int t = e_AST->getType(); // Note: Right now there are no MFCALL_LIB or MFCALL_PARENT_LIB nodes if( IsREF_CHECK(t)) // if( t == FCALL_LIB // || t == MFCALL_LIB //t == FCALL_LIB_N_ELEMENTS || // || t == MFCALL_PARENT_LIB // || t == QUESTION // // TODO: These are ref check as well, but parameter nodes need to know // || t == FCALL || t == MFCALL || t == MFCALL_PARENT // || t == ARRAYEXPR_FCALL // || t == ARRAYEXPR_MFCALL // // t == FCALL_LIB_RETNEW || t == MFCALL_LIB_RETNEW || // // t == MFCALL_PARENT_LIB_RETNEW // // t == ARRARYEXPR_MFCALL_LIB // MFCALL_LIB or VAR or DEREF // ) { // something like: CALLAPRO,reform(a,/OVERWRITE) if( varNum) pos_parameter_AST=RefDNode(astFactory->make((new antlr::ASTArray(2))->add(antlr::RefAST(astFactory->create(REF_CHECK_VN,"ref_check_vn")))->add(antlr::RefAST(e_AST)))); else pos_parameter_AST=RefDNode(astFactory->make((new antlr::ASTArray(2))->add(antlr::RefAST(astFactory->create(REF_CHECK,"ref_check")))->add(antlr::RefAST(e_AST)))); } else { if( varNum) pos_parameter_AST= RefDNode(astFactory->make((new antlr::ASTArray(2))->add(antlr::RefAST(astFactory->create(PARAEXPR_VN,"paraexpr_vn")))->add(antlr::RefAST(e_AST)))); else pos_parameter_AST= RefDNode(astFactory->make((new antlr::ASTArray(2))->add(antlr::RefAST(astFactory->create(PARAEXPR,"paraexpr")))->add(antlr::RefAST(e_AST)))); } } currentAST.root = pos_parameter_AST; if ( pos_parameter_AST!=RefDNode(antlr::nullAST) && pos_parameter_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = pos_parameter_AST->getFirstChild(); else currentAST.child = pos_parameter_AST; currentAST.advanceChildToEnd(); returnAST = pos_parameter_AST; _retTree = _t; } int GDLTreeParser::array_def(RefDNode _t) { int depth; RefDNode array_def_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode array_def_AST = RefDNode(antlr::nullAST); RefDNode a = RefDNode(antlr::nullAST); RefDNode a_AST = RefDNode(antlr::nullAST); RefDNode aa = RefDNode(antlr::nullAST); RefDNode aa_AST = RefDNode(antlr::nullAST); RefDNode sPos; if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ARRAYDEF: { RefDNode __t92 = _t; a = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a_AST_in = RefDNode(antlr::nullAST); a_AST = astFactory->create(antlr::RefAST(a)); astFactory->addASTChild(currentAST, antlr::RefAST(a_AST)); antlr::ASTPair __currentAST92 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),ARRAYDEF); _t = _t->getFirstChild(); sPos=_t; { // ( ... )* for (;;) { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; if ((_tokenSet_1.member(_t->getType()))) { expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); /*check for constant expression*/ } else { goto _loop94; } } _loop94:; } // ( ... )* currentAST = __currentAST92; _t = __t92; _t = _t->getNextSibling(); // better check here as then CONSTANT is propagated depth=0; // bool constant = true; // bool depth0 = false; for( RefDNode e=sPos; e != static_cast(antlr::nullAST); e=e->getNextSibling()) { // if( e->getType() != CONSTANT) // constant = false; // if( !depth0) if( (e->getType() != ARRAYDEF) && (e->getType() != ARRAYDEF_CONST)) { depth=0; break; // depth0 = true; } else { int act=array_def(e); // recursive call act=act+1; if( depth == 0) { depth=act; } else { if( depth > act) depth=act; } } } a_AST->SetArrayDepth(depth); array_def_AST = RefDNode(currentAST.root); break; } case ARRAYDEF_CONST: { RefDNode __t95 = _t; aa = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode aa_AST_in = RefDNode(antlr::nullAST); aa_AST = astFactory->create(antlr::RefAST(aa)); astFactory->addASTChild(currentAST, antlr::RefAST(aa_AST)); antlr::ASTPair __currentAST95 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),ARRAYDEF_CONST); _t = _t->getFirstChild(); sPos=_t; { // ( ... )* for (;;) { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; if ((_tokenSet_1.member(_t->getType()))) { expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); } else { goto _loop97; } } _loop97:; } // ( ... )* currentAST = __currentAST95; _t = __t95; _t = _t->getNextSibling(); depth=0; for( RefDNode e=sPos; e != static_cast(antlr::nullAST); e=e->getNextSibling()) { if( (e->getType() != ARRAYDEF) && (e->getType() != ARRAYDEF_CONST)) { depth=0; break; } else { int act=array_def(e); // recursive call act=act+1; if( depth == 0) { depth=act; } else { if( depth > act) depth=act; } } } aa_AST->SetArrayDepth(depth); array_def_AST = RefDNode(currentAST.root); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } returnAST = array_def_AST; _retTree = _t; return depth; } void GDLTreeParser::struct_def(RefDNode _t) { RefDNode struct_def_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode struct_def_AST = RefDNode(antlr::nullAST); RefDNode n = RefDNode(antlr::nullAST); RefDNode n_AST = RefDNode(antlr::nullAST); bool noTagName = false; if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case NSTRUC_REF: { RefDNode __t99 = _t; n = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode n_AST_in = RefDNode(antlr::nullAST); n_AST = astFactory->create(antlr::RefAST(n)); astFactory->addASTChild(currentAST, antlr::RefAST(n_AST)); antlr::ASTPair __currentAST99 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),NSTRUC_REF); _t = _t->getFirstChild(); RefDNode tmp21_AST = RefDNode(antlr::nullAST); RefDNode tmp21_AST_in = RefDNode(antlr::nullAST); tmp21_AST = astFactory->create(antlr::RefAST(_t)); tmp21_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp21_AST)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ASSIGN: case ARRAYDEF: case ARRAYDEF_CONST: case ARRAYEXPR: case ARRAYEXPR_FCALL: case ARRAYEXPR_MFCALL: case CONSTANT: case DEREF: case EXPR: case FCALL: case GDLNULL: case MFCALL: case MFCALL_PARENT: case NSTRUC_REF: case POSTDEC: case POSTINC: case STRUC: case SYSVAR: case UMINUS: case VAR: case IDENTIFIER: case AND_OP: case EQ_OP: case GE_OP: case GT_OP: case INHERITS: case LE_OP: case LT_OP: case MOD_OP: case NE_OP: case NOT_OP: case OR_OP: case XOR_OP: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: case SLASH: case ASTERIX: case DOT: case POW: case MATRIX_OP1: case MATRIX_OP2: case PLUS: case MINUS: case LTMARK: case GTMARK: case LOG_NEG: case LOG_AND: case LOG_OR: case QUESTION: { { // ( ... )+ int _cnt102=0; for (;;) { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ASSIGN: case ARRAYDEF: case ARRAYDEF_CONST: case ARRAYEXPR: case ARRAYEXPR_FCALL: case ARRAYEXPR_MFCALL: case CONSTANT: case DEREF: case EXPR: case FCALL: case GDLNULL: case MFCALL: case MFCALL_PARENT: case NSTRUC_REF: case POSTDEC: case POSTINC: case STRUC: case SYSVAR: case UMINUS: case VAR: case AND_OP: case EQ_OP: case GE_OP: case GT_OP: case LE_OP: case LT_OP: case MOD_OP: case NE_OP: case NOT_OP: case OR_OP: case XOR_OP: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: case SLASH: case ASTERIX: case DOT: case POW: case MATRIX_OP1: case MATRIX_OP2: case PLUS: case MINUS: case LTMARK: case GTMARK: case LOG_NEG: case LOG_AND: case LOG_OR: case QUESTION: { expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); noTagName = true; break; } case IDENTIFIER: { RefDNode tmp22_AST = RefDNode(antlr::nullAST); RefDNode tmp22_AST_in = RefDNode(antlr::nullAST); tmp22_AST = astFactory->create(antlr::RefAST(_t)); tmp22_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp22_AST)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); break; } case INHERITS: { RefDNode tmp23_AST = RefDNode(antlr::nullAST); RefDNode tmp23_AST_in = RefDNode(antlr::nullAST); tmp23_AST = astFactory->create(antlr::RefAST(_t)); tmp23_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp23_AST)); match(antlr::RefAST(_t),INHERITS); _t = _t->getNextSibling(); RefDNode tmp24_AST = RefDNode(antlr::nullAST); RefDNode tmp24_AST_in = RefDNode(antlr::nullAST); tmp24_AST = astFactory->create(antlr::RefAST(_t)); tmp24_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp24_AST)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); break; } default: { if ( _cnt102>=1 ) { goto _loop102; } else {throw antlr::NoViableAltException(antlr::RefAST(_t));} } } _cnt102++; } _loop102:; } // ( ... )+ // set to nstruct if defined here n_AST->setType(NSTRUC); n_AST->setText("nstruct"); n_AST->DefinedStruct( noTagName); break; } case 3: { break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } currentAST = __currentAST99; _t = __t99; _t = _t->getNextSibling(); struct_def_AST = RefDNode(currentAST.root); break; } case STRUC: { RefDNode __t103 = _t; RefDNode tmp25_AST = RefDNode(antlr::nullAST); RefDNode tmp25_AST_in = RefDNode(antlr::nullAST); tmp25_AST = astFactory->create(antlr::RefAST(_t)); tmp25_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp25_AST)); antlr::ASTPair __currentAST103 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),STRUC); _t = _t->getFirstChild(); { // ( ... )+ int _cnt105=0; for (;;) { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; if ((_t->getType() == IDENTIFIER)) { tag_def(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); } else { if ( _cnt105>=1 ) { goto _loop105; } else {throw antlr::NoViableAltException(antlr::RefAST(_t));} } _cnt105++; } _loop105:; } // ( ... )+ currentAST = __currentAST103; _t = __t103; _t = _t->getNextSibling(); struct_def_AST = RefDNode(currentAST.root); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } returnAST = struct_def_AST; _retTree = _t; } void GDLTreeParser::tag_def(RefDNode _t) { RefDNode tag_def_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode tag_def_AST = RefDNode(antlr::nullAST); RefDNode tmp26_AST = RefDNode(antlr::nullAST); RefDNode tmp26_AST_in = RefDNode(antlr::nullAST); tmp26_AST = astFactory->create(antlr::RefAST(_t)); tmp26_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp26_AST)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); tag_def_AST = RefDNode(currentAST.root); returnAST = tag_def_AST; _retTree = _t; } void GDLTreeParser::arrayindex(RefDNode _t, ArrayIndexVectorT* ixList ) { RefDNode arrayindex_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode arrayindex_AST = RefDNode(antlr::nullAST); RefDNode e1_AST = RefDNode(antlr::nullAST); RefDNode e1 = RefDNode(antlr::nullAST); RefDNode e2_AST = RefDNode(antlr::nullAST); RefDNode e2 = RefDNode(antlr::nullAST); RefDNode e3_AST = RefDNode(antlr::nullAST); RefDNode e3 = RefDNode(antlr::nullAST); RefDNode e4_AST = RefDNode(antlr::nullAST); RefDNode e4 = RefDNode(antlr::nullAST); BaseGDL *c1, *c2, *c3, *c4; { RefDNode __t109 = _t; RefDNode tmp27_AST = RefDNode(antlr::nullAST); RefDNode tmp27_AST_in = RefDNode(antlr::nullAST); tmp27_AST = astFactory->create(antlr::RefAST(_t)); tmp27_AST_in = _t; antlr::ASTPair __currentAST109 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),ARRAYIX); _t = _t->getFirstChild(); { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ALL: { RefDNode tmp28_AST = RefDNode(antlr::nullAST); RefDNode tmp28_AST_in = RefDNode(antlr::nullAST); tmp28_AST = astFactory->create(antlr::RefAST(_t)); tmp28_AST_in = _t; match(antlr::RefAST(_t),ALL); _t = _t->getNextSibling(); ixList->push_back( new ArrayIndexAll()); break; } case ASSIGN: case ARRAYDEF: case ARRAYDEF_CONST: case ARRAYEXPR: case ARRAYEXPR_FCALL: case ARRAYEXPR_MFCALL: case CONSTANT: case DEREF: case EXPR: case FCALL: case GDLNULL: case MFCALL: case MFCALL_PARENT: case NSTRUC_REF: case POSTDEC: case POSTINC: case STRUC: case SYSVAR: case UMINUS: case VAR: case AND_OP: case EQ_OP: case GE_OP: case GT_OP: case LE_OP: case LT_OP: case MOD_OP: case NE_OP: case NOT_OP: case OR_OP: case XOR_OP: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: case SLASH: case ASTERIX: case DOT: case POW: case MATRIX_OP1: case MATRIX_OP2: case PLUS: case MINUS: case LTMARK: case GTMARK: case LOG_NEG: case LOG_AND: case LOG_OR: case QUESTION: { { e1 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; e1_AST = returnAST; // in ConstantIndex the cData of all nodes is stolen // (in case it succeeds) // therefore we build here the new constant node with // proper cData. See below (e2) c1 = comp.ConstantIndex( e1_AST); if( c1 != NULL) { int e1Line = e1_AST->getLine(); e1_AST = astFactory->create(CONSTANT,"CONST_IX"); e1_AST->ResetCData( c1); e1_AST->SetLine( e1Line); } { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case 3: { arrayindex_AST = RefDNode(currentAST.root); bool constantOK = false; if( c1 != NULL) { DType dType = c1->Type(); int typeCheck = DTypeOrder[ dType]; if( dType == GDL_STRING || typeCheck >= 100) { //delete c1; } else { try { // ATTENTION: These two grab c1 (all others don't) // a bit unclean, but for maximum efficiency if( c1->Rank() == 0) ixList->push_back( new CArrayIndexScalar( c1)); else ixList->push_back( new CArrayIndexIndexed( c1)); // prevent c1 from being deleted e1_AST->StealCData(); // ok, as #e1 is not used anymore constantOK = true; } catch( GDLException& e) { //delete c1; // owned by #e1 } } } if( !constantOK) { if( LoopVar( e1_AST)) { if( e1_AST->getType() == VAR) ixList->push_back( new ArrayIndexScalar( e1_AST)); else ixList->push_back( new ArrayIndexScalarVP( e1_AST)); } else { arrayindex_AST = e1_AST; ixList->push_back( new ArrayIndexIndexed()); } } currentAST.root = arrayindex_AST; if ( arrayindex_AST!=RefDNode(antlr::nullAST) && arrayindex_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = arrayindex_AST->getFirstChild(); else currentAST.child = arrayindex_AST; currentAST.advanceChildToEnd(); break; } case ALL: { RefDNode tmp29_AST = RefDNode(antlr::nullAST); RefDNode tmp29_AST_in = RefDNode(antlr::nullAST); tmp29_AST = astFactory->create(antlr::RefAST(_t)); tmp29_AST_in = _t; match(antlr::RefAST(_t),ALL); _t = _t->getNextSibling(); { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case 3: { arrayindex_AST = RefDNode(currentAST.root); //c1 = comp.ConstantIndex( #e1); if( c1 != NULL) { ixList->push_back( new CArrayIndexORange( c1)); } else { arrayindex_AST = e1_AST; ixList->push_back( new ArrayIndexORange()); } currentAST.root = arrayindex_AST; if ( arrayindex_AST!=RefDNode(antlr::nullAST) && arrayindex_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = arrayindex_AST->getFirstChild(); else currentAST.child = arrayindex_AST; currentAST.advanceChildToEnd(); break; } case ASSIGN: case ARRAYDEF: case ARRAYDEF_CONST: case ARRAYEXPR: case ARRAYEXPR_FCALL: case ARRAYEXPR_MFCALL: case CONSTANT: case DEREF: case EXPR: case FCALL: case GDLNULL: case MFCALL: case MFCALL_PARENT: case NSTRUC_REF: case POSTDEC: case POSTINC: case STRUC: case SYSVAR: case UMINUS: case VAR: case AND_OP: case EQ_OP: case GE_OP: case GT_OP: case LE_OP: case LT_OP: case MOD_OP: case NE_OP: case NOT_OP: case OR_OP: case XOR_OP: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: case SLASH: case ASTERIX: case DOT: case POW: case MATRIX_OP1: case MATRIX_OP2: case PLUS: case MINUS: case LTMARK: case GTMARK: case LOG_NEG: case LOG_AND: case LOG_OR: case QUESTION: { e2 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; e2_AST = returnAST; // in ConstantIndex the cData of all nodes is stolen // (in case it succeeds) // therefore we build here the new constant node with // proper cData. This is crucial because if e. g. only e1 but not e2 // is constant, #e1 is put to the output tree (with stolen cData) -> crash c2 = comp.ConstantIndex( e2_AST); if( c2 != NULL) { int e2Line = e2_AST->getLine(); e2_AST = astFactory->create(CONSTANT,"CONST_IX"); e2_AST->ResetCData( c2); e2_AST->SetLine( e2Line); } arrayindex_AST = RefDNode(currentAST.root); //c1 = comp.ConstantIndex( #e1); //c2 = comp.ConstantIndex( #e2); if( c1 != NULL && c2 != NULL) { ixList->push_back( new CArrayIndexORangeS( c1, c2)); } else { //delete c1; //delete c2; arrayindex_AST = RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(NULL))->add(antlr::RefAST(e1_AST))->add(antlr::RefAST(e2_AST)))); ixList->push_back( new ArrayIndexORangeS()); } currentAST.root = arrayindex_AST; if ( arrayindex_AST!=RefDNode(antlr::nullAST) && arrayindex_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = arrayindex_AST->getFirstChild(); else currentAST.child = arrayindex_AST; currentAST.advanceChildToEnd(); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } break; } case ASSIGN: case ARRAYDEF: case ARRAYDEF_CONST: case ARRAYEXPR: case ARRAYEXPR_FCALL: case ARRAYEXPR_MFCALL: case CONSTANT: case DEREF: case EXPR: case FCALL: case GDLNULL: case MFCALL: case MFCALL_PARENT: case NSTRUC_REF: case POSTDEC: case POSTINC: case STRUC: case SYSVAR: case UMINUS: case VAR: case AND_OP: case EQ_OP: case GE_OP: case GT_OP: case LE_OP: case LT_OP: case MOD_OP: case NE_OP: case NOT_OP: case OR_OP: case XOR_OP: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: case SLASH: case ASTERIX: case DOT: case POW: case MATRIX_OP1: case MATRIX_OP2: case PLUS: case MINUS: case LTMARK: case GTMARK: case LOG_NEG: case LOG_AND: case LOG_OR: case QUESTION: { e3 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; e3_AST = returnAST; // see above (#e2) c3 = comp.ConstantIndex( e3_AST); if( c3 != NULL) { int e3Line = e3_AST->getLine(); e3_AST = astFactory->create(CONSTANT,"CONST_IX"); e3_AST->ResetCData( c3); e3_AST->SetLine( e3Line); } { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case 3: { arrayindex_AST = RefDNode(currentAST.root); //c1 = comp.ConstantIndex( #e1); //c3 = comp.ConstantIndex( #e3); if( c1 != NULL && c3 != NULL) { ixList->push_back( new CArrayIndexRange( c1, c3)); } else { //delete c1; //delete c3; arrayindex_AST = RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(NULL))->add(antlr::RefAST(e1_AST))->add(antlr::RefAST(e3_AST)))); ixList->push_back( new ArrayIndexRange()); } currentAST.root = arrayindex_AST; if ( arrayindex_AST!=RefDNode(antlr::nullAST) && arrayindex_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = arrayindex_AST->getFirstChild(); else currentAST.child = arrayindex_AST; currentAST.advanceChildToEnd(); break; } case ASSIGN: case ARRAYDEF: case ARRAYDEF_CONST: case ARRAYEXPR: case ARRAYEXPR_FCALL: case ARRAYEXPR_MFCALL: case CONSTANT: case DEREF: case EXPR: case FCALL: case GDLNULL: case MFCALL: case MFCALL_PARENT: case NSTRUC_REF: case POSTDEC: case POSTINC: case STRUC: case SYSVAR: case UMINUS: case VAR: case AND_OP: case EQ_OP: case GE_OP: case GT_OP: case LE_OP: case LT_OP: case MOD_OP: case NE_OP: case NOT_OP: case OR_OP: case XOR_OP: case DEC: case INC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: case SLASH: case ASTERIX: case DOT: case POW: case MATRIX_OP1: case MATRIX_OP2: case PLUS: case MINUS: case LTMARK: case GTMARK: case LOG_NEG: case LOG_AND: case LOG_OR: case QUESTION: { e4 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; e4_AST = returnAST; // see above (#e2) c4 = comp.ConstantIndex( e4_AST); if( c4 != NULL) { int e4Line = e4_AST->getLine(); e4_AST = astFactory->create(CONSTANT,"CONST_IX"); e4_AST->ResetCData( c4); e4_AST->SetLine( e4Line); } arrayindex_AST = RefDNode(currentAST.root); //c1 = comp.ConstantIndex( #e1); //c3 = comp.ConstantIndex( #e3); //c4 = comp.ConstantIndex( #e4); if( c1 != NULL && c3 != NULL && c4 != NULL) { ixList->push_back( new CArrayIndexRangeS( c1, c3, c4)); } else { //delete c1; //delete c3; //delete c4; arrayindex_AST = RefDNode(astFactory->make((new antlr::ASTArray(4))->add(antlr::RefAST(NULL))->add(antlr::RefAST(e1_AST))->add(antlr::RefAST(e3_AST))->add(antlr::RefAST(e4_AST)))); ixList->push_back( new ArrayIndexRangeS()); } currentAST.root = arrayindex_AST; if ( arrayindex_AST!=RefDNode(antlr::nullAST) && arrayindex_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = arrayindex_AST->getFirstChild(); else currentAST.child = arrayindex_AST; currentAST.advanceChildToEnd(); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } } break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } } currentAST = __currentAST109; _t = __t109; _t = _t->getNextSibling(); } returnAST = arrayindex_AST; _retTree = _t; } void GDLTreeParser::arrayindex_list(RefDNode _t) { RefDNode arrayindex_list_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode arrayindex_list_AST = RefDNode(antlr::nullAST); //std::auto_ptr< ArrayIndexListT> ixList( new ArrayIndexListT()); // compile_opt ArrayIndexVectorT* ixList = new ArrayIndexVectorT(); PtrGuard< ArrayIndexVectorT> guard( ixList); { // ( ... )+ int _cnt117=0; for (;;) { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; if ((_t->getType() == ARRAYIX)) { arrayindex(_t, ixList); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); } else { if ( _cnt117>=1 ) { goto _loop117; } else {throw antlr::NoViableAltException(antlr::RefAST(_t));} } _cnt117++; } _loop117:; } // ( ... )+ arrayindex_list_AST = RefDNode(currentAST.root); arrayindex_list_AST = RefDNode(astFactory->make((new antlr::ASTArray(2))->add(antlr::RefAST(astFactory->create(ARRAYIX,"[...]")))->add(antlr::RefAST(arrayindex_list_AST)))); // ixList->Freeze(); // do all initial one-time settings // if( ixList->NDim() == 1) // #arrayindex_list = #([ARRAYIX1,"[ix]"], arrayindex_list); // else // { // #arrayindex_list = #([ARRAYIX,"[...]"], arrayindex_list); // ixList->Freeze(); // do all initial one-time settings // } guard.Release(); ArrayIndexListT* arrayIndexNoAssoc; ArrayIndexListT* arrayIndex; MakeArrayIndex( ixList, &arrayIndex, &arrayIndexNoAssoc); delete ixList; arrayindex_list_AST->SetArrayIndexList( arrayIndex, arrayIndexNoAssoc); currentAST.root = arrayindex_list_AST; if ( arrayindex_list_AST!=RefDNode(antlr::nullAST) && arrayindex_list_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = arrayindex_list_AST->getFirstChild(); else currentAST.child = arrayindex_list_AST; currentAST.advanceChildToEnd(); arrayindex_list_AST = RefDNode(currentAST.root); returnAST = arrayindex_list_AST; _retTree = _t; } void GDLTreeParser::lassign_expr(RefDNode _t) { RefDNode lassign_expr_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode lassign_expr_AST = RefDNode(antlr::nullAST); RefDNode ex_AST = RefDNode(antlr::nullAST); RefDNode ex = RefDNode(antlr::nullAST); ex = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; ex_AST = returnAST; lassign_expr_AST = RefDNode(currentAST.root); // remove last pair of braces if( ex_AST->getType()==EXPR) { // int cT = #ex->getFirstChild()->getType(); // if( cT != FCALL && // cT != MFCALL && // cT != MFCALL_PARENT && // cT != FCALL_LIB && // cT != MFCALL_LIB && // cT != MFCALL_PARENT_LIB) ex_AST=ex_AST->getFirstChild(); } if( ex_AST->getType()==ASSIGN) throw GDLException( _t, "Assign expression is not allowed as " "l-expression in assignment"); lassign_expr_AST= ex_AST; //#( NULL, ex); currentAST.root = lassign_expr_AST; if ( lassign_expr_AST!=RefDNode(antlr::nullAST) && lassign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = lassign_expr_AST->getFirstChild(); else currentAST.child = lassign_expr_AST; currentAST.advanceChildToEnd(); returnAST = lassign_expr_AST; _retTree = _t; } void GDLTreeParser::assign_expr(RefDNode _t) { RefDNode assign_expr_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode assign_expr_AST = RefDNode(antlr::nullAST); RefDNode a = RefDNode(antlr::nullAST); RefDNode a_AST = RefDNode(antlr::nullAST); RefDNode l_AST = RefDNode(antlr::nullAST); RefDNode l = RefDNode(antlr::nullAST); RefDNode r_AST = RefDNode(antlr::nullAST); RefDNode r = RefDNode(antlr::nullAST); RefDNode __t120 = _t; a = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a_AST_in = RefDNode(antlr::nullAST); a_AST = astFactory->create(antlr::RefAST(a)); antlr::ASTPair __currentAST120 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),ASSIGN); _t = _t->getFirstChild(); l = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; lassign_expr(_t); _t = _retTree; l_AST = returnAST; r = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; r_AST = returnAST; currentAST = __currentAST120; _t = __t120; _t = _t->getNextSibling(); assign_expr_AST = RefDNode(currentAST.root); if( !SelfAssignment( l_AST, r_AST)) { AssignReplace( l_AST, a_AST); // int lT = #l->getType(); // if( lT == FCALL || lT == MFCALL || lT == MFCALL_PARENT || // lT == FCALL_LIB || lT == MFCALL_LIB || lT == MFCALL_PARENT_LIB || // lT == DEREF || lT == VAR || lT == VARPTR) // #a->setType( ASSIGN_REPLACE); assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(a_AST))->add(antlr::RefAST(r_AST))->add(antlr::RefAST(l_AST)))); } else { assign_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(1))->add(antlr::RefAST(l_AST)))); } currentAST.root = assign_expr_AST; if ( assign_expr_AST!=RefDNode(antlr::nullAST) && assign_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = assign_expr_AST->getFirstChild(); else currentAST.child = assign_expr_AST; currentAST.advanceChildToEnd(); returnAST = assign_expr_AST; _retTree = _t; } void GDLTreeParser::sysvar(RefDNode _t) { RefDNode sysvar_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode sysvar_AST = RefDNode(antlr::nullAST); RefDNode s = RefDNode(antlr::nullAST); RefDNode s_AST = RefDNode(antlr::nullAST); RefDNode i = RefDNode(antlr::nullAST); RefDNode i_AST = RefDNode(antlr::nullAST); RefDNode __t145 = _t; s = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode s_AST_in = RefDNode(antlr::nullAST); s_AST = astFactory->create(antlr::RefAST(s)); antlr::ASTPair __currentAST145 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),SYSVAR); _t = _t->getFirstChild(); i = _t; RefDNode i_AST_in = RefDNode(antlr::nullAST); i_AST = astFactory->create(antlr::RefAST(i)); match(antlr::RefAST(_t),SYSVARNAME); _t = _t->getNextSibling(); currentAST = __currentAST145; _t = __t145; _t = _t->getNextSibling(); sysvar_AST = RefDNode(currentAST.root); std::string sysVarName = i->getText(); // here we create the real sysvar node sysvar_AST=astFactory->create(SYSVAR, sysVarName.substr(1)); sysvar_AST->SetLine(s->getLine()); // #sysvar=#[SYSVAR,i->getText()]; comp.SysVar(sysvar_AST); // sets var to NULL currentAST.root = sysvar_AST; if ( sysvar_AST!=RefDNode(antlr::nullAST) && sysvar_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = sysvar_AST->getFirstChild(); else currentAST.child = sysvar_AST; currentAST.advanceChildToEnd(); returnAST = sysvar_AST; _retTree = _t; } void GDLTreeParser::var(RefDNode _t) { RefDNode var_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode var_AST = RefDNode(antlr::nullAST); RefDNode v = RefDNode(antlr::nullAST); RefDNode v_AST = RefDNode(antlr::nullAST); RefDNode i = RefDNode(antlr::nullAST); RefDNode i_AST = RefDNode(antlr::nullAST); RefDNode __t147 = _t; v = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode v_AST_in = RefDNode(antlr::nullAST); v_AST = astFactory->create(antlr::RefAST(v)); antlr::ASTPair __currentAST147 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),VAR); _t = _t->getFirstChild(); i = _t; RefDNode i_AST_in = RefDNode(antlr::nullAST); i_AST = astFactory->create(antlr::RefAST(i)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); currentAST = __currentAST147; _t = __t147; _t = _t->getNextSibling(); var_AST = RefDNode(currentAST.root); var_AST=astFactory->create(VAR,i->getText()); var_AST->SetLine(v->getLine()); // #var=#[VAR,i->getText()]; comp.Var(var_AST); currentAST.root = var_AST; if ( var_AST!=RefDNode(antlr::nullAST) && var_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = var_AST->getFirstChild(); else currentAST.child = var_AST; currentAST.advanceChildToEnd(); returnAST = var_AST; _retTree = _t; } void GDLTreeParser::arrayindex_list_to_parameter_list(RefDNode _t, bool varNum ) { RefDNode arrayindex_list_to_parameter_list_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode arrayindex_list_to_parameter_list_AST = RefDNode(antlr::nullAST); RefDNode e_AST = RefDNode(antlr::nullAST); RefDNode e = RefDNode(antlr::nullAST); int nPar = 0; { // ( ... )+ int _cnt151=0; for (;;) { if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; if ((_t->getType() == ARRAYIX)) { RefDNode __t150 = _t; RefDNode tmp30_AST = RefDNode(antlr::nullAST); RefDNode tmp30_AST_in = RefDNode(antlr::nullAST); tmp30_AST = astFactory->create(antlr::RefAST(_t)); tmp30_AST_in = _t; antlr::ASTPair __currentAST150 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),ARRAYIX); _t = _t->getFirstChild(); e = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; pos_parameter(_t, varNum); _t = _retTree; e_AST = returnAST; currentAST = __currentAST150; _t = __t150; _t = _t->getNextSibling(); arrayindex_list_to_parameter_list_AST = RefDNode(currentAST.root); arrayindex_list_to_parameter_list_AST= RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(NULL))->add(antlr::RefAST(arrayindex_list_to_parameter_list_AST))->add(antlr::RefAST(e_AST)))); ++nPar; currentAST.root = arrayindex_list_to_parameter_list_AST; if ( arrayindex_list_to_parameter_list_AST!=RefDNode(antlr::nullAST) && arrayindex_list_to_parameter_list_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = arrayindex_list_to_parameter_list_AST->getFirstChild(); else currentAST.child = arrayindex_list_to_parameter_list_AST; currentAST.advanceChildToEnd(); } else { if ( _cnt151>=1 ) { goto _loop151; } else {throw antlr::NoViableAltException(antlr::RefAST(_t));} } _cnt151++; } _loop151:; } // ( ... )+ arrayindex_list_to_parameter_list_AST->SetNParam( nPar); returnAST = arrayindex_list_to_parameter_list_AST; _retTree = _t; } void GDLTreeParser::arrayexpr_fn(RefDNode _t) { RefDNode arrayexpr_fn_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode arrayexpr_fn_AST = RefDNode(antlr::nullAST); RefDNode aIn = RefDNode(antlr::nullAST); RefDNode aIn_AST = RefDNode(antlr::nullAST); RefDNode va = RefDNode(antlr::nullAST); RefDNode va_AST = RefDNode(antlr::nullAST); RefDNode id = RefDNode(antlr::nullAST); RefDNode id_AST = RefDNode(antlr::nullAST); RefDNode el_AST = RefDNode(antlr::nullAST); RefDNode el = RefDNode(antlr::nullAST); std::string id_text; bool isVar; RefDNode mark, va2, vaAlt, fn, arrayindex_listAST; RefDNode __t153 = _t; aIn = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode aIn_AST_in = RefDNode(antlr::nullAST); aIn_AST = astFactory->create(antlr::RefAST(aIn)); antlr::ASTPair __currentAST153 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),ARRAYEXPR_FCALL); _t = _t->getFirstChild(); RefDNode __t154 = _t; va = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode va_AST_in = RefDNode(antlr::nullAST); va_AST = astFactory->create(antlr::RefAST(va)); antlr::ASTPair __currentAST154 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),VAR); _t = _t->getFirstChild(); id = _t; RefDNode id_AST_in = RefDNode(antlr::nullAST); id_AST = astFactory->create(antlr::RefAST(id)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); currentAST = __currentAST154; _t = __t154; _t = _t->getNextSibling(); mark = _t; id_text = id_AST->getText(); // IsVar is not needed, we must emit an ARRAYEXPR_FCALL even if the variable is known // (rule: Accessible functions always override variables //isVar = comp.IsVar( id_text); // isVar == true -> VAR for sure // (== false: maybe VAR nevertheless) int libIx = LibFunIx(id_text); { el = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; arrayindex_list_to_parameter_list(_t, libIx != -1 && libFunList[ libIx]->NPar() == -1); _t = _retTree; el_AST = returnAST; } arrayexpr_fn_AST = RefDNode(currentAST.root); // first search library functions if( libIx != -1) { int nParam = 0; if( el_AST != RefDNode(antlr::nullAST)) nParam = el_AST->GetNParam(); int libParam = libFunList[libIx]->NPar(); int libParamMin = libFunList[libIx]->NParMin(); if( libParam != -1 && nParam > libParam) throw GDLException( aIn, libFunList[libIx]->Name() + ": Too many arguments."); if( libParam != -1 && nParam < libParamMin) throw GDLException( aIn, libFunList[libIx]->Name() + ": Too few arguments."); id_AST->SetLibFun( libFunList[libIx]); if( libFunList[ libIx]->RetNew()) { if( libFunList[ libIx]->Name() == "N_ELEMENTS") id_AST->setType( FCALL_LIB_N_ELEMENTS); else if( libFunList[ libIx]->DirectCall()) id_AST->setType( FCALL_LIB_DIRECT); else id_AST->setType( FCALL_LIB_RETNEW); arrayexpr_fn_AST = RefDNode(astFactory->make((new antlr::ASTArray(2))->add(antlr::RefAST(id_AST))->add(antlr::RefAST(el_AST)))); // #([/*FCALL_LIB_RETNEW,"fcall_lib_retnew"],*/ id, el); } else { id_AST->setType( FCALL_LIB); arrayexpr_fn_AST = RefDNode(astFactory->make((new antlr::ASTArray(2))->add(antlr::RefAST(id_AST))->add(antlr::RefAST(el_AST)))); // #(/*[FCALL_LIB,"fcall_lib"],*/ id, el); } } // then search user defined functions else { int funIx=FunIx( id_text); // we use #id for the FCALL part id_AST->setType( FCALL); id_AST->SetFunIx( funIx); if( funIx != -1) // found -> FCALL { arrayexpr_fn_AST = RefDNode(astFactory->make((new antlr::ASTArray(2))->add(antlr::RefAST(id_AST))->add(antlr::RefAST(el_AST)))); // #(/*[FCALL,"fcall"],*/ id, el); } else // function not found -> still ambiguous { // _t = mark; // rewind to parse again arrayindex_list( mark); //_t = _retTree; arrayindex_listAST = returnAST; va2=astFactory->create( VAR, id_text); // #va=#[VAR,id->getText()]; comp.Var( va2); // we declare the variable here! // if IsVar() still would be used this would lead to surprising behavior: // e. g.: function_call(42) & function_call(43) // The first (42) would be an ARRAYEXPR_FCALL the 2nd (43) an ARRAYEXPR // if then at runtime function "function_call" is known, // it will be called only at the first appearance of the call. // that's why we cannot allow unambiguous VAR here vaAlt = RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ARRAYEXPR,"arrayexpr")))->add(antlr::RefAST(va2))->add(antlr::RefAST(arrayindex_listAST)))); fn = RefDNode(astFactory->make((new antlr::ASTArray(2))->add(antlr::RefAST(id_AST))->add(antlr::RefAST(el_AST)))); arrayexpr_fn_AST = RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(aIn_AST))->add(antlr::RefAST(vaAlt))->add(antlr::RefAST(fn)))); } } // // not valid s. a. (kept for reference): unambiguous VAR // { // variable -> arrayexpr // // make var // #va=astFactory->create(VAR,#id->getText()); // // #va=#[VAR,id->getText()]; // comp.Var(#va); // #arrayexpr_fn= // #([ARRAYEXPR,"arrayexpr"], va, al); // } currentAST.root = arrayexpr_fn_AST; if ( arrayexpr_fn_AST!=RefDNode(antlr::nullAST) && arrayexpr_fn_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = arrayexpr_fn_AST->getFirstChild(); else currentAST.child = arrayexpr_fn_AST; currentAST.advanceChildToEnd(); currentAST = __currentAST153; _t = __t153; _t = _t->getNextSibling(); returnAST = arrayexpr_fn_AST; _retTree = _t; } void GDLTreeParser::arrayexpr_mfcall(RefDNode _t) { RefDNode arrayexpr_mfcall_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode arrayexpr_mfcall_AST = RefDNode(antlr::nullAST); RefDNode a = RefDNode(antlr::nullAST); RefDNode a_AST = RefDNode(antlr::nullAST); RefDNode e_AST = RefDNode(antlr::nullAST); RefDNode e = RefDNode(antlr::nullAST); RefDNode i = RefDNode(antlr::nullAST); RefDNode i_AST = RefDNode(antlr::nullAST); RefDNode e2_AST = RefDNode(antlr::nullAST); RefDNode e2 = RefDNode(antlr::nullAST); RefDNode i2 = RefDNode(antlr::nullAST); RefDNode i2_AST = RefDNode(antlr::nullAST); RefDNode a2_AST = RefDNode(antlr::nullAST); RefDNode a2 = RefDNode(antlr::nullAST); RefDNode __t157 = _t; a = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode a_AST_in = RefDNode(antlr::nullAST); a_AST = astFactory->create(antlr::RefAST(a)); antlr::ASTPair __currentAST157 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),ARRAYEXPR_MFCALL); _t = _t->getFirstChild(); RefDNode mark = _t; // mark e = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; e_AST = returnAST; i = _t; RefDNode i_AST_in = RefDNode(antlr::nullAST); i_AST = astFactory->create(antlr::RefAST(i)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); bool success = true; RefDNode first; try { arrayindex_list(_t); RefDNode al = returnAST; RefDNode ae = RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(ARRAYEXPR,"arrayexpr")))->add(antlr::RefAST(i_AST))->add(antlr::RefAST(al)))); if( e->getType() == DOT) { int nDot = e_AST->GetNDot(); e_AST->SetNDot( ++nDot); e_AST->addChild( ae); first = e_AST; } else { RefDNode dot = RefDNode(astFactory->make((new antlr::ASTArray(3))->add(antlr::RefAST(astFactory->create(DOT,".")))->add(antlr::RefAST(e_AST))->add(antlr::RefAST(ae)))); dot->SetNDot( 1); first = dot; } } catch( GDLException& ex) { Message( "Ambiguity resolved: member function call " "due to invalid array index."); success = false; a_AST->setType( MFCALL); a_AST->setText( "mfcall"); } _t = mark; // rewind to parse again e2 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; e2_AST = returnAST; i2 = _t; RefDNode i2_AST_in = RefDNode(antlr::nullAST); i2_AST = astFactory->create(antlr::RefAST(i2)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); a2 = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; arrayindex_list_to_parameter_list(_t, false); _t = _retTree; a2_AST = returnAST; arrayexpr_mfcall_AST = RefDNode(currentAST.root); if( success) arrayexpr_mfcall_AST = RefDNode(astFactory->make((new antlr::ASTArray(5))->add(antlr::RefAST(a_AST))->add(antlr::RefAST(first))->add(antlr::RefAST(e2_AST))->add(antlr::RefAST(i2_AST))->add(antlr::RefAST(a2_AST)))); else arrayexpr_mfcall_AST = RefDNode(astFactory->make((new antlr::ASTArray(4))->add(antlr::RefAST(a_AST))->add(antlr::RefAST(e2_AST))->add(antlr::RefAST(i2_AST))->add(antlr::RefAST(a2_AST)))); currentAST.root = arrayexpr_mfcall_AST; if ( arrayexpr_mfcall_AST!=RefDNode(antlr::nullAST) && arrayexpr_mfcall_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = arrayexpr_mfcall_AST->getFirstChild(); else currentAST.child = arrayexpr_mfcall_AST; currentAST.advanceChildToEnd(); currentAST = __currentAST157; _t = __t157; _t = _t->getNextSibling(); returnAST = arrayexpr_mfcall_AST; _retTree = _t; } void GDLTreeParser::primary_expr(RefDNode _t) { RefDNode primary_expr_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode primary_expr_AST = RefDNode(antlr::nullAST); RefDNode f = RefDNode(antlr::nullAST); RefDNode f_AST = RefDNode(antlr::nullAST); RefDNode id = RefDNode(antlr::nullAST); RefDNode id_AST = RefDNode(antlr::nullAST); RefDNode p_AST = RefDNode(antlr::nullAST); RefDNode p = RefDNode(antlr::nullAST); RefDNode g = RefDNode(antlr::nullAST); RefDNode g_AST = RefDNode(antlr::nullAST); int dummy; RefDNode mark; if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ASSIGN: { assign_expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); primary_expr_AST = RefDNode(currentAST.root); break; } case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: { comp_assign_expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); primary_expr_AST = RefDNode(currentAST.root); break; } case ARRAYEXPR_MFCALL: { arrayexpr_mfcall(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); primary_expr_AST = RefDNode(currentAST.root); break; } case MFCALL: { RefDNode __t159 = _t; RefDNode tmp31_AST = RefDNode(antlr::nullAST); RefDNode tmp31_AST_in = RefDNode(antlr::nullAST); tmp31_AST = astFactory->create(antlr::RefAST(_t)); tmp31_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp31_AST)); antlr::ASTPair __currentAST159 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),MFCALL); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); RefDNode tmp32_AST = RefDNode(antlr::nullAST); RefDNode tmp32_AST_in = RefDNode(antlr::nullAST); tmp32_AST = astFactory->create(antlr::RefAST(_t)); tmp32_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp32_AST)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); parameter_def(_t, false); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST159; _t = __t159; _t = _t->getNextSibling(); primary_expr_AST = RefDNode(currentAST.root); break; } case MFCALL_PARENT: { RefDNode __t160 = _t; RefDNode tmp33_AST = RefDNode(antlr::nullAST); RefDNode tmp33_AST_in = RefDNode(antlr::nullAST); tmp33_AST = astFactory->create(antlr::RefAST(_t)); tmp33_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp33_AST)); antlr::ASTPair __currentAST160 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),MFCALL_PARENT); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); RefDNode tmp34_AST = RefDNode(antlr::nullAST); RefDNode tmp34_AST_in = RefDNode(antlr::nullAST); tmp34_AST = astFactory->create(antlr::RefAST(_t)); tmp34_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp34_AST)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); RefDNode tmp35_AST = RefDNode(antlr::nullAST); RefDNode tmp35_AST_in = RefDNode(antlr::nullAST); tmp35_AST = astFactory->create(antlr::RefAST(_t)); tmp35_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp35_AST)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); parameter_def(_t, false); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST160; _t = __t160; _t = _t->getNextSibling(); primary_expr_AST = RefDNode(currentAST.root); break; } case FCALL: { RefDNode __t161 = _t; f = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode f_AST_in = RefDNode(antlr::nullAST); f_AST = astFactory->create(antlr::RefAST(f)); astFactory->addASTChild(currentAST, antlr::RefAST(f_AST)); antlr::ASTPair __currentAST161 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),FCALL); _t = _t->getFirstChild(); id = _t; RefDNode id_AST_in = RefDNode(antlr::nullAST); id_AST = astFactory->create(antlr::RefAST(id)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); // first search library functions int i=LibFunIx(id->getText()); p = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; parameter_def(_t, i != -1 && libFunList[ i]->NPar() == -1); _t = _retTree; p_AST = returnAST; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); if( i != -1) { // N_ELEMENTS must handle exceptions during parameter evaluation // if( StrUpCase( #id->getText()) == "N_ELEMENTS") // { // #f->setType(FCALL_LIB_N_ELEMENTS); // #f->setText(#id->getText()); // #f->SetLibFun( libFunList[i]); // // #id->SetFunIx(i); // } // else { int nParam = 0; if( p_AST != RefDNode(antlr::nullAST)) nParam = p_AST->GetNParam(); int libParam = libFunList[i]->NPar(); int libParamMin = libFunList[i]->NParMin(); if( libParam != -1 && nParam > libParam) throw GDLException( f, libFunList[i]->Name() + ": Too many arguments."); if( libParam != -1 && nParam < libParamMin) throw GDLException( f, libFunList[i]->Name() + ": Too few arguments."); if( libFunList[ i]->RetNew()) { if( libFunList[ i]->Name() == "N_ELEMENTS") f_AST->setType( FCALL_LIB_N_ELEMENTS); else if( libFunList[ i]->DirectCall()) f_AST->setType( FCALL_LIB_DIRECT); else f_AST->setType(FCALL_LIB_RETNEW); f_AST->setText(id_AST->getText()); f_AST->SetLibFun( libFunList[i]); // #id->SetFunIx(i); } else { f_AST->setType(FCALL_LIB); f_AST->setText(id_AST->getText()); f_AST->SetLibFun( libFunList[i]); // #id->SetFunIx(i); } } } else { // then search user defined functions f_AST->setType(FCALL); f_AST->setText(id_AST->getText()); i=FunIx(id_AST->getText()); f_AST->SetFunIx(i); } currentAST = __currentAST161; _t = __t161; _t = _t->getNextSibling(); primary_expr_AST = RefDNode(currentAST.root); break; } case ARRAYEXPR_FCALL: { arrayexpr_fn(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); primary_expr_AST = RefDNode(currentAST.root); break; } case CONSTANT: { RefDNode tmp36_AST = RefDNode(antlr::nullAST); RefDNode tmp36_AST_in = RefDNode(antlr::nullAST); tmp36_AST = astFactory->create(antlr::RefAST(_t)); tmp36_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp36_AST)); match(antlr::RefAST(_t),CONSTANT); _t = _t->getNextSibling(); primary_expr_AST = RefDNode(currentAST.root); break; } case ARRAYDEF: case ARRAYDEF_CONST: { dummy=array_def(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); primary_expr_AST = RefDNode(currentAST.root); break; } case NSTRUC_REF: case STRUC: { struct_def(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); primary_expr_AST = RefDNode(currentAST.root); break; } case GDLNULL: { g = _t; RefDNode g_AST_in = RefDNode(antlr::nullAST); g_AST = astFactory->create(antlr::RefAST(g)); astFactory->addASTChild(currentAST, antlr::RefAST(g_AST)); match(antlr::RefAST(_t),GDLNULL); _t = _t->getNextSibling(); g_AST->setType(SYSVAR); g_AST->setText("NULL"); comp.SysVar(g_AST); // sets var to NULL primary_expr_AST = RefDNode(currentAST.root); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } returnAST = primary_expr_AST; _retTree = _t; } void GDLTreeParser::op_expr(RefDNode _t) { RefDNode op_expr_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode op_expr_AST = RefDNode(antlr::nullAST); if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case QUESTION: { RefDNode __t163 = _t; RefDNode tmp37_AST = RefDNode(antlr::nullAST); RefDNode tmp37_AST_in = RefDNode(antlr::nullAST); tmp37_AST = astFactory->create(antlr::RefAST(_t)); tmp37_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp37_AST)); antlr::ASTPair __currentAST163 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),QUESTION); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST163; _t = __t163; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case AND_OP: { RefDNode __t164 = _t; RefDNode tmp38_AST = RefDNode(antlr::nullAST); RefDNode tmp38_AST_in = RefDNode(antlr::nullAST); tmp38_AST = astFactory->create(antlr::RefAST(_t)); tmp38_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp38_AST)); antlr::ASTPair __currentAST164 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),AND_OP); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST164; _t = __t164; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case OR_OP: { RefDNode __t165 = _t; RefDNode tmp39_AST = RefDNode(antlr::nullAST); RefDNode tmp39_AST_in = RefDNode(antlr::nullAST); tmp39_AST = astFactory->create(antlr::RefAST(_t)); tmp39_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp39_AST)); antlr::ASTPair __currentAST165 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),OR_OP); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST165; _t = __t165; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case XOR_OP: { RefDNode __t166 = _t; RefDNode tmp40_AST = RefDNode(antlr::nullAST); RefDNode tmp40_AST_in = RefDNode(antlr::nullAST); tmp40_AST = astFactory->create(antlr::RefAST(_t)); tmp40_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp40_AST)); antlr::ASTPair __currentAST166 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),XOR_OP); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST166; _t = __t166; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case LOG_AND: { RefDNode __t167 = _t; RefDNode tmp41_AST = RefDNode(antlr::nullAST); RefDNode tmp41_AST_in = RefDNode(antlr::nullAST); tmp41_AST = astFactory->create(antlr::RefAST(_t)); tmp41_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp41_AST)); antlr::ASTPair __currentAST167 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),LOG_AND); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST167; _t = __t167; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case LOG_OR: { RefDNode __t168 = _t; RefDNode tmp42_AST = RefDNode(antlr::nullAST); RefDNode tmp42_AST_in = RefDNode(antlr::nullAST); tmp42_AST = astFactory->create(antlr::RefAST(_t)); tmp42_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp42_AST)); antlr::ASTPair __currentAST168 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),LOG_OR); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST168; _t = __t168; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case EQ_OP: { RefDNode __t169 = _t; RefDNode tmp43_AST = RefDNode(antlr::nullAST); RefDNode tmp43_AST_in = RefDNode(antlr::nullAST); tmp43_AST = astFactory->create(antlr::RefAST(_t)); tmp43_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp43_AST)); antlr::ASTPair __currentAST169 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),EQ_OP); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST169; _t = __t169; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case NE_OP: { RefDNode __t170 = _t; RefDNode tmp44_AST = RefDNode(antlr::nullAST); RefDNode tmp44_AST_in = RefDNode(antlr::nullAST); tmp44_AST = astFactory->create(antlr::RefAST(_t)); tmp44_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp44_AST)); antlr::ASTPair __currentAST170 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),NE_OP); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST170; _t = __t170; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case LE_OP: { RefDNode __t171 = _t; RefDNode tmp45_AST = RefDNode(antlr::nullAST); RefDNode tmp45_AST_in = RefDNode(antlr::nullAST); tmp45_AST = astFactory->create(antlr::RefAST(_t)); tmp45_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp45_AST)); antlr::ASTPair __currentAST171 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),LE_OP); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST171; _t = __t171; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case LT_OP: { RefDNode __t172 = _t; RefDNode tmp46_AST = RefDNode(antlr::nullAST); RefDNode tmp46_AST_in = RefDNode(antlr::nullAST); tmp46_AST = astFactory->create(antlr::RefAST(_t)); tmp46_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp46_AST)); antlr::ASTPair __currentAST172 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),LT_OP); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST172; _t = __t172; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case GE_OP: { RefDNode __t173 = _t; RefDNode tmp47_AST = RefDNode(antlr::nullAST); RefDNode tmp47_AST_in = RefDNode(antlr::nullAST); tmp47_AST = astFactory->create(antlr::RefAST(_t)); tmp47_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp47_AST)); antlr::ASTPair __currentAST173 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),GE_OP); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST173; _t = __t173; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case GT_OP: { RefDNode __t174 = _t; RefDNode tmp48_AST = RefDNode(antlr::nullAST); RefDNode tmp48_AST_in = RefDNode(antlr::nullAST); tmp48_AST = astFactory->create(antlr::RefAST(_t)); tmp48_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp48_AST)); antlr::ASTPair __currentAST174 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),GT_OP); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST174; _t = __t174; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case NOT_OP: { RefDNode __t175 = _t; RefDNode tmp49_AST = RefDNode(antlr::nullAST); RefDNode tmp49_AST_in = RefDNode(antlr::nullAST); tmp49_AST = astFactory->create(antlr::RefAST(_t)); tmp49_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp49_AST)); antlr::ASTPair __currentAST175 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),NOT_OP); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST175; _t = __t175; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case PLUS: { RefDNode __t176 = _t; RefDNode tmp50_AST = RefDNode(antlr::nullAST); RefDNode tmp50_AST_in = RefDNode(antlr::nullAST); tmp50_AST = astFactory->create(antlr::RefAST(_t)); tmp50_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp50_AST)); antlr::ASTPair __currentAST176 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),PLUS); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST176; _t = __t176; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case MINUS: { RefDNode __t177 = _t; RefDNode tmp51_AST = RefDNode(antlr::nullAST); RefDNode tmp51_AST_in = RefDNode(antlr::nullAST); tmp51_AST = astFactory->create(antlr::RefAST(_t)); tmp51_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp51_AST)); antlr::ASTPair __currentAST177 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),MINUS); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST177; _t = __t177; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case LTMARK: { RefDNode __t178 = _t; RefDNode tmp52_AST = RefDNode(antlr::nullAST); RefDNode tmp52_AST_in = RefDNode(antlr::nullAST); tmp52_AST = astFactory->create(antlr::RefAST(_t)); tmp52_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp52_AST)); antlr::ASTPair __currentAST178 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),LTMARK); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST178; _t = __t178; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case GTMARK: { RefDNode __t179 = _t; RefDNode tmp53_AST = RefDNode(antlr::nullAST); RefDNode tmp53_AST_in = RefDNode(antlr::nullAST); tmp53_AST = astFactory->create(antlr::RefAST(_t)); tmp53_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp53_AST)); antlr::ASTPair __currentAST179 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),GTMARK); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST179; _t = __t179; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case UMINUS: { uminus(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); op_expr_AST = RefDNode(currentAST.root); break; } case LOG_NEG: { RefDNode __t180 = _t; RefDNode tmp54_AST = RefDNode(antlr::nullAST); RefDNode tmp54_AST_in = RefDNode(antlr::nullAST); tmp54_AST = astFactory->create(antlr::RefAST(_t)); tmp54_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp54_AST)); antlr::ASTPair __currentAST180 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),LOG_NEG); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST180; _t = __t180; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case ASTERIX: { RefDNode __t181 = _t; RefDNode tmp55_AST = RefDNode(antlr::nullAST); RefDNode tmp55_AST_in = RefDNode(antlr::nullAST); tmp55_AST = astFactory->create(antlr::RefAST(_t)); tmp55_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp55_AST)); antlr::ASTPair __currentAST181 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),ASTERIX); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST181; _t = __t181; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case MATRIX_OP1: { RefDNode __t182 = _t; RefDNode tmp56_AST = RefDNode(antlr::nullAST); RefDNode tmp56_AST_in = RefDNode(antlr::nullAST); tmp56_AST = astFactory->create(antlr::RefAST(_t)); tmp56_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp56_AST)); antlr::ASTPair __currentAST182 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),MATRIX_OP1); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST182; _t = __t182; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case MATRIX_OP2: { RefDNode __t183 = _t; RefDNode tmp57_AST = RefDNode(antlr::nullAST); RefDNode tmp57_AST_in = RefDNode(antlr::nullAST); tmp57_AST = astFactory->create(antlr::RefAST(_t)); tmp57_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp57_AST)); antlr::ASTPair __currentAST183 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),MATRIX_OP2); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST183; _t = __t183; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case SLASH: { RefDNode __t184 = _t; RefDNode tmp58_AST = RefDNode(antlr::nullAST); RefDNode tmp58_AST_in = RefDNode(antlr::nullAST); tmp58_AST = astFactory->create(antlr::RefAST(_t)); tmp58_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp58_AST)); antlr::ASTPair __currentAST184 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),SLASH); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST184; _t = __t184; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case MOD_OP: { RefDNode __t185 = _t; RefDNode tmp59_AST = RefDNode(antlr::nullAST); RefDNode tmp59_AST_in = RefDNode(antlr::nullAST); tmp59_AST = astFactory->create(antlr::RefAST(_t)); tmp59_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp59_AST)); antlr::ASTPair __currentAST185 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),MOD_OP); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST185; _t = __t185; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case POW: { RefDNode __t186 = _t; RefDNode tmp60_AST = RefDNode(antlr::nullAST); RefDNode tmp60_AST_in = RefDNode(antlr::nullAST); tmp60_AST = astFactory->create(antlr::RefAST(_t)); tmp60_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp60_AST)); antlr::ASTPair __currentAST186 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),POW); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST186; _t = __t186; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case DEC: { RefDNode __t187 = _t; RefDNode tmp61_AST = RefDNode(antlr::nullAST); RefDNode tmp61_AST_in = RefDNode(antlr::nullAST); tmp61_AST = astFactory->create(antlr::RefAST(_t)); tmp61_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp61_AST)); antlr::ASTPair __currentAST187 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),DEC); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST187; _t = __t187; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case INC: { RefDNode __t188 = _t; RefDNode tmp62_AST = RefDNode(antlr::nullAST); RefDNode tmp62_AST_in = RefDNode(antlr::nullAST); tmp62_AST = astFactory->create(antlr::RefAST(_t)); tmp62_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp62_AST)); antlr::ASTPair __currentAST188 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),INC); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST188; _t = __t188; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case POSTDEC: { RefDNode __t189 = _t; RefDNode tmp63_AST = RefDNode(antlr::nullAST); RefDNode tmp63_AST_in = RefDNode(antlr::nullAST); tmp63_AST = astFactory->create(antlr::RefAST(_t)); tmp63_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp63_AST)); antlr::ASTPair __currentAST189 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),POSTDEC); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST189; _t = __t189; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case POSTINC: { RefDNode __t190 = _t; RefDNode tmp64_AST = RefDNode(antlr::nullAST); RefDNode tmp64_AST_in = RefDNode(antlr::nullAST); tmp64_AST = astFactory->create(antlr::RefAST(_t)); tmp64_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp64_AST)); antlr::ASTPair __currentAST190 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),POSTINC); _t = _t->getFirstChild(); expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST190; _t = __t190; _t = _t->getNextSibling(); op_expr_AST = RefDNode(currentAST.root); break; } case ASSIGN: case ARRAYDEF: case ARRAYDEF_CONST: case ARRAYEXPR_FCALL: case ARRAYEXPR_MFCALL: case CONSTANT: case FCALL: case GDLNULL: case MFCALL: case MFCALL_PARENT: case NSTRUC_REF: case STRUC: case AND_OP_EQ: case ASTERIX_EQ: case EQ_OP_EQ: case GE_OP_EQ: case GTMARK_EQ: case GT_OP_EQ: case LE_OP_EQ: case LTMARK_EQ: case LT_OP_EQ: case MATRIX_OP1_EQ: case MATRIX_OP2_EQ: case MINUS_EQ: case MOD_OP_EQ: case NE_OP_EQ: case OR_OP_EQ: case PLUS_EQ: case POW_EQ: case SLASH_EQ: case XOR_OP_EQ: { primary_expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); op_expr_AST = RefDNode(currentAST.root); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } returnAST = op_expr_AST; _retTree = _t; } void GDLTreeParser::uminus(RefDNode _t) { RefDNode uminus_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode uminus_AST = RefDNode(antlr::nullAST); RefDNode u = RefDNode(antlr::nullAST); RefDNode u_AST = RefDNode(antlr::nullAST); RefDNode e_AST = RefDNode(antlr::nullAST); RefDNode e = RefDNode(antlr::nullAST); RefDNode __t192 = _t; u = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode u_AST_in = RefDNode(antlr::nullAST); u_AST = astFactory->create(antlr::RefAST(u)); astFactory->addASTChild(currentAST, antlr::RefAST(u_AST)); antlr::ASTPair __currentAST192 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),UMINUS); _t = _t->getFirstChild(); e = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; e_AST = returnAST; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST192; _t = __t192; _t = _t->getNextSibling(); uminus_AST = RefDNode(currentAST.root); // eliminate (pre-calculate) uminus for constants if( e_AST->getType() == CONSTANT) { e_AST->ResetCData( e_AST->CData()->UMinus()); e_AST->setText( "-"+e_AST->getText()); uminus_AST = e_AST; } // else // { // #uminus = #( [UMINUS,"u-"], e); // } currentAST.root = uminus_AST; if ( uminus_AST!=RefDNode(antlr::nullAST) && uminus_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = uminus_AST->getFirstChild(); else currentAST.child = uminus_AST; currentAST.advanceChildToEnd(); uminus_AST = RefDNode(currentAST.root); returnAST = uminus_AST; _retTree = _t; } void GDLTreeParser::brace_expr(RefDNode _t) { RefDNode brace_expr_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode brace_expr_AST = RefDNode(antlr::nullAST); RefDNode e = RefDNode(antlr::nullAST); RefDNode e_AST = RefDNode(antlr::nullAST); RefDNode ex_AST = RefDNode(antlr::nullAST); RefDNode ex = RefDNode(antlr::nullAST); RefDNode __t194 = _t; e = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; RefDNode e_AST_in = RefDNode(antlr::nullAST); e_AST = astFactory->create(antlr::RefAST(e)); antlr::ASTPair __currentAST194 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),EXPR); _t = _t->getFirstChild(); ex = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; ex_AST = returnAST; currentAST = __currentAST194; _t = __t194; _t = _t->getNextSibling(); brace_expr_AST = RefDNode(currentAST.root); while( ex_AST->getType()==EXPR) ex_AST=ex_AST->getFirstChild(); brace_expr_AST=RefDNode(astFactory->make((new antlr::ASTArray(2))->add(antlr::RefAST(e_AST))->add(antlr::RefAST(ex_AST)))); currentAST.root = brace_expr_AST; if ( brace_expr_AST!=RefDNode(antlr::nullAST) && brace_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = brace_expr_AST->getFirstChild(); else currentAST.child = brace_expr_AST; currentAST.advanceChildToEnd(); returnAST = brace_expr_AST; _retTree = _t; } void GDLTreeParser::unbrace_expr(RefDNode _t) { RefDNode unbrace_expr_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode unbrace_expr_AST = RefDNode(antlr::nullAST); RefDNode ex_AST = RefDNode(antlr::nullAST); RefDNode ex = RefDNode(antlr::nullAST); RefDNode __t196 = _t; RefDNode tmp65_AST = RefDNode(antlr::nullAST); RefDNode tmp65_AST_in = RefDNode(antlr::nullAST); tmp65_AST = astFactory->create(antlr::RefAST(_t)); tmp65_AST_in = _t; antlr::ASTPair __currentAST196 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),EXPR); _t = _t->getFirstChild(); ex = (_t == ASTNULL) ? RefDNode(antlr::nullAST) : _t; expr(_t); _t = _retTree; ex_AST = returnAST; currentAST = __currentAST196; _t = __t196; _t = _t->getNextSibling(); unbrace_expr_AST = RefDNode(currentAST.root); while( ex_AST->getType()==EXPR) ex_AST=ex_AST->getFirstChild(); unbrace_expr_AST=ex_AST; currentAST.root = unbrace_expr_AST; if ( unbrace_expr_AST!=RefDNode(antlr::nullAST) && unbrace_expr_AST->getFirstChild() != RefDNode(antlr::nullAST) ) currentAST.child = unbrace_expr_AST->getFirstChild(); else currentAST.child = unbrace_expr_AST; currentAST.advanceChildToEnd(); returnAST = unbrace_expr_AST; _retTree = _t; } void GDLTreeParser::indexable_expr(RefDNode _t) { RefDNode indexable_expr_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode indexable_expr_AST = RefDNode(antlr::nullAST); if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case VAR: { var(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); indexable_expr_AST = RefDNode(currentAST.root); break; } case SYSVAR: { sysvar(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); indexable_expr_AST = RefDNode(currentAST.root); break; } case EXPR: { unbrace_expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); indexable_expr_AST = RefDNode(currentAST.root); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } returnAST = indexable_expr_AST; _retTree = _t; } void GDLTreeParser::array_expr(RefDNode _t) { RefDNode array_expr_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode array_expr_AST = RefDNode(antlr::nullAST); if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ARRAYEXPR: { RefDNode __t199 = _t; RefDNode tmp66_AST = RefDNode(antlr::nullAST); RefDNode tmp66_AST_in = RefDNode(antlr::nullAST); tmp66_AST = astFactory->create(antlr::RefAST(_t)); tmp66_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp66_AST)); antlr::ASTPair __currentAST199 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),ARRAYEXPR); _t = _t->getFirstChild(); indexable_expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); arrayindex_list(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST199; _t = __t199; _t = _t->getNextSibling(); array_expr_AST = RefDNode(currentAST.root); break; } case EXPR: case SYSVAR: case VAR: { indexable_expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); array_expr_AST = RefDNode(currentAST.root); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } returnAST = array_expr_AST; _retTree = _t; } void GDLTreeParser::tag_indexable_expr(RefDNode _t) { RefDNode tag_indexable_expr_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode tag_indexable_expr_AST = RefDNode(antlr::nullAST); if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case VAR: { var(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); tag_indexable_expr_AST = RefDNode(currentAST.root); break; } case SYSVAR: { sysvar(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); tag_indexable_expr_AST = RefDNode(currentAST.root); break; } case EXPR: { brace_expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); tag_indexable_expr_AST = RefDNode(currentAST.root); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } returnAST = tag_indexable_expr_AST; _retTree = _t; } void GDLTreeParser::tag_array_expr_1st(RefDNode _t) { RefDNode tag_array_expr_1st_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode tag_array_expr_1st_AST = RefDNode(antlr::nullAST); if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ARRAYEXPR: { RefDNode __t202 = _t; RefDNode tmp67_AST = RefDNode(antlr::nullAST); RefDNode tmp67_AST_in = RefDNode(antlr::nullAST); tmp67_AST = astFactory->create(antlr::RefAST(_t)); tmp67_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp67_AST)); antlr::ASTPair __currentAST202 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),ARRAYEXPR); _t = _t->getFirstChild(); tag_indexable_expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); arrayindex_list(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST202; _t = __t202; _t = _t->getNextSibling(); tag_array_expr_1st_AST = RefDNode(currentAST.root); break; } case EXPR: case SYSVAR: case VAR: { tag_indexable_expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); tag_array_expr_1st_AST = RefDNode(currentAST.root); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } returnAST = tag_array_expr_1st_AST; _retTree = _t; } void GDLTreeParser::tag_expr(RefDNode _t) { RefDNode tag_expr_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode tag_expr_AST = RefDNode(antlr::nullAST); if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case EXPR: { brace_expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); tag_expr_AST = RefDNode(currentAST.root); break; } case IDENTIFIER: { RefDNode tmp68_AST = RefDNode(antlr::nullAST); RefDNode tmp68_AST_in = RefDNode(antlr::nullAST); tmp68_AST = astFactory->create(antlr::RefAST(_t)); tmp68_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp68_AST)); match(antlr::RefAST(_t),IDENTIFIER); _t = _t->getNextSibling(); tag_expr_AST = RefDNode(currentAST.root); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } returnAST = tag_expr_AST; _retTree = _t; } void GDLTreeParser::tag_array_expr(RefDNode _t) { RefDNode tag_array_expr_AST_in = (_t == RefDNode(ASTNULL)) ? RefDNode(antlr::nullAST) : _t; returnAST = RefDNode(antlr::nullAST); antlr::ASTPair currentAST; RefDNode tag_array_expr_AST = RefDNode(antlr::nullAST); if (_t == RefDNode(antlr::nullAST) ) _t = ASTNULL; switch ( _t->getType()) { case ARRAYEXPR: { RefDNode __t205 = _t; RefDNode tmp69_AST = RefDNode(antlr::nullAST); RefDNode tmp69_AST_in = RefDNode(antlr::nullAST); tmp69_AST = astFactory->create(antlr::RefAST(_t)); tmp69_AST_in = _t; astFactory->addASTChild(currentAST, antlr::RefAST(tmp69_AST)); antlr::ASTPair __currentAST205 = currentAST; currentAST.root = currentAST.child; currentAST.child = RefDNode(antlr::nullAST); match(antlr::RefAST(_t),ARRAYEXPR); _t = _t->getFirstChild(); tag_expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); arrayindex_list(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); currentAST = __currentAST205; _t = __t205; _t = _t->getNextSibling(); tag_array_expr_AST = RefDNode(currentAST.root); break; } case EXPR: case IDENTIFIER: { tag_expr(_t); _t = _retTree; astFactory->addASTChild(currentAST, antlr::RefAST(returnAST)); tag_array_expr_AST = RefDNode(currentAST.root); break; } default: { throw antlr::NoViableAltException(antlr::RefAST(_t)); } } returnAST = tag_array_expr_AST; _retTree = _t; } void GDLTreeParser::initializeASTFactory( antlr::ASTFactory& factory ) { factory.setMaxNodeType(236); } const char* GDLTreeParser::tokenNames[] = { "<0>", "EOF", "<2>", "NULL_TREE_LOOKAHEAD", "ALL", "ASSIGN", "ASSIGN_INPLACE", "ASSIGN_REPLACE", "ASSIGN_ARRAYEXPR_MFCALL", "ARRAYDEF", "ARRAYDEF_CONST", "ARRAYIX", "ARRAYIX_ALL", "ARRAYIX_ORANGE", "ARRAYIX_RANGE", "ARRAYIX_ORANGE_S", "ARRAYIX_RANGE_S", "ARRAYEXPR", "ARRAYEXPR_FCALL", "ARRAYEXPR_MFCALL", "BLOCK", "BREAK", "CSBLOCK", "CONTINUE", "COMMONDECL", "COMMONDEF", "CONSTANT", "DEREF", "ELSEBLK", "EXPR", "\"for\"", "FOR_STEP", "\"foreach\"", "FOREACH_INDEX", "FOR_LOOP", "FOR_STEP_LOOP", "FOREACH_LOOP", "FOREACH_INDEX_LOOP", "FCALL", "FCALL_LIB", "FCALL_LIB_DIRECT", "FCALL_LIB_N_ELEMENTS", "FCALL_LIB_RETNEW", "GDLNULL", "IF_ELSE", "KEYDECL", "KEYDEF", "KEYDEF_REF", "KEYDEF_REF_CHECK", "KEYDEF_REF_EXPR", "LABEL", "MPCALL", "MPCALL_PARENT", "MFCALL", "MFCALL_LIB", "MFCALL_LIB_RETNEW", "MFCALL_PARENT", "MFCALL_PARENT_LIB", "MFCALL_PARENT_LIB_RETNEW", "NOP", "NSTRUC", "NSTRUC_REF", "ON_IOERROR_NULL", "PCALL", "PCALL_LIB", "PARADECL", "PARAEXPR", "PARAEXPR_VN", "DEC_REF_CHECK", "INC_REF_CHECK", "POSTDEC", "POSTINC", "DECSTATEMENT", "INCSTATEMENT", "REF", "REF_VN", "REF_CHECK", "REF_CHECK_VN", "REF_EXPR", "REF_EXPR_VN", "\"repeat\"", "REPEAT_LOOP", "RETURN", "RETF", "RETP", "STRUC", "SYSVAR", "UMINUS", "VAR", "VARPTR", "\"while\"", "IDENTIFIER", "\"and\"", "\"begin\"", "\"case\"", "\"common\"", "\"compile_opt\"", "\"do\"", "\"else\"", "\"end\"", "\"endcase\"", "\"endelse\"", "\"endfor\"", "\"endforeach\"", "\"endif\"", "\"endrep\"", "\"endswitch\"", "\"endwhile\"", "\"eq\"", "\"forward_function\"", "\"function\"", "\"ge\"", "\"goto\"", "\"gt\"", "\"if\"", "\"inherits\"", "\"le\"", "\"lt\"", "\"mod\"", "\"ne\"", "\"not\"", "\"of\"", "\"on_ioerror\"", "\"or\"", "\"pro\"", "\"switch\"", "\"then\"", "\"until\"", "\"xor\"", "METHOD", "COMMA", "COLON", "END_U", "EQUAL", "DEC", "INC", "AND_OP_EQ", "ASTERIX_EQ", "EQ_OP_EQ", "GE_OP_EQ", "GTMARK_EQ", "GT_OP_EQ", "LE_OP_EQ", "LTMARK_EQ", "LT_OP_EQ", "MATRIX_OP1_EQ", "MATRIX_OP2_EQ", "MINUS_EQ", "MOD_OP_EQ", "NE_OP_EQ", "OR_OP_EQ", "PLUS_EQ", "POW_EQ", "SLASH_EQ", "XOR_OP_EQ", "MEMBER", "LBRACE", "RBRACE", "SLASH", "LSQUARE", "RSQUARE", "SYSVARNAME", "EXCLAMATION", "LCURLY", "RCURLY", "CONSTANT_HEX_BYTE", "CONSTANT_HEX_LONG", "CONSTANT_HEX_LONG64", "CONSTANT_HEX_INT", "CONSTANT_HEX_I", "CONSTANT_HEX_ULONG", "CONSTANT_HEX_ULONG64", "CONSTANT_HEX_UI", "CONSTANT_HEX_UINT", "CONSTANT_BYTE", "CONSTANT_LONG", "CONSTANT_LONG64", "CONSTANT_INT", "CONSTANT_I", "CONSTANT_ULONG", "CONSTANT_ULONG64", "CONSTANT_UI", "CONSTANT_UINT", "CONSTANT_OCT_BYTE", "CONSTANT_OCT_LONG", "CONSTANT_OCT_LONG64", "CONSTANT_OCT_INT", "CONSTANT_OCT_I", "CONSTANT_OCT_ULONG", "CONSTANT_OCT_ULONG64", "CONSTANT_OCT_UI", "CONSTANT_OCT_UINT", "CONSTANT_FLOAT", "CONSTANT_DOUBLE", "CONSTANT_BIN_BYTE", "CONSTANT_BIN_LONG", "CONSTANT_BIN_LONG64", "CONSTANT_BIN_INT", "CONSTANT_BIN_I", "CONSTANT_BIN_ULONG", "CONSTANT_BIN_ULONG64", "CONSTANT_BIN_UI", "CONSTANT_BIN_UINT", "ASTERIX", "DOT", "STRING_LITERAL", "POW", "MATRIX_OP1", "MATRIX_OP2", "PLUS", "MINUS", "LTMARK", "GTMARK", "LOG_NEG", "LOG_AND", "LOG_OR", "QUESTION", "STRING", "INCLUDE", "EOL", "W", "D", "L", "H", "O", "B", "EXP", "DBL_E", "DBL", "CONSTANT_OR_STRING_LITERAL", "COMMENT", "END_MARKER", "WHITESPACE", "SKIP_LINES", "CONT_STATEMENT", "END_OF_LINE", "MAX_TOKEN_NUMBER", 0 }; const unsigned long GDLTreeParser::_tokenSet_0_data_[] = { 1135607840UL, 2149056513UL, 1141178368UL, 604315648UL, 134217664UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // ASSIGN BLOCK BREAK CONTINUE COMMONDECL COMMONDEF "for" "foreach" MPCALL // MPCALL_PARENT PCALL "repeat" RETURN "while" "case" "forward_function" // "goto" "if" "on_ioerror" "switch" DEC INC AND_OP_EQ ASTERIX_EQ EQ_OP_EQ // GE_OP_EQ GTMARK_EQ GT_OP_EQ LE_OP_EQ LTMARK_EQ LT_OP_EQ MATRIX_OP1_EQ // MATRIX_OP2_EQ MINUS_EQ MOD_OP_EQ NE_OP_EQ OR_OP_EQ PLUS_EQ POW_EQ SLASH_EQ // XOR_OP_EQ const antlr::BitSet GDLTreeParser::_tokenSet_0(_tokenSet_0_data_,12); const unsigned long GDLTreeParser::_tokenSet_1_data_[] = { 739116576UL, 555747392UL, 299892928UL, 166891520UL, 1207959489UL, 0UL, 33544192UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // ASSIGN ARRAYDEF ARRAYDEF_CONST ARRAYEXPR ARRAYEXPR_FCALL ARRAYEXPR_MFCALL // CONSTANT DEREF EXPR FCALL GDLNULL MFCALL MFCALL_PARENT NSTRUC_REF POSTDEC // POSTINC STRUC SYSVAR UMINUS VAR "and" "eq" "ge" "gt" "le" "lt" "mod" // "ne" "not" "or" "xor" DEC INC AND_OP_EQ ASTERIX_EQ EQ_OP_EQ GE_OP_EQ // GTMARK_EQ GT_OP_EQ LE_OP_EQ LTMARK_EQ LT_OP_EQ MATRIX_OP1_EQ MATRIX_OP2_EQ // MINUS_EQ MOD_OP_EQ NE_OP_EQ OR_OP_EQ PLUS_EQ POW_EQ SLASH_EQ XOR_OP_EQ // SLASH ASTERIX DOT POW MATRIX_OP1 MATRIX_OP2 PLUS MINUS LTMARK GTMARK // LOG_NEG LOG_AND LOG_OR QUESTION const antlr::BitSet GDLTreeParser::_tokenSet_1(_tokenSet_1_data_,16); gdl-0.9.4/src/basic_fun.cpp0000664000175000017500000056773112221012027014156 0ustar marcmarc/*************************************************************************** basic_fun.cpp - basic GDL library function ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens (exceptions see below) email : m_schellens@users.sf.net strtok_fun, getenv_fun, tag_names_fun, stregex_fun: (C) 2004 by Peter Messmer ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" // get_kbrd patch // http://sourceforge.net/forum/forum.php?thread_id=3292183&forum_id=338691 #ifndef _MSC_VER #include #include #endif #include #include #include //#include #include // stregex #ifdef __APPLE__ # include # define environ (*_NSGetEnviron()) #endif #if defined(__FreeBSD__) || defined(__sun__) || defined(__OpenBSD__) extern "C" char **environ; #endif #include "nullgdl.hpp" #include "datatypes.hpp" #include "envt.hpp" #include "dpro.hpp" #include "dinterpreter.hpp" #include "basic_pro.hpp" #include "terminfo.hpp" #include "typedefs.hpp" #include "base64.hpp" #ifdef HAVE_LOCALE_H # include #endif /* max regexp error message length */ #define MAX_REGEXPERR_LENGTH 80 #ifdef _MSC_VER #define isfinite _finite #define isnan _isnan #define round(f) floor(f+0.5) int strncasecmp(const char *s1, const char *s2, size_t n) { if (n == 0) return 0; while (n-- != 0 && tolower(*s1) == tolower(*s2)) { if (n == 0 || *s1 == '\0' || *s2 == '\0') break; s1++; s2++; } return tolower(*(unsigned char *) s1) - tolower(*(unsigned char *) s2); } #else #include #endif namespace lib { // using namespace std; using std::isnan; using namespace antlr; // assumes all parameters from pOffs till end are dim void arr( EnvT* e, dimension& dim, SizeT pOffs=0) { int nParam=e->NParam()-pOffs; if( nParam <= 0) e->Throw( "Incorrect number of arguments."); const string BadDims="Array dimensions must be greater than 0."; if( nParam == 1 ) { BaseGDL* par = e->GetParDefined( pOffs); SizeT newDim; int ret = par->Scalar2Index( newDim); if (ret < 0) throw GDLException(BadDims); if( ret > 0) { // single argument if (newDim < 1) throw GDLException(BadDims); dim << newDim; return; } if( ret == 0) { // array argument DLongGDL* ind = static_cast(par->Convert2(GDL_LONG, BaseGDL::COPY)); Guard ind_guard( ind); //e->Guard( ind); for(SizeT i =0; i < par->N_Elements(); ++i){ if ((*ind)[i] < 1) throw GDLException(BadDims); dim << (*ind)[i]; } return; } e->Throw( "arr: should never arrive here."); return; } // max number checked in interpreter SizeT endIx=nParam+pOffs; for( SizeT i=pOffs; iGetParDefined( i); SizeT newDim; int ret=par->Scalar2Index( newDim); if( ret < 1 || newDim == 0) throw GDLException(BadDims); dim << newDim; } } BaseGDL* bytarr( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); if( e->KeywordSet(0)) return new DByteGDL(dim, BaseGDL::NOZERO); return new DByteGDL(dim); // } // catch( GDLException& ex) // { // e->Throw( ex.getMessage()); // } } BaseGDL* intarr( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); if( e->KeywordSet(0)) return new DIntGDL(dim, BaseGDL::NOZERO); return new DIntGDL(dim); // } // catch( GDLException& ex) // { // e->Throw( "INTARR: "+ex.getMessage()); // } } BaseGDL* uintarr( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); if( e->KeywordSet(0)) return new DUIntGDL(dim, BaseGDL::NOZERO); return new DUIntGDL(dim); // } // catch( GDLException& ex) // { // e->Throw( "UINTARR: "+ex.getMessage()); // } } BaseGDL* lonarr( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); if( e->KeywordSet(0)) return new DLongGDL(dim, BaseGDL::NOZERO); return new DLongGDL(dim); /* } catch( GDLException& ex) { e->Throw( "LONARR: "+ex.getMessage()); }*/ } BaseGDL* ulonarr( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); if( e->KeywordSet(0)) return new DULongGDL(dim, BaseGDL::NOZERO); return new DULongGDL(dim); /* } catch( GDLException& ex) { e->Throw( "ULONARR: "+ex.getMessage()); } */ } BaseGDL* lon64arr( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); if( e->KeywordSet(0)) return new DLong64GDL(dim, BaseGDL::NOZERO); return new DLong64GDL(dim); /* } catch( GDLException& ex) { e->Throw( "LON64ARR: "+ex.getMessage()); }*/ } BaseGDL* ulon64arr( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); if( e->KeywordSet(0)) return new DULong64GDL(dim, BaseGDL::NOZERO); return new DULong64GDL(dim); /* } catch( GDLException& ex) { e->Throw( "ULON64ARR: "+ex.getMessage()); }*/ } BaseGDL* fltarr( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); if( e->KeywordSet(0)) return new DFloatGDL(dim, BaseGDL::NOZERO); return new DFloatGDL(dim); /* } catch( GDLException& ex) { e->Throw( "FLTARR: "+ex.getMessage()); } */} BaseGDL* dblarr( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); if( e->KeywordSet(0)) return new DDoubleGDL(dim, BaseGDL::NOZERO); return new DDoubleGDL(dim); /* } catch( GDLException& ex) { e->Throw( "DBLARR: "+ex.getMessage()); }*/ } BaseGDL* strarr( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); if( e->KeywordSet(0)) e->Throw( "Keyword parameters not allowed in call."); return new DStringGDL(dim); /* } catch( GDLException& ex) { e->Throw( "STRARR: "+ex.getMessage()); } */ } BaseGDL* complexarr( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); if( e->KeywordSet(0)) return new DComplexGDL(dim, BaseGDL::NOZERO); return new DComplexGDL(dim); /*} catch( GDLException& ex) { e->Throw( "COMPLEXARR: "+ex.getMessage()); } */ } BaseGDL* dcomplexarr( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) if( e->KeywordSet(0)) return new DComplexDblGDL(dim, BaseGDL::NOZERO); return new DComplexDblGDL(dim); /* } catch( GDLException& ex) { e->Throw( "DCOMPLEXARR: "+ex.getMessage()); } */ } BaseGDL* ptrarr( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); DPtrGDL* ret; // if( e->KeywordSet(0)) // ret= new DPtrGDL(dim);//, BaseGDL::NOZERO); // else // if( e->KeywordSet(1)) // ret= new DPtrGDL(dim, BaseGDL::NOZERO); // else // return new DPtrGDL(dim); if( !e->KeywordSet(1)) return new DPtrGDL(dim); ret= new DPtrGDL(dim, BaseGDL::NOZERO); SizeT nEl=ret->N_Elements(); SizeT sIx=e->NewHeap(nEl); // #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { // #pragma omp for for( SizeT i=0; iThrow( "PTRARR: "+ex.getMessage()); }*/ } BaseGDL* objarr( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); // reference counting if( e->KeywordSet(0)) return new DObjGDL(dim, BaseGDL::NOZERO); return new DObjGDL(dim); /* } catch( GDLException& ex) { e->Throw( "OBJARR: "+ex.getMessage()); } */ } BaseGDL* ptr_new( EnvT* e) { int nParam=e->NParam(); if( nParam > 0) { // new ptr from undefined variable is allowed as well BaseGDL* p= e->GetPar( 0); if( p == NULL) { DPtr heapID= e->NewHeap(); return new DPtrGDL( heapID); } if( e->KeywordSet(0)) // NO_COPY { BaseGDL** p= &e->GetPar( 0); // if( *p == NULL) // e->Throw( "Parameter undefined: "+ // e->GetParString(0)); DPtr heapID= e->NewHeap( 1, *p); *p=NULL; return new DPtrGDL( heapID); } else { BaseGDL* p= e->GetParDefined( 0); DPtr heapID= e->NewHeap( 1, p->Dup()); return new DPtrGDL( heapID); } } else { if( e->KeywordSet(1)) // ALLOCATE_HEAP { DPtr heapID= e->NewHeap(); return new DPtrGDL( heapID); } else { return new DPtrGDL( 0); // null ptr } } } BaseGDL* ptr_valid( EnvT* e) { int nParam=e->NParam(); if( e->KeywordPresent( 1)) // COUNT { e->SetKW( 1, new DLongGDL( e->Interpreter()->HeapSize())); } if( nParam == 0) { return e->Interpreter()->GetAllHeap(); } BaseGDL* p = e->GetPar( 0); if( p == NULL) { return new DByteGDL( 0); } DType pType = p->Type(); if( e->KeywordSet( 0)) // CAST { DLongGDL* pL;// = dynamic_cast( p); Guard pL_guard; // if( pL == NULL) if( pType != GDL_LONG) { pL = static_cast(p->Convert2(GDL_LONG,BaseGDL::COPY)); pL_guard.Init( pL); } else { pL = static_cast(p); } SizeT nEl = pL->N_Elements(); DPtrGDL* ret = new DPtrGDL( pL->Dim()); // zero GDLInterpreter* interpreter = e->Interpreter(); for( SizeT i=0; iPtrValid( (*pL)[ i])) (*ret)[ i] = (*pL)[ i]; } return ret; } // DPtrGDL* pPtr = dynamic_cast( p); // if( pPtr == NULL) if( pType != GDL_PTR) { return new DByteGDL( p->Dim()); // zero } DPtrGDL* pPtr = static_cast( p); SizeT nEl = pPtr->N_Elements(); DByteGDL* ret = new DByteGDL( pPtr->Dim()); // zero GDLInterpreter* interpreter = e->Interpreter(); for( SizeT i=0; iPtrValid( (*pPtr)[ i])) (*ret)[ i] = 1; } return ret; } BaseGDL* obj_valid( EnvT* e) { int nParam=e->NParam(); if( e->KeywordPresent( 1)) // COUNT { e->SetKW( 1, new DLongGDL( e->Interpreter()->ObjHeapSize())); } if( nParam == 0) { return e->Interpreter()->GetAllObjHeap(); } BaseGDL* p = e->GetPar( 0); if( p == NULL) { return new DByteGDL( 0); } DType pType = p->Type(); if( e->KeywordSet( 0)) // CAST { DLongGDL* pL;// = dynamic_cast( p); Guard pL_guard; // if( pL == NULL) if( pType != GDL_LONG) { pL = static_cast(p->Convert2(GDL_LONG,BaseGDL::COPY)); pL_guard.Init( pL); // e->Guard( pL); } else { pL = static_cast( p); } SizeT nEl = pL->N_Elements(); DObjGDL* ret = new DObjGDL( pL->Dim()); // zero GDLInterpreter* interpreter = e->Interpreter(); for( SizeT i=0; iObjValid( (*pL)[ i])) (*ret)[ i] = (*pL)[ i]; } return ret; } // DObjGDL* pObj = dynamic_cast( p); // if( pObj == NULL) if( pType != GDL_OBJ) { return new DByteGDL( p->Dim()); // zero } DObjGDL* pObj = static_cast( p); SizeT nEl = pObj->N_Elements(); DByteGDL* ret = new DByteGDL( pObj->Dim()); // zero GDLInterpreter* interpreter = e->Interpreter(); for( SizeT i=0; iObjValid( (*pObj)[ i])) (*ret)[ i] = 1; } return ret; } BaseGDL* obj_new( EnvT* e) { StackGuard guard( e->Interpreter()->CallStack()); int nParam=e->NParam(); if( nParam == 0) { return new DObjGDL( 0); } DString objName; e->AssureScalarPar( 0, objName); // this is a struct name -> convert to UPPERCASE objName=StrUpCase(objName); if( objName == "IDL_OBJECT") objName = GDL_OBJECT_NAME; // replacement also done in GDLParser DStructDesc* objDesc=e->Interpreter()->GetStruct( objName, e->CallingNode()); DStructGDL* objStruct= new DStructGDL( objDesc, dimension()); DObj objID= e->NewObjHeap( 1, objStruct); // owns objStruct DObjGDL* newObj = new DObjGDL( objID); // the object try { // call INIT function DFun* objINIT= objDesc->GetFun( "INIT"); if( objINIT != NULL) { // morph to obj environment and push it onto the stack again e->PushNewEnvUD( objINIT, 1, &newObj); BaseGDL* res=e->Interpreter()->call_fun( objINIT->GetTree()); if( res == NULL || (!res->Scalar()) || res->False()) { GDLDelete(res); return new DObjGDL( 0); } GDLDelete(res); } } catch(...) { e->FreeObjHeap( objID); // newObj might be changed GDLDelete(newObj); throw; } return newObj; } BaseGDL* bindgen( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); return new DByteGDL(dim, BaseGDL::INDGEN); /* } catch( GDLException& ex) { e->Throw( "BINDGEN: "+ex.getMessage()); } */ } // keywords not supported yet BaseGDL* indgen( EnvT* e) { dimension dim; // Defaulting to GDL_INT DType type = GDL_INT; static int kwIx1 = e->KeywordIx("BYTE"); if (e->KeywordSet(kwIx1)){ type = GDL_BYTE; } static int kwIx2 = e->KeywordIx("COMPLEX"); if (e->KeywordSet(kwIx2)){ type = GDL_COMPLEX; } static int kwIx3 = e->KeywordIx("DCOMPLEX"); if (e->KeywordSet(kwIx3)){ type = GDL_COMPLEXDBL; } static int kwIx4 = e->KeywordIx("DOUBLE"); if (e->KeywordSet(kwIx4)){ type = GDL_DOUBLE; } static int kwIx5 = e->KeywordIx("FLOAT"); if (e->KeywordSet(kwIx5)){ type = GDL_FLOAT; } static int kwIx6 = e->KeywordIx("L64"); if (e->KeywordSet(kwIx6)){ type = GDL_LONG64; } static int kwIx7 = e->KeywordIx("LONG"); if (e->KeywordSet(kwIx7)){ type = GDL_LONG; } static int kwIx8 = e->KeywordIx("STRING"); if (e->KeywordSet(kwIx8)){ type = GDL_STRING; } static int kwIx9 = e->KeywordIx("UINT"); if (e->KeywordSet(kwIx9)){ type = GDL_UINT; } static int kwIx10 = e->KeywordIx("UL64"); if (e->KeywordSet(kwIx10)){ type = GDL_ULONG64; } static int kwIx11 = e->KeywordIx("ULONG"); if (e->KeywordSet(kwIx11)){ type = GDL_ULONG; } /*try {*/ // Seeing if the user passed in a TYPE code static int kwIx12 = e->KeywordIx("TYPE"); if ( e->KeywordPresent(kwIx12)){ DLong temp_long; e->AssureLongScalarKW(kwIx12, temp_long); type = static_cast(temp_long); } arr(e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); switch(type) { case GDL_INT: return new DIntGDL(dim, BaseGDL::INDGEN); case GDL_BYTE: return new DByteGDL(dim, BaseGDL::INDGEN); case GDL_COMPLEX: return new DComplexGDL(dim, BaseGDL::INDGEN); case GDL_COMPLEXDBL: return new DComplexDblGDL(dim, BaseGDL::INDGEN); case GDL_DOUBLE: return new DDoubleGDL(dim, BaseGDL::INDGEN); case GDL_FLOAT: return new DFloatGDL(dim, BaseGDL::INDGEN); case GDL_LONG64: return new DLong64GDL(dim, BaseGDL::INDGEN); case GDL_LONG: return new DLongGDL(dim, BaseGDL::INDGEN); case GDL_STRING: { DULongGDL* iGen = new DULongGDL(dim, BaseGDL::INDGEN); return iGen->Convert2(GDL_STRING); } case GDL_UINT: return new DUIntGDL(dim, BaseGDL::INDGEN); case GDL_ULONG64: return new DULong64GDL(dim, BaseGDL::INDGEN); case GDL_ULONG: return new DULongGDL(dim, BaseGDL::INDGEN); default: e->Throw( "Invalid type code specified."); break; } /* } catch( GDLException& ex) { e->Throw( ex.getMessage()); }*/ assert(false); return NULL; } BaseGDL* uindgen( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); return new DUIntGDL(dim, BaseGDL::INDGEN); /* } catch( GDLException& ex) { e->Throw( "UINDGEN: "+ex.getMessage()); } */ } BaseGDL* sindgen( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); DULongGDL* iGen = new DULongGDL(dim, BaseGDL::INDGEN); return iGen->Convert2( GDL_STRING); /* } catch( GDLException& ex) { e->Throw( "SINDGEN: "+ex.getMessage()); }*/ } BaseGDL* lindgen( EnvT* e) { dimension dim; // try{ arr( e, dim); return new DLongGDL(dim, BaseGDL::INDGEN); /* } catch( GDLException& ex) { e->Throw( "LINDGEN: "+ex.getMessage()); }*/ } BaseGDL* ulindgen( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); return new DULongGDL(dim, BaseGDL::INDGEN); /* } catch( GDLException& ex) { e->Throw( "ULINDGEN: "+ex.getMessage()); }*/ } BaseGDL* l64indgen( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); return new DLong64GDL(dim, BaseGDL::INDGEN); /* } catch( GDLException& ex) { e->Throw( "L64INDGEN: "+ex.getMessage()); }*/ } BaseGDL* ul64indgen( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); return new DULong64GDL(dim, BaseGDL::INDGEN); /* } catch( GDLException& ex) { e->Throw( "UL64INDGEN: "+ex.getMessage()); } */ } BaseGDL* findgen( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); return new DFloatGDL(dim, BaseGDL::INDGEN); /* } catch( GDLException& ex) { e->Throw( "FINDGEN: "+ex.getMessage()); }*/ } BaseGDL* dindgen( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); return new DDoubleGDL(dim, BaseGDL::INDGEN); /* } catch( GDLException& ex) { e->Throw( "DINDGEN: "+ex.getMessage()); }*/ } BaseGDL* cindgen( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); return new DComplexGDL(dim, BaseGDL::INDGEN); /* } catch( GDLException& ex) { e->Throw( "CINDGEN: "+ex.getMessage()); }*/ } BaseGDL* dcindgen( EnvT* e) { dimension dim; // try{ arr( e, dim); if (dim[0] == 0) throw GDLException( "Array dimensions must be greater than 0"); return new DComplexDblGDL(dim, BaseGDL::INDGEN); /* } catch( GDLException& ex) { e->Throw( "DCINDGEN: "+ex.getMessage()); } */ } // only called from CALL_FUNCTION // otherwise done directly in FCALL_LIB_N_ELEMENTSNode::Eval(); // (but must be defined anyway for LibInit() for correct parametrization) // N_ELEMENTS is special because on error it just returns 0L // (the error is just caught and dropped) BaseGDL* n_elements( EnvT* e) { SizeT nParam=e->NParam(1); BaseGDL* p0=e->GetPar( 0); if( p0 == NULL) return new DLongGDL( 0); return new DLongGDL( p0->N_Elements()); // assert( 0); // e->Throw("Internal error: lib::n_elements called."); // return NULL; // get rid of compiler warning } template< typename ComplexGDL, typename Complex, typename Float> BaseGDL* complex_fun_template( EnvT* e) { SizeT nParam=e->NParam( 1); if( nParam <= 2) { if( nParam == 2) { BaseGDL* p0=e->GetParDefined( 0); BaseGDL* p1=e->GetParDefined( 1); Float* p0Float = static_cast (p0->Convert2( Float::t,BaseGDL::COPY)); Guard p0FloatGuard(p0Float); Float* p1Float = static_cast (p1->Convert2( Float::t,BaseGDL::COPY)); Guard p1FloatGuard(p1Float); if( p0Float->Rank() == 0) { ComplexGDL* res = new ComplexGDL( p1Float->Dim(), BaseGDL::NOZERO); SizeT nE=p1Float->N_Elements(); // #pragma omp parallel if (nE >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nE)) { // #pragma omp for for( SizeT i=0; iRank() == 0) { ComplexGDL* res = new ComplexGDL( p0Float->Dim(), BaseGDL::NOZERO); SizeT nE=p0Float->N_Elements(); // #pragma omp parallel if (nE >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nE)) { // #pragma omp for for( SizeT i=0; iN_Elements() >= p1Float->N_Elements()) { ComplexGDL* res = new ComplexGDL( p1Float->Dim(), BaseGDL::NOZERO); SizeT nE=p1Float->N_Elements(); // #pragma omp parallel if (nE >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nE)) { // #pragma omp for for( SizeT i=0; iDim(), BaseGDL::NOZERO); SizeT nE=p0Float->N_Elements(); // #pragma omp parallel if (nE >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nE)) { // #pragma omp for for( SizeT i=0; iGetParDefined( 0); if (ComplexGDL::t == p0->Type() && e->GlobalPar(0)) { e->SetPtrToReturnValue( &e->GetPar(0)); return p0; } return p0->Convert2( ComplexGDL::t, BaseGDL::COPY); } } else // COMPLEX( expr, offs, dim1,..,dim8) { BaseGDL* p0 = e->GetParDefined( 0); // *** WRONG: with offs data is converted bytewise Float* p0Float = static_cast(p0->Convert2( Float::t,BaseGDL::COPY)); Guard p0FloatGuard(p0Float); DLong offs; e->AssureLongScalarPar( 1, offs); dimension dim; arr( e, dim, 2); SizeT nElCreate=dim.NDimElements(); SizeT nElSource=p0->N_Elements(); if( (offs+2*nElCreate) > nElSource) e->Throw( "Specified offset to" " array is out of range: "+e->GetParString(0)); ComplexGDL* res=new ComplexGDL( dim, BaseGDL::NOZERO); // #pragma omp parallel if (nElCreate >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nElCreate)) { // #pragma omp for for( SizeT i=0; iKeywordSet("DOUBLE")) { return complex_fun_template< DComplexDblGDL, DComplexDbl, DDoubleGDL>( e); } else { return complex_fun_template< DComplexGDL, DComplex, DFloatGDL>( e); } } BaseGDL* dcomplex_fun( EnvT* e) { return complex_fun_template< DComplexDblGDL, DComplexDbl, DDoubleGDL>( e); } template< class TargetClass> BaseGDL* type_fun( EnvT* e) { SizeT nParam=e->NParam(1); if( nParam == 1) { BaseGDL* p0=e->GetParDefined( 0); assert( dynamic_cast< EnvUDT*>( e->Caller()) != NULL); // type_fun( expr) just convert if( static_cast< EnvUDT*>( e->Caller())->GetIOError() != NULL) return p0->Convert2( TargetClass::t, BaseGDL::COPY_THROWIOERROR); // SA: see tracker item no. 3151760 else if (TargetClass::t == p0->Type() && e->GlobalPar(0)) // HERE THE INPUT VARIABLE IS RETURNED { e->SetPtrToReturnValue( &e->GetPar(0)); return p0; } else return p0->Convert2( TargetClass::t, BaseGDL::COPY); } BaseGDL* p0=e->GetNumericParDefined( 0); // GDL_BYTE( expr, offs, dim1,..,dim8) DLong offs; e->AssureLongScalarPar( 1, offs); dimension dim; if( nParam > 2) arr( e, dim, 2); TargetClass* res=new TargetClass( dim, BaseGDL::NOZERO); SizeT nByteCreate=res->NBytes(); // net size of new data SizeT nByteSource=p0->NBytes(); // net size of src if( offs < 0 || (offs+nByteCreate) > nByteSource) { GDLDelete(res); e->Throw( "Specified offset to" " expression is out of range: "+e->GetParString(0)); } //*** POSSIBLE ERROR because of alignment here void* srcAddr = static_cast( static_cast(p0->DataAddr()) + offs); void* dstAddr = static_cast(&(*res)[0]); memcpy( dstAddr, srcAddr, nByteCreate); // char* srcAddr = reinterpret_cast(p0->DataAddr()); // char* dstAddr = reinterpret_cast(&(*res)[0]); // copy( srcAddr, srcAddr+nByteCreate, dstAddr); return res; } BaseGDL* byte_fun( EnvT* e) { return type_fun( e); } BaseGDL* uint_fun( EnvT* e) { return type_fun( e); } BaseGDL* long_fun( EnvT* e) { return type_fun( e); } BaseGDL* ulong_fun( EnvT* e) { return type_fun( e); } BaseGDL* long64_fun( EnvT* e) { return type_fun( e); } BaseGDL* ulong64_fun( EnvT* e) { return type_fun( e); } BaseGDL* float_fun( EnvT* e) { return type_fun( e); } BaseGDL* double_fun( EnvT* e) { return type_fun( e); } // STRING function behaves different BaseGDL* string_fun( EnvT* e) { SizeT nParam=e->NParam(); if( nParam == 0) e->Throw( "Incorrect number of arguments."); bool printKey = e->KeywordSet( 4); int parOffset = 0; // SA: handling special VMS-compatibility syntax, e.g.: string(1,'$(F)') // (if nor FORMAT neither PRINT defined, >1 parameter, last param is scalar string // which begins with "$(" or "(" but is not "()" then last param [minus "$"] is treated as FORMAT) bool vmshack = false; if (!printKey && (e->GetKW(0) == NULL) && nParam > 1) { vmshack = true; BaseGDL* par = e->GetParDefined(nParam - 1); if (par->Type() == GDL_STRING && par->Scalar()) { int dollar = (*static_cast(par))[0].compare(0,2,"$("); if (dollar == 0 || ((*static_cast(par))[0].compare(0,1,"(") == 0 && (*static_cast(par))[0] != "()")) { e->SetKeyword("FORMAT", new DStringGDL( (*static_cast(par))[0].c_str() + (dollar == 0 ? 1 : 0) )); } } } BaseGDL* format_kw = e->GetKW( 0); bool formatKey = format_kw != NULL; if (formatKey && format_kw->Type() == GDL_STRING && (*static_cast(format_kw))[0] == "") formatKey = false; if( printKey || formatKey) // PRINT or FORMAT { stringstream os; SizeT width = 0; if( printKey) // otherwise: FORMAT -> width is ignored { // for /PRINT always a terminal width of 80 is assumed width = 80;//TermWidth(); } if (vmshack) { parOffset = 1; e->ShiftParNumbering(1); } print_os( &os, e, parOffset, width); if (vmshack) { e->ShiftParNumbering(-1); } vector buf; while( os.good()) { string line; getline( os, line); if( os.good()) buf.push_back( line); } SizeT bufSize = buf.size(); if( bufSize == 0) e->Throw( "Internal error: print buffer empty."); if( bufSize > 1) { DStringGDL* retVal = new DStringGDL( dimension( bufSize), BaseGDL::NOZERO); for( SizeT i=0; i conversion { BaseGDL* p0 = e->GetParDefined( 0); // SA: see tracker item no. 3151760 // HERE INPUT VARIABLE IS RETURNED if (p0->Type() == GDL_STRING && e->GlobalPar(0)) { e->SetPtrToReturnValue( &e->GetPar(0)); return p0; } return p0->Convert2( GDL_STRING, BaseGDL::COPY); } else // concatenation { DString s; for( SizeT i=0; iGetParDefined( i); DStringGDL* sP = static_cast ( p->Convert2(GDL_STRING, BaseGDL::COPY_BYTE_AS_INT)); SizeT nEl = sP->N_Elements(); for( SizeT e=0; eIfDefGetKWAs( 0); if (type != NULL) { int typ = (*type)[0]; if (typ == GDL_BYTE) { // SA: slow yet simple solution using GDL_BYTE->GDL_INT->GDL_BYTE conversion return (e->KeywordSet(1) && e->GetPar(0)->Type() == GDL_STRING) ? type_fun( e)->Convert2(GDL_BYTE, BaseGDL::CONVERT) : type_fun( e); } if (typ == 0 || typ == GDL_INT) return type_fun( e); if (typ == GDL_UINT) return type_fun( e); if (typ == GDL_LONG) return type_fun( e); if (typ == GDL_ULONG) return type_fun( e); if (typ == GDL_LONG64) return type_fun( e); if (typ == GDL_ULONG64) return type_fun( e); if (typ == GDL_FLOAT) return type_fun( e); if (typ == GDL_DOUBLE) return type_fun( e); if (typ == GDL_COMPLEX) return type_fun( e); if (typ == GDL_COMPLEXDBL) return type_fun( e); if (typ == GDL_STRING) { // SA: calling GDL_STRING() with correct parameters static int stringIx = LibFunIx("STRING"); assert( stringIx >= 0); EnvT* newEnv= new EnvT(e, libFunList[stringIx], NULL); Guard guard( newEnv); newEnv->SetNextPar(&e->GetPar(0)); // pass as global if (e->KeywordSet(1) && e->GetPar(0)->Type() == GDL_BYTE) newEnv->SetKeyword("PRINT", new DIntGDL(1)); // e->Interpreter()->CallStack().push_back( newEnv); return static_cast(newEnv->GetPro())->Fun()(newEnv); } e->Throw( "Improper TYPE value."); } return type_fun( e); } BaseGDL* call_function( EnvT* e) { int nParam=e->NParam(); if( nParam == 0) e->Throw( "No function specified."); DString callF; e->AssureScalarPar( 0, callF); // this is a function name -> convert to UPPERCASE callF = StrUpCase( callF); // first search library funcedures int funIx=LibFunIx( callF); if( funIx != -1) { // e->PushNewEnv( libFunList[ funIx], 1); // make the call // EnvT* newEnv = static_cast(e->Interpreter()->CallStack().back()); // handle direct call functions if( libFunList[ funIx]->DirectCall()) { BaseGDL* directCallParameter = e->GetParDefined(1); BaseGDL* res = static_cast(libFunList[ funIx])->FunDirect()(directCallParameter, true /*isReference*/); return res; } else { EnvT* newEnv = e->NewEnv( libFunList[ funIx], 1); Guard guard( newEnv); BaseGDL* res = static_cast(newEnv->GetPro())->Fun()(newEnv); e->SetPtrToReturnValue( newEnv->GetPtrToReturnValue()); return res; } } else { // no direct call here StackGuard guard( e->Interpreter()->CallStack()); funIx = GDLInterpreter::GetFunIx( callF); e->PushNewEnvUD( funList[ funIx], 1); // make the call EnvUDT* newEnv = static_cast(e->Interpreter()->CallStack().back()); return e->Interpreter()->call_fun(static_cast(newEnv->GetPro())->GetTree()); } } BaseGDL* call_method_function( EnvT* e) { StackGuard guard( e->Interpreter()->CallStack()); int nParam=e->NParam(); if( nParam < 2) e->Throw( "Name and object reference" " must be specified."); DString callP; e->AssureScalarPar( 0, callP); // this is a procedure name -> convert to UPPERCASE callP = StrUpCase( callP); DStructGDL* oStruct = e->GetObjectPar( 1); DFun* method= oStruct->Desc()->GetFun( callP); if( method == NULL) e->Throw( "Method not found: "+callP); // // // /**/ e->PushNewEnvUD( method, 2, (DObjGDL**) &e->GetPar( 1)); // make the call return e->Interpreter()->call_fun( method->GetTree()); } BaseGDL* execute( EnvT* e) { int nParam=e->NParam( 1); bool quietCompile = false; if( nParam == 2) { BaseGDL* p1 = e->GetParDefined( 1); if( !p1->Scalar()) e->Throw( "Expression must be scalar in this context: "+ e->GetParString(1)); quietCompile = p1->True(); } if (e->GetParDefined(0)->Rank() != 0) e->Throw("Expression must be scalar in this context: "+e->GetParString(0)); DString line; e->AssureScalarPar( 0, line); // remove current environment (own one) assert( dynamic_cast(e->Caller()) != NULL); EnvUDT* caller = static_cast(e->Caller()); // e->Interpreter()->CallStack().pop_back(); // wrong: e is guarded, do not delete it here // delete e; istringstream istr(line+"\n"); RefDNode theAST; try { GDLLexer lexer(istr, "", caller->CompileOpt()); GDLParser& parser=lexer.Parser(); parser.interactive(); theAST=parser.getAST(); } catch( GDLException& ex) { if( !quietCompile) GDLInterpreter::ReportCompileError( ex); return new DIntGDL( 0); } catch( ANTLRException ex) { if( !quietCompile) cerr << "EXECUTE: Lexer/Parser exception: " << ex.getMessage() << endl; return new DIntGDL( 0); } if( theAST == NULL) return new DIntGDL( 1); RefDNode trAST; try { GDLTreeParser treeParser( caller); treeParser.interactive(theAST); trAST=treeParser.getAST(); } catch( GDLException& ex) { if( !quietCompile) GDLInterpreter::ReportCompileError( ex); return new DIntGDL( 0); } catch( ANTLRException ex) { if( !quietCompile) cerr << "EXECUTE: Compiler exception: " << ex.getMessage() << endl; return new DIntGDL( 0); } if( trAST == NULL) return new DIntGDL( 1); int nForLoopsIn = caller->NForLoops(); try { ProgNodeP progAST = ProgNode::NewProgNode( trAST); Guard< ProgNode> progAST_guard( progAST); int nForLoops = ProgNode::NumberForLoops( progAST, nForLoopsIn); caller->ResizeForLoops( nForLoops); progAST->setLine( e->GetLineNumber()); RetCode retCode = caller->Interpreter()->execute( progAST); caller->ResizeForLoops( nForLoopsIn); if( retCode == RC_OK) return new DIntGDL( 1); else return new DIntGDL( 0); } catch( GDLException& ex) { caller->ResizeForLoops( nForLoopsIn); // are we throwing to target environment? // if( ex.GetTargetEnv() == NULL) if( !quietCompile) cerr << "EXECUTE: " << ex.getMessage() << endl; return new DIntGDL( 0); } catch( ANTLRException ex) { caller->ResizeForLoops( nForLoopsIn); if( !quietCompile) cerr << "EXECUTE: Interpreter exception: " << ex.getMessage() << endl; return new DIntGDL( 0); } return new DIntGDL( 0); // control flow cannot reach here - compiler shut up } BaseGDL* assoc( EnvT* e) { SizeT nParam=e->NParam( 2); DLong lun; e->AssureLongScalarPar( 0, lun); bool stdLun = check_lun( e, lun); if( stdLun) e->Throw( "File unit does not allow" " this operation. Unit: "+i2s( lun)); DLong offset = 0; if( nParam >= 3) e->AssureLongScalarPar( 2, offset); BaseGDL* arr = e->GetParDefined( 1); if( arr->StrictScalar()) e->Throw( "Scalar variable not allowed in this" " context: "+e->GetParString(1)); return arr->AssocVar( lun, offset); } // gdl_ naming because of weired namespace problem in MSVC BaseGDL* gdl_logical_and( EnvT* e) { SizeT nParam=e->NParam(); if( nParam != 2) e->Throw( "Incorrect number of arguments."); BaseGDL* e1=e->GetParDefined( 0);//, "LOGICAL_AND"); BaseGDL* e2=e->GetParDefined( 1);//, "LOGICAL_AND"); ULong nEl1 = e1->N_Elements(); ULong nEl2 = e2->N_Elements(); Data_* res; if( e1->Scalar()) { if( e1->LogTrue(0)) { res= new Data_( e2->Dim(), BaseGDL::NOZERO); // #pragma omp parallel if (nEl2 >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl2)) { // #pragma omp for for( SizeT i=0; i < nEl2; i++) (*res)[i] = e2->LogTrue( i) ? 1 : 0; } } else { return new Data_( e2->Dim()); } } else if( e2->Scalar()) { if( e2->LogTrue(0)) { res= new Data_( e1->Dim(), BaseGDL::NOZERO); // #pragma omp parallel if (nEl1 >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl1)) { // #pragma omp for for( SizeT i=0; i < nEl1; i++) (*res)[i] = e1->LogTrue( i) ? 1 : 0; } } else { return new Data_( e1->Dim()); } } else if( nEl2 < nEl1) { res= new Data_( e2->Dim(), BaseGDL::NOZERO); // #pragma omp parallel if (nEl2 >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl2)) { // #pragma omp for for( SizeT i=0; i < nEl2; i++) (*res)[i] = (e1->LogTrue( i) && e2->LogTrue( i)) ? 1 : 0; } } else // ( nEl2 >= nEl1) { res= new Data_( e1->Dim(), BaseGDL::NOZERO); // #pragma omp parallel if (nEl1 >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl1)) { // #pragma omp for for( SizeT i=0; i < nEl1; i++) (*res)[i] = (e1->LogTrue( i) && e2->LogTrue( i)) ? 1 : 0; } } return res; } // gdl_ naming because of weired namespace problem in MSVC BaseGDL* gdl_logical_or( EnvT* e) { SizeT nParam=e->NParam(); if( nParam != 2) e->Throw( "Incorrect number of arguments."); BaseGDL* e1=e->GetParDefined( 0);//, "LOGICAL_OR"); BaseGDL* e2=e->GetParDefined( 1);//, "LOGICAL_OR"); ULong nEl1 = e1->N_Elements(); ULong nEl2 = e2->N_Elements(); Data_* res; if( e1->Scalar()) { if( e1->LogTrue(0)) { res= new Data_( e2->Dim(), BaseGDL::NOZERO); // #pragma omp parallel if (nEl2 >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl2)) { // #pragma omp for for( SizeT i=0; i < nEl2; i++) (*res)[i] = 1; } } else { res= new Data_( e2->Dim(), BaseGDL::NOZERO); // #pragma omp parallel if (nEl2 >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl2)) { // #pragma omp for for( SizeT i=0; i < nEl2; i++) (*res)[i] = e2->LogTrue( i) ? 1 : 0; } } } else if( e2->Scalar()) { if( e2->LogTrue(0)) { res= new Data_( e1->Dim(), BaseGDL::NOZERO); // #pragma omp parallel if (nEl1 >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl1)) { // #pragma omp for for( SizeT i=0; i < nEl1; i++) (*res)[i] = 1; } } else { res= new Data_( e1->Dim(), BaseGDL::NOZERO); // #pragma omp parallel if (nEl1 >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl1)) { // #pragma omp for for( SizeT i=0; i < nEl1; i++) (*res)[i] = e1->LogTrue( i) ? 1 : 0; } } } else if( nEl2 < nEl1) { res= new Data_( e2->Dim(), BaseGDL::NOZERO); // #pragma omp parallel if (nEl2 >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl2)) { // #pragma omp for for( SizeT i=0; i < nEl2; i++) (*res)[i] = (e1->LogTrue( i) || e2->LogTrue( i)) ? 1 : 0; } } else // ( nEl2 >= nEl1) { res= new Data_( e1->Dim(), BaseGDL::NOZERO); // #pragma omp parallel if (nEl1 >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl1)) { // #pragma omp for for( SizeT i=0; i < nEl1; i++) (*res)[i] = (e1->LogTrue( i) || e2->LogTrue( i)) ? 1 : 0; } } return res; } BaseGDL* logical_true( BaseGDL* e1, bool isReference)//( EnvT* e); { assert( e1 != NULL); assert( e1->N_Elements() > 0); // SizeT nParam=e->NParam(); // if( nParam != 1) // e->Throw( // "Incorrect number of arguments."); // // BaseGDL* e1=e->GetParDefined( 0);//, "LOGICAL_TRUE"); // ULong nEl1 = e1->N_Elements(); Data_* res = new Data_( e1->Dim(), BaseGDL::NOZERO); // #pragma omp parallel if (nEl1 >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl1)) { // #pragma omp for for( SizeT i=0; i < nEl1; i++) (*res)[i] = e1->LogTrue( i) ? 1 : 0; } return res; } BaseGDL* replicate( EnvT* e) { SizeT nParam=e->NParam(); if( nParam < 2) e->Throw( "Incorrect number of arguments."); dimension dim; arr( e, dim, 1); BaseGDL* p0=e->GetParDefined( 0);//, "REPLICATE"); if( !p0->Scalar()) e->Throw( "Expression must be a scalar in this context: "+ e->GetParString(0)); return p0->New( dim, BaseGDL::INIT); } BaseGDL* strtrim( EnvT* e) { SizeT nParam = e->NParam( 1);//, "STRTRIM"); BaseGDL* p0 = e->GetPar( 0); if( p0 == NULL) e->Throw("Variable is undefined: " + e->GetParString(0)); DStringGDL* p0S = static_cast(p0->Convert2(GDL_STRING,BaseGDL::COPY)); DLong mode = 0; if( nParam == 2) { BaseGDL* p1 = e->GetPar( 1); if( p1 == NULL) e->Throw("Variable is undefined: "+e->GetParString(1)); if( !p1->Scalar()) e->Throw("Expression must be a scalar in this context: "+ e->GetParString(1)); DLongGDL* p1L = static_cast (p1->Convert2(GDL_LONG,BaseGDL::COPY)); mode = (*p1L)[ 0]; GDLDelete(p1L); if( mode < 0 || mode > 2) { ostringstream os; p1->ToStream( os); e->Throw( "Value of <"+ p1->TypeStr() + " ("+ os.str() + ")> is out of allowed range."); } } SizeT nEl = p0S->N_Elements(); if( mode == 2) // both { TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if ((nEl*10) >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= (nEl*10))) { #pragma omp for for( OMPInt i=0; i= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= (nEl*10))) { #pragma omp for for( OMPInt i=0; i= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= (nEl*10))) { #pragma omp for for( OMPInt i=0; iNParam( 1); DStringGDL* p0S = e->GetParAs( 0); bool removeAll = e->KeywordSet(0); DStringGDL* res = new DStringGDL( p0S->Dim(), BaseGDL::NOZERO); SizeT nEl = p0S->N_Elements(); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if ((nEl*10) >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= (nEl*10))) { #pragma omp for for( OMPInt i=0; iNParam( 2);//, "STRPOS"); bool reverseOffset = e->KeywordSet(0); // REVERSE_OFFSET bool reverseSearch = e->KeywordSet(1); // REVERSE_SEARCH DStringGDL* p0S = e->GetParAs( 0); DString searchString; // e->AssureScalarPar( 1, searchString); DStringGDL* sStr = e->GetParAs( 1); if( !sStr->Scalar( searchString)) e->Throw( "Search string must be a scalar or one element array: "+ e->GetParString( 1)); unsigned long pos = string::npos; if( nParam > 2) { BaseGDL* p2 = e->GetParDefined(2); // if( p2 != NULL) //e->AssureLongScalarPar( 2,posDLong); // { const SizeT pIx = 2; BaseGDL* p = e->GetParDefined( pIx); DLongGDL* lp = static_cast(p->Convert2( GDL_LONG, BaseGDL::COPY)); Guard guard_lp( lp); DLong scalar; if( !lp->Scalar( scalar)) throw GDLException("Parameter must be a scalar in this context: "+ e->GetParString(pIx)); pos = scalar; } DLongGDL* res = new DLongGDL( p0S->Dim(), BaseGDL::NOZERO); SizeT nSrcStr = p0S->N_Elements(); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if ((nSrcStr*10) >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= (nSrcStr*10))) { #pragma omp for for( OMPInt i=0; iNParam( 2);//, "STRMID"); bool reverse = e->KeywordSet(0); DStringGDL* p0S = e->GetParAs( 0); DLongGDL* p1L = e->GetParAs( 1); // BaseGDL* p2 = e->GetPar( 2); DLongGDL* p2L = NULL; if( nParam > 2) p2L = e->GetParAs( 2); DLong scVal1; bool sc1 = p1L->Scalar( scVal1); DLong scVal2 = numeric_limits::max(); bool sc2 = true; if( p2L != NULL) { DLong scalar; sc2 = p2L->Scalar( scalar); scVal2 = scalar; } DLong stride; if( !sc1 && !sc2) { stride = p1L->Dim( 0); if( stride != p2L->Dim( 0)) e->Throw( "Starting offset and length arguments " "have incompatible first dimension."); } else { // at least one scalar, p2L possibly NULL if( p2L == NULL) stride = p1L->Dim( 0); else stride = max( p1L->Dim( 0), p2L->Dim( 0)); stride = (stride > 0)? stride : 1; } dimension resDim( p0S->Dim()); if( stride > 1) resDim >> stride; DStringGDL* res = new DStringGDL( resDim, BaseGDL::NOZERO); SizeT nEl1 = p1L->N_Elements(); SizeT nEl2 = (sc2)? 1 : p2L->N_Elements(); SizeT nSrcStr = p0S->N_Elements(); if( nSrcStr == 1) { // possibly this optimization is not worth the longer code (as the gain can only be a small fraction // of the overall time), but then this is a very common use for( long ii=0; ii= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= (nSrcStr*10))) default( shared) { #pragma omp for for( OMPInt i=0; iN_Elements() > 0); // e->NParam( 1);//, "STRLOWCASE"); // DStringGDL* p0S = e->GetParAs( 0); DStringGDL* p0S; DStringGDL* res; // Guard guard; if( p0->Type() == GDL_STRING) { p0S = static_cast( p0); if( !isReference) res = p0S; else res = new DStringGDL( p0S->Dim(), BaseGDL::NOZERO); } else { p0S = static_cast( p0->Convert2( GDL_STRING, BaseGDL::COPY)); res = p0S; // guard.Reset( p0S); } // DStringGDL* res = new DStringGDL( p0S->Dim(), BaseGDL::NOZERO); SizeT nEl = p0S->N_Elements(); if( res == p0S) { TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if ((nEl*10) >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= (nEl*10))) { #pragma omp for for( OMPInt i=0; i= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= (nEl*10))) { #pragma omp for for( OMPInt i=0; iN_Elements() > 0); // e->NParam( 1);//, "STRLOWCASE"); // DStringGDL* p0S = e->GetParAs( 0); DStringGDL* p0S; DStringGDL* res; // Guard guard; if( p0->Type() == GDL_STRING) { p0S = static_cast( p0); if( !isReference) res = p0S; else res = new DStringGDL( p0S->Dim(), BaseGDL::NOZERO); } else { p0S = static_cast( p0->Convert2( GDL_STRING, BaseGDL::COPY)); res = p0S; // guard.Reset( p0S); } // DStringGDL* res = new DStringGDL( p0S->Dim(), BaseGDL::NOZERO); SizeT nEl = p0S->N_Elements(); if( res == p0S) { TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if ((nEl*10) >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= (nEl*10))) { #pragma omp for for( OMPInt i=0; i= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= (nEl*10))) { #pragma omp for for( OMPInt i=0; iN_Elements() > 0); // e->NParam( 1);//, "STRLEN"); DStringGDL* p0S; Guard guard; if( p0->Type() == GDL_STRING) p0S = static_cast( p0); else { p0S = static_cast( p0->Convert2( GDL_STRING, BaseGDL::COPY)); guard.Reset( p0S); } DLongGDL* res = new DLongGDL( p0S->Dim(), BaseGDL::NOZERO); SizeT nEl = p0S->N_Elements(); // #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { // #pragma omp for for( SizeT i=0; iNParam( 1); DStringGDL* p0S = e->GetParAs( 0); SizeT nEl = p0S->N_Elements(); DString delim = ""; if( nParam > 1) e->AssureStringScalarPar( 1, delim); bool single = e->KeywordSet( 0); // SINGLE if( single) { DStringGDL* res = new DStringGDL( (*p0S)[0]); DString& scl = (*res)[0]; for( SizeT i=1; iDim()); resDim.Purge(); SizeT stride = resDim.Stride( 1); resDim.Remove( 0); DStringGDL* res = new DStringGDL( resDim, BaseGDL::NOZERO); for( SizeT src=0, dst=0; srcNParam( 1);//, "WHERE"); BaseGDL* p0 = e->GetParDefined( 0);//, "WHERE"); SizeT nEl = p0->N_Elements(); SizeT count; static int nullIx = e->KeywordIx("NULL"); bool nullKW = e->KeywordSet(nullIx); DLong* ixList = p0->Where( e->KeywordPresent( 0), count); ArrayGuard guard( ixList); SizeT nCount = nEl - count; if( e->KeywordPresent( 0)) // COMPLEMENT { if( nCount == 0) { if( nullKW) e->SetKW( 0, NullGDL::GetSingleInstance()); else e->SetKW( 0, new DLongGDL( -1)); } else { DLongGDL* cIxList = new DLongGDL( dimension( &nCount, 1), BaseGDL::NOZERO); SizeT cIx = nEl - 1; // #pragma omp parallel if (nCount >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nCount)) { // #pragma omp for for( SizeT i=0; iSetKW( 0, cIxList); } } if( e->KeywordPresent( 1)) // NCOMPLEMENT { e->SetKW( 1, new DLongGDL( nCount)); } if( nParam == 2) { e->SetPar( 1, new DLongGDL( count)); } if( count == 0) { if( nullKW) return NullGDL::GetSingleInstance(); return new DLongGDL( -1); } return new DLongGDL( ixList, count); // DLongGDL* res = new DLongGDL( dimension( &count, 1), // BaseGDL::NOZERO); // for( SizeT i=0; i(e->Caller()); if( caller == NULL) return new DLongGDL( 0); DLong nP = caller->NParam(); if( caller->IsObject()) return new DLongGDL( nP-1); // "self" is not counted return new DLongGDL( nP); } BaseGDL* keyword_set( EnvT* e) { e->NParam( 1);//, "KEYWORD_SET"); BaseGDL* p0 = e->GetPar( 0); if( p0 == NULL) return new DIntGDL( 0); if( !p0->Scalar()) return new DIntGDL( 1); if( p0->Type() == GDL_STRUCT) return new DIntGDL( 1); if( p0->LogTrue()) return new DIntGDL( 1); return new DIntGDL( 0); } // passing 2nd argument by value is slightly better for float and double, // but incur some overhead for the complex class. template inline void AddOmitNaN(T& dest, T value) { if (isfinite(value)) { // #pragma omp atomic dest += value; } } template inline void AddOmitNaNCpx(T& dest, T value) { // #pragma omp atomic dest += T(isfinite(value.real())? value.real() : 0, isfinite(value.imag())? value.imag() : 0); } template<> inline void AddOmitNaN(DComplex& dest, DComplex value) { AddOmitNaNCpx(dest, value); } template<> inline void AddOmitNaN(DComplexDbl& dest, DComplexDbl value) { AddOmitNaNCpx(dest, value); } template inline void NaN2Zero(T& value) { if (!isfinite(value)) value = 0; } template inline void NaN2ZeroCpx(T& value) { value = T(isfinite(value.real())? value.real() : 0, isfinite(value.imag())? value.imag() : 0); } template<> inline void NaN2Zero(DComplex& value) { NaN2ZeroCpx< DComplex>(value); } template<> inline void NaN2Zero(DComplexDbl& value) { NaN2ZeroCpx< DComplexDbl>(value); } // total over all elements template BaseGDL* total_template( T* src, bool omitNaN) { if (!omitNaN) return new T(src->Sum()); typename T::Ty sum = 0; SizeT nEl = src->N_Elements(); TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) shared(sum) { #pragma omp for for ( OMPInt i=0; i BaseGDL* total_cu_template( T* res, bool omitNaN) { SizeT nEl = res->N_Elements(); if (omitNaN) { // #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { // #pragma omp for for( SizeT i=0; i BaseGDL* total_over_dim_template( T* src, const dimension& srcDim, SizeT sumDimIx, bool omitNaN) { SizeT nEl = src->N_Elements(); // get dest dim and number of summations dimension destDim = srcDim; SizeT nSum = destDim.Remove( sumDimIx); T* res = new T( destDim); // zero fields // sumStride is also the number of linear src indexing SizeT sumStride = srcDim.Stride( sumDimIx); SizeT outerStride = srcDim.Stride( sumDimIx + 1); SizeT sumLimit = nSum * sumStride; SizeT rIx=0; for( SizeT o=0; o < nEl; o += outerStride) for( SizeT i=0; i < sumStride; ++i) { SizeT oi = o+i; SizeT oiLimit = sumLimit + oi; if( omitNaN) { for( SizeT s=oi; s BaseGDL* total_over_dim_cu_template( T* res, SizeT sumDimIx, bool omitNaN) { SizeT nEl = res->N_Elements(); const dimension& resDim = res->Dim(); if (omitNaN) { for( SizeT i=0; iNParam( 1);//, "TOTAL"); BaseGDL* p0 = e->GetParDefined( 0);//, "TOTAL"); SizeT nEl = p0->N_Elements(); if( nEl == 0) e->Throw( "Variable is undefined: "+e->GetParString(0)); if( p0->Type() == GDL_STRING) e->Throw( "String expression not allowed " "in this context: "+e->GetParString(0)); static int cumIx = e->KeywordIx( "CUMULATIVE"); static int intIx = e->KeywordIx("INTEGER"); static int doubleIx = e->KeywordIx( "DOUBLE"); static int nanIx = e->KeywordIx( "NAN"); static int preserveIx = e->KeywordIx( "PRESERVE_TYPE"); bool cumulative = e->KeywordSet( cumIx); bool intRes = e->KeywordSet( intIx); bool doubleRes = e->KeywordSet( doubleIx); bool nan = e->KeywordSet( nanIx); bool preserve = e->KeywordSet( preserveIx); DLong sumDim = 0; if( nParam == 2) e->AssureLongScalarPar( 1, sumDim); if( sumDim == 0) { if( !cumulative) { if (preserve) { switch (p0->Type()) { case GDL_BYTE: return total_template(static_cast(p0), false); case GDL_INT: return total_template(static_cast(p0), false); case GDL_UINT: return total_template(static_cast(p0), false); case GDL_LONG: return total_template(static_cast(p0), false); case GDL_ULONG: return total_template(static_cast(p0), false); case GDL_LONG64: return total_template(static_cast(p0), false); case GDL_ULONG64: return total_template(static_cast(p0), false); case GDL_FLOAT: return total_template(static_cast(p0), nan); case GDL_DOUBLE: return total_template(static_cast(p0), nan); case GDL_COMPLEX: return total_template(static_cast(p0), nan); case GDL_COMPLEXDBL: return total_template(static_cast(p0), nan); default: assert(false); } } // Integer parts by Erin Sheldon // In IDL total(), the INTEGER keyword takes precedence if( intRes ) { // We use GDL_LONG64 unless the input is GDL_ULONG64 if ( p0->Type() == GDL_LONG64 ) { return total_template ( static_cast(p0), nan ); } if ( p0->Type() == GDL_ULONG64 ) { return total_template ( static_cast(p0), nan ); } // Conver to Long64 DLong64GDL* p0L64 = static_cast (p0->Convert2( GDL_LONG64, BaseGDL::COPY)); Guard guard( p0L64); return total_template( p0L64, nan); } // integer results if( p0->Type() == GDL_DOUBLE) { return total_template ( static_cast(p0), nan); } if( p0->Type() == GDL_COMPLEXDBL) { return total_template ( static_cast(p0), nan); } if( !doubleRes) { if( p0->Type() == GDL_FLOAT) { return total_template ( static_cast(p0), nan); } if( p0->Type() == GDL_COMPLEX) { return total_template ( static_cast(p0), nan); } DFloatGDL* p0F = static_cast (p0->Convert2( GDL_FLOAT,BaseGDL::COPY)); Guard guard( p0F); return total_template( p0F, false); } if( p0->Type() == GDL_COMPLEX) { DComplexDblGDL* p0D = static_cast (p0->Convert2( GDL_COMPLEXDBL,BaseGDL::COPY)); Guard p0D_guard( p0D); return total_template( p0D, nan); } DDoubleGDL* p0D = static_cast (p0->Convert2( GDL_DOUBLE, BaseGDL::COPY)); Guard p0D_guard( p0D); return total_template( p0D, nan); } else // cumulative { if (preserve) { switch (p0->Type()) { case GDL_BYTE: return total_cu_template(static_cast(p0->Dup()), false); case GDL_INT: return total_cu_template(static_cast(p0->Dup()), false); case GDL_UINT: return total_cu_template(static_cast(p0->Dup()), false); case GDL_LONG: return total_cu_template(static_cast(p0->Dup()), false); case GDL_ULONG: return total_cu_template(static_cast(p0->Dup()), false); case GDL_LONG64: return total_cu_template(static_cast(p0->Dup()), false); case GDL_ULONG64: return total_cu_template(static_cast(p0->Dup()), false); case GDL_FLOAT: return total_cu_template(static_cast(p0->Dup()), nan); case GDL_DOUBLE: return total_cu_template(static_cast(p0->Dup()), nan); case GDL_COMPLEX: return total_cu_template(static_cast(p0->Dup()), nan); case GDL_COMPLEXDBL: return total_cu_template(static_cast(p0->Dup()), nan); default: assert(false); } } // INTEGER keyword takes precedence if( intRes ) { // We use GDL_LONG64 unless the input is GDL_ULONG64 if ( p0->Type() == GDL_LONG64 ) { return total_cu_template ( static_cast(p0->Dup()), nan ); } if ( p0->Type() == GDL_ULONG64 ) { return total_cu_template ( static_cast(p0->Dup()), nan ); } // Convert to Long64 return total_cu_template ( static_cast (p0->Convert2( GDL_LONG64, BaseGDL::COPY)), nan); } // integer results // special case as GDL_DOUBLE type overrides /GDL_DOUBLE if( p0->Type() == GDL_DOUBLE) { return total_cu_template< DDoubleGDL> ( static_cast(p0->Dup()), nan); } if( p0->Type() == GDL_COMPLEXDBL) { return total_cu_template< DComplexDblGDL> ( static_cast(p0->Dup()), nan); } if( !doubleRes) { // special case for GDL_FLOAT has no advantage here if( p0->Type() == GDL_COMPLEX) { return total_cu_template< DComplexGDL> ( static_cast(p0->Dup()), nan); } return total_cu_template< DFloatGDL> ( static_cast( p0->Convert2(GDL_FLOAT, BaseGDL::COPY)), nan); } if( p0->Type() == GDL_COMPLEX) { return total_cu_template< DComplexDblGDL> ( static_cast(p0->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY)), nan); } return total_cu_template< DDoubleGDL> ( static_cast(p0->Convert2( GDL_DOUBLE, BaseGDL::COPY)), nan); } } // total over sumDim dimension srcDim = p0->Dim(); SizeT srcRank = srcDim.Rank(); if( sumDim < 1 || sumDim > srcRank) e->Throw( "Array must have "+i2s(sumDim)+ " dimensions: "+e->GetParString(0)); if( !cumulative) { if (preserve) { switch (p0->Type()) { case GDL_BYTE: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, false); case GDL_INT: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, false); case GDL_UINT: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, false); case GDL_LONG: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, false); case GDL_ULONG: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, false); case GDL_LONG64: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, false); case GDL_ULONG64: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, false); case GDL_FLOAT: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, nan); case GDL_DOUBLE: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, nan); case GDL_COMPLEX: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, nan); case GDL_COMPLEXDBL: return total_over_dim_template(static_cast(p0), srcDim, sumDim-1, nan); default: assert(false); } } // INTEGER keyword takes precedence if( intRes ) { // We use GDL_LONG64 unless the input is GDL_ULONG64 if ( p0->Type() == GDL_LONG64 ) { return total_over_dim_template ( static_cast(p0), srcDim, sumDim-1, nan ); } if ( p0->Type() == GDL_ULONG64 ) { return total_over_dim_template ( static_cast(p0), srcDim, sumDim-1, nan ); } // Conver to Long64 DLong64GDL* p0L64 = static_cast (p0->Convert2( GDL_LONG64, BaseGDL::COPY)); Guard p0L64_guard( p0L64); return total_over_dim_template ( p0L64, srcDim, sumDim-1, nan); } // integer results if( p0->Type() == GDL_DOUBLE) { return total_over_dim_template< DDoubleGDL> ( static_cast(p0), srcDim, sumDim-1, nan); } if( p0->Type() == GDL_COMPLEXDBL) { return total_over_dim_template< DComplexDblGDL> ( static_cast(p0), srcDim, sumDim-1, nan); } if( !doubleRes) { if( p0->Type() == GDL_FLOAT) { return total_over_dim_template< DFloatGDL> ( static_cast(p0), srcDim, sumDim-1, nan); } if( p0->Type() == GDL_COMPLEX) { return total_over_dim_template< DComplexGDL> ( static_cast(p0), srcDim, sumDim-1, nan); } // default for NOT /GDL_DOUBLE DFloatGDL* p0F = static_cast (p0->Convert2( GDL_FLOAT,BaseGDL::COPY)); Guard p0F_guard( p0F); // p0F_guard.Reset( p0F); return total_over_dim_template< DFloatGDL> ( p0F, srcDim, sumDim-1, false); } if( p0->Type() == GDL_COMPLEX) { DComplexDblGDL* p0D = static_cast (p0->Convert2( GDL_COMPLEXDBL,BaseGDL::COPY)); Guard p0D_guard( p0D); // p0D_guard.Reset( p0D); return total_over_dim_template< DComplexDblGDL> ( p0D, srcDim, sumDim-1, nan); } // default for /GDL_DOUBLE DDoubleGDL* p0D = static_cast (p0->Convert2( GDL_DOUBLE,BaseGDL::COPY)); Guard p0D_guard( p0D); //p0D_guard.Reset( p0D); return total_over_dim_template< DDoubleGDL>( p0D, srcDim, sumDim-1,nan); } else // cumulative { if (preserve) { switch (p0->Type()) { case GDL_BYTE: return total_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, false); case GDL_INT: return total_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, false); case GDL_UINT: return total_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, false); case GDL_LONG: return total_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, false); case GDL_ULONG: return total_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, false); case GDL_LONG64: return total_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, false); case GDL_ULONG64: return total_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, false); case GDL_FLOAT: return total_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, nan); case GDL_DOUBLE: return total_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, nan); case GDL_COMPLEX: return total_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, nan); case GDL_COMPLEXDBL: return total_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, nan); default: assert(false); } } // INTEGER keyword takes precedence if( intRes ) { // We use GDL_LONG64 unless the input is GDL_ULONG64 if ( p0->Type() == GDL_LONG64 ) { return total_over_dim_cu_template ( static_cast(p0->Dup()), sumDim-1, nan ); } if ( p0->Type() == GDL_ULONG64 ) { return total_over_dim_cu_template ( static_cast(p0->Dup()), sumDim-1, nan ); } // Convert to Long64 return total_over_dim_cu_template ( static_cast (p0->Convert2( GDL_LONG64, BaseGDL::COPY)), sumDim-1, nan); } // integer results if( p0->Type() == GDL_DOUBLE) { return total_over_dim_cu_template< DDoubleGDL> ( static_cast(p0->Dup()), sumDim-1, nan); } if( p0->Type() == GDL_COMPLEXDBL) { return total_over_dim_cu_template< DComplexDblGDL> ( static_cast(p0->Dup()), sumDim-1, nan); } if( !doubleRes) { // special case for GDL_FLOAT has no advantage here if( p0->Type() == GDL_COMPLEX) { return total_over_dim_cu_template< DComplexGDL> ( static_cast(p0->Dup()), sumDim-1, nan); } // default for NOT /GDL_DOUBLE return total_over_dim_cu_template< DFloatGDL> ( static_cast( p0->Convert2( GDL_FLOAT, BaseGDL::COPY)), sumDim-1, nan); } if( p0->Type() == GDL_COMPLEX) { return total_over_dim_cu_template< DComplexDblGDL> ( static_cast(p0->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY)), sumDim-1, nan); } // default for /GDL_DOUBLE return total_over_dim_cu_template< DDoubleGDL> ( static_cast(p0->Convert2( GDL_DOUBLE, BaseGDL::COPY)), sumDim-1, nan); } } // passing 2nd argument by value is slightly better for float and double, // but incur some overhead for the complex class. template inline void MultOmitNaN(T& dest, T value) { if (isfinite(value)) { // #pragma omp atomic dest *= value; } } template inline void MultOmitNaNCpx(T& dest, T value) { dest *= T(isfinite(value.real())? value.real() : 1, isfinite(value.imag())? value.imag() : 1); } template<> inline void MultOmitNaN(DComplex& dest, DComplex value) { MultOmitNaNCpx(dest, value); } template<> inline void MultOmitNaN(DComplexDbl& dest, DComplexDbl value) { MultOmitNaNCpx(dest, value); } template inline void Nan2One(T& value) { if (!isfinite(value)) value = 1; } template inline void Nan2OneCpx(T& value) { value = T(isfinite(value.real())? value.real() : 1, isfinite(value.imag())? value.imag() : 1); } template<> inline void Nan2One(DComplex& value) { Nan2OneCpx< DComplex>(value); } template<> inline void Nan2One(DComplexDbl& value) { Nan2OneCpx< DComplexDbl>(value); } // product over all elements template BaseGDL* product_template( T* src, bool omitNaN) { typename T::Ty sum = 1; SizeT nEl = src->N_Elements(); if( !omitNaN) { TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) shared(sum) { #pragma omp for reduction(*:sum) for ( OMPInt i=0; i= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) shared(sum) { #pragma omp for reduction(*:sum) for ( OMPInt i=0; i BaseGDL* product_template( DComplexGDL* src, bool omitNaN) { DComplexGDL::Ty sum = 1; SizeT nEl = src->N_Elements(); if( !omitNaN) { for ( SizeT i=0; i BaseGDL* product_template( DComplexDblGDL* src, bool omitNaN) { DComplexDblGDL::Ty sum = 1; SizeT nEl = src->N_Elements(); if( !omitNaN) { for ( SizeT i=0; i BaseGDL* product_cu_template( T* res, bool omitNaN) { SizeT nEl = res->N_Elements(); if( omitNaN) { for( SizeT i=0; i BaseGDL* product_over_dim_template( T* src, const dimension& srcDim, SizeT sumDimIx, bool omitNaN) { SizeT nEl = src->N_Elements(); // get dest dim and number of summations dimension destDim = srcDim; SizeT nSum = destDim.Remove( sumDimIx); T* res = new T( destDim, BaseGDL::NOZERO); // sumStride is also the number of linear src indexing SizeT sumStride = srcDim.Stride( sumDimIx); SizeT outerStride = srcDim.Stride( sumDimIx + 1); SizeT sumLimit = nSum * sumStride; SizeT rIx=0; for( SizeT o=0; o < nEl; o += outerStride) for( SizeT i=0; i < sumStride; ++i) { (*res)[ rIx] = 1; SizeT oi = o+i; SizeT oiLimit = sumLimit + oi; if( omitNaN) { for( SizeT s=oi; s BaseGDL* product_over_dim_cu_template( T* res, SizeT sumDimIx, bool omitNaN) { SizeT nEl = res->N_Elements(); const dimension& resDim = res->Dim(); if (omitNaN) { for( SizeT i=0; iNParam( 1); BaseGDL* p0 = e->GetParDefined( 0); SizeT nEl = p0->N_Elements(); if( nEl == 0) e->Throw( "Variable is undefined: "+e->GetParString(0)); if( p0->Type() == GDL_STRING) e->Throw( "String expression not allowed " "in this context: "+e->GetParString(0)); static int cumIx = e->KeywordIx( "CUMULATIVE"); static int nanIx = e->KeywordIx( "NAN"); static int intIx = e->KeywordIx("INTEGER"); static int preIx = e->KeywordIx("PRESERVE_TYPE"); bool KwCumul = e->KeywordSet( cumIx); bool KwNaN = e->KeywordSet( nanIx); bool KwInt = e->KeywordSet( intIx); bool KwPre = e->KeywordSet( preIx); bool nanInt=false; DLong sumDim = 0; if( nParam == 2) e->AssureLongScalarPar( 1, sumDim); if( sumDim == 0) { if( !KwCumul) { if (KwPre) { switch (p0->Type()) { case GDL_BYTE: return product_template(static_cast(p0), nanInt); case GDL_INT: return product_template(static_cast(p0), nanInt); case GDL_UINT: return product_template(static_cast(p0), nanInt); case GDL_LONG: return product_template(static_cast(p0), nanInt); case GDL_ULONG: return product_template(static_cast(p0), nanInt); case GDL_LONG64: return product_template(static_cast(p0), nanInt); case GDL_ULONG64: return product_template(static_cast(p0), nanInt); case GDL_FLOAT: return product_template(static_cast(p0), KwNaN); case GDL_DOUBLE: return product_template(static_cast(p0), KwNaN); case GDL_COMPLEX: return product_template(static_cast(p0), KwNaN); case GDL_COMPLEXDBL: return product_template(static_cast(p0), KwNaN); default: assert(false); } } // Integer parts derivated from Total code by Erin Sheldon // In IDL PRODUCT(), the INTEGER keyword takes precedence if (KwInt) { // We use GDL_LONG64 unless the input is GDL_ULONG64 if ((p0->Type() == GDL_LONG64) && (!KwNaN)) { return product_template ( static_cast(p0), nanInt ); } if ((p0->Type() == GDL_ULONG64) && (!KwNaN)) { return product_template (static_cast(p0), nanInt ); } // Convert to Long64 DLong64GDL* p0L64 = static_cast (p0->Convert2( GDL_LONG64, BaseGDL::COPY)); Guard guard( p0L64); if (KwNaN) { DFloatGDL* p0f = static_cast (p0->Convert2( GDL_FLOAT, BaseGDL::COPY)); Guard guard( p0f); for( SizeT i=0; i( p0L64, nanInt); } // integer results if( p0->Type() == GDL_DOUBLE) { return product_template ( static_cast(p0), KwNaN); } if( p0->Type() == GDL_COMPLEXDBL) { return product_template ( static_cast(p0), KwNaN); } if( p0->Type() == GDL_COMPLEX) { DComplexDblGDL* p0D = static_cast (p0->Convert2( GDL_COMPLEXDBL,BaseGDL::COPY)); Guard p0D_guard( p0D); //p0D_guard.Reset( p0D); return product_template( p0D, KwNaN); } DDoubleGDL* p0D = static_cast (p0->Convert2( GDL_DOUBLE, BaseGDL::COPY)); Guard p0D_guard( p0D); // p0D_guard.Reset( p0D); return product_template( p0D, KwNaN); } else { // KwCumul if (KwPre) { switch (p0->Type()) { case GDL_BYTE: return product_cu_template(static_cast(p0->Dup()), nanInt); case GDL_INT: return product_cu_template(static_cast(p0->Dup()), nanInt); case GDL_UINT: return product_cu_template(static_cast(p0->Dup()), nanInt); case GDL_LONG: return product_cu_template(static_cast(p0->Dup()), nanInt); case GDL_ULONG: return product_cu_template(static_cast(p0->Dup()), nanInt); case GDL_LONG64: return product_cu_template(static_cast(p0->Dup()), nanInt); case GDL_ULONG64: return product_cu_template(static_cast(p0->Dup()), nanInt); case GDL_FLOAT: return product_cu_template(static_cast(p0->Dup()), KwNaN); case GDL_DOUBLE: return product_cu_template(static_cast(p0->Dup()), KwNaN); case GDL_COMPLEX: return product_cu_template(static_cast(p0->Dup()), KwNaN); case GDL_COMPLEXDBL: return product_cu_template(static_cast(p0->Dup()), KwNaN); default: assert(false); } } // Integer parts derivated from Total code by Erin Sheldon // In IDL PRODUCT(), the INTEGER keyword takes precedence if (KwInt) { // We use GDL_LONG64 unless the input is GDL_ULONG64 if ((p0->Type() == GDL_LONG64) && (!KwNaN)) { return product_cu_template ( static_cast(p0->Dup()), nanInt); } if ((p0->Type() == GDL_ULONG64) && (!KwNaN)) { return product_cu_template ( static_cast(p0->Dup()), nanInt); } // Convert to Long64 DLong64GDL* p0L64 = static_cast (p0->Convert2( GDL_LONG64, BaseGDL::COPY)); Guard guard( p0L64); if (KwNaN) { DFloatGDL* p0f = static_cast (p0->Convert2( GDL_FLOAT, BaseGDL::COPY)); Guard guard( p0f); for( SizeT i=0; i (static_cast(p0L64->Dup()), nanInt); } // integer results // special case as GDL_DOUBLE type overrides /GDL_DOUBLE if (p0->Type() == GDL_DOUBLE) { return product_cu_template< DDoubleGDL> ( static_cast(p0->Dup()), KwNaN); } if (p0->Type() == GDL_COMPLEXDBL) { return product_cu_template< DComplexDblGDL> ( static_cast(p0->Dup()), KwNaN); } if (p0->Type() == GDL_COMPLEX) { return product_cu_template< DComplexDblGDL> ( static_cast (p0->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY)), KwNaN); } return product_cu_template< DDoubleGDL> ( static_cast (p0->Convert2( GDL_DOUBLE, BaseGDL::COPY)), KwNaN); } } // product over sumDim dimension srcDim = p0->Dim(); SizeT srcRank = srcDim.Rank(); if( sumDim < 1 || sumDim > srcRank) e->Throw( "Array must have "+i2s(sumDim)+ " dimensions: "+e->GetParString(0)); if (!KwCumul) { if (KwPre) { switch (p0->Type()) { case GDL_BYTE: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, nanInt); case GDL_INT: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, nanInt); case GDL_UINT: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, nanInt); case GDL_LONG: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, nanInt); case GDL_ULONG: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, nanInt); case GDL_LONG64: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, nanInt); case GDL_ULONG64: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, nanInt); case GDL_FLOAT: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, KwNaN); case GDL_DOUBLE: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, KwNaN); case GDL_COMPLEX: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, KwNaN); case GDL_COMPLEXDBL: return product_over_dim_template(static_cast(p0), srcDim, sumDim-1, KwNaN); default: assert(false); } } // Integer parts derivated from Total code by Erin Sheldon // In IDL PRODUCT(), the INTEGER keyword takes precedence if (KwInt) { // We use GDL_LONG64 unless the input is GDL_ULONG64 if ((p0->Type() == GDL_LONG64 ) && (!KwNaN)) { return product_over_dim_template ( static_cast(p0), srcDim, sumDim-1, nanInt); } if ((p0->Type() == GDL_ULONG64) && (!KwNaN)) { return product_over_dim_template ( static_cast(p0), srcDim, sumDim-1, nanInt); } // Conver to Long64 DLong64GDL* p0L64 = static_cast (p0->Convert2( GDL_LONG64, BaseGDL::COPY)); Guard guard( p0L64); if (KwNaN) { DFloatGDL* p0f = static_cast (p0->Convert2( GDL_FLOAT, BaseGDL::COPY)); Guard guard( p0f); for( SizeT i=0; i ( p0L64, srcDim, sumDim-1, nanInt); } // integer results if( p0->Type() == GDL_DOUBLE) { return product_over_dim_template< DDoubleGDL> ( static_cast(p0), srcDim, sumDim-1, KwNaN); } if( p0->Type() == GDL_COMPLEXDBL) { return product_over_dim_template< DComplexDblGDL> ( static_cast(p0), srcDim, sumDim-1, KwNaN); } if( p0->Type() == GDL_COMPLEX) { DComplexDblGDL* p0D = static_cast (p0->Convert2( GDL_COMPLEXDBL,BaseGDL::COPY)); Guard p0D_guard( p0D); // p0D_guard.Reset( p0D); return product_over_dim_template< DComplexDblGDL> ( p0D, srcDim, sumDim-1, KwNaN); } DDoubleGDL* p0D = static_cast (p0->Convert2( GDL_DOUBLE,BaseGDL::COPY)); Guard p0D_guard( p0D); //p0D_guard.Reset( p0D); return product_over_dim_template< DDoubleGDL> ( p0D, srcDim, sumDim-1,KwNaN); } else { // KwCumul if (KwPre) { switch (p0->Type()) { case GDL_BYTE: return product_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, nanInt); case GDL_INT: return product_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, nanInt); case GDL_UINT: return product_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, nanInt); case GDL_LONG: return product_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, nanInt); case GDL_ULONG: return product_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, nanInt); case GDL_LONG64: return product_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, nanInt); case GDL_ULONG64: return product_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, nanInt); case GDL_FLOAT: return product_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, KwNaN); case GDL_DOUBLE: return product_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, KwNaN); case GDL_COMPLEX: return product_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, KwNaN); case GDL_COMPLEXDBL: return product_over_dim_cu_template(static_cast(p0->Dup()), sumDim-1, KwNaN); default: assert(false); } } // Integer parts derivated from Total code by Erin Sheldon // In IDL PRODUCT(), the INTEGER keyword takes precedence if (KwInt) { // We use GDL_LONG64 unless the input is GDL_ULONG64 if ((p0->Type() == GDL_LONG64) && (!KwNaN)) { return product_over_dim_cu_template ( static_cast(p0->Dup()), sumDim-1, nanInt); } if ((p0->Type() == GDL_ULONG64 ) && (!KwNaN)) { return product_over_dim_cu_template ( static_cast(p0->Dup()), sumDim-1, nanInt); } // Convert to Long64 if (KwNaN) { DFloatGDL* p0f = static_cast (p0->Convert2( GDL_FLOAT, BaseGDL::COPY)); Guard guard( p0f); for( SizeT i=0; i ( static_cast (p0f->Convert2( GDL_LONG64, BaseGDL::COPY)), sumDim-1, nanInt); } else { return product_over_dim_cu_template ( static_cast (p0->Convert2( GDL_LONG64, BaseGDL::COPY)), sumDim-1, nanInt); } } // integer results if( p0->Type() == GDL_DOUBLE) { return product_over_dim_cu_template< DDoubleGDL> ( static_cast(p0->Dup()), sumDim-1, KwNaN); } if( p0->Type() == GDL_COMPLEXDBL) { return product_over_dim_cu_template< DComplexDblGDL> ( static_cast(p0->Dup()), sumDim-1, KwNaN); } if( p0->Type() == GDL_COMPLEX) { return product_over_dim_cu_template< DComplexDblGDL> ( static_cast (p0->Convert2( GDL_COMPLEXDBL, BaseGDL::COPY)), sumDim-1, KwNaN); } return product_over_dim_cu_template< DDoubleGDL> ( static_cast (p0->Convert2( GDL_DOUBLE, BaseGDL::COPY)), sumDim-1, KwNaN); } } BaseGDL* array_equal( EnvT* e) { e->NParam( 2);//, "ARRAY_EQUAL"); BaseGDL* p0 = e->GetParDefined( 0);//, "ARRAY_EQUAL"); BaseGDL* p1 = e->GetParDefined( 1);//, "ARRAY_EQUAL"); if( p0 == p1) return new DByteGDL( 1); SizeT nEl0 = p0->N_Elements(); SizeT nEl1 = p1->N_Elements(); // first case : arrays with differents size (>1) if( nEl0 != nEl1 && nEl0 != 1 && nEl1 != 1) return new DByteGDL( 0); // if one of input has only one element, it should NOt be an array // ARRAY_EQUAL(1,[1,1]) True, ARRAY_EQUAL([1],[1,1]) False !! if( nEl0 != nEl1) { if (nEl0 == 1 && nEl1 != 1) { if (!p0->StrictScalar()) return new DByteGDL( 0); } if (nEl0 != 1 && nEl1 == 1) { if (!p1->StrictScalar()) return new DByteGDL( 0); } } //cout << "pO "<< p0->Dim() << " p1 "<< p1->Dim() << endl; //cout << "pO "<< p0->StrictScalar() << " p1 "<< p1->StrictScalar() << endl; Guard p0_guard; Guard p1_guard; if( p0->Type() != p1->Type()) { if( e->KeywordSet( 0)) // NO_TYPECONV return new DByteGDL( 0); else { DType aTy=p0->Type(); DType bTy=p1->Type(); if( DTypeOrder[aTy] >= DTypeOrder[bTy]) { p1 = p1->Convert2( aTy, BaseGDL::COPY); p1_guard.Reset( p1); } else { p0 = p0->Convert2( bTy, BaseGDL::COPY); p0_guard.Reset( p0); } } } if( p0->ArrayEqual( p1)) return new DByteGDL( 1); return new DByteGDL( 0); } BaseGDL* min_fun( EnvT* e) { SizeT nParam = e->NParam( 1); BaseGDL* searchArr = e->GetParDefined( 0); bool omitNaN = e->KeywordSet( "NAN"); static int subIx = e->KeywordIx("SUBSCRIPT_MAX"); bool subMax = e->KeywordPresent(subIx); static int dimIx = e->KeywordIx("DIMENSION"); bool dimSet = e->KeywordSet(dimIx); static int maxIx = e->KeywordIx("MAX"); bool maxSet = e->KeywordPresent(maxIx); DLong searchDim; if (dimSet) { e->AssureLongScalarKW(dimIx, searchDim); if (searchDim < 0 || searchDim > searchArr->Rank()) e->Throw("Illegal keyword value for DIMENSION"); } if (dimSet && searchArr->Rank() > 1) { searchDim -= 1; // user-supplied dimensions start with 1! // here destDim is in fact the srcDim... dimension destDim = searchArr->Dim(); SizeT searchStride = destDim.Stride(searchDim); SizeT outerStride = destDim.Stride(searchDim + 1); // ... and now becomes the destDim SizeT nSearch = destDim.Remove(searchDim); SizeT searchLimit = nSearch * searchStride; SizeT nEl = searchArr->N_Elements(); // memory allocation BaseGDL *maxVal, *resArr = searchArr->New(destDim, BaseGDL::NOZERO); DLongGDL *minElArr, *maxElArr; if (maxSet) { e->AssureGlobalKW(maxIx); // instead of using a guard pointer maxVal = searchArr->New(destDim, BaseGDL::NOZERO); } if (subMax) { e->AssureGlobalKW(subIx); // instead of using a guard pointer maxElArr = new DLongGDL(destDim); } if (nParam == 2) { e->AssureGlobalPar(1); // instead of using a guard pointer minElArr = new DLongGDL(destDim); } SizeT rIx = 0; for (SizeT o = 0; o < nEl; o += outerStride) for (SizeT i = 0; i < searchStride; ++i) { searchArr->MinMax( (nParam == 2 ? &((*minElArr)[rIx]) : NULL), (subMax ? &((*maxElArr)[rIx]) : NULL), &resArr, (maxSet ? &maxVal : NULL), omitNaN, o + i, searchLimit + o + i, searchStride, rIx ); rIx++; } if (nParam == 2) e->SetPar(1, minElArr); if (subMax) e->SetKW(subIx, maxElArr); if (maxSet) e->SetKW(maxIx, maxVal); return resArr; } else { DLong minEl; BaseGDL* res; if (maxSet) // MAX keyword given { e->AssureGlobalKW( 0); GDLDelete(e->GetKW( 0)); DLong maxEl; searchArr->MinMax( &minEl, &maxEl, &res, &e->GetKW( 0), omitNaN); if (subMax) e->SetKW(subIx, new DLongGDL(maxEl)); } else // no MAX keyword { if (subMax) { DLong maxEl; searchArr->MinMax( &minEl, &maxEl, &res, NULL, omitNaN); e->SetKW(subIx, new DLongGDL(maxEl)); } else searchArr->MinMax(&minEl, NULL, &res, NULL, omitNaN); } // handle index if (nParam == 2) e->SetPar(1, new DLongGDL( minEl)); else SysVar::SetC( minEl); return res; } } BaseGDL* max_fun( EnvT* e) { SizeT nParam = e->NParam( 1); BaseGDL* searchArr = e->GetParDefined( 0); bool omitNaN = e->KeywordSet( "NAN"); static int subIx = e->KeywordIx("SUBSCRIPT_MIN"); bool subMin = e->KeywordPresent(subIx); static int dimIx = e->KeywordIx("DIMENSION"); bool dimSet = e->KeywordSet(dimIx); static int minIx = e->KeywordIx("MIN"); bool minSet = e->KeywordPresent(minIx); DLong searchDim; if (dimSet) { e->AssureLongScalarKW(dimIx, searchDim); if (searchDim < 0 || searchDim > searchArr->Rank()) e->Throw("Illegal keyword value for DIMENSION"); } if (dimSet && searchArr->Rank() > 1) { searchDim -= 1; // user-supplied dimensions start with 1! // here destDim is in fact the srcDim... dimension destDim = searchArr->Dim(); SizeT searchStride = destDim.Stride(searchDim); SizeT outerStride = destDim.Stride(searchDim + 1); // ... and now becomes the destDim SizeT nSearch = destDim.Remove(searchDim); SizeT searchLimit = nSearch * searchStride; SizeT nEl = searchArr->N_Elements(); // memory allocation BaseGDL *minVal, *resArr = searchArr->New(destDim, BaseGDL::NOZERO); DLongGDL *minElArr, *maxElArr; if (minSet) { e->AssureGlobalKW(minIx); // instead of using a guard pointer minVal = searchArr->New(destDim, BaseGDL::NOZERO); } if (subMin) { e->AssureGlobalKW(subIx); // instead of using a guard pointer minElArr = new DLongGDL(destDim); } if (nParam == 2) { e->AssureGlobalPar(1); // instead of using a guard pointer maxElArr = new DLongGDL(destDim); } SizeT rIx = 0; for (SizeT o = 0; o < nEl; o += outerStride) for (SizeT i = 0; i < searchStride; ++i) { searchArr->MinMax( (subMin ? &((*minElArr)[rIx]) : NULL), (nParam == 2 ? &((*maxElArr)[rIx]) : NULL), (minSet ? &minVal : NULL), &resArr, omitNaN, o + i, searchLimit + o + i, searchStride, rIx ); rIx++; } if (nParam == 2) e->SetPar(1, maxElArr); if (subMin) e->SetKW(subIx, minElArr); if (minSet) e->SetKW(minIx, minVal); return resArr; } else { DLong maxEl; BaseGDL* res; if (minSet) // MIN keyword given { e->AssureGlobalKW( 0); GDLDelete(e->GetKW( 0)); DLong minEl; searchArr->MinMax( &minEl, &maxEl, &e->GetKW( 0), &res, omitNaN); if (subMin) e->SetKW(subIx, new DLongGDL(minEl)); } else // no MIN keyword { if (subMin) { DLong minEl; searchArr->MinMax( &minEl, &maxEl, NULL, &res, omitNaN); e->SetKW(subIx, new DLongGDL(minEl)); } else searchArr->MinMax(NULL, &maxEl, NULL, &res, omitNaN); } // handle index if (nParam == 2) e->SetPar(1, new DLongGDL( maxEl)); else SysVar::SetC(maxEl); return res; } } BaseGDL* transpose( EnvT* e) { SizeT nParam=e->NParam( 1); BaseGDL* p0 = e->GetParDefined( 0); if( p0->Type() == GDL_STRUCT) e->Throw("Struct expression not allowed in this context: "+ e->GetParString(0)); SizeT rank = p0->Rank(); if( rank == 0) e->Throw( "Expression must be an array " "in this context: "+ e->GetParString(0)); if( nParam == 2) { BaseGDL* p1 = e->GetParDefined( 1); if( p1->N_Elements() != rank) e->Throw("Incorrect number of elements in permutation."); DUInt* perm = new DUInt[rank]; ArrayGuard perm_guard( perm); DUIntGDL* p1L = static_cast (p1->Convert2( GDL_UINT, BaseGDL::COPY)); for( SizeT i=0; iThrow( "Incorrect permutation vector."); } return p0->Transpose( perm); } return p0->Transpose( NULL); } // BaseGDL* matrix_multiply( EnvT* e) // { // SizeT nParam=e->NParam( 2); // // BaseGDL* a = e->GetNumericArrayParDefined( 0); // BaseGDL* b = e->GetNumericArrayParDefined( 1); // // static int aTIx = e->KeywordIx("ATRANSPOSE"); // bool aT = e->KeywordPresent(aTIx); // static int bTIx = e->KeywordIx("BTRANSPOSE"); // bool bT = e->KeywordPresent(bTIx); // // static int strassenIx = e->KeywordIx("STRASSEN_ALGORITHM"); // bool strassen = e->KeywordPresent(strassenIx); // // // if( p1->N_Elements() != rank) // e->Throw("Incorrect number of elements in permutation."); // // DUInt* perm = new DUInt[rank]; // Guard perm_guard( perm); // // DUIntGDL* p1L = static_cast // (p1->Convert2( GDL_UINT, BaseGDL::COPY)); // for( SizeT i=0; iThrow( "Incorrect permutation vector."); // } // return p0->Transpose( perm); // } // // return a->Transpose( NULL); // } // helper function for sort_fun, recursive // optimized version template< typename IndexT> void MergeSortOpt( BaseGDL* p0, IndexT* hhS, IndexT* h1, IndexT* h2, SizeT len) { if( len <= 1) return; SizeT h1N = len / 2; SizeT h2N = len - h1N; // 1st half MergeSortOpt(p0, hhS, h1, h2, h1N); // 2nd half IndexT* hhM = &hhS[h1N]; MergeSortOpt(p0, hhM, h1, h2, h2N); SizeT i; for(i=0; iGreater( h1[h1Ix], h2[h2Ix])) hhS[ i] = h2[ h2Ix++]; else hhS[ i] = h1[ h1Ix++]; } for(; h1Ix < h1N; ++i) hhS[ i] = h1[ h1Ix++]; for(; h2Ix < h2N; ++i) hhS[ i] = h2[ h2Ix++]; } // helper function for sort_fun, recursive void MergeSort( BaseGDL* p0, SizeT* hh, SizeT* h1, SizeT* h2, SizeT start, SizeT end) { if( start+1 >= end) return; SizeT middle = (start+end) / 2; MergeSort(p0, hh, h1, h2, start, middle); MergeSort(p0, hh, h1, h2, middle, end); SizeT h1N = middle - start; SizeT h2N = end - middle; SizeT* hhS = &hh[start]; SizeT i; for(i=0; iGreater( h1[h1Ix], h2[h2Ix])) hhS[ i] = h2[ h2Ix++]; else hhS[ i] = h1[ h1Ix++]; } for(; h1Ix < h1N; ++i) hhS[ i] = h1[ h1Ix++]; for(; h2Ix < h2N; ++i) hhS[ i] = h2[ h2Ix++]; } // sort function uses MergeSort BaseGDL* sort_fun( EnvT* e) { e->NParam( 1); BaseGDL* p0 = e->GetParDefined( 0); if( p0->Type() == GDL_STRUCT) e->Throw( "Struct expression not allowed in this context: "+ e->GetParString(0)); static int l64Ix = e->KeywordIx( "L64"); bool l64 = e->KeywordSet( l64Ix); SizeT nEl = p0->N_Elements(); // helper arrays DLongGDL* res = new DLongGDL( dimension( nEl), BaseGDL::INDGEN); DLong nanIx = nEl; if( p0->Type() == GDL_FLOAT) { DFloatGDL* p0F = static_cast(p0); for( DLong i=nEl-1; i >= 0; --i) { if( isnan((*p0F)[ i]) )//|| !isfinite((*p0F)[ i])) { --nanIx; (*res)[i] = (*res)[nanIx]; (*res)[ nanIx] = i; // cout << "swap " << i << " with " << nanIx << endl; // cout << "now: "; // for( DLong ii=0; ii < nEl; ++ii) // { // cout << (*res)[ii] << " "; // } // cout << endl; } } } else if( p0->Type() == GDL_DOUBLE) { DDoubleGDL* p0F = static_cast(p0); for( DLong i=nEl-1; i >= 0; --i) { if( isnan((*p0F)[ i]))// || !isfinite((*p0F)[ i])) { --nanIx; (*res)[i] = (*res)[nanIx]; (*res)[ nanIx] = i; } } } else if( p0->Type() == GDL_COMPLEX) { DComplexGDL* p0F = static_cast(p0); for( DLong i=nEl-1; i >= 0; --i) { if( isnan((*p0F)[ i].real()) || //!isfinite((*p0F)[ i].real()) || isnan((*p0F)[ i].imag()))// || !isfinite((*p0F)[ i].imag()) ) { --nanIx; (*res)[i] = (*res)[nanIx]; (*res)[ nanIx] = i; } } } else if( p0->Type() == GDL_COMPLEXDBL) { DComplexDblGDL* p0F = static_cast(p0); for( DLong i=nEl-1; i >= 0; --i) { if( isnan((*p0F)[ i].real()) || //!isfinite((*p0F)[ i].real()) || isnan((*p0F)[ i].imag()))// || !isfinite((*p0F)[ i].imag()) ) { --nanIx; (*res)[i] = (*res)[nanIx]; (*res)[ nanIx] = i; } } } // cout << "nEl " << nEl << " nanIx " << nanIx << endl; nEl = nanIx; // cout << "sorting: "; // for( DLong ii=0; ii < nEl; ++ii) // { // cout << (*res)[ii] << " "; // } // cout << endl; DLong *hh = static_cast(res->DataAddr()); DLong* h1 = new DLong[ nEl/2]; DLong* h2 = new DLong[ (nEl+1)/2]; // call the sort routine MergeSortOpt( p0, hh, h1, h2, nEl); delete[] h1; delete[] h2; if( l64) { // leave it this way, as sorting of more than 2^31 // items seems not feasible in the future we might // use MergeSortOpt(...) for this return res->Convert2( GDL_LONG64); } return res; } // uses MergeSort // 2 parts in the code: without "width" or with "width" (limited to 1D and 2D) BaseGDL* median( EnvT* e) { BaseGDL* p0 = e->GetParDefined( 0); if( p0->Type() == GDL_PTR) e->Throw( "Pointer expression not allowed in this context: "+ e->GetParString(0)); if( p0->Type() == GDL_OBJ) e->Throw( "Object expression not allowed in this context: "+ e->GetParString(0)); if( p0->Type() == GDL_STRUCT) e->Throw( "Struct expression not allowed in this context: "+ e->GetParString(0)); if( p0->Rank() == 0) e->Throw( "Expression must be an array in this context: "+ e->GetParString(0)); SizeT nParam = e->NParam( 1); SizeT nEl = p0->N_Elements(); // "f_nan" and "d_nan" used by both parts ... static DStructGDL *Values = SysVar::Values(); DFloat f_nan=(*static_cast(Values->GetTag(Values->Desc()->TagIndex("F_NAN"), 0)))[0]; DDouble d_nan=(*static_cast(Values->GetTag(Values->Desc()->TagIndex("D_NAN"), 0)))[0]; // -------------------------------------------------------- // begin of the part 1: without "width" param if( nParam == 1) { static int evenIx = e->KeywordIx( "EVEN"); // TYPE bool dbl = p0->Type() == GDL_DOUBLE || p0->Type() == GDL_COMPLEXDBL || e->KeywordSet(e->KeywordIx("DOUBLE")); DType type = dbl ? GDL_DOUBLE : GDL_FLOAT; bool noconv = (dbl && p0->Type() == GDL_DOUBLE) || (!dbl && p0->Type() == GDL_FLOAT); // DIMENSION keyword DLong dim = 0; DLong nmed = 1; BaseGDL *res; e->AssureLongScalarKWIfPresent( "DIMENSION", dim); // cout << "dim : "<< dim << endl; if (dim > p0->Rank()) e->Throw( "Illegal keyword value for DIMENSION."); if (dim > 0) { DLong dims[8]; DLong k = 0; for (SizeT i=0; iRank(); ++i) if (i != (dim-1)) { nmed *= p0->Dim(i); dims[k++] = p0->Dim(i); } dimension dimRes((DLong *) dims, p0->Rank()-1); res = dbl ? static_cast(new DDoubleGDL(dimRes, BaseGDL::NOZERO)) : static_cast(new DFloatGDL(dimRes, BaseGDL::NOZERO)); } else { res = dbl ? static_cast(new DDoubleGDL(1)) : static_cast(new DFloatGDL(1)); } // conversion of Complex types if (p0->Type() == GDL_COMPLEX) p0 = p0->Convert2(GDL_FLOAT, BaseGDL::COPY); if (p0->Type() == GDL_COMPLEXDBL) p0 = p0->Convert2(GDL_DOUBLE, BaseGDL::COPY); // helper arrays if (nmed > 1) nEl = p0->N_Elements() / nmed; // cout << "hello2" << endl; DLong *hh = new DLong[ nEl]; DLong* h1 = new DLong[ nEl/2]; DLong* h2 = new DLong[ (nEl+1)/2]; DLong accumStride = 1; if (nmed > 1) for( DLong i=0; iDim(i); BaseGDL *op1, *op2, *op3; if (dbl) op3 = new DDoubleGDL(2); else op3 = new DFloatGDL(2); // nEl_extern is used to store "nEl" initial value DLong nanIx, nEl_extern; nEl_extern=nEl; // if (nmed > 1) nEl_extern = p0->N_Elements() / nmed; //else nEl_extern = p0->N_Elements(); // cout << "hello type" << p0->Type() << endl; // Loop over all subarray medians for (SizeT k=0; kType() == GDL_DOUBLE) { DDoubleGDL* p0F = static_cast(p0); for( DLong i=nEl-1; i >= 0; --i) { if( isnan((*p0F)[i])) { --nanIx; hh[i] = hh[nanIx]; hh[ nanIx] = i; } } } if (p0->Type() == GDL_FLOAT) { DFloatGDL* p0F = static_cast(p0); for( DLong i=nEl-1; i >= 0; --i) { if( isnan((*p0F)[i])) { --nanIx; hh[i] = hh[nanIx]; hh[ nanIx] = i; } } } //cout << "nEl " << nEl << " nanIx " << nanIx << endl; nEl = nanIx; } else { nanIx = nEl; nEl=nEl_extern; // DLong nanIx = nEl; // Starting Element DLong start = accumStride * p0->Dim(dim-1) * (k / accumStride) + (k % accumStride); for( DLong i=0; iType() == GDL_FLOAT) { DFloatGDL* p0F = static_cast(p0); for( DLong i=nEl-1; i >= 0; --i) { jj=start + i * accumStride; if( isnan((*p0F)[ jj]) ) { --nanIx; hh[i] = hh[nanIx]; hh[ nanIx] = i; } } nEl = nanIx; } if (p0->Type() == GDL_DOUBLE) { DDoubleGDL* p0F = static_cast(p0); for( DLong i=nEl-1; i >= 0; --i) { jj=start + i * accumStride; if( isnan((*p0F)[ jj]) ) { --nanIx; hh[i] = hh[nanIx]; hh[ nanIx] = i; } } //cout << "nanIx :" << nanIx << "nEl :" << nEl << endl; nEl = nanIx; } } DLong medEl, medEl_1; // call the sort routine if (nEl > 1) { MergeSortOpt( p0, hh, h1, h2, nEl); medEl = hh[ nEl/2]; medEl_1 = hh[ nEl/2 - 1]; } else { if (nEl == 1) { medEl = hh[0]; medEl_1 = hh[0]; } else { // normal case, more than one element, nothing to do //cout << "gasp : no result ! " << endl; } } if (nEl <= 0) { // we have a NaN if (dbl) (*static_cast(res))[k] = d_nan; else (*static_cast(res))[k] = f_nan; } else { //cout << k << "" << (*static_cast(p0))[medEl] << " " // << (*static_cast(p0))[medEl_1] << endl; //cout << "k :" << k << endl; if( (nEl % 2) == 1 || !e->KeywordSet( evenIx)) { if (nmed == 1) res = p0->NewIx(medEl)->Convert2(type, BaseGDL::CONVERT); else { if (noconv) { if (dbl) (*static_cast(res))[k] = (*static_cast(p0))[medEl]; else (*static_cast(res))[k] = (*static_cast(p0))[medEl]; } else { op1 = p0->NewIx(medEl)->Convert2(type, BaseGDL::CONVERT); if (dbl) (*static_cast(res))[k] = (*static_cast(op1))[0]; else (*static_cast(res))[k] = (*static_cast(op1))[0]; delete(op1); } } } else { if (noconv) { if (dbl) (*static_cast(res))[k] = .5 * ( (*static_cast(p0))[medEl] + (*static_cast(p0))[medEl_1] ); else (*static_cast(res))[k] = .5 * ( (*static_cast(p0))[medEl] + (*static_cast(p0))[medEl_1] ); } else { op1 = p0->NewIx(medEl)->Convert2(type, BaseGDL::CONVERT); op2 = p0->NewIx(medEl_1)->Convert2(type, BaseGDL::CONVERT); if (nmed == 1) res = op2->Add(op1)->Div(op3); // TODO: leak with res? else { if (dbl) (*static_cast(res))[k] = (*static_cast((op2->Add(op1)->Div(op3))))[0]; else (*static_cast(res))[k] = (*static_cast((op2->Add(op1)->Div(op3))))[0]; delete(op2); } delete(op1); } } } } delete(op3); delete[] h1; delete[] h2; delete[] hh; return res; } // begin of the part 2: with "width" param if( nParam == 2) { // with parameter Width : median filtering with no optimisation, // such as histogram algorithms. // Copyright: (C) 2008 by Nicolas Galmiche // basic checks on "vector/array" input DDoubleGDL* p0 = e->GetParAs( 0); if( p0->Rank() > 2) e->Throw( "Only 1 or 2 dimensions allowed: "+ e->GetParString(0)); // basic checks on "width" input DDoubleGDL* p1d = e->GetParAs(1); if (p1d->N_Elements() > 1 || (*p1d)[0] <=0 ) e->Throw( "Width must be a positive scalar or 1 (positive) element array in this context: "+ e->GetParString(0)); DLong MaxAllowedWidth=0; if (p0->Rank() == 1) MaxAllowedWidth=p0->N_Elements(); if (p0->Rank() == 2) { MaxAllowedWidth=p0->Dim(0); if (p0->Dim(1) < MaxAllowedWidth) MaxAllowedWidth=p0->Dim(1); } const int debug =0; if (debug == 1) { cout << "X dim " << p0->Dim(0) <Dim(1) <Throw("Width must be > 1, and < dimension of array (NaN or Inf)"); DLongGDL* p1 = e->GetParAs(1); DDoubleGDL *tamp = new DDoubleGDL(p0->Dim(),BaseGDL::NOZERO); DDouble min=((*p0)[0]); DDouble max=min; for (SizeT ii=0 ; iiN_Elements() ; ++ii) {(*tamp)[ii]=(*p0)[ii]; if ( (*p0)[ii] < min ) min = ((*p0)[ii]); if ( (*p0)[ii] > max ) max = ((*p0)[ii]); } //---------------------------- END d'acquisistion des paramÃ?tres ------------------------------------- static int evenIx = e->KeywordIx( "EVEN"); static int doubleIx = e->KeywordIx( "DOUBLE"); static DStructGDL *Values = SysVar::Values(); DDouble d_nan=(*static_cast(Values->GetTag(Values->Desc()->TagIndex("D_NAN"), 0)))[0]; DDouble d_infinity= (*static_cast(Values->GetTag(Values->Desc()->TagIndex("D_INFINITY"), 0)))[0]; //------------------------------ Init variables and allocation --------------------------------------- SizeT width=(*p1)[0]; SizeT N_MaskElem= width*width; SizeT larg = p0->Stride(1); SizeT haut = p0->Stride(2)/larg; SizeT lim= static_cast(round(width/2)); SizeT init=(lim*larg+lim); // we don't go further if dimension(s) versus not width OK if (debug == 1) {cout << "ici" <Rank() == 1) { if (larg < width || width==1 ) e->Throw( "Width must be > 1, and < width of vector"); } if ( p0->Rank() == 2) { if (larg < width || haut < width || width==1) e->Throw("Width must be > 1, and < dimension of array"); } // for 2D arrays, we use the algorithm described in paper // from T. Huang, G. Yang, and G. Tang, “A Fast Two-Dimensional Median // Filtering Algorithm,†IEEE Trans. Acoust., Speech, Signal Processing, // vol. 27, no. 1, pp. 13–18, 1979. if ( (e->GetParDefined( 0)->Type() == GDL_BYTE || e->GetParDefined( 0)->Type() == GDL_INT || e->GetParDefined( 0)->Type() == GDL_UINT || e->GetParDefined( 0)->Type() == GDL_LONG || e->GetParDefined( 0)->Type() == GDL_ULONG || e->GetParDefined( 0)->Type() == GDL_LONG64 || e->GetParDefined( 0)->Type() == GDL_ULONG64) && (haut>1)) { SizeT taille=static_cast(abs(max)-min+1); DDoubleGDL* Histo = new DDoubleGDL(taille,BaseGDL::NOZERO); if (width % 2 ==0) { for(SizeT i=0 ; i((*p0)[ii+yy*larg]-min)]++; } while (ltmed+(*Histo)[med]<=(N_MaskElem /2)) { ltmed+= static_cast((*Histo)[med]); ++med; } if (e->KeywordSet( evenIx)) { SizeT EvenMed=med; //if ((*Histo)[EvenMed]==1 || (ltmed!=0 && ltmed !=(N_MaskElem /2) -1)) if ((*Histo)[EvenMed]==1 || (ltmed!=0 && N_MaskElem /2- ltmed!=1) ) { while ((*Histo)[EvenMed-1]==0) { EvenMed--;} (*tamp)[init+i*larg]=((med+min)+(EvenMed-1+min))/2; } else (*tamp)[init+i*larg]=med+min; } else {(*tamp)[init+i*larg]=med+min; } for(SizeT j=init+i*larg +1; j((*p0)[initMask-1+k*larg]-min)]--; if ((*p0)[initMask-1+k*larg]-min((*p0)[initMask+k*larg+2*lim-1]-min)]++; if ((*p0)[initMask+k*larg+2*lim-1]-minN_MaskElem /2) { while(ltmed>N_MaskElem /2) { --med; ltmed-=static_cast((*Histo)[med]); } } else { while (ltmed+(*Histo)[med]<=(N_MaskElem /2)) { ltmed+= static_cast((*Histo)[med]); ++med; } } if (e->KeywordSet( evenIx)) { SizeT EvenMed=med; if ((*Histo)[EvenMed]==1 || (ltmed!=0 &&N_MaskElem /2- ltmed!=1 )) { while ((*Histo)[EvenMed-1]==0) { EvenMed--;} (*tamp)[j]=((med+min)+(EvenMed-1+min))/2; } else {(*tamp)[j]=med+min; } } else {(*tamp)[j]=med+min; } } } } else { for(SizeT i=0 ; i((*p0)[ii+yy*larg]-min)]++; } while (ltmed+(*Histo)[med]<=(N_MaskElem /2)) { ltmed+= static_cast((*Histo)[med]); ++med; } (*tamp)[init+i*larg]=med+min; for(SizeT j=init+i*larg +1; j((*p0)[initMask-1+k*larg]-min)]--; if ((*p0)[initMask-1+k*larg]-min((*p0)[initMask+k*larg+2*lim]-min)]++; if ((*p0)[initMask+k*larg+2*lim]-minN_MaskElem /2) { while(ltmed>N_MaskElem /2) { --med; ltmed-=static_cast((*Histo)[med]); } } else { while (ltmed+(*Histo)[med]<=(N_MaskElem /2)) { ltmed+= static_cast((*Histo)[med]); ++med; } } (*tamp)[j]=med+min; } } } } else { DLong* hh; DLong* h1; DLong* h2; DDoubleGDL* Mask,*Mask1D; if ( p0->Rank() != 1 ) { hh = new DLong[ N_MaskElem]; h1 = new DLong[ N_MaskElem/2]; h2= new DLong[ (N_MaskElem+1)/2]; Mask = new DDoubleGDL(N_MaskElem,BaseGDL::NOZERO); for( DLong i=0; iRank() == 1 )//------------------------ For a vector with even width ------------------- { for (SizeT col= lim ; col(Mask1Dbis); MergeSortOpt( besort, hhbis, h1bis, h2bis,(width - ctl_NaN)); if (e->KeywordSet( evenIx)&& (width - ctl_NaN) % 2 == 0) (*tamp)[col]=((*Mask1Dbis)[hhbis[ (width-ctl_NaN)/2]]+(*Mask1Dbis )[hhbis [ (width - ctl_NaN-1)/2]])/2; else (*tamp)[col]=(*Mask1Dbis)[hhbis[ (width- ctl_NaN)/2]]; delete[]hhbis; delete[]h2bis; delete[]h1bis; } } else { BaseGDL* besort=static_cast(Mask1D); MergeSortOpt( besort, hh, h1, h2,width ); // call the sort routine if (e->KeywordSet( evenIx)) (*tamp)[col]=((*Mask1D)[hh[ width/2]]+(*Mask1D)[hh[ (width-1)/2]])/2; else (*tamp)[col]=(*Mask1D)[hh[ width/2]];// replace value by Mask median } } } else//------------------------ For an array with even width ------------------- { SizeT jj; for(SizeT i=0 ; i(Maskb); MergeSortOpt( besort, hhb, h1b, h2b,(N_MaskElem - ctl_NaN)); if ((N_MaskElem - ctl_NaN) % 2 == 0 && e->KeywordSet( evenIx)) (*tamp)[j]=((*Maskb)[hhb[ (N_MaskElem-ctl_NaN)/2]]+(*Maskb)[hhb [ (N_MaskElem - ctl_NaN-1)/2]])/2; else (*tamp)[j]=(*Maskb)[hhb[ (N_MaskElem- ctl_NaN)/2]]; delete[]hhb; delete[]h2b; delete[]h1b; } } else { BaseGDL* besort=static_cast(Mask); MergeSortOpt( besort, hh, h1, h2, N_MaskElem); // call the sort routine if (e->KeywordSet( evenIx)) (*tamp)[j]=((*Mask)[hh[ N_MaskElem/2]]+(*Mask)[hh[ (N_MaskElem-1)/2]])/2; else (*tamp)[j]=(*Mask)[hh[ N_MaskElem/2]];// replace value by median Mask one } } } } } else { if ( p0->Rank() == 1 )//------------------------ For a vector with odd width ------------------- { for (SizeT col= lim ; col(Mask1Dbis); MergeSortOpt( besort, hhbis, h1bis, h2bis,(width - ctl_NaN)); if (e->KeywordSet( evenIx)&& (width - ctl_NaN) % 2 == 0) (*tamp)[col]=((*Mask1Dbis)[hhbis[ (width-ctl_NaN)/2]]+(*Mask1Dbis )[hhbis [ (width - ctl_NaN-1)/2]])/2; else(*tamp)[col]=(*Mask1Dbis)[hhbis[ (width- ctl_NaN)/2]]; delete[]hhbis; delete[]h2bis; delete[]h1bis; } } else { BaseGDL* besort=static_cast(Mask1D); MergeSortOpt( besort, hh, h1, h2,width ); // call the sort routine (*tamp)[col]=(*Mask1D)[hh[ (width)/2]]; // replace value by Mask median } } } else //----------------------------- For an array with odd width --------------------------------- { SizeT jj; for(SizeT i=0 ; i(Maskb); MergeSortOpt( besort, hhb, h1b, h2b,(N_MaskElem - ctl_NaN)); if ((N_MaskElem - ctl_NaN) % 2 == 0 && e->KeywordSet( evenIx)) (*tamp)[j]=((*Maskb)[hhb[ (N_MaskElem-ctl_NaN)/2]]+(*Maskb)[hhb [ (N_MaskElem - ctl_NaN-1)/2]])/2; else(*tamp)[j]=(*Maskb)[hhb[(N_MaskElem- ctl_NaN)/2]]; delete[]hhb; delete[]h2b; delete[]h1b; } } else { BaseGDL* besort=static_cast(Mask); MergeSortOpt( besort, hh, h1, h2, N_MaskElem); // call the sort routine (*tamp)[j]=(*Mask)[hh[ (N_MaskElem)/2]]; // replace value by Mask median } } } } } //--------------------------- END OF MEDIAN FILTER ALOGORITHMS ----------------------------------- delete[] h1; delete[] h2; delete[] hh; } if ( e->GetParDefined( 0)->Type() == GDL_DOUBLE || p0->Type() == GDL_COMPLEXDBL ||e->KeywordSet( doubleIx) ) return tamp; else if (e->GetParDefined( 0)->Type() == GDL_BYTE) return tamp->Convert2(GDL_BYTE,BaseGDL::CONVERT); return tamp->Convert2(GDL_FLOAT,BaseGDL::CONVERT); }// end if e->Throw("More than 2 parameters not handled."); return NULL; }// end of median BaseGDL* shift_fun( EnvT* e) { SizeT nParam = e->NParam( 2); BaseGDL* p0 = e->GetParDefined( 0); SizeT nShift = nParam - 1; if( nShift == 1) { DLong s1; e->AssureLongScalarPar( 1, s1); // IncRef[Obj] done for GDL_PTR and GDL_OBJ return p0->CShift( s1); } if( p0->Rank() != nShift) e->Throw( "Incorrect number of arguments."); DLong sIx[ MAXRANK]; for( SizeT i=0; i< nShift; i++) e->AssureLongScalarPar( i+1, sIx[ i]); if( p0->Type() == GDL_OBJ) GDLInterpreter::IncRefObj( static_cast(p0)); else if( p0->Type() == GDL_PTR) GDLInterpreter::IncRef( static_cast(p0)); return p0->CShift( sIx); } BaseGDL* arg_present( EnvT* e) { e->NParam( 1); if( !e->GlobalPar( 0)) return new DIntGDL( 0); EnvBaseT* caller = e->Caller(); if( caller == NULL) return new DIntGDL( 0); BaseGDL** pp0 = &e->GetPar( 0); int ix = caller->FindGlobalKW( pp0); if( ix == -1) return new DIntGDL( 0); return new DIntGDL( 1); } BaseGDL* eof_fun( EnvT* e) { e->NParam( 1); DLong lun; e->AssureLongScalarPar( 0, lun); bool stdLun = check_lun( e, lun); if( stdLun) return new DIntGDL( 0); // nicer error message (Disregard if socket) if ( fileUnits[ lun-1].SockNum() == -1) { if( !fileUnits[ lun-1].IsOpen()) throw GDLIOException( e->CallingNode(), "File unit is not open: "+i2s( lun)+"."); if( fileUnits[ lun-1].Eof()) return new DIntGDL( 1); } else { // Socket string *recvBuf = &fileUnits[ lun-1].RecvBuf(); if (recvBuf->size() == 0) return new DIntGDL( 1); } return new DIntGDL( 0); } /* BaseGDL* convol( EnvT* e) { SizeT nParam=e->NParam( 2); BaseGDL* p0 = e->GetNumericParDefined( 0); if( p0->Rank() == 0) e->Throw( "Expression must be an array in this context: "+ e->GetParString(0)); BaseGDL* p1 = e->GetNumericParDefined( 1); if( p1->Rank() == 0) e->Throw( "Expression must be an array in this context: "+ e->GetParString(1)); if( p0->N_Elements() < p1->N_Elements()) e->Throw( "Incompatible dimensions for Array and Kernel."); // rank 1 for kernel works always if( p1->Rank() != 1) { SizeT rank = p0->Rank(); if( rank != p1->Rank()) e->Throw( "Incompatible dimensions for Array and Kernel."); for( SizeT r=0; rDim( r) < p1->Dim( r)) e->Throw( "Incompatible dimensions for Array and Kernel."); } // convert kernel to array type Guard p1Guard; if( p0->Type() == GDL_BYTE) { if( p1->Type() != GDL_INT) { p1 = p1->Convert2( GDL_INT, BaseGDL::COPY); p1Guard.Reset( p1); } } else if( p0->Type() != p1->Type()) { p1 = p1->Convert2( p0->Type(), BaseGDL::COPY); p1Guard.Reset( p1); } BaseGDL* scale; Guard scaleGuard; if( nParam > 2) { scale = e->GetParDefined( 2); if( scale->Rank() > 0) e->Throw( "Expression must be a scalar in this context: "+ e->GetParString(2)); // p1 here handles GDL_BYTE case also if( p1->Type() != scale->Type()) { scale = scale->Convert2( p1->Type(),BaseGDL::COPY); scaleGuard.Reset( scale); } } else { scale = p1->New( dimension(), BaseGDL::ZERO); } bool center = true; static int centerIx = e->KeywordIx( "CENTER"); if( e->KeywordPresent( centerIx)) { DLong c; e->AssureLongScalarKW( centerIx, c); center = (c != 0); } // overrides EDGE_TRUNCATE static int edge_wrapIx = e->KeywordIx( "EDGE_WRAP"); bool edge_wrap = e->KeywordSet( edge_wrapIx); static int edge_truncateIx = e->KeywordIx( "EDGE_TRUNCATE"); bool edge_truncate = e->KeywordSet( edge_truncateIx); int edgeMode = 0; if( edge_wrap) edgeMode = 1; else if( edge_truncate) edgeMode = 2; // p0, p1 and scale have same type // p1 has rank of 1 or same rank as p0 with each dimension smaller than p0 // scale is a scalar static int biasIx = e->KeywordIx("BIAS"); bool statusBias = e->KeywordPresent( biasIx ); DLong bias=0; if(statusBias) e->AssureLongScalarKW( biasIx, bias); if(statusBias)cout<<"bias is present: "<Convol( p1, scale, NULL, center, false, edgeMode); } */ BaseGDL* rebin_fun( EnvT* e) { SizeT nParam = e->NParam( 2); BaseGDL* p0 = e->GetNumericParDefined( 0); SizeT rank = p0->Rank(); if( rank == 0) e->Throw( "Expression must be an array in this context: "+ e->GetParString(0)); SizeT resDimInit[ MAXRANK]; DLongGDL* p1 = e->GetParAs(1); if (p1->Rank() > 0 && nParam > 2) e->Throw("The new dimensions must either be specified as an array or as a set of scalars."); SizeT np = p1->Rank() == 0 ? nParam : p1->N_Elements() + 1; for( SizeT p=1; pRank() == 0) e->AssureLongScalarPar( p, newDim); else newDim = (*p1)[p - 1]; if( newDim <= 0) e->Throw( "Array dimensions must be greater than 0."); if( rank >= p) { SizeT oldDim = p0->Dim( p-1); if( newDim > oldDim) { if( (newDim % oldDim) != 0) e->Throw( "Result dimensions must be integer factor " "of original dimensions."); } else { if( (oldDim % newDim) != 0) e->Throw( "Result dimensions must be integer factor " "of original dimensions."); } } resDimInit[ p-1] = newDim; } dimension resDim( resDimInit, np-1); static int sampleIx = e->KeywordIx( "SAMPLE"); bool sample = e->KeywordSet( sampleIx); return p0->Rebin( resDim, sample); } BaseGDL* obj_class( EnvT* e) { SizeT nParam = e->NParam(); static int countIx = e->KeywordIx( "COUNT"); static int superIx = e->KeywordIx( "SUPERCLASS"); bool super = e->KeywordSet( superIx); bool count = e->KeywordPresent( countIx); if( count) e->AssureGlobalKW( countIx); if( nParam > 0) { BaseGDL* p0 = e->GetParDefined( 0); if( p0->Type() != GDL_STRING && p0->Type() != GDL_OBJ) e->Throw( "Argument must be a scalar object reference or string: "+ e->GetParString(0)); if( !p0->Scalar()) e->Throw( "Expression must be a scalar or 1 element " "array in this context: "+e->GetParString(0)); DStructDesc* objDesc; if( p0->Type() == GDL_STRING) { DString objName; e->AssureScalarPar( 0, objName); objName = StrUpCase( objName); objDesc = FindInStructList( structList, objName); if( objDesc == NULL) { if( count) e->SetKW( countIx, new DLongGDL( 0)); return new DStringGDL( ""); } } else // GDL_OBJ { DObj objRef; e->AssureScalarPar( 0, objRef); if( objRef == 0) { if( count) e->SetKW( countIx, new DLongGDL( 0)); return new DStringGDL( ""); } DStructGDL* oStruct; try { oStruct = e->GetObjHeap( objRef); } catch ( GDLInterpreter::HeapException ) { // non valid object if( count) e->SetKW( countIx, new DLongGDL( 0)); return new DStringGDL( ""); } objDesc = oStruct->Desc(); // cannot be NULL } if( !super) { if( count) e->SetKW( countIx, new DLongGDL( 1)); return new DStringGDL( objDesc->Name()); } vector< string> pNames; objDesc->GetParentNames( pNames); SizeT nNames = pNames.size(); if( count) e->SetKW( countIx, new DLongGDL( nNames)); if( nNames == 0) { return new DStringGDL( ""); } DStringGDL* res = new DStringGDL( dimension( nNames), BaseGDL::NOZERO); for( SizeT i=0; iThrow( "Conflicting keywords."); SizeT nObj = structList.size(); DStringGDL* res = new DStringGDL( dimension( nObj), BaseGDL::NOZERO); for( SizeT i=0; iName(); } return res; } BaseGDL* obj_isa( EnvT* e) { SizeT nParam = e->NParam( 2); BaseGDL* p0 = e->GetPar( 0); if( p0 == NULL || p0->Type() != GDL_OBJ) e->Throw( "Object reference type required in this context: "+ e->GetParString(0)); DString className; e->AssureScalarPar( 1, className); className = StrUpCase( className); DObjGDL* pObj = static_cast( p0); DByteGDL* res = new DByteGDL( pObj->Dim()); // zero GDLInterpreter* interpreter = e->Interpreter(); SizeT nElem = pObj->N_Elements(); for( SizeT i=0; iObjValid( (*pObj)[ i])) { DStructGDL* oStruct = e->GetObjHeap( (*pObj)[i]); if( oStruct->Desc()->IsParent( className)) (*res)[i] = 1; } } return res; } BaseGDL* n_tags( EnvT* e) { e->NParam( 1); BaseGDL* p0 = e->GetPar( 0); if( p0 == NULL) return new DLongGDL( 0); if( p0->Type() != GDL_STRUCT) return new DLongGDL( 0); DStructGDL* s = static_cast( p0); //static int lengthIx = e->KeywordIx( "DATA_LENGTH"); //bool length = e->KeywordSet( lengthIx); // we don't know now how to distinghuis the 2 following cases if(e->KeywordSet("DATA_LENGTH")) return new DLongGDL( s->Sizeof()); if(e->KeywordSet("LENGTH")) return new DLongGDL( s->Sizeof()); return new DLongGDL( s->Desc()->NTags()); } BaseGDL* bytscl( EnvT* e) { SizeT nParam = e->NParam( 1); BaseGDL* p0=e->GetNumericParDefined( 0); static int minIx = e->KeywordIx( "MIN"); static int maxIx = e->KeywordIx( "MAX"); static int topIx = e->KeywordIx( "TOP"); bool omitNaN = e->KeywordPresent( 3); DLong topL=255; if( e->GetKW( topIx) != NULL) e->AssureLongScalarKW( topIx, topL); if (topL > 255) topL=255; // Bug corrected! DByte top = static_cast(topL); DDouble dTop = static_cast(top); DDouble min; bool minSet = false; // SA: handling 3 parameters to emulate undocumented IDL behaviour // of translating second and third arguments to MIN and MAX, respectively // (parameters have precedence over keywords) if (nParam >= 2) { e->AssureDoubleScalarPar(1, min); minSet = true; } else if (e->GetKW(minIx) != NULL) { e->AssureDoubleScalarKW(minIx, min); minSet = true; } DDouble max; bool maxSet = false; if (nParam == 3) { e->AssureDoubleScalarPar(2, max); maxSet = true; } else if (e->GetKW(maxIx) != NULL) { e->AssureDoubleScalarKW(maxIx, max); maxSet = true; } DDoubleGDL* dRes = static_cast(p0->Convert2( GDL_DOUBLE, BaseGDL::COPY)); DLong maxEl, minEl; if( !maxSet || !minSet) dRes->MinMax( &minEl, &maxEl, NULL, NULL, omitNaN); if( !minSet) min = (*dRes)[ minEl]; if( !maxSet) max = (*dRes)[ maxEl]; SizeT nEl = dRes->N_Elements(); for( SizeT i=0; i= max) (*dRes)[ i] = dTop; else { // SA: floor is used for integer types to simulate manipulation on input data types if (IntType(p0->Type())) (*dRes)[ i] = floor(((dTop + 1.)*(d - min) - 1.) / (max-min)); // SA (?): here floor is used (instead of round) to simulate IDL behaviour else (*dRes)[ i] = floor((d - min) / (max-min) * (dTop + .9999)); } } return dRes->Convert2( GDL_BYTE); } BaseGDL* strtok_fun( EnvT* e) { SizeT nParam=e->NParam( 1); DString stringIn; e->AssureStringScalarPar( 0, stringIn); DString pattern = " \t"; if(nParam > 1) { e->AssureStringScalarPar( 1, pattern); } static int extractIx = e->KeywordIx( "EXTRACT"); bool extract = e->KeywordSet( extractIx); static int lengthIx = e->KeywordIx( "LENGTH"); bool lengthPresent = e->KeywordPresent( lengthIx); if( extract && lengthPresent) e->Throw( "Conflicting keywords."); static int pre0Ix = e->KeywordIx( "PRESERVE_NULL"); bool pre0 = e->KeywordSet( pre0Ix); static int regexIx = e->KeywordIx( "REGEX"); bool regex = e->KeywordSet( regexIx); char err_msg[MAX_REGEXPERR_LENGTH]; regex_t regexp; vector tokenStart; vector tokenLen; int strLen = stringIn.length(); DString escape = ""; e->AssureStringScalarKWIfPresent( "ESCAPE", escape); vector escList; long pos = 0; while(pos != string::npos) { pos = stringIn.find_first_of( escape, pos); if( pos != string::npos) { escList.push_back( pos+1); // remember escaped char pos += 2; // skip escaped char } } vector::iterator escBeg = escList.begin(); vector::iterator escEnd = escList.end(); long tokB = 0; long tokE; long nextE = 0; long actLen; // If regex then compile regex if( regex) { if (pattern == " \t") pattern = " "; // regcomp doesn't like "\t" JMG int compRes = regcomp( ®exp, pattern.c_str(), REG_EXTENDED); if (compRes) { regerror(compRes, ®exp, err_msg, MAX_REGEXPERR_LENGTH); e->Throw( "Error processing regular expression: "+ pattern+"\n "+string(err_msg)+"."); } } for(;;) { regmatch_t pmatch[1]; if( regex) { int matchres = regexec( ®exp, stringIn.c_str()+nextE, 1, pmatch, 0); tokE = matchres? -1:pmatch[0].rm_so; } else { tokE = stringIn.find_first_of( pattern, nextE); } if( tokE == string::npos) { actLen = strLen - tokB; if( actLen > 0 || pre0) { tokenStart.push_back( tokB); tokenLen.push_back( actLen); } break; } if( find( escBeg, escEnd, tokE) == escEnd) { if (regex) actLen = tokE; else actLen = tokE - tokB; if( actLen > 0 || pre0) { tokenStart.push_back( tokB); tokenLen.push_back( actLen); } if (regex) tokB += pmatch[0].rm_eo; else tokB = tokE + 1; } if (regex) nextE += pmatch[0].rm_eo; else nextE = tokE + 1; } // for(;;) if (regex) regfree( ®exp); SizeT nTok = tokenStart.size(); if( !extract) { if( lengthPresent) { e->AssureGlobalKW( lengthIx); if( nTok > 0) { dimension dim(nTok); DLongGDL* len = new DLongGDL(dim); for(int i=0; i < nTok; i++) (*len)[i] = tokenLen[i]; e->SetKW( lengthIx, len); } else { e->SetKW( lengthIx, new DLongGDL( 0)); } } if( nTok == 0) return new DLongGDL( 0); dimension dim(nTok); DLongGDL* d = new DLongGDL(dim); for(int i=0; i < nTok; i++) (*d)[i] = tokenStart[i]; return d; } // EXTRACT if( nTok == 0) return new DStringGDL( ""); dimension dim(nTok); DStringGDL *d = new DStringGDL(dim); for(int i=0; i < nTok; i++) { (*d)[i] = stringIn.substr(tokenStart[i], tokenLen[i]); // remove escape DString& act = (*d)[i]; long escPos = act.find_first_of( escape, 0); while( escPos != string::npos) { act = act.substr( 0, escPos)+act.substr( escPos+1); escPos = act.find_first_of( escape, escPos+1); } } return d; } BaseGDL* getenv_fun( EnvT* e) { SizeT nParam=e->NParam(); static int environmentIx = e->KeywordIx( "ENVIRONMENT" ); bool environment = e->KeywordSet( environmentIx ); SizeT nEnv; DStringGDL* env; if( environment) { if(nParam != 0) e->Throw( "Incorrect number of arguments."); // determine number of environment entries for(nEnv = 0; environ[nEnv] != NULL ; ++nEnv); dimension dim( nEnv ); env = new DStringGDL(dim); // copy stuff into local string array for(SizeT i=0; i < nEnv ; ++i) (*env)[i] = environ[i]; } else { if(nParam != 1) e->Throw( "Incorrect number of arguments."); DStringGDL* name = e->GetParAs(0); nEnv = name->N_Elements(); env = new DStringGDL( name->Dim()); // copy the stuff into local string only if param found char *resPtr; for(SizeT i=0; i < nEnv ; ++i) { // handle special environment variables // GDL_TMPDIR, IDL_TMPDIR if( (*name)[i] == "GDL_TMPDIR" || (*name)[i] == "IDL_TMPDIR") { resPtr = getenv((*name)[i].c_str()); if( resPtr != NULL) (*env)[i] = resPtr; else (*env)[i] = SysVar::Dir(); AppendIfNeeded( (*env)[i], "/"); } else // normal environment variables if( (resPtr = getenv((*name)[i].c_str())) ) (*env)[i] = resPtr; } } return env; } BaseGDL* tag_names_fun( EnvT* e) { SizeT nParam=e->NParam(); DStructGDL* struc= e->GetParAs(0); static int structureNameIx = e->KeywordIx( "STRUCTURE_NAME" ); bool structureName = e->KeywordSet( structureNameIx ); DStringGDL* tagNames; if(structureName){ if ((*struc).Desc()->Name() != "$truct") tagNames = new DStringGDL((*struc).Desc()->Name()); else tagNames = new DStringGDL(""); } else { SizeT nTags = (*struc).Desc()->NTags(); tagNames = new DStringGDL(dimension(nTags)); for(int i=0; i < nTags; ++i) (*tagNames)[i] = (*struc).Desc()->TagName(i); } return tagNames; } // AC 12-Oc-2011: better version for: len=len, /Extract and /Sub // but it is still not perfect BaseGDL* stregex_fun( EnvT* e) { SizeT nParam=e->NParam( 2); DStringGDL* stringExpr= e->GetParAs(0); dimension dim = stringExpr->Dim(); DString pattern; e->AssureStringScalarPar(1, pattern); if (pattern.size() <= 0) { e->Throw( "Error processing regular expression: "+pattern+ "\n empty (sub)expression"); } static int booleanIx = e->KeywordIx( "BOOLEAN" ); bool booleanKW = e->KeywordSet( booleanIx ); static int extractIx = e->KeywordIx( "EXTRACT" ); bool extractKW = e->KeywordSet( extractIx ); static int foldCaseIx = e->KeywordIx( "FOLD_CASE" ); bool foldCaseKW = e->KeywordSet( foldCaseIx ); //XXXpch: this is wrong, should check arg_present static int lengthIx = e->KeywordIx( "LENGTH" ); bool lengthKW = e->KeywordPresent( lengthIx ); static int subexprIx = e->KeywordIx( "SUBEXPR" ); bool subexprKW = e->KeywordSet( subexprIx ); if( booleanKW && (subexprKW || extractKW || lengthKW)) e->Throw( "Conflicting keywords."); char err_msg[MAX_REGEXPERR_LENGTH]; // set the compile flags int cflags = REG_EXTENDED; if (foldCaseKW) cflags |= REG_ICASE; if (booleanKW) cflags |= REG_NOSUB; // compile the regular expression regex_t regexp; int compRes = regcomp( ®exp, pattern.c_str(), cflags); SizeT nSubExpr = regexp.re_nsub + 1; // cout << regexp.re_nsub << endl; if (compRes) { regerror(compRes, ®exp, err_msg, MAX_REGEXPERR_LENGTH); e->Throw( "Error processing regular expression: "+ pattern+"\n "+string(err_msg)+"."); } BaseGDL* result; if( booleanKW) result = new DByteGDL(dim); else if( extractKW && !subexprKW) { // cout << "my pb ! ? dim= " << dim << endl; result = new DStringGDL(dim); } else if( subexprKW) { // cout << "my pb 2 ? dim= " << dim << endl; dimension subExprDim = dim; subExprDim >> nSubExpr; // m_schellens: commented in, needed if( extractKW) result = new DStringGDL(subExprDim); else result = new DLongGDL(subExprDim); } else result = new DLongGDL(dim); DLongGDL* len = NULL; if( lengthKW) { e->AssureGlobalKW( lengthIx); if( subexprKW) { dimension subExprDim = dim; subExprDim >> nSubExpr; // m_schellens: commented in, needed len = new DLongGDL(subExprDim); } else { len = new DLongGDL(dim); } for( SizeT i=0; iN_Elements(); ++i) (*len)[i]= -1; } int nmatch = 1; if( subexprKW) nmatch = nSubExpr; regmatch_t* pmatch = new regmatch_t[nSubExpr]; ArrayGuard pmatchGuard( pmatch); // cout << "dim " << dim.NDimElements() << endl; for( SizeT s=0; s(result))[i+s*nSubExpr] = (*stringExpr)[s].substr( pmatch[i].rm_so, pmatch[i].rm_eo - pmatch[i].rm_so); // (*stringExpr)[i+s*nSubExpr].substr( pmatch[i].rm_so, pmatch[i].rm_eo - pmatch[i].rm_so); if( lengthKW) (*len)[i+s*nSubExpr] = pmatch[i].rm_so != -1 ? pmatch[i].rm_eo - pmatch[i].rm_so : -1; // (*len)[i+s*nSubExpr] = pmatch[i].rm_eo - pmatch[i].rm_so; } } else if ( subexprKW) { // cout << "je ne comprends pas v2: "<< nSubExpr << endl; // Loop through subexpressions & fill output array for( SizeT i = 0; i(result))[i+s*nSubExpr] = pmatch[i].rm_so; if( lengthKW) (*len)[i+s*nSubExpr] = pmatch[i].rm_so != -1 ? pmatch[i].rm_eo - pmatch[i].rm_so : -1; } } else { if( booleanKW) (* static_cast(result))[s] = (matchres == 0); else if ( extractKW) // !subExprKW { if( matchres == 0) (* static_cast(result))[s] = (*stringExpr)[s].substr( pmatch[0].rm_so, pmatch[0].rm_eo - pmatch[0].rm_so); } else (*static_cast(result))[s] = matchres ? -1 : pmatch[0].rm_so; } if( lengthKW && !subexprKW) (*len)[s] = pmatch[0].rm_eo - pmatch[0].rm_so; } regfree( ®exp); if( lengthKW) e->SetKW( lengthIx, len); return result; } BaseGDL* routine_info( EnvT* e) { SizeT nParam=e->NParam(); if (nParam > 1) e->Throw("Incorrect number of arguments."); static int functionsIx = e->KeywordIx( "FUNCTIONS" ); bool functionsKW = e->KeywordSet( functionsIx ); static int systemIx = e->KeywordIx( "SYSTEM" ); bool systemKW = e->KeywordSet( systemIx ); static int disabledIx = e->KeywordIx( "DISABLED" ); bool disabledKW = e->KeywordSet( disabledIx ); static int parametersIx = e->KeywordIx( "PARAMETERS" ); bool parametersKW = e->KeywordSet( parametersIx ); static int sourceIx = e->KeywordIx( "SOURCE" ); bool sourceKW = e->KeywordSet(sourceIx ); if (sourceKW) { // sanity checks if (systemKW) e->Throw("Conflicting keywords."); // we are not ready to manage the case when no param is provide (routine name) if (nParam == 0) e->Throw("This case is not ready"); // it seems that the code inside "CREATE_STRUCTURE()" (see here below) // shall be a base to do it (notes by AC, May 16, 2013) /*if (functionsKW) { if (funList.size() == 0) { return new DStringGDL(""); } else { */ // getting the routine name from the first parameter (must be a singleton) DString raw_name, name; e->AssureScalarPar(0, raw_name); name = StrUpCase(raw_name); string FullFileName; bool found=false; // SizeT n = funList.size(); //cout << funList.size() << endl; //cout << proList.size() << endl; // looking in the compiled functions (if /function keyword provided) // or in the compiled procedures if (functionsKW) { for(FunListT::iterator i=funList.begin(); i != funList.end(); ++i) { if ((*i)->ObjectName() == name) { found=true; FullFileName=(*i)->GetFilename(); break; } } if (!found) e->Throw("% Attempt to call undefined/not compiled function: '"+raw_name+"'"); } else { for(ProListT::iterator i=proList.begin(); i != proList.end(); ++i) { if ((*i)->ObjectName() == name) { found=true; FullFileName=(*i)->GetFilename(); break; } } if (!found) e->Throw("% Attempt to call undefined/not compiled procedure: '"+raw_name+"'"); } // creating the output anonymous structure DStructDesc* stru_desc = new DStructDesc("$truct"); SpDString aString; stru_desc->AddTag("NAME", &aString); stru_desc->AddTag("PATH", &aString); DStructGDL* stru = new DStructGDL(stru_desc, dimension()); // filling the structure with information about the routine stru->InitTag("NAME", DStringGDL(name)); stru->InitTag("PATH", DStringGDL(FullFileName)); return stru; } if (parametersKW) { // sanity checks if (systemKW || disabledKW) e->Throw("Conflicting keywords."); // getting the routine name from the first parameter DString name; e->AssureScalarPar(0, name); name = StrUpCase(name); DSubUD* routine = functionsKW ? static_cast(funList[GDLInterpreter::GetFunIx(name)]) : static_cast(proList[GDLInterpreter::GetProIx(name)]); SizeT np = routine->NPar(), nk = routine->NKey(); // creating the output anonymous structure DStructDesc* stru_desc = new DStructDesc("$truct"); SpDLong aLong; stru_desc->AddTag("NUM_ARGS", &aLong); stru_desc->AddTag("NUM_KW_ARGS", &aLong); if (np > 0) { SpDString aStringArr(dimension((int)np)); stru_desc->AddTag("ARGS", &aStringArr); } if (nk > 0) { SpDString aStringArr(dimension((int)nk)); stru_desc->AddTag("KW_ARGS", &aStringArr); } DStructGDL* stru = new DStructGDL(stru_desc, dimension()); // filling the structure with information about the routine stru->InitTag("NUM_ARGS", DLongGDL(np)); stru->InitTag("NUM_KW_ARGS", DLongGDL(nk)); if (np > 0) { DStringGDL *pnames = new DStringGDL(dimension(np)); for (SizeT p = 0; p < np; ++p) (*pnames)[p] = routine->GetVarName(nk + p); stru->InitTag("ARGS", *pnames); GDLDelete(pnames); } if (nk > 0) { DStringGDL *knames = new DStringGDL(dimension(nk)); for (SizeT k = 0; k < nk; ++k) (*knames)[k] = routine->GetKWName(k); stru->InitTag("KW_ARGS", *knames); GDLDelete(knames); } // returning return stru; } // GDL does not have disabled routines if( disabledKW) return new DStringGDL(""); // if( functionsKW || systemKW || nParam == 0) // { vector subList; if( functionsKW) { if( systemKW) { SizeT n = libFunList.size(); if( n == 0) return new DStringGDL(""); DStringGDL* res = new DStringGDL( dimension( n), BaseGDL::NOZERO); for( SizeT i = 0; iObjectName(); return res; } else { SizeT n = funList.size(); if( n == 0) return new DStringGDL(""); subList.resize( n); for( SizeT i = 0; iObjectName()); } } else { if( systemKW) { SizeT n = libProList.size(); if( n == 0) return new DStringGDL(""); DStringGDL* res = new DStringGDL( dimension( n), BaseGDL::NOZERO); for( SizeT i = 0; iObjectName(); return res; } else { SizeT n = proList.size(); if( n == 0) return new DStringGDL(""); subList.resize( n); for( SizeT i = 0; iObjectName()); } } sort( subList.begin(), subList.end()); SizeT nS = subList.size(); DStringGDL* res = new DStringGDL( dimension( nS), BaseGDL::NOZERO); for( SizeT s=0; s rl_prep_terminal (0); #endif SizeT nParam=e->NParam(); bool doWait = true; if( nParam > 0) { doWait = false; DLong waitArg = 0; e->AssureLongScalarPar( 0, waitArg); if( waitArg != 0) { doWait = true; } } // https://sourceforge.net/forum/forum.php?thread_id=3292183&forum_id=338691 // DONE: Implement proper SCALAR parameter handling (doWait variable) // which is/was not blocking in the original program. // note: multi-byte input is not supported here. char c='\0'; //initialize is never a bad idea... int fd=fileno(stdin); #ifndef _MSC_VER struct termios orig, get; #endif // Get terminal setup to revert to it at end. #ifndef _MSC_VER (void)tcgetattr(fd, &orig); // New terminal setup, non-canonical. get.c_lflag = ISIG; #endif if (doWait) { // will wait for a character #ifndef _MSC_VER get.c_cc[VTIME]=0; get.c_cc[VMIN]=1; (void)tcsetattr(fd, TCSANOW, &get); #endif cin.get(c); } else { // will not wait, but return EOF or next character in terminal buffer if present #ifndef _MSC_VER get.c_cc[VTIME]=0; get.c_cc[VMIN]=0; (void)tcsetattr(fd, TCSANOW, &get); #endif //the trick is *not to use C++ functions here. cin.get would wait.* c=std::fgetc(stdin); //and to convert EOF to null (otherwise GDL may exit if not compiled with //[lib][n]curses) if(c==EOF) c='\0'; } // Restore original terminal settings. #ifndef _MSC_VER (void)tcsetattr(fd, TCSANOW, &orig); #endif #if defined(HAVE_LIBREADLINE) rl_deprep_terminal (); #endif DStringGDL* res = new DStringGDL( DString( i2s( c))); return res; } BaseGDL* temporary( EnvT* e) { SizeT nParam=e->NParam(1); BaseGDL** p0 = &e->GetParDefined( 0); BaseGDL* ret = *p0; *p0 = NULL; // make parameter undefined return ret; } BaseGDL* memory( EnvT* e) { SizeT nParam=e->NParam( 0); BaseGDL* ret; bool kw_l64 = e->KeywordSet(e->KeywordIx("L64")); // TODO: IDL-doc mentions about automatically switching to L64 if needed if (e->KeywordSet(e->KeywordIx("STRUCTURE"))) { // returning structure if (kw_l64) { ret = new DStructGDL("IDL_MEMORY64"); DStructGDL* retStru = static_cast(ret); (retStru->GetTag(retStru->Desc()->TagIndex("CURRENT")))->InitFrom( DLong64GDL(MemStats::GetCurrent())); (retStru->GetTag(retStru->Desc()->TagIndex("NUM_ALLOC")))->InitFrom( DLong64GDL(MemStats::GetNumAlloc())); (retStru->GetTag(retStru->Desc()->TagIndex("NUM_FREE")))->InitFrom( DLong64GDL(MemStats::GetNumFree())); (retStru->GetTag(retStru->Desc()->TagIndex("HIGHWATER")))->InitFrom( DLong64GDL(MemStats::GetHighWater())); } else { ret = new DStructGDL("IDL_MEMORY"); DStructGDL* retStru = static_cast(ret); (retStru->GetTag(retStru->Desc()->TagIndex("CURRENT")))->InitFrom( DLongGDL(MemStats::GetCurrent())); (retStru->GetTag(retStru->Desc()->TagIndex("NUM_ALLOC")))->InitFrom( DLongGDL(MemStats::GetNumAlloc())); (retStru->GetTag(retStru->Desc()->TagIndex("NUM_FREE")))->InitFrom( DLongGDL(MemStats::GetNumFree())); (retStru->GetTag(retStru->Desc()->TagIndex("HIGHWATER")))->InitFrom( DLongGDL(MemStats::GetHighWater())); } } else { bool kw_current = e->KeywordSet(e->KeywordIx("CURRENT")); bool kw_num_alloc = e->KeywordSet(e->KeywordIx("NUM_ALLOC")); bool kw_num_free = e->KeywordSet(e->KeywordIx("NUM_FREE")); bool kw_highwater = e->KeywordSet(e->KeywordIx("HIGHWATER")); // Following the IDL documentation: mutually exclusive keywords // IDL behaves different, incl. segfaults with selected kw combinations if (kw_current + kw_num_alloc + kw_num_free + kw_highwater > 1) e->Throw("CURRENT, NUM_ALLOC, NUM_FREE & HIGHWATER keywords" " are mutually exclusive"); if (kw_current) { if (kw_l64) ret = new DLong64GDL(MemStats::GetCurrent()); else ret = new DLongGDL(MemStats::GetCurrent()); } else if (kw_num_alloc) { if (kw_l64) ret = new DLong64GDL(MemStats::GetNumAlloc()); else ret = new DLongGDL(MemStats::GetNumAlloc()); } else if (kw_num_free) { if (kw_l64) ret = new DLong64GDL(MemStats::GetNumFree()); else ret = new DLongGDL(MemStats::GetNumFree()); } else if (kw_highwater) { if (kw_l64) ret = new DLong64GDL(MemStats::GetHighWater()); else ret = new DLongGDL(MemStats::GetHighWater()); } else { // returning 4-element array if (kw_l64) { ret = new DLong64GDL(dimension(4)); (*static_cast(ret))[0] = MemStats::GetCurrent(); (*static_cast(ret))[1] = MemStats::GetNumAlloc(); (*static_cast(ret))[2] = MemStats::GetNumFree(); (*static_cast(ret))[3] = MemStats::GetHighWater(); } else { ret = new DLongGDL(dimension(4)); (*static_cast(ret))[0] = MemStats::GetCurrent(); (*static_cast(ret))[1] = MemStats::GetNumAlloc(); (*static_cast(ret))[2] = MemStats::GetNumFree(); (*static_cast(ret))[3] = MemStats::GetHighWater(); } } } return ret; } inline DByte StrCmp( const string& s1, const string& s2, DLong n) { if( n <= 0) return 1; if( s1.substr(0,n) == s2.substr(0,n)) return 1; return 0; } inline DByte StrCmp( const string& s1, const string& s2) { if( s1 == s2) return 1; return 0; } inline DByte StrCmpFold( const string& s1, const string& s2, DLong n) { if( n <= 0) return 1; if( StrUpCase( s1.substr(0,n)) == StrUpCase(s2.substr(0,n))) return 1; return 0; } inline DByte StrCmpFold( const string& s1, const string& s2) { if( StrUpCase( s1) == StrUpCase(s2)) return 1; return 0; } BaseGDL* strcmp_fun( EnvT* e) { SizeT nParam=e->NParam(2); DStringGDL* s0 = static_cast( e->GetParAs< DStringGDL>( 0)); DStringGDL* s1 = static_cast( e->GetParAs< DStringGDL>( 1)); DLongGDL* l2 = NULL; if( nParam > 2) { l2 = static_cast( e->GetParAs< DLongGDL>( 2)); } static int foldIx = e->KeywordIx( "FOLD_CASE"); bool fold = e->KeywordSet( foldIx ); if( s0->Scalar() && s1->Scalar()) { if( l2 == NULL) { if( fold) return new DByteGDL( StrCmpFold( (*s0)[0], (*s1)[0])); else return new DByteGDL( StrCmp( (*s0)[0], (*s1)[0])); } else { DByteGDL* res = new DByteGDL( l2->Dim(), BaseGDL::NOZERO); SizeT nEl = l2->N_Elements(); if( fold) for( SizeT i=0; iScalar()) { DByteGDL* res = new DByteGDL( s1->Dim(), BaseGDL::NOZERO); SizeT nEl = s1->N_Elements(); if( fold) for( SizeT i=0; iScalar()) { DByteGDL* res = new DByteGDL( s0->Dim(), BaseGDL::NOZERO); SizeT nEl = s0->N_Elements(); if( fold) for( SizeT i=0; iN_Elements() <= s1->N_Elements()) { res = new DByteGDL( s0->Dim(), BaseGDL::NOZERO); nEl = s0->N_Elements(); } else { res = new DByteGDL( s1->Dim(), BaseGDL::NOZERO); nEl = s1->N_Elements(); } if( fold) for( SizeT i=0; iScalar(); if( s0->Scalar()) { if( l2Scalar || s1->N_Elements() <= l2->N_Elements()) { res = new DByteGDL( s1->Dim(), BaseGDL::NOZERO); nEl = s1->N_Elements(); } else { res = new DByteGDL( l2->Dim(), BaseGDL::NOZERO); nEl = l2->N_Elements(); } if( fold) for( SizeT i=0; iScalar()) { if( l2Scalar || s0->N_Elements() <= l2->N_Elements()) { res = new DByteGDL( s0->Dim(), BaseGDL::NOZERO); nEl = s0->N_Elements(); } else { res = new DByteGDL( l2->Dim(), BaseGDL::NOZERO); nEl = l2->N_Elements(); } if( fold) for( SizeT i=0; iN_Elements() <= s1->N_Elements()) { res = new DByteGDL( s0->Dim(), BaseGDL::NOZERO); nEl = s0->N_Elements(); } else { res = new DByteGDL( s1->Dim(), BaseGDL::NOZERO); nEl = s1->N_Elements(); } else { if( s0->N_Elements() <= s1->N_Elements()) if( s0->N_Elements() <= l2->N_Elements()) { res = new DByteGDL( s0->Dim(), BaseGDL::NOZERO); nEl = s0->N_Elements(); } else { res = new DByteGDL( l2->Dim(), BaseGDL::NOZERO); nEl = l2->N_Elements(); } else if( s1->N_Elements() <= l2->N_Elements()) { res = new DByteGDL( s1->Dim(), BaseGDL::NOZERO); nEl = s1->N_Elements(); } else { res = new DByteGDL( l2->Dim(), BaseGDL::NOZERO); nEl = l2->N_Elements(); } } if( fold) for( SizeT i=0; i 'Z')) e->Throw( "Illegal tag name: "+name+"."); for( SizeT i=1; i 'Z') && (n[i] < '0' || n[i] > '9')) e->Throw( "Illegal tag name: "+name+"."); } return n; } BaseGDL* create_struct( EnvT* e) { static int nameIx = e->KeywordIx( "NAME" ); DString name = "$truct"; if( e->KeywordPresent( nameIx)) { // Check if name exists, if not then treat as unnamed if (e->GetKW( nameIx) != NULL) e->AssureStringScalarKW( nameIx, name); } if( name != "$truct") // named struct { name = StrUpCase( name); SizeT nParam=e->NParam(); if( nParam == 0) { DStructDesc* desc = e->Interpreter()->GetStruct( name, e->CallingNode()); dimension dim( 1); return new DStructGDL( desc, dim); } DStructDesc* nStructDesc; Guard nStructDescGuard; DStructDesc* oStructDesc= FindInStructList( structList, name); if( oStructDesc == NULL || oStructDesc->NTags() > 0) { // not defined at all yet (-> define now) // or completely defined (-> define now and check equality) nStructDesc= new DStructDesc( name); // guard it nStructDescGuard.Reset( nStructDesc); } else { // NTags() == 0 // not completely defined (only name in list) nStructDesc= oStructDesc; } // the instance variable // dimension dim( 1); // DStructGDL* instance = new DStructGDL( nStructDesc, dim); DStructGDL* instance = new DStructGDL( nStructDesc); Guard instance_guard(instance); for( SizeT p=0; pGetParDefined( p); if( par->Type() == GDL_STRUCT) { DStructGDL* parStruct = static_cast( par); // add struct if( !parStruct->Scalar()) e->Throw("Expression must be a scalar in this context: "+ e->GetParString( p)); DStructDesc* desc = parStruct->Desc(); for( SizeT t=0; t< desc->NTags(); ++t) { instance->NewTag( desc->TagName( t), parStruct->GetTag( t)->Dup()); } } else { // add tag value pair DStringGDL* tagNames = e->GetParAs( p); SizeT nTags = tagNames->N_Elements(); SizeT tagStart = p+1; SizeT tagEnd = p+nTags; if( tagEnd >= nParam) e->Throw( "Incorrect number of arguments."); do{ ++p; BaseGDL* value = e->GetParDefined( p); // add instance->NewTag( TagName( e, (*tagNames)[ p-tagStart]), value->Dup()); } while( pAssureIdentical(nStructDesc); instance->DStructGDL::SetDesc(oStructDesc); //delete nStructDesc; // auto_ptr } } else { // release from guard (if not NULL) nStructDescGuard.release(); // insert into struct list structList.push_back(nStructDesc); } instance_guard.release(); return instance; } else { // unnamed struc // Handle case of single structure parameter SizeT nParam; nParam = e->NParam(1); BaseGDL* par = e->GetParDefined( 0); // DStructGDL* parStruct = dynamic_cast( par); if (nParam != 1 || par->Type() != GDL_STRUCT)// == NULL) nParam=e->NParam(2); DStructDesc* nStructDesc = new DStructDesc( "$truct"); // instance takes care of nStructDesc since it is unnamed // dimension dim( 1); // DStructGDL* instance = new DStructGDL( nStructDesc, dim); DStructGDL* instance = new DStructGDL( nStructDesc); Guard instance_guard(instance); for( SizeT p=0; pGetParDefined( p); // DStructGDL* parStruct = dynamic_cast( par); // if( parStruct != NULL) if( par->Type() == GDL_STRUCT) { // add struct DStructGDL* parStruct = static_cast( par); if( !parStruct->Scalar()) e->Throw("Expression must be a scalar in this context: "+ e->GetParString( p)); DStructDesc* desc = parStruct->Desc(); for( SizeT t=0; t< desc->NTags(); ++t) { instance->NewTag( desc->TagName( t), parStruct->GetTag( t)->Dup()); } ++p; } else { // add tag value pair DStringGDL* tagNames = e->GetParAs( p); SizeT nTags = tagNames->N_Elements(); SizeT tagStart = p+1; SizeT tagEnd = p+nTags; if( tagEnd >= nParam) e->Throw( "Incorrect number of arguments."); for(++p; p<=tagEnd; ++p) { BaseGDL* value = e->GetParDefined( p); // add instance->NewTag( TagName( e, (*tagNames)[ p-tagStart]), value->Dup()); } } } instance_guard.release(); return instance; } } BaseGDL* rotate( EnvT* e) { e->NParam(2); BaseGDL* p0 = e->GetParDefined( 0); if( p0->Rank() == 0) e->Throw( "Expression must be an array in this context: " + e->GetParString( 0)); if( p0->Rank() != 1 && p0->Rank() != 2) e->Throw( "Only 1 or 2 dimensions allowed: " + e->GetParString( 0)); if( p0->Type() == GDL_STRUCT) e->Throw( "STRUCT expression not allowed in this context: "+ e->GetParString( 0)); DLong dir; e->AssureLongScalarPar( 1, dir); return p0->Rotate( dir); } // SA: based on the code of rotate() (above) BaseGDL* reverse( EnvT* e) { e->NParam(1); BaseGDL* p0 = e->GetParDefined(0); if (p0->Rank() == 0) return p0->Dup(); DLong dim = 1; if (e->GetPar(1) != NULL) e->AssureLongScalarPar(1, dim); if (p0->Rank() != 0 && (dim > p0->Rank() || dim < 1)) e->Throw("Subscript_index must be positive and less than or equal to number of dimensions."); BaseGDL* ret; // IDL doc states that OVERWRITE is ignored for one- or two-dim. arrays // but it seems to behave differently // if (p0->Rank() > 2 && e->KeywordSet("OVERWRITE") && e->GlobalPar(0)) static int overwriteIx = e->KeywordIx("OVERWRITE"); if (e->KeywordSet(overwriteIx)) { p0->Reverse(dim-1); bool stolen = e->StealLocalPar( 0); // if( !stolen) // e->GetPar(0) = NULL; if( !stolen) e->SetPtrToReturnValue( &e->GetPar(0)); return p0; } else ret = p0->DupReverse(dim - 1); return ret; } // SA: parse_url based on the PHP parse_url() function code // by Jim Winstead / The PHP Group (PHP license v. 3.01) // (http://svn.php.net/viewvc/php/php-src/trunk/ext/standard/url.c) // PHP is free software available at http://www.php.net/software/ // // notes: // - IDL does not support IPv6 URLs, GDL does // - IDL includes characters after '#' in the QUERY part, GDL // just skips them and issues a warning (perhaps not needed) // - IDL preserves controll characters in URLs, GDL preserves // them as well but a warning is issued // - IDL sets 80 as a default value for PORT, even if the url has // an ftp:// schema indicated - GDL does not have any default value // - IDL excludes the leading "/" from the path, GDL preserves it // ... these differences seem just rational for me but please do change // it if IDL-compatibility would be beneficial for any reason here BaseGDL* parse_url(EnvT* env) { // sanity check for number of parameters SizeT nParam = env->NParam(); // 1-nd argument : the url string DString url; env->AssureScalarPar(0, url); // sanity check for controll characters string::iterator it; for (it = url.begin(); it < url.end(); it++) if (iscntrl(*it)) { Warning("PARSE_URL: URL contains a control character"); break; } // creating the output anonymous structure DStructDesc* urlstru_desc = new DStructDesc("$truct"); SpDString aString; urlstru_desc->AddTag("SCHEME", &aString); static size_t ixSCHEME = 0; urlstru_desc->AddTag("USERNAME", &aString); urlstru_desc->AddTag("PASSWORD", &aString); urlstru_desc->AddTag("HOST", &aString); urlstru_desc->AddTag("PORT", &aString); static size_t ixPORT = 4; urlstru_desc->AddTag("PATH", &aString); urlstru_desc->AddTag("QUERY", &aString); DStructGDL* urlstru = new DStructGDL(urlstru_desc, dimension()); Guard urlstru_guard(urlstru); // parsing the URL char const *str = url.c_str(); size_t length = url.length(); char port_buf[6]; char const *s, *e, *p, *pp, *ue; s = str; ue = s + length; // parsing scheme if ((e = (const char*)memchr(s, ':', length)) && (e - s)) { // validating scheme p = s; while (p < e) { // scheme = 1*[ lowalpha | digit | "+" | "-" | "." ] if (!isalpha(*p) && !isdigit(*p) && *p != '+' && *p != '.' && *p != '-') { if (e + 1 < ue) goto parse_port; else goto just_path; } p++; } if (*(e + 1) == '\0') { // only scheme is available urlstru->InitTag("SCHEME", DStringGDL(string(s, (e - s)))); goto end; } // schemas without '/' (like mailto: and zlib:) if (*(e+1) != '/') { // check if the data we get is a port this allows us to correctly parse things like a.com:80 p = e + 1; while (isdigit(*p)) p++; if ((*p == '\0' || *p == '/') && (p - e) < 7) goto parse_port; urlstru->InitTag("SCHEME", DStringGDL(string(s, (e - s)))); length -= ++e - s; s = e; goto just_path; } else { urlstru->InitTag("SCHEME", DStringGDL(string(s, (e - s)))); if (*(e+2) == '/') { s = e + 3; if (!strncasecmp("file", (*static_cast(urlstru->GetTag(ixSCHEME)))[0].c_str(), sizeof("file") )) { if (*(e + 3) == '/') { // support windows drive letters as in: file:///c:/somedir/file.txt if (*(e + 5) == ':') s = e + 4; goto nohost; } } } else { if (!strncasecmp("file", (*static_cast(urlstru->GetTag(ixSCHEME)))[0].c_str(), sizeof("file")) ) { s = e + 1; goto nohost; } else { length -= ++e - s; s = e; goto just_path; } } } } else if (e) { // no scheme, look for port parse_port: p = e + 1; pp = p; while (pp-p < 6 && isdigit(*pp)) pp++; if (pp-p < 6 && (*pp == '/' || *pp == '\0')) { memcpy(port_buf, p, (pp-p)); port_buf[pp-p] = '\0'; urlstru->InitTag("PORT", DStringGDL(port_buf)); } else goto just_path; } else { just_path: ue = s + length; goto nohost; } e = ue; if (!(p = (const char*)memchr(s, '/', (ue - s)))) { if ((p = (const char*)memchr(s, '?', (ue - s)))) e = p; else if ((p = (const char*)memchr(s, '#', (ue - s)))) e = p; } else e = p; // check for login and password { size_t pos; if ((pos = string(s, e - s).find_last_of("@")) != string::npos) { p = s + pos; if ((pp = (const char*)memchr(s, ':', (p-s)))) { if ((pp-s) > 0) urlstru->InitTag("USERNAME", DStringGDL(string(s, (pp - s)))); pp++; if (p-pp > 0) urlstru->InitTag("PASSWORD", DStringGDL(string(pp, (p - pp)))); } else urlstru->InitTag("USERNAME", DStringGDL(string(s, (p - s)))); s = p + 1; } } // check for port if (*s == '[' && *(e-1) == ']') p = s; // IPv6 embedded address else for(p = e; *p != ':' && p >= s; p--); // memrchr is a GNU extension if (p >= s && *p == ':') { if ((*static_cast(urlstru->GetTag(ixPORT)))[0].length() == 0) { p++; if (e-p > 5) env->Throw("port cannot be longer then 5 characters"); else if (e - p > 0) { memcpy(port_buf, p, (e-p)); port_buf[e-p] = '\0'; urlstru->InitTag("PORT", DStringGDL(port_buf)); } p--; } } else p = e; // check if we have a valid host, if we don't reject the string as url if ((p-s) < 1) env->Throw("invalid host"); urlstru->InitTag("HOST", DStringGDL(string(s, (p - s)))); if (e == ue) goto end; s = e; nohost: if ((p = (const char*)memchr(s, '?', (ue - s)))) { pp = strchr(s, '#'); if (pp && pp < p) { p = pp; pp = strchr(pp+2, '#'); } if (p - s) urlstru->InitTag("PATH", DStringGDL(string(s, (p - s)))); if (pp) { if (pp - ++p) urlstru->InitTag("QUERY", DStringGDL(string(p, (pp - p)))); p = pp; goto label_parse; } else if (++p - ue) urlstru->InitTag("QUERY", DStringGDL(string(p, (ue - p)))); } else if ((p = (const char*)memchr(s, '#', (ue - s)))) { if (p - s) urlstru->InitTag("PATH", DStringGDL(string(s, (p - s)))); label_parse: p++; if (ue - p) Warning("PARSE_URL: URL fragment left out: #" + string(p, (ue-p))); } else urlstru->InitTag("PATH", DStringGDL(string(s, (ue - s)))); end: // returning the result urlstru_guard.release(); return urlstru; } BaseGDL* locale_get(EnvT* e) { #ifdef HAVE_LOCALE_H // make GDL inherit the calling process locale setlocale(LC_ALL, ""); // note doen the inherited locale DStringGDL *locale = new DStringGDL(setlocale(LC_CTYPE, NULL)); // return to the C locale setlocale(LC_ALL, "C"); return locale; #else e->Throw("OS does not provide locale information"); #endif } // SA: relies on the contents of the lib::command_line_args vector // defined and filled with data (pointers) in gdl.cpp BaseGDL* command_line_args_fun(EnvT* e) { #ifdef PYTHON_MODULE e->Throw("no command line arguments available (GDL built as a Python module)"); #else static int countIx = e->KeywordIx("COUNT"); extern std::vector command_line_args; // setting the COUNT keyword value if (e->KeywordPresent(countIx)) { e->AssureGlobalKW(countIx); e->SetKW(countIx, new DLongGDL(command_line_args.size())); } // returning empty string or an array of arguments if (command_line_args.empty()) return new DStringGDL(""); else { BaseGDL* ret = new DStringGDL(dimension(command_line_args.size())); for (size_t i = 0; i < command_line_args.size(); i++) (*static_cast(ret))[i] = command_line_args[i]; return ret; } #endif } // SA: relies in the uname() from libc (must be there if POSIX) BaseGDL* get_login_info( EnvT* e) { // getting the info #ifdef _MSC_VER #define MAX_TCHAR_BUF 256 char login[MAX_TCHAR_BUF]; char info[MAX_TCHAR_BUF]; DWORD N_TCHAR = MAX_TCHAR_BUF; #ifdef _UNICODE TCHAR t_buf[MAX_TCHAR_BUF]; GetUserName(t_buf, &N_TCHAR); WideCharToMultiByte(CP_ACP, 0, t_buf, N_TCHAR, login, N_TCHAR, NULL, NULL); GetComputerName( t_buf, &N_TCHAR ); WideCharToMultiByte(CP_ACP, 0, t_buf, N_TCHAR, info, N_TCHAR, NULL, NULL); #else GetUserName(login, &N_TCHAR); GetComputerName(info, &N_TCHAR); #endif #else char* login = getlogin(); if (login == NULL) e->Throw("Failed to get user name from the OS"); struct utsname info; if (0 != uname(&info)) e->Throw("Failed to get machine name from the OS"); #endif // creating the output anonymous structure DStructDesc* stru_desc = new DStructDesc("$truct"); SpDString aString; stru_desc->AddTag("MACHINE_NAME", &aString); stru_desc->AddTag("USER_NAME", &aString); DStructGDL* stru = new DStructGDL(stru_desc, dimension()); // returning the info stru->InitTag("USER_NAME", DStringGDL(login)); #ifdef _MSC_VER stru->InitTag("MACHINE_NAME", DStringGDL(info)); #else stru->InitTag("MACHINE_NAME", DStringGDL(info.nodename)); #endif return stru; } // SA: base64 logic in base64.hpp, based on code by Bob Withers (consult base64.hpp) BaseGDL* idl_base64(EnvT* e) { BaseGDL* p0 = e->GetPar(0); if (p0 != NULL) { if (p0->Rank() == 0 && p0->Type() == GDL_STRING) { // decoding string* str = &((*static_cast(p0))[0]); if (str->length() == 0) return new DByteGDL(0); if (str->length() % 4 != 0) e->Throw("Input string length must be a multiple of 4"); unsigned int retlen = base64::decodeSize(*str); if (retlen == 0 || retlen > str->length()) e->Throw("No data in the input string"); DByteGDL* ret = new DByteGDL(dimension(retlen)); if (!base64::decode(*str, (char*)&((*ret)[0]), ret->N_Elements())) { delete ret; e->Throw("Base64 decoder failed"); } return ret; } if (p0->Rank() >= 1 && p0->Type() == GDL_BYTE) { // encoding return new DStringGDL( base64::encode((char*)&(*static_cast(p0))[0], p0->N_Elements()) ); } } e->Throw("Expecting string or byte array as a first parameter"); } BaseGDL* get_drive_list(EnvT* e) { if (e->KeywordPresent(0)) e->SetKW(0, new DLongGDL(0)); return new DStringGDL(""); } // note: changes here MUST be reflected in scope_varfetch_reference() as well // because DLibFun of this function is used for scope_varfetch_reference() the keyword // indices must match BaseGDL* scope_varfetch_value( EnvT* e) { SizeT nParam=e->NParam(); EnvStackT& callStack = e->Interpreter()->CallStack(); // DLong curlevnum = callStack.size()-1; // 'e' is not on the stack DLong curlevnum = callStack.size(); // static int variablesIx = e->KeywordIx( "VARIABLES" ); static int levelIx = e->KeywordIx( "LEVEL" ); DLongGDL* level = e->IfDefGetKWAs( levelIx); DLong desiredlevnum = 0; if (level != NULL) desiredlevnum = (*level)[0]; if (desiredlevnum <= 0) desiredlevnum += curlevnum; if (desiredlevnum < 1) desiredlevnum = 1; else if (desiredlevnum > curlevnum) desiredlevnum = curlevnum; DSubUD* pro = static_cast(callStack[desiredlevnum-1]->GetPro()); SizeT nVar = pro->Size(); // # var in GDL for desired level int nKey = pro->NKey(); DString varName; e->AssureScalarPar( 0, varName); varName = StrUpCase( varName); int xI = pro->FindVar( varName); if (xI != -1) { // BaseGDL*& par = ((EnvT*)(callStack[desiredlevnum-1]))->GetPar( xI); BaseGDL*& par = callStack[desiredlevnum-1]->GetKW( xI); if( par == NULL) e->Throw( "Variable is undefined: " + varName); return par->Dup(); } e->Throw( "Variable not found: " + varName); return new DLongGDL(0); // compiler shut-up } // this routine is special, only called as an l-function (from FCALL_LIB::LEval()) // it MUST use an EnvT set up for scope_varfetch_value BaseGDL** scope_varfetch_reference( EnvT* e) { SizeT nParam=e->NParam(); EnvStackT& callStack = e->Interpreter()->CallStack(); // DLong curlevnum = callStack.size()-1; // 'e' is not on the stack DLong curlevnum = callStack.size(); // static int variablesIx = e->KeywordIx( "VARIABLES" ); static int levelIx = e->KeywordIx( "LEVEL" ); DLongGDL* level = e->IfDefGetKWAs( levelIx); DLong desiredlevnum = 0; if (level != NULL) desiredlevnum = (*level)[0]; if (desiredlevnum <= 0) desiredlevnum += curlevnum; if (desiredlevnum < 1) desiredlevnum = 1; else if (desiredlevnum > curlevnum) desiredlevnum = curlevnum; DSubUD* pro = static_cast(callStack[desiredlevnum-1]->GetPro()); SizeT nVar = pro->Size(); // # var in GDL for desired level int nKey = pro->NKey(); DString varName; e->AssureScalarPar( 0, varName); varName = StrUpCase( varName); int xI = pro->FindVar( varName); if (xI != -1) { // BaseGDL*& par = ((EnvT*)(callStack[desiredlevnum-1]))->GetPar( xI); BaseGDL*& par = callStack[desiredlevnum-1]->GetKW( xI); // if( par == NULL) // e->Throw( "Variable is undefined: " + varName); return ∥ } e->Throw( "LVariable not found: " + varName); return NULL; // compiler shut-up } } // namespace gdl-0.9.4/src/gdlsvgstream.hpp0000664000175000017500000000251511300362652014725 0ustar marcmarc/* ************************************************************************* gdlsvgstream.hpp - graphic stream SVG ------------------- begin : December 26 2008 copyright : (C) 2008 by Sylwester Arabas email : slayoo@users.sf.net ***************************************************************************/ /* ************************************************************************* * * * 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. * * * ***************************************************************************/ #ifndef GDLSVGSTREAM_HPP_ #define GDLSVGSTREAM_HPP_ #include "gdlgstream.hpp" class GDLSVGStream: public GDLGStream { public: GDLSVGStream( int nx, int ny): GDLGStream( nx, ny, checkPlplotDriver("svgcairo") ? "svgcairo" : "svg") { } ~GDLSVGStream() { } void eop() { } void Init(); }; #endif gdl-0.9.4/src/initct.cpp0000664000175000017500000040246610276107467013535 0ustar marcmarc// define the color tables #include "includefirst.hpp" #include "graphics.hpp" void Graphics::InitCT() { { // make r, g, b local identifiers DByte r[256]={ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255}; DByte g[256]={ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255}; DByte b[256]={ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255}; CT.push_back(GDLCT("B-W LINEAR",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 90, 94, 98,102,106,110,114,118,122,126,130,134,138,142,146,150,154,158,162,166,170,175,179,183,187,191,195,199,203,207,211,215,219,223,227,231,235,239,243,247,251,255}; DByte g[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 5, 7, 9, 10, 12, 13, 15, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 34, 36, 37, 39, 41, 42, 44, 45, 47, 49, 50, 52, 53, 55, 57, 58, 60, 61, 63, 65, 66, 68, 69, 71, 73, 74, 76, 77, 79, 81, 82, 84, 85, 87, 89, 90, 92, 94, 95, 97, 98,100,102,103,105,106,108,110,111,113,114,116,118,119,121,122,124,126,127,129,130,132,134,135,137,138,140,142,143,145,146,148,150,151,153,154,156,158,159,161,162,164,166,167,169,170,172,174,175,177,179,180,182,183,185,187,188,190,191,193,195,196,198,199,201,203,204,206,207,209,211,212,214,215,217,219,220,222,223,225,227,228,230,231,233,235,236,238,239,241,243,244,246,247,249,251,252,254,255}; DByte b[256]={ 0, 1, 2, 4, 5, 6, 8, 9, 10, 12, 13, 14, 16, 17, 18, 20, 21, 23, 24, 25, 27, 28, 29, 31, 32, 33, 35, 36, 37, 39, 40, 42, 43, 44, 46, 47, 48, 50, 51, 52, 54, 55, 56, 58, 59, 61, 62, 63, 65, 66, 67, 69, 70, 71, 73, 74, 75, 77, 78, 80, 81, 82, 84, 85, 86, 88, 89, 90, 92, 93, 94, 96, 97, 99,100,101,103,104,105,107,108,109,111,112,113,115,116,118,119,120,122,123,124,126,127,128,130,131,132,134,135,136,138,139,141,142,143,145,146,147,149,150,151,153,154,155,157,158,160,161,162,164,165,166,168,169,170,172,173,174,176,177,179,180,181,183,184,185,187,188,189,191,192,193,195,196,198,199,200,202,203,204,206,207,208,210,211,212,214,215,217,218,219,221,222,223,225,226,227,229,230,231,233,234,236,237,238,240,241,242,244,245,246,248,249,250,252,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}; CT.push_back(GDLCT("BLUE/WHITE",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, 78, 84, 90, 96,102,108,114,120,126,132,138,144,150,156,162,168,174,180,186,192,198,204,210,216,222,228,234,240,243,246,249,252,252,252,252,252,251,250,249,248,248,248,248,248,247,246,245,244,243,242,241,240,240,239,238,237,236,236,236,236,235,234,233,232,231,230,229,228,228,228,228,228,227,226,225,224,223,222,221,220,219,218,217,216,216,216,216,216,215,214,213,212,211,210,209,208,207,206,205,204,204,204,204,204,203,202,201,200,199,198,197,196,196,196,196,196,195,194,193,192,191,190,189,188,187,186,185,184,184,184,184,184,183,182,181,180,179,178,177,176,176,176,176,176,175,174,173,172,171,170,169,168,167,166,165,164,164,164,164,164,163,162,161,160,159,158,157,156,155,154,153,152,152,152,152,152,151,150,149,148,151,154,157,160,163,166,169,172,176,180,184,188,191,194,197,200,203,206,209,212,215,218,221,224,228,232,236,240,243,246,249,252,253,254,255}; DByte g[256]={ 0, 36, 72, 75, 79, 82, 86, 90, 93, 97,100,104,108,117,126,135,144,153,162,171,180,189,198,207,216,225,234,243,252,249,246,243,240,234,228,222,216,210,204,198,192,186,180,174,168,162,156,150,144,138,132,126,120,114,108,102, 96, 90, 84, 78, 72, 66, 60, 54, 48, 42, 36, 30, 24, 18, 12, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 16, 24, 32, 40, 48, 56, 64, 72, 80, 88, 96,104,112,120,128,135,142,149,156,164,172,180,188,196,204,212,220,228,236,244,252,253,254,255}; DByte b[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 5, 7, 9, 10, 12, 14, 16, 18, 20, 22, 25, 27, 29, 31, 34, 35, 37, 39, 41, 43, 45, 47, 50, 52, 54, 56, 59, 61, 63, 65, 67, 68, 70, 72, 74, 76, 78, 80, 83, 85, 87, 89, 92, 94, 96, 98,101,102,104,106,108,110,112,114,116,118,120,122,125,127,129,131,134,135,137,139,141,143,145,147,150,152,154,156,159,160,162,163,165,167,169,171,174,176,178,180,183,185,187,189,192,193,195,197,199,201,203,205,208,210,212,214,216,217,219,221,223,225,227,229,232,234,236,238,241,243,245,247,250,251,252,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}; CT.push_back(GDLCT("GRN-RED-BLU-WHT",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 1, 2, 4, 5, 7, 8, 10, 11, 13, 14, 15, 17, 18, 20, 21, 23, 24, 26, 27, 28, 30, 31, 33, 34, 36, 37, 39, 40, 42, 43, 44, 46, 47, 49, 50, 52, 53, 55, 56, 57, 59, 60, 62, 63, 65, 66, 68, 69, 70, 72, 73, 75, 76, 78, 79, 81, 82, 84, 85, 86, 88, 89, 91, 92, 94, 95, 97, 98, 99,101,102,104,105,107,108,110,111,113,114,115,117,118,120,121,123,124,126,127,128,130,131,133,134,136,137,139,140,141,143,144,146,147,149,150,152,153,155,156,157,159,160,162,163,165,166,168,169,170,172,173,175,176,178,179,181,182,184,185,186,188,189,191,192,194,195,197,198,199,201,202,204,205,207,208,210,211,212,214,215,217,218,220,221,223,224,226,227,228,230,231,233,234,236,237,239,240,241,243,244,246,247,249,250,252,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}; DByte g[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 18, 20, 22, 24, 26, 28, 30, 32, 34, 35, 37, 39, 41, 43, 45, 47, 49, 51, 52, 54, 56, 58, 60, 62, 64, 66, 68, 69, 71, 73, 75, 77, 79, 81, 83, 85, 86, 88, 90, 92, 94, 96, 98,100,102,103,105,107,109,111,113,115,117,119,120,122,124,126,128,130,132,134,136,137,139,141,143,145,147,149,151,153,154,156,158,160,162,164,166,168,170,171,173,175,177,179,181,183,185,187,188,190,192,194,196,198,200,202,204,205,207,209,211,213,215,217,219,221,222,224,226,228,230,232,234,236,238,239,241,243,245,247,249,251,253,255}; DByte b[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 54, 58, 62, 66, 70, 74, 78, 82, 86, 90, 94, 98,102,105,109,113,117,121,125,129,133,137,141,145,149,153,156,160,164,168,172,176,180,184,188,192,196,200,204,207,211,215,219,223,227,231,235,239,243,247,251,255}; CT.push_back(GDLCT("RED TEMPERATURE",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 15, 22, 30, 37, 45, 52, 60, 67, 75, 82, 90, 97,105,112,120,125,130,135,140,145,150,155,160,165,170,175,180,185,190,195,200,200,201,201,202,202,203,203,204,204,205,205,206,206,207,207,208,208,209,209,210,210,211,211,212,212,213,213,214,214,215,215,216,216,217,217,218,218,219,219,220,220,221,221,222,222,223,223,224,224,225,225,226,226,227,227,228,228,229,229,230,230,231,231,232,232,233,233,234,234,235,235,236,236,237,237,238,238,239,239,240,240,241,241,242,242,243,243,244,244,245,245,246,246,247,247,248,248,249,249,250,250,251,251,252,252,253,253,254,254,255,255}; DByte g[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 6, 9, 12, 15, 18, 21, 25, 28, 31, 34, 37, 40, 43, 46, 50, 53, 56, 59, 62, 65, 68, 71, 75, 78, 81, 84, 87, 90, 93, 96,100,103,106,109,112,115,118,121,125,128,131,134,137,140,143,146,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,149,148,148,147,146,146,145,145,144,143,143,142,141,141,140,140,137,135,132,130,127,125,122,120,117,115,112,110,107,105,102,100, 93, 87, 81, 75, 68, 62, 56, 50, 43, 37, 31, 25, 18, 12, 6, 0, 2, 4, 6, 9, 11, 13, 16, 18, 20, 23, 25, 27, 29, 32, 34, 36, 39, 41, 43, 46, 48, 50, 53, 55, 57, 59, 62, 64, 66, 69, 71, 73, 76, 78, 80, 83, 85, 87, 89, 92, 94, 96, 99,101,103,106,108,110,113,115,117,119,122,124,126,129,131,133,136,138,140,142,145,147,149,152,154,156,159,161,163,166,168,170,172,175,177,179,182,184,186,189,191,193,196,198,200,202,205,207,209,212,214,216,219,221,223,226,228,230,232,235,237,239,242,244,246,249,251,253,255}; DByte b[256]={ 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, 96, 93, 90, 87, 84, 81, 78, 75, 71, 68, 65, 62, 59, 56, 53, 50, 46, 43, 40, 37, 34, 31, 28, 25, 21, 18, 15, 12, 9, 6, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; CT.push_back(GDLCT("BLUE/GREEN/RED/YELLOW",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 9, 14, 19, 23, 28, 33, 38, 42, 47, 52, 57, 61, 66, 71, 76, 81, 81, 81, 81, 81, 81, 81, 81, 80, 80, 80, 80, 80, 80, 80, 79, 84, 89, 94, 99,104,109,114,119,124,129,134,139,144,149,154,159,164,169,174,180,185,190,196,201,206,212,217,222,228,233,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,248,240,232,225,217,209,202,194,186,179,171,163,168,173,178,183,188,193,198,203,209,214,219,224,229,234,239,244,249,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}; DByte g[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 10, 16, 21, 27, 32, 37, 43, 48, 54, 59, 64, 70, 75, 81, 85, 90, 95,100,105,109,114,119,124,129,134,138,143,148,153,158,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,169,175,181,187,193,199,205,212,218,224,230,236,242,248,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}; DByte b[256]={ 0, 5, 10, 15, 20, 26, 31, 36, 41, 46, 52, 57, 62, 67, 72, 78, 83, 88, 93, 98,104,109,114,119,124,130,135,140,145,150,156,161,166,171,176,182,187,192,197,202,208,213,218,223,228,234,239,244,249,255,250,245,239,234,228,223,218,212,207,201,196,190,185,180,174,169,163,158,152,147,142,136,131,125,120,114,109,104, 98, 93, 87, 82, 76, 71, 66, 60, 55, 49, 44, 38, 33, 28, 22, 17, 11, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 9, 14, 19, 24, 28, 33, 38, 43, 48, 53, 57, 62, 67, 72, 77, 82, 77, 71, 65, 59, 53, 47, 41, 36, 30, 24, 18, 12, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 6, 9, 12, 16, 19, 22, 25, 29, 32, 35, 38, 41, 45, 48, 51, 54, 58, 61, 64, 67, 71, 74, 77, 80, 83, 87, 90, 93, 96,100,103,106,109,112,116,119,122,125,129,132,135,138,142,145,148,151,154,158,161,164,167,171,174,177,180,183,187,190,193,196,200,203,206,209,213,216,219,222,225,229,232,235,238,242,245,248,251,255}; CT.push_back(GDLCT("STD GAMMA-II",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 3, 7, 11, 15, 19, 22, 26, 30, 34, 38, 41, 45, 49, 53, 57, 60, 64, 68, 72, 76, 79, 83, 87, 91, 95, 98,102,106,110,114,117,121,125,129,133,137,140,144,148,152,156,159,163,167,171,175,178,182,186,190,194,197,201,205,209,213,216,220,224,228,232,235,239,243,247,251,255,251,247,243,239,235,230,226,222,218,214,210,205,201,197,193,189,184,180,176,172,168,164,159,155,151,147,143,138,134,130,126,122,118,113,109,105,101, 97, 92, 88, 84, 80, 76, 72, 67, 63, 59, 55, 51, 46, 42, 38, 34, 30, 26, 21, 17, 13, 9, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; DByte g[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99,103,107,111,115,119,123,127,131,135,139,143,147,151,155,159,163,167,171,175,179,183,187,191,195,199,203,207,211,215,219,223,227,231,235,239,243,247,251,255,251,247,243,239,235,231,227,223,219,215,211,207,203,199,195,191,187,183,179,175,170,166,162,158,154,150,146,142,138,134,130,126,122,118,114,110,106,102, 98, 94, 90, 85, 81, 77, 73, 69, 65, 61, 57, 53, 49, 45, 41, 37, 33, 29, 25, 21, 17, 13, 9, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; DByte b[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 7, 11, 15, 19, 23, 27, 30, 34, 38, 42, 46, 50, 54, 57, 61, 65, 69, 73, 77, 81, 85, 88, 92, 96,100,104,108,112,115,119,123,127,131,135,139,142,146,150,154,158,162,166,170,173,177,181,185,189,193,197,200,204,208,212,216,220,224,227,231,235,239,243,247,251,255,251,247,243,239,235,231,227,223,219,215,211,207,203,199,195,191,187,183,179,175,170,166,162,158,154,150,146,142,138,134,130,126,122,118,114,110,106,102, 98, 94, 90, 85, 81, 77, 73, 69, 65, 61, 57, 53, 49, 45, 41, 37, 33, 29, 25, 21, 17, 13, 9, 5, 0}; CT.push_back(GDLCT("PRISM",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 0, 3, 6, 10, 13, 17, 20, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 85, 86, 87, 88, 90, 92, 94, 96, 97, 98, 99,100,102,104,106,108,109,110,111,112,114,116,118,120,121,122,123,124,126,128,130,132,133,134,135,136,138,140,142,144,145,146,147,148,150,152,154,156,157,158,159,160,162,164,166,168,169,170,171,172,174,176,178,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,198,200,202,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,222,224,226,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,246,248,250,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,253,254}; DByte g[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 6, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 10, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 18, 19, 20, 20, 20, 20, 20, 21, 22, 23, 24, 24, 24, 24, 24, 25, 26, 27, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 61, 62, 63, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98,100,102,104,107,110,113,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,176,180,184,188,192,197,202,207,212,217,222,227,232,237,242,247,252,252,253,254}; DByte b[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 6, 7, 9, 9, 10, 11, 12, 13, 14, 15, 17, 17, 18, 18, 19, 20, 22, 23, 25, 25, 26, 26, 27, 28, 29, 30, 32, 32, 33, 33, 34, 35, 36, 37, 39, 39, 40, 40, 41, 42, 43, 44, 46, 46, 47, 48, 49, 50, 51, 52, 54, 54, 53, 53, 52, 54, 56, 58, 60, 60, 61, 62, 63, 64, 65, 66, 68, 69, 70, 71, 73, 74, 75, 76, 77, 78, 79, 80, 82, 82, 83, 83, 84, 85, 86, 87, 89, 90, 91, 92, 94, 95, 96, 97, 98, 99,100,101,103,103,104,105,106,107,108,109,110,111,112,113,115,116,117,118,119,120,121,122,124,124,125,125,126,127,129,131,133,134,136,138,140,141,143,144,146,147,149,151,153,154,156,157,159,160,161,162,164,165,166,167,169,170,172,173,175,176,177,178,180,181,183,184,186,187,188,189,191,192,193,194,196,197,199,200,202,203,204,205,207,208,209,210,212,213,214,215,217,218,219,220,221,222,223,224,226,227,228,229,230,231,232,233,235,236,237,238,239,240,241,242,243,243,244,245,246,246,247,248,249,249,250,251,252,252,253,254}; CT.push_back(GDLCT("RED-PURPLE",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 4, 6, 8, 9, 11, 12, 14, 16, 17, 19, 20, 22, 24, 25, 27, 29, 30, 32, 33, 35, 37, 38, 40, 41, 43, 45, 46, 48, 50, 51, 53, 54, 56, 58, 59, 61, 62, 64, 66, 67, 69, 71, 72, 74, 75, 77, 79, 80, 82, 83, 85, 87, 88, 90, 91, 93, 95, 96, 98,100,101,103,104,106,108,109,111,112,114,116,117,119,121,122,124,125,127,129,130,132,133,135,137,138,140,142,143,145,146,148,150,151,153,154,156,158,159,161,163,164,166,167,169,171,172,174,175,177,179,180,182,183,185,187,188,190,192,193,195,196,198,200,201,203,204,206,208,209,211,213,214,216,217,219,221,222,224,225,227,229,230,232,234,235,237,238,240,242,243,245,246,248,250,251,253,255}; DByte g[256]={ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255}; DByte b[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 6, 10, 13, 17, 20, 24, 27, 31, 34, 37, 41, 44, 48, 51, 55, 58, 62, 65, 68, 72, 75, 79, 82, 86, 89, 93, 96, 99,103,106,110,113,117,120,124,127,130,134,137,141,144,148,151,155,158,161,165,168,172,175,179,182,186,189,192,196,199,203,206,210,213,217,220,223,227,230,234,237,241,244,248,251,255}; CT.push_back(GDLCT("GREEN/WHITE LINEAR",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 15, 15, 15, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 20, 20, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 25, 25, 25, 26, 26, 26, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 31, 31, 31, 32, 32, 33, 33, 33, 34, 34, 34, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 39, 39, 39, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 47, 47, 47, 48, 48, 49, 49, 49, 50, 50, 50, 51, 51, 52, 52, 52, 54, 54, 55, 56, 56, 57, 58, 58, 59, 60, 60, 61, 62, 62, 63, 64, 64, 66, 68, 70, 71, 73, 75, 77, 79, 81, 83, 85, 86, 88, 90, 92, 94, 96, 98, 99,101,103,105,107,109,111,113,114,116,118,120,122,124,126,127,129,131,133,135,137,139,141,142,144,146,148,150,152,154,156,157,159,161,163,165,167,169,170,172,174,176,178,180,182,184,185,187,189,191,193,195,197,198,200,202,204,206,208,210,212,213,215,217,219,221,223,225,226,228,230,232,234,236,238,240,241,243,245,247,249,251,253,255}; DByte g[256]={ 0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 12, 12, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 20, 20, 21, 22, 22, 23, 24, 24, 25, 26, 26, 27, 28, 28, 29, 30, 30, 31, 32, 32, 33, 34, 34, 35, 36, 36, 37, 38, 38, 39, 40, 40, 41, 42, 42, 43, 44, 44, 45, 46, 46, 47, 48, 48, 49, 50, 50, 51, 52, 52, 53, 54, 54, 55, 56, 56, 57, 58, 58, 59, 60, 60, 61, 62, 62, 63, 64, 64, 65, 66, 66, 67, 68, 68, 69, 70, 70, 71, 72, 72, 73, 74, 74, 75, 76, 76, 77, 78, 78, 79, 80, 80, 81, 82, 82, 83, 84, 84, 85, 86, 87, 88, 90, 91, 92, 94, 95, 96, 98, 99,100,102,103,104,106,107,108,110,111,112,114,115,116,118,119,120,122,123,124,126,127,128,130,131,132,134,135,136,138,139,140,142,143,145,146,147,149,150,151,153,154,155,157,158,159,161,162,163,165,166,167,169,170,171,173,174,175,177,178,179,181,182,183,185,186,187,189,190,191,193,194,195,197,198,200,201,202,204,205,206,208,209,210,212,213,214,216,217,218,220,221,222,224,225,226,228,229,230,232,233,234,236,237,238,240,241,242,244,245,246,248,249,250,252,253,255}; DByte b[256]={ 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 25, 25, 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 34, 34, 34, 35, 35, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, 38, 38, 38, 38, 39, 39, 39, 40, 40, 40, 40, 41, 41, 41, 41, 42, 42, 42, 42, 43, 43, 43, 43, 44, 44, 44, 45, 45, 45, 45, 46, 46, 46, 46, 47, 47, 47, 47, 48, 47, 49, 52, 55, 58, 61, 64, 67, 70, 73, 76, 79, 82, 85, 88, 90, 93, 96, 99,102,105,108,111,114,117,120,123,126,129,131,134,137,140,143,146,149,152,155,158,161,164,167,170,172,175,178,181,184,187,190,193,196,199,202,205,208,211,213,216,219,222,225,228,231,234,237,240,243,246,249,252,255}; CT.push_back(GDLCT("GRN/WHT EXPONENTIAL",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 84, 88, 92, 96,101,106,111,116,121,126,131,136,141,146,151,156,159,162,165,168,171,174,177,180,183,186,189,192,195,198,201,204,207,210,213,216,219,222,225,228,231,234,237,240,243,246,249,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,253,254,255}; DByte g[256]={ 0, 0, 0, 0, 14, 28, 43, 57, 72, 81, 90, 99,108,117,126,135,144,153,162,171,180,179,178,177,176,175,174,173,172,171,170,169,168,167,166,165,164,163,162,161,160,159,158,157,156,154,152,150,148,147,146,145,144,143,142,141,140,139,138,137,136,135,134,133,132,131,130,129,128,126,124,122,120,119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100, 99, 98, 97, 96, 94, 92, 90, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 66, 64, 62, 60, 59, 58, 57, 56, 54, 52, 50, 48, 47, 46, 45, 44, 42, 40, 38, 36, 34, 32, 30, 28, 26, 24, 22, 20, 19, 18, 17, 16, 14, 12, 10, 8, 6, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96,100,104,108,112,116,120,124,128,132,136,140,144,147,150,153,156,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220,224,228,232,236,240,244,248,252,253,254,255}; DByte b[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 4, 6, 8, 10, 12, 14, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 38, 40, 42, 44, 46, 48, 50, 53, 54, 56, 58, 60, 62, 64, 66, 68, 69, 71, 73, 75, 77, 79, 81, 83, 84, 86, 88, 90, 92, 94, 96, 99,100,102,104,106,108,110,112,114,116,118,120,122,123,125,127,129,131,133,135,137,138,140,142,144,146,148,150,153,154,156,158,160,162,164,166,168,170,172,174,176,177,179,181,183,185,187,189,191,193,195,197,199,199,198,197,196,196,196,196,195,195,194,193,192,192,191,191,190,190,190,190,190,190,190,190,189,189,188,187,186,186,185,185,184,184,185,186,187,187,187,187,187,187,187,187,188,188,188,188,189,189,189,189,189,189,189,189,190,190,190,190,191,191,191,191,191,192,193,194,195,196,197,198,199,200,201,202,203,203,204,205,206,207,208,209,210,211,212,213,214,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255}; CT.push_back(GDLCT("GREEN-PINK",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 85, 89, 93, 97,101,105,109,113,117,121,125,129,133,137,141,145,149,153,157,161,165,170,174,178,182,186,190,194,198,202,206,210,214,218,222,226,230,234,238,242,246,250,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}; DByte g[256]={ 0, 1, 2, 3, 4, 8, 12, 16, 21, 25, 29, 33, 38, 42, 46, 50, 55, 59, 63, 67, 72, 76, 80, 84, 89, 93, 97,101,106,110,114,118,123,127,131,135,140,144,148,152,157,161,165,169,174,178,182,186,191,195,199,203,208,212,216,220,225,229,233,237,242,246,250,255,255,251,247,243,239,235,231,227,223,219,215,211,207,203,199,195,191,187,183,179,175,170,166,162,158,154,150,146,142,138,134,130,126,122,118,114,110,106,102, 98, 94, 90, 85, 81, 77, 73, 69, 65, 61, 57, 53, 49, 45, 41, 37, 33, 29, 25, 21, 17, 13, 9, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; DByte b[256]={ 0, 1, 2, 3, 4, 8, 12, 16, 21, 25, 29, 33, 38, 42, 46, 50, 55, 59, 63, 67, 72, 76, 80, 84, 89, 93, 97,101,106,110,114,118,123,127,131,135,140,144,148,152,157,161,165,169,174,178,182,186,191,195,199,203,208,212,216,220,225,229,233,237,242,246,250,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,251,247,243,239,235,231,227,223,218,214,210,206,202,198,194,190,186,181,177,173,169,165,161,157,153,149,144,140,136,132,128,124,120,116,112,107,103, 99, 95, 91, 87, 83, 79, 75, 70, 66, 62, 58, 54, 50, 46, 42, 38, 33, 29, 25, 21, 17, 13, 9, 5, 0, 0}; CT.push_back(GDLCT("BLUE-RED",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,220,220,220,220,220,221,221,221,221,221,222,222,222,222,222,223,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}; DByte g[256]={ 0, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}; DByte b[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,180,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,190,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}; CT.push_back(GDLCT("16 LEVEL",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 4, 9, 13, 18, 22, 27, 31, 36, 40, 45, 50, 54, 58, 61, 64, 68, 69, 72, 74, 77, 79, 80, 82, 83, 85, 84, 86, 87, 88, 86, 87, 87, 87, 85, 84, 84, 84, 83, 79, 78, 77, 76, 71, 70, 68, 66, 60, 58, 55, 53, 46, 43, 40, 36, 33, 25, 21, 16, 12, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 8, 12, 21, 25, 29, 33, 42, 46, 51, 55, 63, 67, 72, 76, 80, 89, 93, 97,101,110,114,119,123,131,135,140,144,153,157,161,165,169,178,182,187,191,199,203,208,212,221,225,229,233,242,246,250,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}; DByte g[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 8, 16, 21, 25, 29, 38, 42, 46, 51, 55, 63, 67, 72, 76, 84, 89, 93, 97,106,110,114,119,127,131,135,140,144,152,157,161,165,174,178,182,187,195,199,203,208,216,220,225,229,233,242,246,250,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,250,242,238,233,229,221,216,212,208,199,195,191,187,178,174,170,165,161,153,148,144,140,131,127,123,119,110,106,102, 97, 89, 85, 80, 76, 72, 63, 59, 55, 51, 42, 38, 34, 29, 21, 17, 12, 8, 0}; DByte b[256]={ 0, 3, 7, 10, 14, 19, 23, 28, 32, 38, 43, 48, 53, 59, 63, 68, 72, 77, 81, 86, 91, 95,100,104,109,113,118,122,127,132,136,141,145,150,154,159,163,168,173,177,182,186,191,195,200,204,209,214,218,223,227,232,236,241,245,250,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,246,242,238,233,225,220,216,212,203,199,195,191,187,178,174,170,165,157,152,148,144,135,131,127,123,114,110,106,102, 97, 89, 84, 80, 76, 67, 63, 59, 55, 46, 42, 38, 34, 25, 21, 16, 12, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; CT.push_back(GDLCT("RAINBOW",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 15, 23, 31, 39, 47, 55, 63, 70, 78, 86, 94,102,110,118,126,134,142,151,159,168,176,184,193,201,210,218,226,235,243,252, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, 18, 20, 23, 25, 27, 29, 32, 34, 36, 38, 41, 44, 47, 50, 53, 56, 59, 63, 66, 69, 72, 75, 78, 82, 85, 89, 93, 97,101,105,108,112,116,120,124,128,131,135,139,143,147,151,155,159,163,167,171,175,178,181,185,188,192,195,198,202,205,209,212,216,218,220,223,225,227,230,232,234,237,239,241,244,244,245,246,247,247,248,249,250,250,251,252,253,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}; DByte g[256]={ 0, 42, 85,127,170,212,255,246,236,226,216,206,197,187,177,167,157,148,138,128,118,108, 99, 89, 79, 69, 59, 50, 40, 30, 20, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 3, 5, 8, 10, 12, 15, 17, 19, 22, 24, 26, 29, 31, 33, 36, 36, 38, 40, 42, 45, 48, 51, 54, 58, 61, 64, 67, 70, 73, 77, 82, 87, 92, 96,100,104,108,113,119,125,131,138,144,151,157,164,171,178,185,193,200,208,215,223,229,235,242,248,255}; DByte b[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 16, 24, 32, 41, 49, 57, 65, 74, 82, 90, 98,106,115,123,131,139,148,156,164,172,180,189,197,205,213,222,230,238,246,255, 0, 5, 10, 15, 21, 26, 31, 37, 42, 47, 53, 58, 63, 69, 74, 79, 85, 89, 94, 98,103,108,112,117,121,126,131,135,140,144,149,154, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 4, 5, 7, 9, 12, 14, 17, 20, 23, 27, 30, 34, 39, 44, 49, 55, 60, 65, 71, 76, 82, 89, 97,104,112,120,128,136,145,153,162,171,180,189,198,207,217,224,232,239,247,255}; CT.push_back(GDLCT("STEPS",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 18, 36, 54, 72, 90,108,127,145,163,181,199,217,235,254,249,244,239,234,229,223,218,213,208,203,197,192,187,182,177,172,166,161,156,151,146,140,135,130,125,120,115,109,104, 99, 94, 89, 83, 78, 73, 68, 63, 58, 52, 47, 42, 37, 32, 26, 21, 16, 11, 6, 0, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255}; DByte g[256]={ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255}; DByte b[256]={ 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,129,131,133,135,137,139,141,143,145,147,149,151,153,155,157,159,161,163,165,167,169,171,173,175,177,179,181,183,185,187,189,191,193,195,197,199,201,203,205,207,209,211,213,215,217,219,221,223,225,227,229,231,233,235,237,239,241,243,245,247,249,251,253,255,251,247,243,238,234,230,226,221,217,213,209,204,200,196,192,187,183,179,175,170,166,162,158,153,149,145,141,136,132,128,124,119,115,111,107,102, 98, 94, 90, 85, 81, 77, 73, 68, 64, 60, 56, 51, 47, 43, 39, 34, 30, 26, 22, 17, 13, 9, 5, 0, 3, 7, 11, 15, 19, 22, 26, 30, 34, 38, 41, 45, 49, 53, 57, 60, 64, 68, 72, 76, 79, 83, 87, 91, 95, 98,102,106,110,114,117,121,125,129,133,137,140,144,148,152,156,159,163,167,171,175,178,182,186,190,194,197,201,205,209,213,216,220,224,228,232,235,239,243,247,251,255}; CT.push_back(GDLCT("BOW SPECIAL",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={167,167,255,254,249,247,245,243,242,240,238,236,234,232,230,228,226,224,222,220,218,216,214,212,210,208,206,204,202,200,198,196,194,192,190,188,186,184,182,180,178,176,174,172,170,168,166,164,162,160,158,156,154,152,150,148,146,144,142,141,139,137,135,133,131,129,127,125,123,121,119,117,115,113,111,109,107,105,103,101, 99, 97, 95, 93, 91, 89, 87, 85, 83, 81, 79, 77, 75, 73, 71, 69, 67, 65, 63, 61, 59, 57, 55, 53, 51, 49, 47, 45, 43, 41, 40, 38, 36, 34, 32, 30, 28, 26, 24, 22, 20, 18, 16, 14, 12, 13, 8, 6, 4, 4, 6, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99,101,103,105,107,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,211,213,215,217,219,221,223,225,227,229,231,233,235,237,239,241,243,245,247,249,251,251}; DByte g[256]={112,112,213,212,210,209,208,206,205,203,202,200,199,198,196,195,193,192,191,189,188,186,185,183,182,181,179,178,176,175,174,172,171,169,168,166,165,164,162,161,159,158,157,155,154,152,151,150,148,147,145,144,142,141,140,138,137,135,134,133,131,130,128,127,125,124,123,121,120,118,117,116,114,113,111,110,109,107,106,104,103,101,100, 99, 97, 96, 94, 93, 92, 90, 89, 87, 86, 84, 83, 82, 80, 79, 77, 76, 75, 73, 72, 70, 69, 68, 66, 65, 63, 62, 60, 59, 58, 56, 55, 53, 52, 51, 49, 48, 46, 45, 43, 42, 41, 39, 38, 36, 35, 34, 32, 31, 32, 33, 34, 36, 37, 38, 40, 41, 42, 44, 45, 46, 48, 49, 50, 52, 53, 54, 56, 57, 58, 60, 61, 62, 64, 65, 66, 68, 69, 70, 72, 73, 75, 76, 77, 79, 80, 81, 83, 84, 85, 87, 88, 89, 91, 92, 93, 95, 96, 97, 99,100,101,103,104,105,107,108,109,111,112,113,115,116,117,119,120,121,123,124,125,127,128,129,131,132,133,135,136,137,139,140,141,143,144,145,147,148,149,151,152,153,155,156,157,159,160,161,163,164,165,167,168,169,171,172,173,175,176,177,179,180,181,183,184,185,187,188,189,191,192,193,195,195}; DByte b[256]={255,255,254,251,250,249,248,247,246,245,244,243,242,241,240,239,238,237,236,235,234,233,232,231,230,229,228,227,226,225,224,223,222,221,220,219,218,217,216,215,214,213,212,211,210,209,208,207,206,205,204,203,202,201,200,199,198,197,196,195,194,193,192,191,190,189,188,187,186,185,184,183,182,181,180,179,178,177,176,175,174,173,172,171,170,169,168,167,166,165,164,163,162,161,160,159,158,157,156,155,154,153,152,151,150,149,148,147,146,145,144,143,142,141,140,139,138,137,136,135,134,133,132,131,130,129,128,127,126,125,124,123,122,121,120,119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 13, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0}; CT.push_back(GDLCT("Haze",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 33, 33, 32, 31, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 17, 16, 15, 14, 12, 11, 13, 8, 7, 5, 4, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 5, 7, 8, 13, 11, 13, 14, 15, 17, 18, 19, 20, 21, 29, 36, 42, 48, 53, 58, 61, 65, 68, 70, 72, 73, 74, 74, 74, 75, 75, 76, 76, 76, 77, 76, 77, 78, 79, 80, 81, 83, 84, 85, 86, 88, 89, 91, 92, 91, 94, 96, 98,100,102,104,106,108,109,111,112,113,115,116,117,119,120,121,123,124,125,127,128,129,131,132,133,135,136,137,138,140,141,142,144,145,146,148,149,150,152,153,154,156,157,158,160,161,162,164,165,166,168,169,170,172,173,174,175,177,178,179,181,182,183,185,186,187,189,190,191,193,193}; DByte g[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 5, 6, 8, 13, 12, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 42, 44, 46, 49, 51, 53, 56, 58, 60, 63, 65, 68, 71, 73, 76, 78, 81, 84, 87, 89, 92, 95, 98,101,104,107,110,113,116,119,122,125,128,131,134,138,141,144,148,151,154,158,161,165,168,172,175,179,182,186,190,193,197,201,205,209,212,216,220,224,228,232,234,235,236,238,239,240,241,243,244,245,246,247,249,249,246,244,241,237,232,227,223,218,214,209,205,201,196,192,188,184,180,175,171,167,163,160,156,152,148,144,141,137,133,130,126,123,119,116,116,115,113,112,110,109,104,104,103,102,101,100, 99, 98, 97, 96, 95, 94, 93, 92, 88, 88, 88, 87, 86, 85, 85, 84, 83, 82, 80, 79, 78, 76, 75, 74, 73, 71, 70, 69, 68, 67, 66, 64, 63, 61, 58, 56, 54, 52, 49, 47, 45, 43, 41, 40, 38, 36, 34, 33, 31, 29, 28, 26, 25, 23, 22, 21, 19, 18, 17, 16, 14, 13, 12, 11, 13, 9, 8, 7, 7, 6, 5, 4, 4, 3, 2, 2, 1, 1, 0, 0, 0, 0}; DByte b[256]={ 96, 96, 97, 99,100,101,102,104,105,106,107,108,110,111,112,113,115,116,117,118,119,121,122,123,124,125,127,128,129,130,132,133,134,135,136,138,139,140,141,143,144,145,146,147,149,150,151,152,154,155,156,157,158,160,161,162,163,164,166,167,168,169,171,172,173,174,175,177,178,179,180,182,183,184,185,186,188,189,190,191,193,194,195,196,197,199,200,201,202,203,205,206,207,208,210,211,212,213,214,216,217,218,219,221,222,223,224,225,227,228,229,230,232,233,232,230,229,227,225,223,222,220,218,216,214,212,210,208,149,142,135,127,118,111,103, 95, 88, 81, 74, 67, 60, 53, 47, 40, 34, 28, 22, 22, 23, 24, 25, 26, 27, 28, 28, 29, 30, 30, 31, 31, 32, 32, 29, 28, 26, 25, 23, 22, 20, 18, 17, 16, 15, 14, 13, 12, 11, 13, 9, 8, 7, 6, 5, 5, 4, 3, 3, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; CT.push_back(GDLCT("Blue - Pastel - Red",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,251,249,247,245,243,241,239,237,235,233,231,229,227,225,223,221,219,217,216,214,212,210,208,206,204,202,200,198,196,194,192,190,188,186, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 8, 13, 19, 25, 30, 36, 42, 48, 53, 59, 65, 71, 76, 82, 88, 93, 99,105,111,116,122,128,133,139,145,151,156,162,168,173,179,185,191,196,202,208,214,219,225,231,236,242,248,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}; DByte g[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,140,146,152,157,163,169,174,180,186,192,197,203,209,214,220,226,232,237,243,249,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,250,244,238,233,227,221,215,210,204,198,193,187,181,175,170,170}; DByte b[256]={ 72, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 91, 93, 95, 97, 99,101,103,105,107,109,111,113,115,117,119,121,123,125,127,129,131,133,135,137,139,141,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,191,193,195,197,199,201,203,205,207,209,211,213,215,217,219,221,223,225,227,229,231,233,235,237,239,241,242,244,246,248,250,252,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,249,243,237,232,226,220,214,209,203,197,192,186,180,174,169,163,157,152,146,140,134,129,123,117,112,106,100, 94, 89, 83, 77, 71, 66, 60, 54, 49, 43, 37, 31, 26, 20, 14, 9, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; CT.push_back(GDLCT("Pastels",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={251,251,251,251,252,252,253,252,252,251,251,250,250,249,249,249,248,248,247,247,246,246,246,245,245,244,244,243,243,243,242,242,241,241,241,240,240,240,239,239,239,238,238,237,235,230,226,222,217,213,209,205,201,197,194,190,186,183,179,176,173,169,166,163,160,157,154,151,148,145,143,140,137,135,133,130,128,126,124,122,120,118,116,114,112,111,109,109,110,111,113,114,115,116,117,118,119,121,122,123,125,125,126,127,128,129,131,132,133,135,136,137,138,139,140,140,141,142,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,171,172,174,174,175,176,177,178,179,180,181,182,183,184,185,185,186,187,188,189,190,190,191,192,193,194,195,196,197,199,200,202,203,204,206,207,208,210,211,212,213,214,215,216,217,218,219,220,220,221,222,223,224,225,226,226,227,228,228,229,230,230,231,232,232,233,233,234,235,235,235,236,236,236,237,237,237,238,238,239,239,239,240,240,240,241,242,242,242,242,243,243,244,244,244,245,245,246,246,246,247,247,248,248,249,249,250,250,251,251}; DByte g[256]={ 0, 0, 0, 1, 1, 2, 2, 4, 5, 7, 8, 7, 9, 13, 8, 15, 17, 18, 20, 21, 23, 24, 26, 27, 28, 30, 31, 33, 34, 35, 37, 38, 40, 41, 42, 44, 45, 46, 48, 49, 50, 52, 53, 55, 56, 57, 59, 60, 61, 63, 64, 65, 66, 68, 69, 70, 72, 73, 74, 76, 77, 78, 79, 81, 82, 83, 84, 85, 86, 87, 88, 90, 91, 92, 93, 95, 96, 97, 98, 99,101,102,103,104,105,107,108,110,114,118,122,125,129,132,136,139,143,146,149,152,156,158,161,164,167,170,173,175,178,181,184,186,188,191,193,195,197,199,201,203,205,207,209,211,213,215,216,218,220,221,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,223,223,223,223,223,223,223,223,223,223,223,223,223,224,224,224,224,224,224,224,224,225,225,225,225,225,225,225,226,226,226,226,226,226,227,227,227,227,227,228,228,228,228,228,229,229,229,229,229,229,230,230,230,230,231,231,232,232,232,232,232,233,233,233,234,234,234,234,235,235,235,236,236,236,236,236,237,237,237,237,238,238,238,239,239,239,240,240,241,241,242,242,242,243,243,244,244,245,245,246,246,247,247,248,248,249,249,250,250,250}; DByte b[256]={ 3, 3, 9, 15, 22, 28, 34, 41, 48, 55, 62, 66, 73, 81, 84, 94,100,106,112,118,124,130,135,141,147,152,157,162,168,173,178,183,187,192,197,201,206,210,215,219,223,227,231,235,237,237,236,236,236,235,235,235,235,234,234,234,233,233,233,232,232,232,232,231,231,231,230,230,230,230,230,229,229,229,229,228,228,228,228,228,227,227,227,227,227,226,226,226,226,226,225,225,225,225,225,225,225,224,224,224,224,224,224,224,224,224,223,223,223,223,223,223,223,223,223,223,223,223,222,222,222,222,222,222,222,222,222,222,222,222,221,220,218,217,216,214,213,212,211,210,208,207,206,206,205,204,203,202,202,201,200,200,199,198,198,197,197,197,196,197,196,196,195,195,195,195,195,195,195,195,195,195,195,196,196,197,198,199,200,201,201,202,203,204,205,205,206,207,208,209,209,210,211,212,212,213,213,214,215,216,216,217,218,218,219,220,221,221,222,223,223,224,225,226,226,227,228,228,229,230,230,231,232,232,233,233,234,235,235,236,237,237,238,238,239,240,240,241,241,242,243,243,244,244,245,246,246,247,247,248,248,249,249,250,250,250}; CT.push_back(GDLCT("Hue Sat Lightness 1",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={253,253,251,250,250,249,249,248,248,247,247,246,246,246,245,245,244,244,244,243,243,242,242,242,241,241,240,240,240,239,239,239,238,238,238,237,237,236,236,236,235,235,235,235,234,233,233,232,232,231,231,230,229,229,228,227,226,226,225,224,223,223,222,221,220,219,218,217,216,215,214,213,212,211,210,208,207,206,205,204,202,200,199,198,196,195,194,192,192,191,191,190,189,188,187,185,185,184,183,183,182,181,180,179,178,177,176,175,174,173,172,172,171,170,169,168,167,166,165,165,164,163,162,161,160,159,158,157,156,155,154,153,152,151,149,148,147,146,145,144,143,142,140,139,138,138,137,136,135,134,132,131,130,129,128,127,126,125,124,122,121,120,119,118,118,116,114,113,112,111,111,109,108,109,111,114,115,117,118,120,123,125,127,129,131,134,137,139,141,144,147,150,152,155,158,161,164,167,171,174,177,181,184,188,192,195,199,203,207,211,216,220,224,228,233,237,238,239,239,240,240,240,241,241,241,242,242,243,243,243,244,244,245,245,245,246,246,247,247,247,248,248,249,249,250,250,251,251,252,252,253,253,254,254,254,254}; DByte g[256]={252,252,250,250,249,249,248,248,247,247,246,246,245,245,244,244,243,242,242,241,241,240,239,239,238,238,237,236,236,235,235,234,233,233,232,232,231,230,230,229,228,228,227,226,226,225,224,223,223,222,221,221,220,219,218,218,217,217,216,215,214,214,213,212,211,211,209,209,208,208,206,206,205,205,204,202,202,201,201,200,199,197,197,196,196,195,195,194,194,194,194,194,194,194,195,194,195,195,195,196,196,196,197,197,198,198,199,199,200,200,201,202,203,204,204,205,206,207,208,210,211,212,213,215,216,217,219,220,222,222,222,222,222,222,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,223,224,224,224,224,224,224,224,224,224,225,225,225,225,225,225,225,226,226,226,226,226,227,227,227,227,227,227,228,228,228,228,229,229,229,229,229,230,230,230,230,231,231,231,231,232,232,232,232,233,233,233,234,234,234,234,235,235,235,236,236,236,237,237,237,238,238,235,231,227,223,218,214,210,205,201,196,191,187,182,177,172,167,162,157,151,146,140,135,129,123,117,111,106, 99, 93, 85, 78, 74, 67, 61, 54, 47, 40, 33, 27, 27}; DByte b[256]={252,252,250,250,249,249,248,248,247,247,246,246,245,245,244,244,243,243,243,242,242,241,241,241,240,240,239,239,239,238,238,238,237,237,237,237,236,236,236,236,235,235,235,235,234,234,234,234,233,233,233,232,232,232,232,231,231,231,230,230,230,230,229,229,229,229,229,228,228,228,228,227,227,227,227,227,226,226,226,226,226,226,225,226,225,225,225,225,224,225,224,224,224,224,224,224,224,224,224,223,223,223,223,223,223,223,223,223,223,223,223,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,222,220,218,217,215,213,211,210,208,206,204,202,200,197,195,193,191,188,186,183,181,178,176,173,170,168,165,162,159,156,153,150,146,143,140,137,133,129,126,122,118,116,112,107,106,105,105,104,102,100, 99, 99, 97, 96, 94, 93, 93, 91, 90, 88, 88, 86, 85, 83, 83, 81, 80, 78, 78, 76, 75, 73, 72, 71, 70, 69, 67, 66, 65, 63, 62, 62, 59, 58, 58, 55, 54, 54, 51, 50, 49, 47, 46, 45, 43, 42, 41, 39, 38, 36, 35, 34, 32, 31, 30, 28, 27, 25, 24, 23, 22, 20, 18, 17, 15, 14, 13, 8, 13, 8, 7, 5, 4, 2, 1, 0, 0}; CT.push_back(GDLCT("Hue Sat Lightness 2",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,252,247,242,237,233,228,223,219,214,210,205,201,196,192,188,184,179,175,171,167,163,159,155,151,147,144,140,136,133,129,125,122,118,115,112,108,105,102, 99, 95, 92, 89, 86, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,172,175,177,180,183,186,188,191,194,196,199,201,203,206,208,210,213,215,217,219,221,223,225,227,229,230,232,234,236,237,239,240,242,243,245,246,247,248,250,251,252,253,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}; DByte g[256]={ 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 13, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 87, 92, 97,102,107,111,116,121,125,130,134,139,143,147,152,156,160,164,168,172,176,180,184,188,192,196,199,203,207,210,214,217,221,224,228,231,234,238,241,244,247,250,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,253,252,251,251,250,249,249,248,247,247,246,246,246,245,245,245,245,244,244,244,244,244,244,245,245,245,245,246,246,246,247,247,248,249,249,250,251,251,251}; DByte b[256]={ 3, 3, 13, 17, 23, 30, 37, 44, 50, 57, 63, 70, 76, 82, 89, 95,101,107,114,120,126,132,138,144,149,155,161,167,172,178,184,189,195,200,205,211,216,221,227,232,237,242,247,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,250,247,244,242,239,236,234,231,229,226,224,221,219,217,214,212,210,208,206,204,202,200,198,196,194,192,191,189,187,186,184,183,181,180,179,177,176,175,174,173,172,171,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,251}; CT.push_back(GDLCT("Hue Sat Value 1",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,253,252,251,249,248,247,246,244,243,241,240,238,237,235,233,231,230,228,226,224,222,220,218,216,213,211,209,207,204,202,199,197,194,192,189,187,184,181,178,175,172,170,168,167,166,165,164,163,162,161,160,159,158,157,156,155,154,153,152,151,150,149,148,147,146,145,144,143,142,141,140,139,138,137,136,135,134,133,132,131,130,129,128,127,126,125,124,123,122,121,120,119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100, 99, 98, 97, 96, 95, 94, 93, 92, 91, 90, 89, 88, 87, 86, 85, 85, 84, 84, 88, 91, 94, 97,100,103,107,110,114,117,121,124,128,131,135,139,143,146,150,154,158,162,166,170,174,179,183,187,191,196,200,205,209,214,218,223,228,233,237,242,247,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}; DByte g[256]={253,253,252,251,250,249,248,247,246,245,244,243,242,241,240,239,238,237,236,235,234,233,232,231,230,229,228,227,226,225,224,223,222,221,220,219,218,217,216,215,214,213,212,211,210,209,208,207,206,205,204,203,202,201,200,199,198,197,196,195,194,193,192,191,190,189,188,187,186,185,184,183,182,181,180,179,178,177,176,175,174,173,172,171,170,169,169,169,170,171,172,173,174,176,177,178,180,181,183,184,186,188,189,191,193,195,197,199,201,203,205,207,209,211,214,216,218,221,223,226,228,231,233,236,239,241,244,247,250,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,252,247,242,237,232,226,221,216,211,205,200,194,189,183,178,172,166,160,155,149,143,137,131,125,119,113,107,100, 94, 88, 81, 75, 69, 62, 56, 49, 42, 36, 29, 29}; DByte b[256]={253,253,252,251,250,249,248,248,247,247,246,246,245,245,244,244,244,244,243,243,243,243,243,243,243,243,244,244,244,244,245,245,246,246,247,247,248,249,250,250,251,252,253,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,253,250,247,244,241,237,234,231,227,224,220,217,213,210,206,203,199,195,191,187,183,179,175,171,167,163,159,155,150,146,142,137,133,128,124,119,114,110,105,100, 95, 90, 86, 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 13, 9, 8, 7, 6, 5, 4, 3, 2, 2}; CT.push_back(GDLCT("Hue Sat Value 2",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 0,127,191,188,186,184,182,179,177,140,138,170,168,165,163,161,158,156,154,121,119,147,145,142,140,138,135,133,131,103,101,124,122,119,117,115,112,110,108, 84, 82,101, 99, 96, 94, 92, 89, 87, 85, 66, 64, 78, 76, 73, 71, 69, 66, 64, 62, 47, 46, 55, 52, 50, 48, 46, 43, 41, 39, 29, 27, 32, 29, 27, 25, 23, 20, 18, 16, 11, 9, 9, 6, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 12, 18, 24, 30, 36, 42, 48, 54, 48, 53, 72, 78, 85, 91, 97,103,109,115, 97,102,133,139,145,151,157,163,170,176,145,150,194,200,206,212,218,224,230,236,194,199,255,255,255,255,255,255,255,255,204,204,255,255,255,255,255,255,255,255,204,204,255,255,255,255,255,255,255,255,204,204,255,255,255,255,255,255,255,255,204,204,255,255,255,255}; DByte g[256]={ 0, 0,127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 12, 18, 19, 24, 36, 42, 48, 54, 60, 66, 72, 78, 68, 72, 97,103,109,115,121,127,133,139,116,121,157,163,170,176,182,188,194,200,165,170,218,224,230,236,242,248,255,255,204,204,255,255,255,255,255,255,255,255,204,204,255,255,255,255,255,255,255,255,204,204,255,255,255,255,255,255,255,255,204,204,255,255,255,255,255,255,255,255,204,204,255,255,255,255,255,255,255,255,204,204,255,255,255,255,255,255,255,255,204,204,255,255,255,255,255,255,255,255,204,204,255,255,255,255,255,255,255,255,204,204,255,248,242,235,229,223,216,210,163,158,191,184,178,172,165,159,153,146,112,107,127,121,115,110,104, 98, 92, 86, 64, 60, 69, 63, 57, 52, 46, 40, 34, 28, 18, 13, 11, 5, 0, 0}; DByte b[256]={ 0, 0,127,191,192,192,193,194,195,195,157,157,198,198,199,200,201,202,202,203,163,164,205,206,207,208,208,209,210,211,169,170,213,214,215,215,216,217,218,218,175,176,221,221,222,223,224,225,225,226,181,182,228,229,230,231,231,232,233,234,188,188,236,237,238,238,239,240,241,241,194,194,244,245,245,246,247,248,248,249,200,200,251,252,253,254,255,255,255,255,204,204,255,255,255,255,255,255,255,255,204,204,255,255,255,255,255,255,255,255,204,204,255,255,255,255,255,255,255,255,204,204,255,255,255,255,255,255,255,248,194,189,230,224,218,212,206,200,194,188,145,140,169,163,157,151,145,139,133,127, 97, 92,109,103, 97, 91, 84, 78, 72, 66, 48, 43, 48, 42, 36, 30, 24, 18, 12, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 5, 7, 10, 12, 15, 17, 16, 18, 25, 28, 30, 33, 35, 38, 40, 43, 36, 38, 51, 48, 46, 44, 41, 39, 37, 34, 25, 24, 27, 25, 23, 20, 18, 16, 13, 11, 7, 5, 4, 2, 0, 0}; CT.push_back(GDLCT("Purple-Red + Stripes",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 8, 12, 17, 21, 25, 29, 34, 38, 42, 46, 51, 55, 59, 64, 68, 72, 76, 81, 85, 89, 93, 98,102,106,110,115,119,123,128,132,136,140, 76, 76, 76, 81, 85, 89, 93, 98,102,106,110,115,119,123,128,132,136,140,145,149,153,157,157,161,164,167,170,173,177,180,183,186,189,193,196,199,202,205,209,212,215,218,218,219,220,222,223,224,225,226,227,229,230,231,232,233,234,236,237,238,239,240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; DByte g[256]={251,251,249,247,245,243,241,238,236,234,232,230,228,226,224,221,219,217,215,213,211,209,206,204,202,200,198,196,194,192,189,187,185,183,181,179,177,174,172,170,168,166,164,162,160,157,155,153,151,149,147,145,142,140,138,136,134,132,130,128,128,129,131,133,134,136,138,139,141,143,145,146,148,150,151,153,155,157,158,160,162,163,165,167,168,170,172,174,175,177,179,180,182,182,177,171,165,160,154,149,143,138,132,126,121,115,110,104, 99, 93, 88, 82, 76, 71, 65, 60, 54, 49, 43, 37, 32, 26, 21, 15, 13, 4, 0, 0, 0, 4, 8, 12, 17, 21, 25, 29, 34, 38, 42, 46, 51, 55, 59, 64, 68, 72, 76, 81, 81, 85, 89, 93, 98,102,106,110,115,119,123,128,132,136,140,145,149,153,157,162,162,166,170,174,179,183,187,192,196,200,204,209,213,217,221,226,230,234,238,243, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; DByte b[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 8, 12, 17, 21, 25, 29, 34, 38, 42, 46, 51, 55, 59, 64, 68, 72, 76, 81, 85, 89, 93, 98,102,106,110,115,119,123,128,132,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136, 76, 76, 76, 72, 68, 64, 60, 56, 52, 48, 44, 40, 36, 32, 28, 23, 19, 15, 11, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 8, 12, 17, 21, 25, 29, 34, 38, 42, 46, 51, 55, 59, 64, 68, 72, 76, 81, 81, 84, 88, 91, 95, 98,102,105,109,113,116,120,123,127,130,134,137,141,145,148,152,155,159,159,162,166,170,173,177,181,184,188,192,195,199,203,206,210,214,217,221,225,228,232,236,239, 0, 0, 0}; CT.push_back(GDLCT("Beach",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={124,124,120,115,111,106,102, 97, 93, 88, 84, 79, 75, 70, 66, 61, 57, 52, 48, 43, 39, 34, 30, 25, 21, 16, 12, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 5, 13, 14, 19, 23, 28, 32, 37, 41, 46, 50, 55, 59, 64, 68, 73, 77, 82, 86, 91, 95,100,104,109,113,118,123,126,132,135,141,144,150,153,159,162,168,171,177,180,186,189,195,198,204,207,213,216,222,225,231,234,240,243,249,252,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,255,255}; DByte g[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 11, 15, 20, 24, 29, 33, 38, 42, 47, 51, 56, 60, 65, 69, 74, 78, 83, 87, 92, 96,101,105,110,114,119,122,128,131,137,140,146,149,155,158,164,167,173,176,182,185,191,194,200,203,209,212,218,221,227,230,236,240,245,249,254,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,252,247,243,238,234,229,225,220,216,211,207,202,198,193,189,184,180,175,171,166,162,157,153,148,144,139,135,131,126,122,117,113,108,104, 99, 95, 90, 86, 81, 77, 72, 68, 63, 59, 54, 50, 45, 41, 36, 32, 27, 23, 18, 14, 9, 5, 5}; DByte b[256]={255,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,254,255,250,247,241,238,232,229,223,220,214,211,205,202,196,193,187,184,178,175,169,166,160,157,151,148,142,139,133,130,125,121,116,112,107,103, 98, 94, 89, 85, 80, 76, 71, 67, 62, 58, 53, 49, 44, 40, 35, 31, 26, 22, 17, 13, 8, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; CT.push_back(GDLCT("Mac Style",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 0,127,123,119,114,110,106,102, 97, 84, 80, 76, 80, 76, 72, 67, 63, 59, 55, 45, 42, 38, 38, 33, 29, 25, 21, 16, 12, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 17, 25, 34, 42, 51, 59, 61, 68, 76, 93,102,110,119,127,136,144,137,145,153,178,187,195,204,212,221,229,214,221,229,255,255,255,255,255,255,255,229,229,229,255,255,255,255,255,255,255,229,229,229,255,255,255,255,255,255,255,229,229,229,255,255,255,255,255,255,255,229,229,229,255,255,255,255,255,255,255,229,229,229,255,255,255,255,255,255,255,229,229,229,255,255,255,255,255,255,255,229,229,229,255,255,255,255,255,255,255,229,229,229,255,255,255,255,255,255,255,229,229,229,253,251,249,248,246,244,242,217,215,213,236,234,232,230,229,227,225,201,200,198,218,217,215,213,211,210,208,186,184,182,201,199,198,196,194,192,191,170,169,167,184,182,180,179,177,175,174,155,153,151,167,165,163,161,160,158,156,139,138,136,149,148,146,144,143,141,139,124,122,120,132,130,130}; DByte g[256]={ 0, 0,127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 34, 51, 68, 85,102,119,122,137,153,187,204,221,238,255,255,255,229,229,229,255,255,255,255,255,255,255,229,229,229,255,255,255,255,255,255,255,229,229,229,255,255,255,255,255,255,255,229,229,229,255,255,255,255,255,255,255,229,229,229,250,246,242,238,233,229,225,198,195,191,208,204,199,195,191,187,182,160,156,152,165,161,157,153,148,144,140,122,118,114,125,123,121,119,116,114,112, 99, 97, 95,104,102, 99, 97, 95, 93, 91, 80, 78, 76, 82, 80, 78, 76, 74, 72, 70, 61, 59, 57, 61, 59, 57, 55, 53, 50, 48, 42, 40, 38, 40, 38, 36, 33, 31, 29, 27, 22, 21, 19, 19, 16, 14, 12, 13, 8, 6, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; DByte b[256]={ 0, 0,127,193,195,197,199,201,204,206,187,189,191,214,216,218,221,223,225,227,206,208,210,235,238,240,242,244,246,248,225,227,229,255,255,255,255,255,255,255,229,229,229,255,255,255,255,255,238,221,183,168,152,153,135,118,101, 84, 67, 50, 30, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; CT.push_back(GDLCT("Eos A",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={255,255,127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 18, 27, 36, 45, 49, 57, 72, 81, 91,100,109,118,127,136,131,139,163,173,182,191,200,209,218,227,213,221,255,255,255,255,255,255,255,255,229,229,255,255,255,255,255,255,255,255,229,229,255,255,255,255,255,255,255,255,229,229,255,255,255,255,255,255,255,255,229,229,255,255,255,255,255,255,255,255,229,229,255,255,255,255,255,255,255,255,229,229,255,255,255,255,255,255,255,255,229,229,255,255,255,255,255,255,255,255,229,229,255,255,255,255,255,255,255,255,229,229,255,253,251,249,247,245,243,241,215,214,235,234,232,230,228,226,224,222,198,196,216,215,213,211,209,207,205,203,181,179,197,196,194,192,190,188,186,184,164,162,178,176,175,173,171,169,167,165,147,145,159,157,156,154,152,150,148,146,130,128,140,138,137,135,133,131,129,127,113,111,121,119,117,117}; DByte g[256]={255,255,127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 15, 23, 31, 39, 47, 55, 57, 64, 79, 87, 95,103,111,119,127,135,129,136,159,167,175,183,191,199,207,215,200,207,239,247,255,255,255,255,255,255,229,229,255,255,255,255,255,255,255,255,229,229,255,255,255,255,255,255,255,255,229,229,255,250,246,242,238,233,229,225,198,195,212,208,204,199,195,191,187,182,160,156,169,165,161,157,153,148,144,140,122,118,127,125,123,121,119,116,114,112, 99, 97,106,104,102, 99, 97, 95, 93, 91, 80, 78, 84, 82, 80, 78, 76, 74, 72, 70, 61, 59, 63, 61, 59, 57, 55, 53, 50, 48, 42, 40, 42, 40, 38, 36, 33, 31, 29, 27, 22, 21, 21, 19, 16, 14, 12, 13, 8, 6, 3, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; DByte b[256]={255,255,127,131,136,140,144,148,153,157,145,149,170,174,178,182,187,191,195,199,183,187,212,216,221,225,229,233,238,242,221,225,255,247,239,231,223,215,207,199,172,164,175,167,159,151,143,135,127,119,100, 93, 95, 87, 79, 71, 63, 55, 47, 39, 28, 21, 15, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; CT.push_back(GDLCT("Eos B",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 4, 4, 5, 7, 9, 11, 12, 14, 15, 16, 17, 17, 18, 18, 18, 17, 16, 15, 14, 13, 11, 13, 8, 5, 3, 1, 0, 3, 5, 7, 13, 12, 13, 15, 17, 18, 19, 19, 19, 19, 19, 18, 16, 14, 12, 9, 5, 2, 2, 6, 11, 17, 23, 29, 36, 42, 49, 56, 64, 71, 78, 85, 93,100,106,113,119,125,130,135,139,143,146,149,150,151,152,151,150,148,145,142,138,133,127,121,114,107, 99, 90, 82, 73, 63, 54, 44, 35, 25, 16, 6, 1, 13, 18, 25, 32, 38, 44, 48, 52, 55, 56, 57, 57, 56, 53, 50, 45, 39, 33, 25, 16, 6, 3, 15, 27, 40, 53, 67, 81, 96,111,126,141,156,170,185,199,212,225,237,248,252,242,234,227,222,217,214,212,212,213,216,220,225,232,240,249,251,239,226,213,198,183,167,150,133,116, 98, 81, 64, 47, 30, 14, 1, 15, 29, 42, 54, 64, 73, 81, 87, 91, 94, 95, 95, 92, 88, 82, 75, 66, 55, 42, 28, 13, 3, 21, 40, 60, 81,103,125,147,170,193,216,239,249,228,207,187,168,151,134,119,106, 95, 85, 77, 71, 67, 65, 66, 68, 72, 79, 87, 98,110,124,140,158,177,197,219,241,245,221,196,171,145,120, 95, 70, 46, 23, 1, 19, 39, 57, 74, 89,102,112,121,127,127}; DByte g[256]={ 51, 51, 58, 65, 72, 79, 85, 92, 99,105,111,117,124,129,135,141,146,152,157,162,167,171,176,180,184,188,191,195,198,201,203,206,208,210,212,213,214,215,216,216,216,216,216,215,215,213,212,210,209,206,204,201,199,195,192,189,185,181,177,172,168,163,158,153,148,142,137,131,125,119,113,106,100, 93, 87, 80, 73, 67, 60, 53, 46, 39, 32, 25, 18, 11, 4, 2, 9, 16, 22, 29, 36, 42, 49, 55, 61, 68, 74, 79, 85, 91, 96,101,106,111,116,120,125,129,133,136,140,143,146,149,151,153,155,157,159,160,161,162,162,162,162,162,162,161,160,159,157,155,153,151,148,146,143,139,136,132,128,124,120,115,111,106,101, 95, 90, 84, 79, 73, 67, 61, 54, 48, 42, 35, 28, 22, 15, 8, 1, 5, 12, 19, 26, 33, 40, 47, 54, 61, 67, 74, 81, 88, 94,101,107,113,120,126,131,137,143,148,154,159,164,168,173,177,181,185,189,193,196,199,202,204,207,209,211,212,214,215,216,216,216,216,216,216,215,214,213,212,210,208,206,203,201,198,194,191,187,184,180,175,171,166,161,156,151,146,140,135,129,123,117,111,104, 98, 91, 85, 78, 71, 64, 57, 50, 44, 37, 30, 23, 23}; DByte b[256]={116,116,105, 94, 84, 74, 64, 55, 46, 38, 30, 24, 18, 12, 8, 5, 2, 0, 0, 0, 1, 3, 6, 13, 14, 20, 26, 33, 41, 50, 59, 68, 78, 88, 99,109,120,131,142,153,163,174,184,193,202,211,218,226,232,238,243,247,250,252,253,253,253,251,249,246,241,236,230,224,216,208,200,190,181,171,160,150,139,128,117,106, 96, 85, 75, 65, 56, 47, 39, 31, 24, 18, 13, 9, 5, 2, 0, 0, 0, 1, 3, 5, 9, 14, 19, 25, 32, 40, 48, 57, 67, 76, 87, 97,108,119,130,140,151,162,172,182,192,201,209,217,225,231,237,242,246,249,252,253,254,253,252,249,246,242,237,231,225,217,209,201,192,182,172,162,151,140,130,119,108, 97, 87, 76, 67, 57, 48, 40, 32, 25, 19, 14, 9, 5, 3, 1, 0, 0, 0, 2, 5, 9, 13, 18, 24, 31, 39, 47, 56, 65, 75, 85, 96,106,117,128,139,150,160,171,181,190,200,208,216,224,230,236,241,246,249,251,253,253,253,252,250,247,243,238,232,226,218,211,202,193,184,174,163,153,142,131,120,109, 99, 88, 78, 68, 59, 50, 41, 33, 26, 20, 14, 13, 6, 3, 1, 0, 0, 0, 2, 5, 8, 12, 18, 24, 30, 38, 46, 55, 64, 74, 84, 94,105,105}; CT.push_back(GDLCT("Hardcandy",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={105,105,105,105,105,105,105,105,105,110,114,123,127,131,135,143,147,150,157,160,163,165,170,172,174,176,179,180,180,181,182,181,181,180,179,177,174,172,170,168,163,160,157,154,147,143,139,131,127,123,119,110,105,100, 96, 87, 82, 77, 68, 63, 59, 54, 46, 42, 38, 30, 26, 23, 19, 13, 13, 8, 5, 1, 0, 2, 5, 6, 6, 7, 8, 7, 7, 6, 5, 3, 2, 1, 3, 5, 8, 13, 16, 19, 26, 30, 34, 38, 46, 50, 54, 59, 68, 73, 77, 86, 91, 96,100,110,114,119,127,131,135,139,147,150,154,157,163,165,168,172,174,176,177,180,180,181,182,181,181,180,179,177,176,174,170,168,165,160,157,154,150,143,139,135,127,123,119,114,105,100, 96, 91, 82, 77, 73, 63, 59, 54, 50, 42, 38, 34, 30, 23, 19, 16, 13, 8, 5, 3, 0, 2, 3, 6, 6, 7, 7, 7, 7, 6, 6, 3, 2, 0, 3, 5, 8, 13, 16, 19, 23, 30, 34, 38, 42, 50, 54, 59, 63, 73, 77, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 82, 0,255,255}; DByte g[256]={246,246,246,246,246,246,246,246,246,251,253,244,239,235,231,224,222,219,216,214,214,213,214,215,216,218,223,226,229,237,241,246,251,248,243,237,225,218,212,205,192,186,179,173,160,154,148,137,132,127,122,113,109,105,102, 96, 94, 92, 89, 88, 88, 88, 88, 89, 90, 93, 95, 97, 99,104,107,110,113,120,124,127,134,138,141,145,152,155,158,164,166,169,171,175,176,178,179,180,180,180,180,179,178,176,173,171,169,166,161,158,154,148,144,140,136,128,124,120,112,108,104,100, 92, 88, 85, 81, 74, 71, 68, 62, 60, 57, 55, 51, 50, 48, 46, 45, 44, 44, 43, 43, 43, 44, 44, 45, 46, 47, 48, 49, 51, 53, 54, 55, 57, 59, 60, 61, 63, 64, 64, 65, 66, 67, 67, 67, 67, 67, 67, 66, 66, 65, 64, 62, 61, 60, 58, 56, 55, 53, 50, 48, 46, 43, 41, 39, 37, 34, 32, 30, 28, 25, 23, 22, 19, 17, 16, 15, 12, 11, 13, 8, 7, 6, 6, 4, 4, 3, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255}; DByte b[256]={234,234,234,234,234,234,234,234,234,222,210,186,175,164,153,132,122,113, 95, 87, 79, 72, 59, 54, 49, 44, 37, 34, 32, 30, 29, 30, 31, 34, 37, 40, 49, 54, 59, 66, 79, 87, 95,104,122,132,142,164,175,186,198,222,234,246,251,227,214,202,177,165,153,141,118,107, 96, 75, 65, 56, 47, 30, 22, 15, 9, 2, 7, 12, 19, 22, 24, 25, 27, 26, 25, 22, 19, 16, 12, 2, 2, 9, 15, 30, 38, 47, 65, 75, 85, 96,118,129,141,153,177,189,202,226,239,251,246,222,210,198,175,164,153,142,122,113,104, 95, 79, 72, 66, 54, 49, 44, 40, 34, 32, 31, 29, 30, 31, 32, 37, 40, 44, 49, 59, 66, 72, 87, 95,104,113,132,142,153,175,186,198,210,234,246,251,239,214,202,189,165,153,141,129,107, 96, 85, 75, 56, 47, 38, 22, 15, 9, 2, 7, 12, 16, 22, 24, 25, 26, 26, 25, 24, 22, 16, 12, 7, 2, 9, 15, 22, 38, 47, 56, 75, 85, 96,107,129,141,153,165,189,202,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214, 0,255,255}; CT.push_back(GDLCT("Nature",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 54, 54, 59, 63, 68, 73, 77, 82, 82, 87, 91, 96,100,105,110,114,119,123,127,131,135,139,143,143,147,150,154,157,160,163,165,168,170,172,174,176,177,177,179,180,180,181,181,182,181,181,180,180,179,177,176,174,174,172,170,168,165,163,160,157,154,150,147,143,139,135,131,131,127,123,119,114,110,105,100, 96, 91, 86, 82, 77, 73, 68, 68, 63, 59, 54, 50, 46, 42, 38, 34, 30, 26, 23, 19, 16, 13, 13, 13, 8, 5, 3, 1, 0, 2, 3, 5, 6, 6, 7, 7, 8, 8, 7, 7, 6, 6, 5, 3, 2, 0, 1, 3, 5, 8, 13, 13, 13, 16, 19, 23, 26, 30, 34, 38, 42, 46, 50, 54, 59, 63, 68, 68, 73, 77, 82, 87, 91, 96,100,105,110,114,119,123,127,131,131,135,139,143,147,150,154,157,160,163,165,168,170,172,172,174,176,177,179,180,180,181,181,182,181,181,180,180,179,179,177,176,174,172,170,168,165,163,160,157,154,150,147,143,143,139,135,131,127,123,119,114,110,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105, 0,255,255}; DByte g[256]={ 67, 67, 67, 67, 67, 67, 67, 66, 66, 66, 65, 64, 64, 63, 62, 61, 60, 59, 57, 56, 55, 54, 53, 53, 52, 51, 49, 48, 47, 47, 46, 45, 44, 44, 44, 43, 43, 43, 43, 43, 44, 44, 45, 46, 47, 48, 50, 51, 53, 55, 57, 60, 60, 62, 65, 68, 71, 74, 78, 81, 85, 88, 92, 96,100,104,108,108,112,116,120,124,128,132,136,140,144,148,151,154,158,161,161,164,166,169,171,173,175,176,178,179,180,180,180,180,180,180,179,179,178,176,175,173,171,169,166,164,161,158,155,152,152,148,145,141,138,134,131,127,124,120,117,113,110,107,104,104,101, 99, 97, 95, 93, 91, 90, 89, 88, 88, 88, 88, 88, 89, 89, 91, 92, 94, 96, 99,102,105,109,113,117,122,127,132,137,137,142,148,154,160,166,173,179,186,192,199,205,212,218,218,225,231,237,243,248,254,251,246,241,237,233,229,226,223,223,220,218,216,215,214,213,213,214,214,216,217,219,222,224,224,228,231,235,239,244,248,253,251,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246,246, 0,255,255}; DByte b[256]={141,141,153,165,177,189,202,214,214,227,239,251,246,234,222,210,198,186,175,164,153,142,132,132,122,113,104, 95, 87, 79, 72, 66, 59, 54, 49, 44, 40, 40, 37, 34, 32, 31, 30, 29, 30, 31, 32, 34, 37, 40, 44, 49, 49, 54, 59, 66, 72, 79, 87, 95,104,113,122,132,142,153,164,164,175,186,198,210,222,234,246,251,239,226,214,202,189,177,177,165,153,141,129,118,107, 96, 85, 75, 65, 56, 47, 38, 30, 30, 22, 15, 9, 2, 2, 7, 12, 16, 19, 22, 24, 25, 26, 27, 27, 26, 25, 24, 22, 19, 16, 12, 7, 2, 2, 9, 15, 22, 30, 30, 38, 47, 56, 65, 75, 85, 96,107,118,129,141,153,165,177,177,189,202,214,227,239,251,246,234,222,210,198,186,175,164,164,153,142,132,122,113,104, 95, 87, 79, 72, 66, 59, 54, 54, 49, 44, 40, 37, 34, 32, 31, 30, 29, 30, 31, 32, 34, 37, 37, 40, 44, 49, 54, 59, 66, 72, 79, 87, 95,104,113,122,132,132,142,153,164,175,186,198,210,222,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234, 0,255,255}; CT.push_back(GDLCT("Ocean",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 0, 0, 0, 80, 80, 80, 80,160,160,160,160,240,240,240,240, 0, 0, 0, 0, 80, 80, 80, 80,160,160,160,160,240,240,240,240, 0, 0, 0, 0, 80, 80, 80, 80,160,160,160,160,240,240,240,240, 0, 0, 0, 0, 80, 80, 80, 80,160,160,160,160,240,240,240,240, 0, 0, 0, 0, 80, 80, 80, 80,160,160,160,160,240,240,240,240, 0, 0, 0, 0, 80, 80, 80, 80,160,160,160,160,240,240,240,240, 0, 0, 0, 0, 80, 80, 80, 80,160,160,160,160,240,240,240,240, 0, 0, 0, 0, 80, 80, 80, 80,160,160,160,160,240,240,240,240, 0, 0, 0, 0, 80, 80, 80, 80,160,160,160,160,240,240,240,240, 0, 0, 0, 0, 80, 80, 80, 80,160,160,160,160,240,240,240,240, 0, 0, 0, 0, 80, 80, 80, 80,160,160,160,160,240,240,240,240, 0, 0, 0, 0, 80, 80, 80, 80,160,160,160,160,240,240,240,240, 0, 0, 0, 0, 80, 80, 81, 80,160,160,160,160,240,240,240,240, 0, 0, 0, 0, 80, 80, 80, 80,160,160,160,160,240,240,240,240, 0, 0, 0, 0, 80, 80, 80, 80,160,160,160,160,240,240,240,240, 0, 0, 0, 0, 80, 80, 80, 80,160,160,160,160,240,240,240,240}; DByte g[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,192,192,192,192,192,192,193,192,192,192,192,192,192,192,192,192,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,208,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240,240}; DByte b[256]={ 80, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,240, 0, 80,160,160}; CT.push_back(GDLCT("Peppermint",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 2, 2, 3, 4, 5, 6, 7, 8, 9, 13, 11, 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 39, 40, 41, 42, 43, 44, 45, 46, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 65, 66, 67, 68, 70, 71, 72, 74, 75, 77, 78, 79, 81, 82, 84, 85, 86, 88, 89, 90, 92, 93, 94, 95, 97, 98, 99,100,101,102,103,103,104,105,106,107,107,108,108,109,110,110,111,111,112,113,113,114,114,115,116,117,117,118,119,120,121,122,123,124,125,127,128,129,131,132,134,135,137,138,140,142,143,145,147,149,150,152,154,155,157,158,160,161,163,164,166,167,168,169,170,171,172,173,174,174,175,175,176,176,177,177,178,178,178,178,179,179,179,180,180,180,181,181,182,182,183,184,184,185,186,187,188,190,191,192,194,195,197,198,200,202,204,206,208,210,212,214,216,218,220,222,224,225,227,229,231,232,234,236,237,238,239,241,242,242,243,244,245,245,246,246,246,246,246,247,247,247,247,247,247,247,247,247,247,247,247,247,248,248,248,249,250,251,251,252,254,255,254,252,251,249,247,247}; DByte g[256]={ 19, 19, 20, 22, 25, 29, 33, 38, 44, 51, 58, 65, 73, 81, 89, 98,106,115,124,132,140,148,155,162,169,175,180,184,188,191,193,194,195,194,193,191,188,184,180,175,169,162,155,148,140,132,124,115,107, 98, 89, 81, 73, 65, 58, 51, 44, 38, 33, 29, 25, 22, 20, 19, 19, 19, 20, 22, 25, 29, 33, 38, 44, 51, 58, 65, 73, 81, 89, 98,107,115,124,132,140,148,155,162,169,175,180,184,188,191,193,194,195,194,193,191,188,184,180,175,169,162,155,148,140,132,124,115,106, 98, 89, 81, 73, 65, 58, 51, 44, 38, 33, 29, 25, 22, 20, 19, 19, 19, 20, 22, 25, 29, 33, 38, 44, 51, 58, 65, 73, 81, 89, 98,107,115,124,132,140,148,155,162,169,175,180,184,188,191,193,194,195,194,193,191,188,184,180,175,169,162,155,148,140,132,124,115,106, 98, 89, 81, 73, 65, 58, 51, 44, 38, 33, 29, 25, 22, 20, 19, 19, 19, 20, 22, 25, 29, 33, 38, 44, 51, 58, 65, 73, 81, 89, 98,107,115,124,132,140,148,155,162,169,175,180,184,188,191,193,194,195,194,193,191,188,184,180,175,169,162,155,148,140,132,124,115,106, 98, 89, 81, 73, 65, 58, 51, 44, 38, 33, 29, 25, 22, 20, 20}; DByte b[256]={ 7, 7, 11, 15, 19, 22, 26, 30, 34, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 78, 82, 86, 90, 93, 97,100,103,107,110,113,116,119,122,125,128,130,133,136,139,141,144,147,150,153,156,159,162,165,169,172,176,180,184,188,192,196,201,205,210,215,220,225,230,235,241,246,251,253,248,243,237,232,227,222,217,212,207,202,198,194,190,186,182,179,176,172,170,167,165,162,160,158,157,155,154,152,151,150,148,147,146,144,143,141,140,138,136,134,132,129,126,123,120,116,113,108,104, 99, 94, 89, 83, 78, 72, 65, 59, 53, 46, 39, 32, 25, 18, 11, 5,253,246,239,233,227,221,215,210,205,200,195,191,188,184,181,178,176,174,172,171,170,169,169,168,168,168,168,169,169,169,169,170,170,170,169,169,168,167,166,164,162,160,157,154,150,146,141,136,131,125,119,112,106, 98, 91, 83, 75, 67, 58, 50, 41, 33, 24, 16, 8,255,247,239,232,225,219,213,207,202,197,193,189,186,183,181,179,178,177,177,177,178,179,180,181,183,184,186,188,190,192,193,195,196,197,198,198,198,198,197,195,193,191,188,184,180,175,169,163,156,149,142,133,125,116,107, 97, 87, 87}; CT.push_back(GDLCT("Plasma",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99,103,107,111,115,119,123,127,131,135,139,143,147,151,155,159,163,167,171,175,179,183,187,191,195,199,203,207,211,215,219,223,227,231,235,239,243,247,251,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,250,246,241,237,233,228,224,219,215,211,206,202,197,193,189,184,180,175,171,167,162,158,153,149,145,140,136,131,131}; DByte g[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99,103,107,111,115,119,123,127,131,135,139,143,147,151,155,159,163,167,171,175,179,183,187,191,195,199,203,207,211,215,219,223,227,231,235,239,243,247,251,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,251,247,243,239,235,231,227,223,219,215,211,207,203,199,195,191,187,183,179,175,171,167,163,159,155,151,147,143,139,135,131,127,123,119,115,111,107,103, 99, 95, 91, 87, 83, 79, 75, 71, 67, 63, 59, 55, 51, 47, 43, 39, 35, 31, 27, 23, 19, 15, 11, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; DByte b[256]={131,131,135,139,143,147,151,155,159,163,167,171,175,179,183,187,191,195,199,203,207,211,215,219,223,227,231,235,239,243,247,251,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,251,247,243,239,235,231,227,223,219,215,211,207,203,199,195,191,187,183,179,175,171,167,163,159,155,151,147,143,139,135,131,127,123,119,115,111,107,103, 99, 95, 91, 87, 83, 79, 75, 71, 67, 63, 59, 55, 51, 47, 43, 39, 35, 31, 27, 23, 19, 15, 11, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; CT.push_back(GDLCT("Blue-Red",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={124,124,120,115,111,106,102, 97, 93, 88, 84, 79, 75, 70, 66, 61, 57, 52, 48, 43, 39, 34, 30, 25, 21, 16, 12, 7, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 5, 13, 14, 19, 23, 28, 32, 37, 41, 46, 50, 55, 59, 64, 68, 73, 77, 82, 86, 91, 95,100,104,109,113,118,123,127,132,136,141,145,150,154,159,163,168,172,177,181,186,190,195,199,204,208,213,217,222,226,231,235,240,244,249,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}; DByte g[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 11, 15, 20, 24, 29, 33, 38, 42, 47, 51, 56, 60, 65, 69, 74, 78, 83, 87, 92, 96,101,105,110,114,119,123,128,132,137,141,146,150,155,159,164,168,173,177,182,186,191,195,200,204,209,213,218,222,227,231,236,241,245,250,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,252,248,243,239,234,230,225,221,216,212,207,203,198,194,189,185,180,176,171,167,162,158,153,149,144,140,135,131,126,122,117,113,108,104, 99, 95, 90, 86, 81, 77, 72, 68, 63, 59, 54, 50, 45, 41, 36, 32, 27, 23, 18, 14, 9, 5, 5}; DByte b[256]={255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,251,247,242,238,233,229,224,220,215,211,206,202,197,193,188,184,179,175,170,166,161,157,152,148,143,139,134,130,125,121,116,112,107,103, 98, 94, 89, 85, 80, 76, 71, 67, 62, 58, 53, 49, 44, 40, 35, 31, 26, 22, 17, 13, 8, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; CT.push_back(GDLCT("Rainbow",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 82, 82, 77, 73, 68, 63, 59, 54, 50, 46, 42, 38, 34, 30, 26, 23, 19, 16, 13, 13, 8, 5, 3, 1, 0, 2, 3, 5, 6, 6, 7, 7, 8, 7, 7, 6, 6, 5, 3, 2, 0, 1, 3, 5, 8, 13, 13, 16, 19, 23, 26, 30, 34, 38, 42, 46, 50, 54, 59, 63, 68, 73, 77, 82, 87, 91, 96,100,105,110,114,119,123,127,131,135,139,143,147,150,154,157,160,163,165,168,170,172,174,176,177,179,180,180,181,181,182,181,181,180,180,179,177,176,174,172,170,168,165,163,160,157,154,150,147,143,139,135,131,127,123,119,114,110,105,100, 96, 91, 86, 82, 77, 73, 68, 63, 59, 54, 50, 46, 42, 38, 34, 30, 26, 23, 19, 16, 13, 13, 8, 5, 3, 1, 0, 2, 3, 5, 6, 6, 7, 7, 8, 7, 7, 6, 6, 5, 3, 2, 0, 1, 3, 5, 8, 13, 13, 16, 19, 23, 26, 30, 34, 38, 42, 46, 50, 54, 59, 63, 68, 73, 77, 82, 87, 91, 96,100,105,110,114,119,123,127,131,135,139,143,147,150,154,157,160,163,165,168,170,172,174,176,177,179,180,180,181,181,182,181,181,180,180,179,177,176,174,172,170,168,165,163,160,157,154,150,147,143,139,135,131,127,123,119,114,110,105,100, 96, 96}; DByte g[256]={ 0, 0, 1, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 13, 11, 12, 13, 15, 16, 17, 19, 20, 22, 23, 25, 27, 28, 30, 32, 34, 35, 37, 39, 41, 43, 45, 46, 48, 50, 51, 53, 55, 56, 58, 59, 60, 61, 62, 63, 64, 65, 66, 66, 67, 67, 67, 67, 67, 67, 67, 67, 66, 66, 65, 64, 64, 63, 62, 61, 60, 59, 57, 56, 55, 54, 53, 52, 51, 49, 48, 47, 47, 46, 45, 44, 44, 44, 43, 43, 43, 43, 44, 44, 45, 46, 47, 48, 50, 51, 53, 55, 57, 60, 62, 65, 68, 71, 74, 78, 81, 85, 88, 92, 96,100,104,108,112,116,120,124,128,132,136,140,144,148,151,154,158,161,164,166,169,171,173,175,176,178,179,180,180,180,180,180,179,179,178,176,175,173,171,169,166,164,161,158,155,152,148,145,141,138,134,131,127,124,120,117,113,110,107,104,101, 99, 97, 95, 93, 91, 90, 89, 88, 88, 88, 88, 88, 89, 91, 92, 94, 96, 99,102,105,109,113,117,122,127,132,137,142,148,154,160,166,173,179,186,192,199,205,212,218,225,231,237,243,248,254,251,246,241,237,233,229,226,223,220,218,216,215,214,213,213,214,214,216,217,219,222,224,228,231,235,239,244,248,253,251,246,240,234,234}; DByte b[256]={214,214,202,189,177,165,153,141,129,118,107, 96, 85, 75, 65, 56, 47, 38, 30, 22, 15, 9, 2, 2, 7, 12, 16, 19, 22, 24, 25, 26, 27, 26, 25, 24, 22, 19, 16, 12, 7, 2, 2, 9, 15, 22, 30, 38, 47, 56, 65, 75, 85, 96,107,118,129,141,153,165,177,189,202,214,227,239,251,246,234,222,210,198,186,175,164,153,142,132,122,113,104, 95, 87, 79, 72, 66, 59, 54, 49, 44, 40, 37, 34, 32, 31, 30, 29, 30, 31, 32, 34, 37, 40, 44, 49, 54, 59, 66, 72, 79, 87, 95,104,113,122,132,142,153,164,175,186,198,210,222,234,246,251,239,226,214,202,189,177,165,153,141,129,118,107, 96, 85, 75, 65, 56, 47, 38, 30, 22, 15, 9, 2, 2, 7, 12, 16, 19, 22, 24, 25, 26, 27, 26, 25, 24, 22, 19, 16, 12, 7, 2, 2, 9, 15, 22, 30, 38, 47, 56, 65, 75, 85, 96,107,118,129,141,153,165,177,189,202,214,227,239,251,246,234,222,210,198,186,175,164,153,142,132,122,113,104, 95, 87, 79, 72, 66, 59, 54, 49, 44, 40, 37, 34, 32, 31, 30, 29, 30, 31, 32, 34, 37, 40, 44, 49, 54, 59, 66, 72, 79, 87, 95,104,113,122,132,142,153,164,175,186,198,210,222,234,246,251,251}; CT.push_back(GDLCT("Blue Waves",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 64, 64, 60, 57, 54, 51, 48, 45, 42, 40, 37, 35, 32, 30, 28, 26, 24, 22, 20, 19, 17, 16, 14, 13, 12, 11, 13, 9, 9, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 9, 13, 11, 12, 13, 14, 15, 17, 18, 20, 22, 23, 25, 27, 30, 32, 34, 37, 39, 42, 44, 47, 50, 53, 56, 59, 63, 66, 70, 73, 77, 80, 84, 88, 92, 96,100,104,109,113,117,122,126,131,136,140,145,150,155,160,165,170,175,180,186,191,196,201,207,212,218,223,229,234,240,246,251,253,247,241,236,230,224,218,213,207,201,195,189,183,178,172,166,160,154,148,143,137,131,125,120,114,108,103, 97, 92, 86, 80, 75, 70, 64, 59, 53, 48, 43, 38, 33, 28, 23, 18, 13, 8, 3, 1, 5, 13, 15, 19, 23, 28, 32, 36, 40, 44, 48, 52, 56, 60, 63, 67, 70, 73, 77, 80, 83, 86, 89, 92, 94, 97,100,102,104,107,109,111,113,114,116,118,119,121,122,123,124,125,126,127,128,128,129,129,129,129,129,129,129,129,129,128,127,127,126,125,124,123,122,120,119,117,116,114,112,110,108,106,103,101, 99, 96, 93, 91, 88, 85, 82, 79, 75, 72, 69, 65, 62, 58, 54, 50, 47, 43, 39, 34, 30, 26, 22, 17, 13, 8, 8}; DByte g[256]={ 35, 35, 40, 44, 49, 54, 58, 63, 67, 72, 76, 80, 84, 89, 93, 96,100,104,108,111,115,118,121,124,127,130,133,135,137,140,142,144,145,147,148,150,151,152,152,153,153,153,153,153,153,153,152,151,150,149,148,146,145,143,141,139,137,134,132,129,126,123,120,117,113,110,106,103, 99, 95, 91, 87, 83, 79, 74, 70, 66, 61, 57, 52, 47, 43, 38, 33, 29, 24, 19, 15, 13, 5, 1, 3, 7, 12, 16, 20, 25, 29, 33, 37, 41, 45, 49, 53, 56, 60, 63, 66, 69, 72, 75, 78, 80, 83, 85, 87, 89, 91, 92, 94, 95, 96, 97, 98, 99, 99, 99, 99, 99, 99, 99, 98, 97, 97, 95, 94, 93, 91, 89, 88, 86, 83, 81, 78, 76, 73, 70, 67, 64, 61, 57, 54, 50, 46, 42, 38, 34, 30, 26, 22, 17, 13, 9, 4, 0, 4, 9, 13, 18, 23, 27, 32, 37, 41, 46, 51, 55, 60, 64, 69, 73, 77, 82, 86, 90, 94, 98,102,105,109,112,116,119,122,125,128,131,133,136,138,140,142,144,146,147,149,150,151,152,152,153,153,153,153,153,153,152,152,151,150,149,147,146,144,142,140,138,136,133,131,128,125,122,119,116,112,109,105,101, 98, 94, 90, 86, 81, 77, 73, 68, 64, 60, 55, 50, 46, 41, 37, 32, 32}; DByte b[256]={116,116,105, 94, 84, 74, 64, 55, 46, 38, 30, 24, 18, 12, 8, 5, 2, 0, 0, 0, 1, 3, 6, 13, 14, 20, 26, 33, 41, 50, 59, 68, 78, 88, 99,109,120,131,142,153,163,174,184,193,202,211,218,226,232,238,243,247,250,252,253,253,253,251,249,246,241,236,230,224,216,208,200,190,181,171,160,150,139,128,117,106, 96, 85, 75, 65, 56, 47, 39, 31, 24, 18, 13, 9, 5, 2, 0, 0, 0, 1, 3, 5, 9, 14, 19, 25, 32, 40, 48, 57, 67, 76, 87, 97,108,119,130,140,151,162,172,182,192,201,209,217,225,231,237,242,246,249,252,253,254,253,252,249,246,242,237,231,225,217,209,201,192,182,172,162,151,140,130,119,108, 97, 87, 76, 67, 57, 48, 40, 32, 25, 19, 14, 9, 5, 3, 1, 0, 0, 0, 2, 5, 9, 13, 18, 24, 31, 39, 47, 56, 65, 75, 85, 96,106,117,128,139,150,160,171,181,190,200,208,216,224,230,236,241,246,249,251,253,253,253,252,250,247,243,238,232,226,218,211,202,193,184,174,163,153,142,131,120,109, 99, 88, 78, 68, 59, 50, 41, 33, 26, 20, 14, 13, 6, 3, 1, 0, 0, 0, 2, 5, 8, 12, 18, 24, 30, 38, 46, 55, 64, 74, 84, 94,105,105}; CT.push_back(GDLCT("Volcano",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={124,124,121,118,115,112,109,106,103,100, 97, 94, 91, 88, 85, 82, 79, 76, 73, 70, 68, 65, 62, 60, 57, 54, 52, 49, 47, 45, 42, 40, 38, 36, 33, 31, 29, 27, 25, 24, 22, 20, 19, 17, 15, 14, 13, 11, 13, 9, 8, 7, 6, 5, 4, 4, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 4, 4, 5, 6, 7, 8, 9, 13, 11, 13, 14, 15, 17, 19, 20, 22, 24, 25, 27, 29, 31, 33, 36, 38, 40, 42, 45, 47, 49, 52, 54, 57, 60, 62, 65, 68, 70, 73, 76, 79, 82, 85, 88, 91, 94, 97,100,103,106,109,112,115,118,121,124,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,176,179,182,185,187,190,193,195,198,201,203,206,208,210,213,215,217,219,222,224,226,228,230,231,233,235,236,238,240,241,242,244,245,246,247,248,249,250,251,251,252,253,253,254,254,254,254,254,255,254,254,254,254,254,253,253,252,251,251,250,249,248,247,246,245,244,242,241,240,238,236,235,233,231,230,228,226,224,222,219,217,215,213,210,208,206,203,201,198,195,193,190,187,185,182,179,176,173,170,167,164,161,158,155,152,149,146,143,140,137,134,134}; DByte g[256]={121,121,141,155,160,155,141,121, 97, 72, 52, 38, 34, 38, 52, 72, 96,121,141,155,160,155,141,121, 97, 72, 52, 38, 34, 38, 52, 72, 96,121,141,155,160,155,141,121, 97, 72, 52, 38, 34, 38, 52, 72, 96,121,141,155,160,155,141,121, 97, 72, 52, 38, 34, 38, 52, 72, 96,121,141,155,160,155,141,121, 97, 72, 52, 38, 34, 38, 52, 72, 96,121,141,155,160,155,141,121, 97, 72, 52, 38, 34, 38, 52, 72, 96,121,141,155,160,155,141,121, 97, 72, 52, 38, 34, 38, 52, 72, 96,121,141,155,160,155,141,121, 96, 72, 52, 38, 34, 38, 52, 72, 97,121,141,155,160,155,141,121, 96, 72, 52, 38, 34, 38, 52, 72, 97,121,141,155,160,155,141,121, 96, 72, 52, 38, 34, 38, 52, 72, 97,121,141,155,160,155,141,121, 96, 72, 52, 38, 34, 38, 52, 72, 97,121,141,155,160,155,141,121, 96, 72, 52, 38, 34, 38, 52, 72, 97,121,141,155,160,155,141,121, 96, 72, 52, 38, 34, 38, 52, 72, 97,121,141,155,160,155,141,121, 96, 72, 52, 38, 34, 38, 52, 72, 97,121,141,155,160,155,141,121, 96, 72, 52, 38, 34, 38, 52, 72, 97,121,141,155,160,155,141,121, 96, 72, 52, 38, 34, 38, 52, 52}; DByte b[256]={131,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,176,179,182,185,187,190,193,195,198,201,203,206,208,210,213,215,217,219,222,224,226,228,230,231,233,235,236,238,240,241,242,244,245,246,247,248,249,250,251,251,252,253,253,254,254,254,254,254,255,254,254,254,254,254,253,253,252,251,251,250,249,248,247,246,245,244,242,241,240,238,236,235,233,231,230,228,226,224,222,219,217,215,213,210,208,206,203,201,198,195,193,190,187,185,182,179,176,173,170,167,164,161,158,155,152,149,146,143,140,137,134,131,127,124,121,118,115,112,109,106,103,100, 97, 94, 91, 88, 85, 82, 79, 76, 73, 70, 68, 65, 62, 60, 57, 54, 52, 49, 47, 45, 42, 40, 38, 36, 33, 31, 29, 27, 25, 24, 22, 20, 19, 17, 15, 14, 13, 11, 13, 9, 8, 7, 6, 5, 4, 4, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 3, 4, 4, 5, 6, 7, 8, 9, 13, 11, 13, 14, 15, 17, 19, 20, 22, 24, 25, 27, 29, 31, 33, 36, 38, 40, 42, 45, 47, 49, 52, 54, 57, 60, 62, 65, 68, 70, 73, 76, 79, 82, 85, 88, 91, 94, 97,100,103,106,109,112,115,118,121,121}; CT.push_back(GDLCT("Waves",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,175,175,175,175,175,175,175,175,175,175,175,175,175,175,255,255}; DByte g[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125,125, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,255,255}; DByte b[256]={ 0,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,200,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120,120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,255,255}; CT.push_back(GDLCT("Rainbow18",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 4, 9, 13, 18, 22, 27, 31, 36, 40, 45, 50, 58, 61, 64, 68, 69, 72, 74, 77, 79, 80, 82, 83, 84, 86, 87, 88, 86, 87, 87, 87, 85, 84, 84, 84, 79, 78, 77, 76, 71, 70, 68, 66, 60, 58, 55, 46, 43, 40, 36, 33, 25, 21, 16, 12, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 8, 12, 21, 25, 29, 42, 46, 51, 55, 63, 67, 72, 76, 80, 89, 93, 97,110,114,119,123,131,135,140,144,153,157,161,165,178,182,187,191,199,203,208,212,221,225,229,242,246,250,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255}; DByte g[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 16, 21, 25, 29, 38, 42, 46, 51, 55, 63, 67, 72, 84, 89, 93, 97,106,110,114,119,127,131,135,140,152,157,161,165,174,178,182,187,195,199,203,216,220,225,229,233,242,246,250,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,250,242,238,233,229,221,216,212,199,195,191,187,178,174,170,165,161,153,148,144,131,127,123,119,110,106,102, 97, 89, 85, 80, 76, 63, 59, 55, 51, 42, 38, 34, 29, 21, 17, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255}; DByte b[256]={ 0, 3, 7, 10, 14, 19, 23, 28, 32, 38, 43, 48, 59, 63, 68, 72, 77, 81, 86, 91, 95,100,104,109,118,122,127,132,136,141,145,150,154,159,163,168,177,182,186,191,195,200,204,209,214,218,223,232,236,241,245,250,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,246,242,238,225,220,216,212,203,199,195,191,187,178,174,170,157,152,148,144,135,131,127,123,114,110,106,102, 89, 84, 80, 76, 67, 63, 59, 55, 46, 42, 38, 25, 21, 16, 12, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255}; CT.push_back(GDLCT("Rainbow + white",r,g,b,256)); } // local identifiers { // make r, g, b local identifiers DByte r[256]={ 0, 4, 9, 13, 18, 22, 27, 31, 36, 40, 45, 50, 58, 61, 64, 68, 69, 72, 74, 77, 79, 80, 82, 83, 84, 86, 87, 88, 86, 87, 87, 87, 85, 84, 84, 84, 79, 78, 77, 76, 71, 70, 68, 66, 60, 58, 55, 46, 43, 40, 36, 33, 25, 21, 16, 12, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 8, 12, 21, 25, 29, 42, 46, 51, 55, 63, 67, 72, 76, 80, 89, 93, 97,110,114,119,123,131,135,140,144,153,157,161,165,178,182,187,191,199,203,208,212,221,225,229,242,246,250,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 0}; DByte g[256]={ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 16, 21, 25, 29, 38, 42, 46, 51, 55, 63, 67, 72, 84, 89, 93, 97,106,110,114,119,127,131,135,140,152,157,161,165,174,178,182,187,195,199,203,216,220,225,229,233,242,246,250,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,250,242,238,233,229,221,216,212,199,195,191,187,178,174,170,165,161,153,148,144,131,127,123,119,110,106,102, 97, 89, 85, 80, 76, 63, 59, 55, 51, 42, 38, 34, 29, 21, 17, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; DByte b[256]={ 0, 3, 7, 10, 14, 19, 23, 28, 32, 38, 43, 48, 59, 63, 68, 72, 77, 81, 86, 91, 95,100,104,109,118,122,127,132,136,141,145,150,154,159,163,168,177,182,186,191,195,200,204,209,214,218,223,232,236,241,245,250,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,246,242,238,225,220,216,212,203,199,195,191,187,178,174,170,157,152,148,144,135,131,127,123,114,110,106,102, 89, 84, 80, 76, 67, 63, 59, 55, 46, 42, 38, 25, 21, 16, 12, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; CT.push_back(GDLCT("Rainbow + black",r,g,b,256)); } // local identifiers // init actCT to B-W linear actCT = CT[0]; } gdl-0.9.4/src/typetraits.cpp0000664000175000017500000003256412121125244014431 0ustar marcmarc/*************************************************************************** typetraits.cpp - type parameterization ------------------- begin : July 22 2002 copyright : (C) 2002-2006 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" #include "typetraits.hpp" #include "datatypes.hpp" #include "dstructgdl.hpp" using namespace std; const DType SpDByte::t=GDL_BYTE; // type ID const string SpDByte::str("BYTE"); // type string const DByte SpDByte::zero=0; BaseGDL* SpDByte::GetTag() const { return new SpDByte(*this);} DType SpDByte::Type() const { return t;} const std::string& SpDByte::TypeStr() const { return str;} const DType SpDInt::t=GDL_INT; // type ID const string SpDInt::str("INT"); // type string const DInt SpDInt::zero=0; BaseGDL* SpDInt::GetTag() const { return new SpDInt(*this);} DType SpDInt::Type() const { return t;} const std::string& SpDInt::TypeStr() const { return str;} const DType SpDUInt::t=GDL_UINT; // type ID const string SpDUInt::str("UINT"); // type string const DUInt SpDUInt::zero=0; BaseGDL* SpDUInt::GetTag() const { return new SpDUInt(*this);} DType SpDUInt::Type() const { return t;} const std::string& SpDUInt::TypeStr() const { return str;} const DType SpDLong::t=GDL_LONG; // type ID const string SpDLong::str("LONG"); // type string const DLong SpDLong::zero=0; BaseGDL* SpDLong::GetTag() const { return new SpDLong(*this);} DType SpDLong::Type() const { return t;} const std::string& SpDLong::TypeStr() const { return str;} const DType SpDULong::t=GDL_ULONG; // type ID const string SpDULong::str("ULONG"); // type string const DULong SpDULong::zero=0; BaseGDL* SpDULong::GetTag() const { return new SpDULong(*this);} DType SpDULong::Type() const { return t;} const std::string& SpDULong::TypeStr() const { return str;} const DType SpDLong64::t=GDL_LONG64; // type ID const string SpDLong64::str("LONG64"); // type string const DLong64 SpDLong64::zero=0; BaseGDL* SpDLong64::GetTag() const { return new SpDLong64(*this);} DType SpDLong64::Type() const { return t;} const std::string& SpDLong64::TypeStr() const { return str;} const DType SpDULong64::t=GDL_ULONG64; // type ID const string SpDULong64::str("ULONG64"); // type string const DULong64 SpDULong64::zero=0; BaseGDL* SpDULong64::GetTag() const { return new SpDULong64(*this);} DType SpDULong64::Type() const { return t;} const std::string& SpDULong64::TypeStr() const { return str;} const DType SpDFloat::t=GDL_FLOAT; // type ID const string SpDFloat::str("FLOAT"); // type string const DFloat SpDFloat::zero=0.0; BaseGDL* SpDFloat::GetTag() const { return new SpDFloat(*this);} DType SpDFloat::Type() const { return t;} const std::string& SpDFloat::TypeStr() const { return str;} const DType SpDDouble::t=GDL_DOUBLE; // type ID const string SpDDouble::str("DOUBLE"); // type string const DDouble SpDDouble::zero=0.0; BaseGDL* SpDDouble::GetTag() const { return new SpDDouble(*this);} DType SpDDouble::Type() const { return t;} const std::string& SpDDouble::TypeStr() const { return str;} const DType SpDString::t=GDL_STRING; // type ID const string SpDString::str("STRING"); // type string const DString SpDString::zero(""); // zero string BaseGDL* SpDString::GetTag() const { return new SpDString(*this);} DType SpDString::Type() const { return t;} const std::string& SpDString::TypeStr() const { return str;} const DType SpDStruct::t=GDL_STRUCT; // type ID const string SpDStruct::str("STRUCT"); // type string const SpDStruct::Ty SpDStruct::zero=0; // zero struct, special meaning BaseGDL* SpDStruct::GetTag() const { SpDStruct* newTag = new SpDStruct(*this); newTag->MakeOwnDesc(); return newTag; } DType SpDStruct::Type() const { return t;} const std::string& SpDStruct::TypeStr() const { return str;} const DType SpDPtr::t=GDL_PTR; // type ID const string SpDPtr::str("POINTER"); // type string const DPtr SpDPtr::zero=0; // zero ptr BaseGDL* SpDPtr::GetTag() const { return new SpDPtr(*this);} DType SpDPtr::Type() const { return t;} const std::string& SpDPtr::TypeStr() const { return str;} const DType SpDObj::t=GDL_OBJ; // type ID const string SpDObj::str("OBJREF"); // type string const DObj SpDObj::zero=0; // zero ptr/obj BaseGDL* SpDObj::GetTag() const { return new SpDObj(*this);} DType SpDObj::Type() const { return t;} const std::string& SpDObj::TypeStr() const { return str;} const DType SpDComplex::t=GDL_COMPLEX; // type ID const string SpDComplex::str("COMPLEX"); // type string const DComplex SpDComplex::zero(0.0,0.0); BaseGDL* SpDComplex::GetTag() const { return new SpDComplex(*this);} DType SpDComplex::Type() const { return t;} const std::string& SpDComplex::TypeStr() const { return str;} const DType SpDComplexDbl::t=GDL_COMPLEXDBL; // type ID const string SpDComplexDbl::str("DCOMPLEX"); // type string const DComplexDbl SpDComplexDbl::zero(0.0,0.0); BaseGDL* SpDComplexDbl::GetTag() const { return new SpDComplexDbl(*this);} DType SpDComplexDbl::Type() const { return t;} const std::string& SpDComplexDbl::TypeStr() const { return str;} // for GDL structs // returns an empty instance (for actually holding data) BaseGDL* SpDByte::GetInstance() const { return new Data_(dim);} BaseGDL* SpDInt::GetInstance() const { return new Data_(dim);} BaseGDL* SpDUInt::GetInstance() const { return new Data_(dim);} BaseGDL* SpDLong::GetInstance() const { return new Data_(dim);} BaseGDL* SpDULong::GetInstance() const { return new Data_(dim);} BaseGDL* SpDLong64::GetInstance() const { return new Data_(dim);} BaseGDL* SpDULong64::GetInstance() const { return new Data_(dim);} BaseGDL* SpDFloat::GetInstance() const { return new Data_(dim);} BaseGDL* SpDDouble::GetInstance() const { return new Data_(dim);} BaseGDL* SpDString::GetInstance() const { return new Data_(dim);} BaseGDL* SpDPtr::GetInstance() const { return new Data_(dim);} BaseGDL* SpDObj::GetInstance() const { return new Data_(dim);} BaseGDL* SpDStruct::GetInstance() const { DStructGDL* newInstance = new DStructGDL(desc,dim); newInstance->MakeOwnDesc(); return newInstance; } BaseGDL* SpDComplex::GetInstance() const { return new Data_(dim);} BaseGDL* SpDComplexDbl::GetInstance() const { return new Data_(dim);} // returns an instance without allocating memory BaseGDL* SpDByte::GetEmptyInstance() const { return new Data_( dim, BaseGDL::NOALLOC);} BaseGDL* SpDInt::GetEmptyInstance() const { return new Data_( dim, BaseGDL::NOALLOC);} BaseGDL* SpDUInt::GetEmptyInstance() const { return new Data_( dim, BaseGDL::NOALLOC);} BaseGDL* SpDLong::GetEmptyInstance() const { return new Data_( dim, BaseGDL::NOALLOC);} BaseGDL* SpDULong::GetEmptyInstance() const { return new Data_( dim, BaseGDL::NOALLOC);} BaseGDL* SpDLong64::GetEmptyInstance() const { return new Data_( dim, BaseGDL::NOALLOC);} BaseGDL* SpDULong64::GetEmptyInstance() const { return new Data_( dim, BaseGDL::NOALLOC);} BaseGDL* SpDFloat::GetEmptyInstance() const { return new Data_( dim, BaseGDL::NOALLOC);} BaseGDL* SpDDouble::GetEmptyInstance() const { return new Data_( dim, BaseGDL::NOALLOC);} BaseGDL* SpDString::GetEmptyInstance() const { return new Data_( dim, BaseGDL::NOALLOC);} BaseGDL* SpDPtr::GetEmptyInstance() const { return new Data_( dim, BaseGDL::NOALLOC);} BaseGDL* SpDObj::GetEmptyInstance() const { return new Data_( dim, BaseGDL::NOALLOC);} BaseGDL* SpDStruct::GetEmptyInstance() const { DStructGDL* newInstance = new DStructGDL( desc, dim, BaseGDL::NOALLOC); newInstance->MakeOwnDesc(); return newInstance; } BaseGDL* SpDComplex::GetEmptyInstance() const { return new Data_( dim, BaseGDL::NOALLOC);} BaseGDL* SpDComplexDbl::GetEmptyInstance() const { return new Data_( dim, BaseGDL::NOALLOC);} SpDByte::SpDByte(): BaseGDL() {} SpDByte::SpDByte( const dimension& dim_): BaseGDL(dim_) {} SpDByte::~SpDByte() {} SpDInt::SpDInt(): BaseGDL() {} SpDInt::SpDInt( const dimension& dim_): BaseGDL(dim_) {} SpDInt::~SpDInt() {} SpDUInt::SpDUInt(): BaseGDL() {} SpDUInt::SpDUInt( const dimension& dim_): BaseGDL(dim_) {} SpDUInt::~SpDUInt() {}; SpDLong::SpDLong(): BaseGDL() {} SpDLong::SpDLong( const dimension& dim_): BaseGDL(dim_) {} SpDLong::~SpDLong() {} SpDULong::SpDULong(): BaseGDL() {} SpDULong::SpDULong( const dimension& dim_): BaseGDL(dim_) {} SpDULong::~SpDULong() {} SpDLong64::SpDLong64(): BaseGDL() {} SpDLong64::SpDLong64( const dimension& dim_): BaseGDL(dim_) {} SpDLong64::~SpDLong64() {} SpDULong64::SpDULong64(): BaseGDL() {} SpDULong64::SpDULong64( const dimension& dim_): BaseGDL(dim_) {} SpDULong64::~SpDULong64() {} SpDFloat::SpDFloat(): BaseGDL() {} SpDFloat::SpDFloat( const dimension& dim_): BaseGDL(dim_) {} SpDFloat::~SpDFloat() {} SpDDouble::SpDDouble(): BaseGDL() {} SpDDouble::SpDDouble( const dimension& dim_): BaseGDL(dim_) {} SpDDouble::~SpDDouble() {} SpDString::SpDString(): BaseGDL() {} SpDString::SpDString( const dimension& dim_): BaseGDL(dim_) {} SpDString::~SpDString() {} SpDStruct::SpDStruct( DStructDesc* desc_): BaseGDL(), desc(desc_) { // if( desc != NULL && desc->IsUnnamed()) // desc = new DStructDesc( desc); } SpDStruct::SpDStruct( DStructDesc* desc_, const dimension& dim_): BaseGDL(dim_), desc(desc_) { // if( desc == NULL) cout << "SpDStruct::SpDStruct( DStructDesc* desc_, const dimension& dim_): desc_ == NULL" << endl; // if( desc_ != NULL && desc_->IsUnnamed()) // desc = new DStructDesc( desc_); } SpDStruct::~SpDStruct() { if( desc != NULL && desc->IsUnnamed()) desc->Delete(); } SpDPtr::SpDPtr(): BaseGDL() {} SpDPtr::SpDPtr( const dimension& dim_): BaseGDL(dim_) {} SpDPtr::~SpDPtr() {} SpDObj::SpDObj(): BaseGDL() {} SpDObj::SpDObj( const dimension& dim_): BaseGDL(dim_) {} SpDObj::~SpDObj() {} SpDComplex::SpDComplex(): BaseGDL() {} SpDComplex::SpDComplex( const dimension& dim_): BaseGDL(dim_) {} SpDComplex::~SpDComplex() {} SpDComplexDbl::SpDComplexDbl(): BaseGDL() {} SpDComplexDbl::SpDComplexDbl( const dimension& dim_): BaseGDL(dim_) {} SpDComplexDbl::~SpDComplexDbl() {} /* const bool SpDByte::IS_INTEGER=true; const bool SpDByte::IS_SIGNED=false; const bool SpDByte::IS_NUMERIC=true; const bool SpDByte::IS_COMPLEX=false; const bool SpDByte::IS_POD=true; const bool SpDByte::IS_CONVERTABLE=true; const bool SpDInt::IS_INTEGER=true; const bool SpDInt::IS_SIGNED=true; const bool SpDInt::IS_NUMERIC=true; const bool SpDInt::IS_COMPLEX=false; const bool SpDInt::IS_POD=true; const bool SpDInt::IS_CONVERTABLE=true; const bool SpDUInt::IS_INTEGER=true; const bool SpDUInt::IS_SIGNED=false; const bool SpDUInt::IS_NUMERIC=true; const bool SpDUInt::IS_COMPLEX=false; const bool SpDLong::IS_INTEGER=true; const bool SpDLong::IS_SIGNED=true; const bool SpDLong::IS_NUMERIC=true; const bool SpDLong::IS_COMPLEX=false; const bool SpDULong::IS_INTEGER=true; const bool SpDULong::IS_SIGNED=false; const bool SpDULong::IS_NUMERIC=true; const bool SpDULong::IS_COMPLEX=false; const bool SpDLong64::IS_INTEGER=true; const bool SpDLong64::IS_SIGNED=true; const bool SpDLong64::IS_NUMERIC=true; const bool SpDLong64::IS_COMPLEX=false; const bool SpDFloat::IS_INTEGER=false; const bool SpDFloat::IS_SIGNED=true; const bool SpDFloat::IS_NUMERIC=true; const bool SpDFloat::IS_COMPLEX=false; const bool SpDULong64::IS_INTEGER=true; const bool SpDULong64::IS_SIGNED=false; const bool SpDULong64::IS_NUMERIC=true; const bool SpDULong64::IS_COMPLEX=false; const bool SpDDouble::IS_INTEGER=false; const bool SpDDouble::IS_SIGNED=true; const bool SpDDouble::IS_NUMERIC=true; const bool SpDDouble::IS_COMPLEX=false; const bool SpDString::IS_INTEGER=false; const bool SpDString::IS_SIGNED=false; const bool SpDString::IS_NUMERIC=false; const bool SpDString::IS_COMPLEX=false; const bool SpDStruct::IS_INTEGER=false; const bool SpDStruct::IS_SIGNED=false; const bool SpDStruct::IS_NUMERIC=false; const bool SpDStruct::IS_COMPLEX=false; const bool SpDPtr::IS_INTEGER=false; const bool SpDPtr::IS_SIGNED=false; const bool SpDPtr::IS_NUMERIC=false; const bool SpDPtr::IS_COMPLEX=false; const bool SpDObj::IS_INTEGER=false; const bool SpDObj::IS_SIGNED=false; const bool SpDObj::IS_NUMERIC=false; const bool SpDObj::IS_COMPLEX=false; const bool SpDComplex::IS_INTEGER=false; const bool SpDComplex::IS_SIGNED=true; const bool SpDComplex::IS_NUMERIC=true; const bool SpDComplex::IS_COMPLEX=true; const bool SpDComplexDbl::IS_INTEGER=false; const bool SpDComplexDbl::IS_SIGNED=true; const bool SpDComplexDbl::IS_NUMERIC=true; const bool SpDComplexDbl::IS_COMPLEX=true; */ gdl-0.9.4/src/basic_op_mult.cpp0000664000175000017500000000776212122717103015045 0ustar marcmarc/*************************************************************************** basic_op_mult.cpp - GDL mult (*) operators ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ // to be included from datatypes.cpp #ifdef INCLUDE_BASIC_OP_CPP // // header in datatypes.hpp // // //#include "datatypes.hpp" // //#include "dstructgdl.hpp" // //#include "arrayindex.hpp" // // //#include // #include "sigfpehandler.hpp" // // #ifdef _OPENMP // #include // #endif // // #include "typetraits.hpp" // // using namespace std; // Mult // Mults right to itself, //C deletes right // right must always have more or same number of elements template Data_* Data_::Mult( BaseGDL* r) { Data_* right=static_cast(r); // ULong rEl=right->N_Elements(); ULong nEl=N_Elements(); // assert( rEl); assert( nEl); // if( !rEl || !nEl) throw GDLException("Variable is undefined."); if( nEl == 1) { (*this)[0] *= (*right)[0]; return this; } #ifdef USE_EIGEN Eigen::Map ,Eigen::Aligned> mThis(&(*this)[0], nEl); Eigen::Map ,Eigen::Aligned> mRight(&(*right)[0], nEl); mThis *= mRight; return this; #else TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*this)[i] *= (*right)[i]; } //C delete right; return this; #endif } // invalid types template<> Data_* Data_::Mult( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return this; } template<> Data_* Data_::Mult( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return this; } template<> Data_* Data_::Mult( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return this; } template Data_* Data_::MultS( BaseGDL* r) { Data_* right=static_cast(r); ULong nEl=N_Elements(); assert( nEl); if( nEl == 1) { (*this)[0] *= (*right)[0]; return this; } Ty s = (*right)[0]; // right->Scalar(s); // dd *= s; #ifdef USE_EIGEN Eigen::Map ,Eigen::Aligned> mThis(&(*this)[0], nEl); mThis *= s; return this; #else TRACEOMP( __FILE__, __LINE__) #pragma omp parallel if (nEl >= CpuTPOOL_MIN_ELTS && (CpuTPOOL_MAX_ELTS == 0 || CpuTPOOL_MAX_ELTS <= nEl)) { #pragma omp for for( OMPInt i=0; i < nEl; ++i) (*this)[i] *= s; } //C delete right; return this; #endif } // invalid types template<> Data_* Data_::MultS( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype STRING.",true,false); return this; } template<> Data_* Data_::MultS( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype PTR.",true,false); return this; } template<> Data_* Data_::MultS( BaseGDL* r) { throw GDLException("Cannot apply operation to datatype OBJECT.",true,false); return this; } #endif gdl-0.9.4/src/gdlwidget.hpp0000664000175000017500000002166612026101346014202 0ustar marcmarc/*************************************************************************** gdlwidget - base class for GDL widgets ------------------- begin : Fri May 7 2004 copyright : (C) 2004 by Marc Schellens email : m_schellens@users.sourceforge.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifndef GDLWIDGET_HPP #define GDLWIDGET_HPP #include #include #include "typedefs.hpp" class guiThread : public wxThread { public: guiThread() : wxThread(wxTHREAD_JOINABLE) {}; // thread execution starts here virtual void *Entry(); // called when the thread exits - whether it terminates normally or is // stopped with Delete() (but not when it is Kill()ed!) virtual void OnExit( guiThread *thread); }; static guiThread *thread; class GDLWidget; // global widget list type typedef DLong WidgetIDT; typedef std::map WidgetListT; // main App class class GDLApp: public wxApp { virtual int OnRun(); // Defined in GDLApp::OnRun() virtual int OnExit(); // Defined in GDLApp::OnExit() }; // GUI base class ********************************** class GDLWidget { // static part is used for the abstraction // all widgets are refered to as IDs private: // the global widget list and the actual index for new widgets // shared among all widgets static WidgetIDT widgetIx; static WidgetListT widgetList; protected: // removes a widget, (called from widgets destructor -> don't delete) static void WidgetRemove( WidgetIDT widID); public: // ID for widget (called from widgets constructor) static WidgetIDT NewWidget( GDLWidget* w); // get widget from ID static GDLWidget* GetWidget( WidgetIDT widID); static GDLWidget* GetParent( WidgetIDT widID); static WidgetIDT GetBase( WidgetIDT widID); static void Init(); // GUI intialization upon GDL startup protected: wxObject* wxWidget; // deleted only from TLB as the rest is deleted // automatic // Note: wxWidget is GDL name not wxWidgets (JMG) WidgetIDT widgetID; // own index to widgetList WidgetIDT parent; // parent ID (0 for TLBs) BaseGDL* uValue; // the UVALUE BaseGDL* vValue; // the VVALUE bool sensitive; bool managed; bool map; bool buttonSet; int exclusiveMode; DLong xOffset, yOffset, xSize, ySize; wxSizer* topWidgetSizer; wxSizer* widgetSizer; wxPanel* widgetPanel; DString widgetType; DString uName; DString proValue; DString funcValue; public: GDLWidget( WidgetIDT p=0, BaseGDL* uV=NULL, BaseGDL* vV=NULL, bool s=true, bool mp=true, DLong xO=-1, DLong yO=-1, DLong xS=-1, DLong yS=-1); virtual ~GDLWidget(); wxObject* WxWidget() { return wxWidget;} BaseGDL* GetUvalue() { return uValue;} BaseGDL* GetVvalue() { return vValue;} virtual void Realize( bool) {} virtual DLong GetChild( DLong) {return 0;}; virtual void SetXmanagerActiveCommand() {}; virtual bool GetXmanagerActiveCommand() {return false;}; virtual void SetEventPro( DString) {}; virtual DString GetEventPro() {return NULL;}; static bool GetXmanagerBlock(); static bool PollEvents( DLong *, DLong *, DLong *, DLong *); WidgetIDT WidgetID() { return widgetID;} wxSizer* GetSizer() { return widgetSizer;} wxPanel* GetPanel() { return widgetPanel;} // void SetSizer( wxSizer*); bool GetManaged() { return managed;} void SetManaged( bool); bool GetMap() { return map;} void SetMap( bool); int GetExclusiveMode() { return exclusiveMode;} void SetExclusiveMode( int); void SetUvalue( BaseGDL *); void SetVvalue( BaseGDL *); void SetWidgetType( DString); DString GetWidgetType() { return widgetType;} void SetButtonOff(); void SetButtonOn(); bool GetButtonSet() { return buttonSet;} void SetUname( DString); DString GetUname() { return uName;} void SetProValue( DString); DString GetProValue() { return proValue;} void SetFuncValue( DString); DString GetFuncValue() { return funcValue;} }; class GDLWidgetMbar; // button widget ************************************************** class GDLWidgetButton: public GDLWidget { public: GDLWidgetButton( WidgetIDT parentID, BaseGDL *uvalue, DString value); void SetSelectOff(); }; // droplist widget ************************************************** class GDLWidgetDropList: public GDLWidget { public: // GDLWidgetDropList( WidgetIDT p, BaseGDL *uV, DStringGDL *value, // DString title, DLong xSize, DLong style); GDLWidgetDropList( WidgetIDT p, BaseGDL *uV, BaseGDL *value, DString title, DLong xSize, DLong style); void SetSelectOff(); }; // list widget ************************************************** class GDLWidgetList : public GDLWidget { public: GDLWidgetList( WidgetIDT p, BaseGDL *uV, BaseGDL *value, DLong xSize, DLong ySize, DLong style); void SetSelectOff(); }; // bgroup widget ************************************************** class GDLWidgetBGroup: public GDLWidget { public: typedef enum e_BGroupMode {NORMAL, EXCLUSIVE, NONEXCLUSIVE} BGroupMode; typedef enum e_BGRoupReturn {RETURN_ID, RETURN_INDEX, RETURN_NAME} BGroupReturn; GDLWidgetBGroup(WidgetIDT p, DStringGDL* names, BaseGDL *uV, DStringGDL buttonuvalue, DLong xSize, DLong ySize, DString labeltop, DLong rows, DLong cols, BGroupMode mode, BGroupReturn ret ); }; // text widget ************************************************** class GDLWidgetText: public GDLWidget { private: wxTextCtrl *text; public: GDLWidgetText( WidgetIDT parentID, BaseGDL *uvalue, DString value, DLong xSize, bool editable); void SetTextValue( DString); }; // label widget ************************************************** class GDLWidgetLabel: public GDLWidget { private: wxStaticText *label; public: GDLWidgetLabel( WidgetIDT parentID, BaseGDL *uvalue, DString value, DLong xSize); void SetLabelValue( DString); }; // base widget ************************************************** class GDLWidgetBase: public GDLWidget { protected: typedef std::deque::iterator cIter; std::deque children; bool xmanActCom; bool modal; WidgetIDT mbarID; DString eventHandler; public: GDLWidgetBase( WidgetIDT parentID, BaseGDL* uvalue, DString uname, bool sensitive, bool mapWid, WidgetIDT mBarID, bool modal, WidgetIDT group_leader, DLong col, DLong row, long events, int exclusiveMode, bool floating, DString event_func, DString event_pro, DString pro_set_value, DString func_get_value, DString notify_realize, DString kill_notify, DString resource_name, DString rname_mbar, DString title, DLong frame, DLong units, DString display_name, DLong xpad, DLong ypad, DLong xoffset, DLong yoffset, DLong xsize, DLong ysize, DLong scr_xsize, DLong scr_ysize, DLong x_scroll_size, DLong y_scroll_size); GDLWidgetBase( WidgetIDT p=0, // parent BaseGDL* uV=NULL, // UVALUE BaseGDL* vV=NULL, // VVALUE bool s=true, // SENSITIVE bool mp=true, // MAP DLong xO=-1, DLong yO=-1, // offset DLong xS=-1, DLong yS=-1); // size virtual ~GDLWidgetBase(); void AddChild( WidgetIDT c) { children.push_back( c);} void RemoveChild( WidgetIDT c) { children.erase( find( children.begin(), children.end(), c));} void Realize( bool); void SetXmanagerActiveCommand(); bool GetXmanagerActiveCommand() { return xmanActCom;} void SetEventPro( DString); DString GetEventPro() { return eventHandler;} DLong GetChild( DLong); }; class GDLWidgetMBar: public GDLWidgetBase { }; class GDLFrame : public wxFrame { public: // ctor(s) GDLFrame(wxWindow* parent, wxWindowID id, const wxString& title); // event handlers (these functions should _not_ be virtual) void OnButton( wxCommandEvent& event); void OnRadioButton( wxCommandEvent& event); void OnIdle( wxIdleEvent& event); private: // any class wishing to process wxWidgets events must use this macro DECLARE_EVENT_TABLE() }; #endif gdl-0.9.4/src/GDLTreeParserTokenTypes.hpp0000664000175000017500000001130112221270776016655 0ustar marcmarc#ifndef INC_GDLTreeParserTokenTypes_hpp_ #define INC_GDLTreeParserTokenTypes_hpp_ /* $ANTLR 2.7.7 (20120518): "gdlc.tree.g" -> "GDLTreeParserTokenTypes.hpp"$ */ #ifndef CUSTOM_API # define CUSTOM_API #endif #ifdef __cplusplus struct CUSTOM_API GDLTreeParserTokenTypes { #endif enum { EOF_ = 1, ALL = 4, ASSIGN = 5, ASSIGN_INPLACE = 6, ASSIGN_REPLACE = 7, ASSIGN_ARRAYEXPR_MFCALL = 8, ARRAYDEF = 9, ARRAYDEF_CONST = 10, ARRAYIX = 11, ARRAYIX_ALL = 12, ARRAYIX_ORANGE = 13, ARRAYIX_RANGE = 14, ARRAYIX_ORANGE_S = 15, ARRAYIX_RANGE_S = 16, ARRAYEXPR = 17, ARRAYEXPR_FCALL = 18, ARRAYEXPR_MFCALL = 19, BLOCK = 20, BREAK = 21, CSBLOCK = 22, CONTINUE = 23, COMMONDECL = 24, COMMONDEF = 25, CONSTANT = 26, DEREF = 27, ELSEBLK = 28, EXPR = 29, FOR = 30, FOR_STEP = 31, FOREACH = 32, FOREACH_INDEX = 33, FOR_LOOP = 34, FOR_STEP_LOOP = 35, FOREACH_LOOP = 36, FOREACH_INDEX_LOOP = 37, FCALL = 38, FCALL_LIB = 39, FCALL_LIB_DIRECT = 40, FCALL_LIB_N_ELEMENTS = 41, FCALL_LIB_RETNEW = 42, GDLNULL = 43, IF_ELSE = 44, KEYDECL = 45, KEYDEF = 46, KEYDEF_REF = 47, KEYDEF_REF_CHECK = 48, KEYDEF_REF_EXPR = 49, LABEL = 50, MPCALL = 51, MPCALL_PARENT = 52, MFCALL = 53, MFCALL_LIB = 54, MFCALL_LIB_RETNEW = 55, MFCALL_PARENT = 56, MFCALL_PARENT_LIB = 57, MFCALL_PARENT_LIB_RETNEW = 58, NOP = 59, NSTRUC = 60, NSTRUC_REF = 61, ON_IOERROR_NULL = 62, PCALL = 63, PCALL_LIB = 64, PARADECL = 65, PARAEXPR = 66, PARAEXPR_VN = 67, DEC_REF_CHECK = 68, INC_REF_CHECK = 69, POSTDEC = 70, POSTINC = 71, DECSTATEMENT = 72, INCSTATEMENT = 73, REF = 74, REF_VN = 75, REF_CHECK = 76, REF_CHECK_VN = 77, REF_EXPR = 78, REF_EXPR_VN = 79, REPEAT = 80, REPEAT_LOOP = 81, RETURN = 82, RETF = 83, RETP = 84, STRUC = 85, SYSVAR = 86, UMINUS = 87, VAR = 88, VARPTR = 89, WHILE = 90, IDENTIFIER = 91, AND_OP = 92, BEGIN = 93, CASE = 94, COMMON = 95, COMPILE_OPT = 96, DO = 97, ELSE = 98, END = 99, ENDCASE = 100, ENDELSE = 101, ENDFOR = 102, ENDFOREACH = 103, ENDIF = 104, ENDREP = 105, ENDSWITCH = 106, ENDWHILE = 107, EQ_OP = 108, FORWARD = 109, FUNCTION = 110, GE_OP = 111, GOTO = 112, GT_OP = 113, IF = 114, INHERITS = 115, LE_OP = 116, LT_OP = 117, MOD_OP = 118, NE_OP = 119, NOT_OP = 120, OF = 121, ON_IOERROR = 122, OR_OP = 123, PRO = 124, SWITCH = 125, THEN = 126, UNTIL = 127, XOR_OP = 128, METHOD = 129, COMMA = 130, COLON = 131, END_U = 132, EQUAL = 133, DEC = 134, INC = 135, AND_OP_EQ = 136, ASTERIX_EQ = 137, EQ_OP_EQ = 138, GE_OP_EQ = 139, GTMARK_EQ = 140, GT_OP_EQ = 141, LE_OP_EQ = 142, LTMARK_EQ = 143, LT_OP_EQ = 144, MATRIX_OP1_EQ = 145, MATRIX_OP2_EQ = 146, MINUS_EQ = 147, MOD_OP_EQ = 148, NE_OP_EQ = 149, OR_OP_EQ = 150, PLUS_EQ = 151, POW_EQ = 152, SLASH_EQ = 153, XOR_OP_EQ = 154, MEMBER = 155, LBRACE = 156, RBRACE = 157, SLASH = 158, LSQUARE = 159, RSQUARE = 160, SYSVARNAME = 161, EXCLAMATION = 162, LCURLY = 163, RCURLY = 164, CONSTANT_HEX_BYTE = 165, CONSTANT_HEX_LONG = 166, CONSTANT_HEX_LONG64 = 167, CONSTANT_HEX_INT = 168, CONSTANT_HEX_I = 169, CONSTANT_HEX_ULONG = 170, CONSTANT_HEX_ULONG64 = 171, CONSTANT_HEX_UI = 172, CONSTANT_HEX_UINT = 173, CONSTANT_BYTE = 174, CONSTANT_LONG = 175, CONSTANT_LONG64 = 176, CONSTANT_INT = 177, CONSTANT_I = 178, CONSTANT_ULONG = 179, CONSTANT_ULONG64 = 180, CONSTANT_UI = 181, CONSTANT_UINT = 182, CONSTANT_OCT_BYTE = 183, CONSTANT_OCT_LONG = 184, CONSTANT_OCT_LONG64 = 185, CONSTANT_OCT_INT = 186, CONSTANT_OCT_I = 187, CONSTANT_OCT_ULONG = 188, CONSTANT_OCT_ULONG64 = 189, CONSTANT_OCT_UI = 190, CONSTANT_OCT_UINT = 191, CONSTANT_FLOAT = 192, CONSTANT_DOUBLE = 193, CONSTANT_BIN_BYTE = 194, CONSTANT_BIN_LONG = 195, CONSTANT_BIN_LONG64 = 196, CONSTANT_BIN_INT = 197, CONSTANT_BIN_I = 198, CONSTANT_BIN_ULONG = 199, CONSTANT_BIN_ULONG64 = 200, CONSTANT_BIN_UI = 201, CONSTANT_BIN_UINT = 202, ASTERIX = 203, DOT = 204, STRING_LITERAL = 205, POW = 206, MATRIX_OP1 = 207, MATRIX_OP2 = 208, PLUS = 209, MINUS = 210, LTMARK = 211, GTMARK = 212, LOG_NEG = 213, LOG_AND = 214, LOG_OR = 215, QUESTION = 216, STRING = 217, INCLUDE = 218, EOL = 219, W = 220, D = 221, L = 222, H = 223, O = 224, B = 225, EXP = 226, DBL_E = 227, DBL = 228, CONSTANT_OR_STRING_LITERAL = 229, COMMENT = 230, END_MARKER = 231, WHITESPACE = 232, SKIP_LINES = 233, CONT_STATEMENT = 234, END_OF_LINE = 235, MAX_TOKEN_NUMBER = 236, NULL_TREE_LOOKAHEAD = 3 }; #ifdef __cplusplus }; #endif #endif /*INC_GDLTreeParserTokenTypes_hpp_*/ gdl-0.9.4/src/basic_fun_cl.cpp0000664000175000017500000003704112220134771014630 0ustar marcmarc/*************************************************************************** basic_fun.cpp - basic GDL library function ------------------- begin : March 14 2004 copyright : (C) 2004 by Christopher Lee email : leec_gdl@publius.co.uk ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifdef HAVE_CONFIG_H #include #else // default: assume we have netCDF #define USE_NETCDF 1 // default: assume we have ImageMagick #define USE_MAGICK 1 #endif #include "includefirst.hpp" #include #include #include #include #include #include #include #include #include "initsysvar.hpp" #include "datatypes.hpp" #include "envt.hpp" //#include "dpro.hpp" //#include "dinterpreter.hpp" #include "basic_fun_cl.hpp" //#include "terminfo.hpp" #define MAX_DATE_STRING_LENGTH 80 #ifdef _MSC_VER #include "gtdhelper.hpp" #else #include #endif namespace lib { using namespace std; using namespace antlr; BaseGDL* magick_exists(EnvT *e) { #ifdef USE_MAGICK return new DIntGDL(1); #else return new DIntGDL(0); #endif } BaseGDL* ncdf_exists(EnvT* e) { #ifdef USE_NETCDF return new DIntGDL(1); #else return new DIntGDL(0); #endif } double Gregorian2Julian(struct tm *ts) { double jd; // SA: gives bad results, e.g.: // IDL> print, systime(/julian), f='(G)' // 2454995.131712963 // GDL> print, systime(/julian), f='(G)' // 2454994.527534722 // // jd = 367.0*(1900.+ts->tm_year) // - (7.0*((1900.+ts->tm_year) + ((1+ts->tm_mon+9.0)/12.0))/4.0) // + (275.0*(1+ts->tm_mon)/9.0)+ts->tm_mday // + (ts->tm_hour + (ts->tm_min + ts->tm_sec/60.0)/60.0)/24.0 // + 1721013.5; // // SA: an alterntive from the NOVAS library // (http://aa.usno.navy.mil/software/novas/novas_c/novasc_info.php) jd = ts->tm_mday - 32075L + 1461L * (ts->tm_year + 1900 + 4800L + (1 + ts->tm_mon - 14L) / 12L) / 4L + 367L * (1 + ts->tm_mon - 2L - (1 + ts->tm_mon - 14L) / 12L * 12L) / 12L - 3L * ((1900 + ts->tm_year + 4900L + (1 + ts->tm_mon - 14L) / 12L) / 100L) / 4L + (ts->tm_hour + (ts->tm_min + ts->tm_sec/60.0)/60.0)/24.0 - .5; // SA: end of modifications, the code below was here before if ((100.0*(1900.+ts->tm_year) + 1+ts->tm_mon - 190002.5) < 0) jd=jd+1.0; return jd; } BaseGDL* systime(EnvT* e) { struct timeval tval; struct timezone tzone; /*get the time before doing anything else, this hopefully gives a more meaningful "time" than if the t=time(0) call came after an arbitary number of conditional statements.*/ // cout << "lib::systime: " << t << endl; gettimeofday(&tval,&tzone); double tt = tval.tv_sec+tval.tv_usec/1e+6; // time in UTC seconds SizeT nParam=e->NParam(0); //,"SYSTIME"); bool ret_seconds=false; Guard v_guard; Guard v1_guard; if (nParam == 1) { //1 parameter, // 1->current UTC time seconds // default DIntGDL* v = static_cast(e->GetParDefined(0)->Convert2(GDL_INT,BaseGDL::COPY)); v_guard.Reset( v); // e->Guard(v); if ( (*v)[0] == 1) //->EqualNoDelete( static_cDIntGDL(1))) ret_seconds=true; } else if (nParam == 2) { if (e->KeywordSet("JULIAN")) e->Throw("Conflicting keywords."); //2 parameters //if the first param is 0, return the date of the second arg //if the first param is 1, return the 'double' of the second arg DIntGDL* v1 = static_cast(e->GetParDefined(0)->Convert2(GDL_INT,BaseGDL::COPY)); v_guard.Reset( v1); // e->Guard(v1); DDoubleGDL* v2 = static_cast(e->GetParDefined(1)->Convert2(GDL_DOUBLE,BaseGDL::COPY)); if( (*v1)[0] == 0) { //v1->EqualNoDelete( DIntGDL(0))) { //0, read the second argument as time_t; tval.tv_sec = static_cast((*v2)[0]); tval.tv_usec = static_cast(((*v2)[0]-tval.tv_sec)*1e+6); delete v2; // we delete v2 here as it is not guarded. Avoids a "new" in the following "else" } else { //1 return v2; } } //return the variable in seconds, either JULIAN, JULIAN+UTC, //or no other keywords struct tm *tstruct; if( ret_seconds || e->KeywordSet("SECONDS") ) { if( e->KeywordSet("JULIAN") ) { if( e->KeywordSet("UTC") ) tstruct=gmtime((time_t *)&tval.tv_sec); else tstruct=localtime((time_t *)&tval.tv_sec); return new DDoubleGDL(Gregorian2Julian(tstruct)); } else { // does not (necessaryly) work: time might count backwards //double tickTime = static_cast(t) + tt - floor( tt); return new DDoubleGDL(static_cast(tt)); } } //return a string of the time, either UTC or local (default) if(e->KeywordSet("UTC")) tstruct= gmtime((time_t *)&tval.tv_sec); else tstruct= localtime((time_t *)&tval.tv_sec); //Convert the time to JULIAN or NOT if(e->KeywordSet("JULIAN")) return new DDoubleGDL(Gregorian2Julian(tstruct)); else { char st[MAX_DATE_STRING_LENGTH]; // char *st=new char[MAX_DATE_STRING_LENGTH]; // ArrayGuard stGuard( st); const char *format="%a %h %d %T %Y";//my IDL date format. DStringGDL *S; SizeT res=strftime(st,MAX_DATE_STRING_LENGTH,format,tstruct); if(res != 0) S=new DStringGDL(st); else S=new DStringGDL(""); //delete st; should have been delete[] return S; } } BaseGDL* legendre(EnvT* e) { Guard x_guard; Guard l_guard; Guard m_guard; SizeT nParam=e->NParam(2); //, "LEGENDRE"); Guard guard; int count; BaseGDL* xvals,* lvals,* mvals; xvals= e->GetParDefined(0); //,"LEGENDRE"); SizeT nEx,nEl, nEm,nmin; nEl=0; nEm=0; nEx=xvals->N_Elements(); if(nEx == 0) e->Throw( "Variable is undefined: " +e->GetParString(0)); lvals=e->GetParDefined(1); //,"LEGENDRE"); nEl=lvals->N_Elements(); if(nEl == 0) e->Throw( "Variable is undefined: " +e->GetParString(1)); if(nParam > 2) { mvals=e->GetParDefined(2); //,"LEGENDRE"); nEm=mvals->N_Elements(); } else { mvals=new DIntGDL(0); nEm=1; guard.Reset(mvals); } if(nEm == 0) e->Throw( "Variable is undefined: " +e->GetParString(2)); nmin=nEx; if(nEl < nmin && nEl > 1) nmin=nEl; if(nEm < nmin && nEm > 1) nmin=nEm; if (xvals->Type() == GDL_STRING) { e->Throw( "String expression not allowed in this context: " +e->GetParString(0)); } else if (xvals->Type() == GDL_PTR) { e->Throw( "Pointer expression not allowed in this context: " +e->GetParString(0)); } else if (xvals->Type() == GDL_OBJ) { e->Throw( "Object expression not allowed in this context: " +e->GetParString(0)); } else if (xvals->Type() == GDL_STRUCT) { e->Throw( "Struct expression not allowed in this context: " +e->GetParString(0)); } else if(xvals->Type() == GDL_COMPLEX || xvals->Type() == GDL_COMPLEXDBL) { e->Throw( "Complex Legendre not implemented: "); } else { //byte, int, long float, double, uint, ulong, int64, uint64 DDoubleGDL* res; DDoubleGDL* x_cast; DIntGDL* l_cast,*m_cast; if(xvals->Type() == GDL_DOUBLE) x_cast= static_cast(xvals); else { x_cast= static_cast(xvals->Convert2(GDL_DOUBLE,BaseGDL::COPY)); x_guard.Reset(x_cast);//e->Guard( x_cast); } //lval check if (lvals->Type() == GDL_STRING) e->Throw( "String expression not allowed in this context: " +e->GetParString(1)); else if (lvals->Type() == GDL_PTR) e->Throw( "Pointer expression not allowed in this context: " +e->GetParString(1)); else if (lvals->Type() == GDL_OBJ) e->Throw( "Object expression not allowed in this context: " +e->GetParString(1)); else if (lvals->Type() == GDL_STRUCT) e->Throw( "Struct expression not allowed in this context: " +e->GetParString(1)); else if(lvals->Type() == GDL_COMPLEX || lvals->Type() == GDL_COMPLEXDBL) e->Throw( "Complex Legendre not implemented: "); else if(lvals->Type() == GDL_INT) l_cast=static_cast(lvals); else { l_cast=static_cast(lvals->Convert2(GDL_INT,BaseGDL::COPY)); l_guard.Reset(l_cast);//e->Guard( l_cast); } //mval check if (mvals->Type() == GDL_STRING) e->Throw( "String expression not allowed in this context: " +e->GetParString(2)); else if (mvals->Type() == GDL_PTR) e->Throw( "Pointer expression not allowed in this context: " +e->GetParString(2)); else if (mvals->Type() == GDL_OBJ) e->Throw( "Object expression not allowed in this context: " +e->GetParString(2)); else if (mvals->Type() == GDL_STRUCT) e->Throw( "Struct expression not allowed in this context: " +e->GetParString(2)); else if(mvals->Type() == GDL_COMPLEX || mvals->Type() == GDL_COMPLEXDBL) e->Throw( "Complex Legendre not implemented: "); else if(mvals->Type() == GDL_INT) m_cast=static_cast(mvals); else { m_cast=static_cast(mvals->Convert2(GDL_INT,BaseGDL::COPY)); //e->Guard( m_cast); m_guard.Reset(m_cast); } //x,m,l are converted to the correct format (double, int, int) here //make the result array have the same size as the smallest x,m,l array if(nmin == nEx) res=new DDoubleGDL(xvals->Dim(),BaseGDL::NOZERO); else if(nmin == nEl) res=new DDoubleGDL(lvals->Dim(),BaseGDL::NOZERO); else if(nmin == nEm) res=new DDoubleGDL(mvals->Dim(),BaseGDL::NOZERO); for (count=0;count nEx?0:count]; DInt lNow = (*l_cast)[nmin > nEl?0:count]; DInt mNow = (*m_cast)[nmin > nEm?0:count]; if( xNow < -1.0 || xNow > 1.0) e->Throw( "Argument X must be in the range [-1.0, 1.0]"); if( lNow < 0) e->Throw( "Argument L must be greater than or equal to zero."); if( mNow < -lNow || mNow > lNow) e->Throw( "Argument M must be in the range [-L, L]."); if( mNow >= 0) (*res)[count]= gsl_sf_legendre_Plm( lNow, mNow, xNow); else { mNow = -mNow; int addIx = lNow+mNow; DDouble mul = 1.0; DDouble dD = static_cast( lNow-mNow+1); for( int d=lNow-mNow+1; d<=addIx; ++d) { mul *= dD; dD += 1.0; } DDouble Pm = gsl_sf_legendre_Plm( lNow, mNow, xNow); if( mNow % 2 == 1) Pm = -Pm; (*res)[count] = Pm / mul; } } //convert things back if(xvals->Type() != GDL_DOUBLE && !e->KeywordSet("DOUBLE")) { return res->Convert2(GDL_FLOAT,BaseGDL::CONVERT); } else { return res; } } return new DByteGDL(0); } // Gamma, LnGamma, IGamma and Beta are now in math_fun_gm.cpp // I rewrite them because they had many bugs (gregory.marchal_at_obspm.fr) BaseGDL* gsl_exp(EnvT* e) { Guard cdr_guard; Guard cd_guard; Guard d_guard; Guard fr_guard; SizeT nParam = e->NParam(1); BaseGDL* v=e->GetParDefined(0); size_t nEl = v->N_Elements(); size_t i; if (v->Type() == GDL_STRING) { e->Throw( "String expression not allowed in this context: " +e->GetParString(0)); } else if (v->Type() == GDL_PTR) { e->Throw( "Pointer expression not allowed in this context: " +e->GetParString(0)); } else if (v->Type() == GDL_OBJ) { e->Throw( "Object expression not allowed in this context: " +e->GetParString(0)); } else if (v->Type() == GDL_STRUCT) { e->Throw( "Struct expression not allowed in this context: " +e->GetParString(0)); } else { // DDoubleGDL* d; DDoubleGDL* dr = new DDoubleGDL(v->Dim(), BaseGDL::NOZERO); // e->Guard( dr); if(v->Type() == GDL_COMPLEX) { DComplexDblGDL* cd= static_cast(v->Convert2(GDL_COMPLEXDBL, BaseGDL::COPY)); cd_guard.Reset(cd);//e->Guard( cd); DComplexDblGDL* cdr = new DComplexDblGDL(v->Dim(), BaseGDL::NOZERO); cdr_guard.Reset(cdr);//e->Guard( cdr); if(nEl == 1) (*cdr)[0]= DComplex((gsl_sf_exp((*cd)[0].real())*cos((*cd)[0].imag())), (gsl_sf_exp((*cd)[0].real())*sin((*cd)[0].imag()))); else for(i=0;i(cdr->Convert2(GDL_COMPLEX,BaseGDL::COPY)); } else if(v->Type() == GDL_COMPLEXDBL) { DComplexDblGDL* cd= static_cast(v->Convert2(GDL_COMPLEXDBL, BaseGDL::COPY)); cd_guard.Reset(cd);//e->Guard( cd); DComplexDblGDL* cdr = new DComplexDblGDL(v->Dim(), BaseGDL::NOZERO); if(nEl == 1) (*cdr)[0]= DComplex((gsl_sf_exp((*cd)[0].real())*cos((*cd)[0].imag())), (gsl_sf_exp((*cd)[0].real())*sin((*cd)[0].imag()))); else for(i=0;iType() == GDL_DOUBLE) { DDoubleGDL* d=static_cast(v->Convert2(GDL_DOUBLE, BaseGDL::COPY)); d_guard.Reset(d);//e->Guard( d); if(nEl == 1) (*dr)[0]=gsl_sf_exp((*d)[0]); else for (i=0;iType() == GDL_FLOAT || v->Type() == GDL_INT || v->Type() == GDL_LONG) { DFloatGDL *fr=new DFloatGDL(v->Dim(), BaseGDL::NOZERO); fr_guard.Reset(fr);//e->Guard( fr); DDoubleGDL* d=static_cast(v->Convert2(GDL_DOUBLE, BaseGDL::COPY)); d_guard.Reset(d);//e->Guard( d); if(nEl == 1) (*dr)[0]=gsl_sf_exp((*d)[0]); else for (i=0;i(dr->Convert2(GDL_FLOAT,BaseGDL::COPY)); } } assert(false); return NULL; } } // namespace gdl-0.9.4/src/ncdf_att_cl.cpp0000664000175000017500000004312712156375370014475 0ustar marcmarc/*************************************************************************** ncdf_cl.cpp - NetCDF GDL library function ------------------- begin : March 24 2004 copyright : (C) 2004 by Christopher Lee email : leec_gdl@publius.co.uk ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #ifdef HAVE_CONFIG_H # include #else // default: assume we have netCDF # define USE_NETCDF 1 #endif #ifdef USE_NETCDF # include "includefirst.hpp" # define HDF 1 # include # include # include # include # include # include # include # include "datatypes.hpp" # include "math_utl.hpp" # include "envt.hpp" # include "dpro.hpp" # include "dinterpreter.hpp" # include "ncdf_cl.hpp" # include "terminfo.hpp" # include "typedefs.hpp" //# define GDL_DEBUG # undef GDL_DEBUG namespace lib { using namespace std; using namespace antlr; template void ncdf_att_handle_error(EnvT *e, int status, const char *function,T* data) // {{{ { if (data != NULL and status != NC_NOERR) delete data; ncdf_handle_error(e, status, function); } // }}} BaseGDL* ncdf_attname(EnvT* e) // {{{ { size_t nParam=e->NParam(2); if (nParam ==3 && e->KeywordSet(0)) e->Throw("Specifying both GLOBAL keyword an variable id not allowed"); int status; char att_name[NC_MAX_NAME]; DLong cdfid, varid,attnum; varid=0; attnum=0; DString attname; e->AssureLongScalarPar(0, cdfid); if (e->KeywordSet(0)) { e->AssureLongScalarPar(1, attnum); varid = NC_GLOBAL; } else { // Check type of varid BaseGDL* p1 = e->GetParDefined( 1); if (p1->Type() != GDL_STRING) { // Numeric e->AssureLongScalarPar(1, varid); } else { // String DString var_name; e->AssureScalarPar(1, var_name); status=nc_inq_varid(cdfid, var_name.c_str(), &varid); ncdf_handle_error(e,status,"NCDF_ATTNAME"); } e->AssureLongScalarPar(2, attnum); } //get the att_name variable. status=nc_inq_attname(cdfid, varid, attnum, att_name); if (status == NC_ENOTATT) { Warning("NCDF_ATTNAME: Attribute " + i2s(attnum) + " not found."); return new DStringGDL(""); } //handle the error ncdf_handle_error(e,status,"NCDF_ATTNAME"); return new DStringGDL(att_name); } // }}} BaseGDL* ncdf_attinq(EnvT* e) // {{{ { size_t nParam=e->NParam(2); if(nParam ==3 && e->KeywordSet(0)) { throw GDLException(e->CallingNode(), "NCDF_ATTINQ: The error is Global + varid, not allowed, proper text to come."); } else{ int status; nc_type att_type; size_t length; DString attname; DLong cdfid, varid; varid=0; e->AssureLongScalarPar(0, cdfid); if(e->KeywordSet(0)) { e->AssureStringScalarPar(1, attname); varid=NC_GLOBAL; } else { // Check type of varid BaseGDL* p1 = e->GetParDefined( 1); if (p1->Type() != GDL_STRING) { // Numeric e->AssureLongScalarPar(1, varid); } else { // String DString var_name; e->AssureScalarPar(1, var_name); status=nc_inq_varid(cdfid, var_name.c_str(), &varid); ncdf_handle_error(e,status,"NCDF_ATTNAME"); } e->AssureStringScalarPar(2, attname); } //get the attinq data status=nc_inq_att(cdfid, varid, attname.c_str(), &att_type, &length); //handle the error ncdf_handle_error(e,status,"NCDF_ATTNAME"); // $ is necessary here (see dstructgdl.cpp) DStructDesc* ncdf_attinq=new DStructDesc("$truct"); SpDLong aLong; SpDString aString; ncdf_attinq->AddTag("DATATYPE", &aString); ncdf_attinq->AddTag("LENGTH", &aLong); // never for unnamed structs: //structList.push_back(ncdf_attinq); DStructGDL* inq=new DStructGDL(ncdf_attinq,dimension()); inq->InitTag("DATATYPE",ncdf_gdl_typename(att_type)); inq->InitTag("LENGTH", DLongGDL(length)); return inq; } } // }}} void ncdf_attget(EnvT* e) // {{{ { size_t nParam=e->NParam(2); if (nParam >3 && e->KeywordSet(0)) e->Throw("The error is Global + varid, not allowed, proper text to come."); int status; nc_type att_type; size_t length; DString attname; DLong cdfid, varid; e->AssureLongScalarPar(0, cdfid); if (e->KeywordSet(0)) { e->AssureStringScalarPar(1, attname); varid = NC_GLOBAL; } else { // Check type of varid BaseGDL* p1 = e->GetParDefined( 1); if (p1->Type() != GDL_STRING) { // Numeric e->AssureLongScalarPar(1, varid); } else { // String DString var_name; e->AssureScalarPar(1, var_name); status=nc_inq_varid(cdfid, var_name.c_str(), &varid); ncdf_handle_error(e,status,"NCDF_ATTGET"); } e->AssureStringScalarPar(2, attname); } //attname, varid, cdfid are set up //get the attinq data status=nc_inq_att(cdfid, varid, attname.c_str(), &att_type, &length); //handle the error ncdf_handle_error(e,status,"NCDF_ATTGET"); if (att_type == NC_CHAR) { DByteGDL* temp = new DByteGDL(dimension(length)); status = nc_get_att_text(cdfid, varid, attname.c_str(), (char*)(&((*temp)[0]))); ncdf_handle_error(e, status, "NCDF_ATTGET"); delete e->GetParGlobal(nParam-1); e->GetParGlobal(nParam-1)=temp; } else { dimension dim(length); BaseGDL* temp; switch (att_type) { case NC_INT : { int *ip = new int[length]; status=nc_get_att_int(cdfid, varid, attname.c_str(), ip); ncdf_att_handle_error(e, status, "NCDF_ATTGET", ip); temp = length == 1 ? new DLongGDL(BaseGDL::NOZERO) : new DLongGDL(dim, BaseGDL::NOZERO); memcpy(&(*static_cast(temp))[0], &(*ip), length * sizeof(int)); delete ip; break; } case NC_SHORT : { short *sp = new short[length]; status = nc_get_att_short(cdfid, varid, attname.c_str(), sp); ncdf_att_handle_error(e, status, "NCDF_ATTGET", sp); temp = length == 1 ? new DIntGDL(BaseGDL::NOZERO) : new DIntGDL(dim, BaseGDL::NOZERO); memcpy(&(*static_cast(temp))[0], &(*sp), length * sizeof(DInt)); delete sp; break; } case NC_FLOAT : { float *fp = new float[length]; status=nc_get_att_float(cdfid, varid, attname.c_str(), fp); ncdf_att_handle_error(e,status,"NCDF_ATTGET",fp); temp = length == 1 ? new DFloatGDL(BaseGDL::NOZERO) : new DFloatGDL(dim, BaseGDL::NOZERO); memcpy(&(*static_cast(temp))[0], &(*fp), length * sizeof(DFloat)); delete fp; break; } case NC_DOUBLE : { double *dp = new double[length]; status = nc_get_att_double(cdfid, varid, attname.c_str(), dp); ncdf_att_handle_error(e, status, "NCDF_ATTGET", dp); temp = length == 1 ? new DDoubleGDL(BaseGDL::NOZERO) : new DDoubleGDL(dim, BaseGDL::NOZERO); memcpy(&(*static_cast(temp))[0], &(*dp), length * sizeof(DDouble)); delete dp; break; } case NC_BYTE : { unsigned char *bp = new unsigned char[length]; status = nc_get_att_uchar(cdfid, varid, attname.c_str(), bp); ncdf_att_handle_error(e, status, "NCDF_ATTGET", bp); temp = length == 1 ? new DByteGDL(BaseGDL::NOZERO) : new DByteGDL(dim, BaseGDL::NOZERO); memcpy(&(*static_cast(temp))[0], &(*bp), length * sizeof(DByte)); delete bp; break; } } GDLDelete(e->GetParGlobal(nParam - 1)); e->GetParGlobal(nParam - 1) = temp; } } // }}} void ncdf_attput(EnvT* e) // {{{ { size_t N_Params=e->NParam(3); int status, val_num; nc_type xtype; BaseGDL* at;//name DString attname; BaseGDL* val;//value; //get the cdfid, which must be given. DLong cdfid, varid; e->AssureLongScalarPar(0, cdfid); varid=0; if(e->KeywordSet(0)) { e->AssureStringScalarPar(1, attname); val=e->GetParDefined(2); val_num=2; varid=NC_GLOBAL; } else { // Check type of varid BaseGDL* p1 = e->GetParDefined( 1); if (p1->Type() != GDL_STRING) { // Numeric e->AssureLongScalarPar(1, varid); } else { // String DString var_name; e->AssureScalarPar(1, var_name); status=nc_inq_varid(cdfid, var_name.c_str(), &varid); ncdf_handle_error(e,status,"NCDF_ATTPUT"); } e->AssureStringScalarPar(2, attname); val=e->GetParDefined(3); val_num=3; } //we have the cdfid, varid, attname, attval here //determine default data type xtype = NC_FLOAT; if (val->Type() == GDL_BYTE) xtype=NC_BYTE; if (val->Type() == GDL_STRING) xtype=NC_CHAR; if (val->Type() == GDL_INT) xtype=NC_SHORT; if (val->Type() == GDL_LONG) xtype=NC_INT; if (val->Type() == GDL_FLOAT) xtype=NC_FLOAT; if (val->Type() == GDL_DOUBLE) xtype=NC_DOUBLE; // SA: TODO: GDL_UINT, GDL_ULONG, GDL_COMPLEX, GDL_PTR... if(e->KeywordSet(2)) //GDL_BYTE xtype=NC_BYTE; else if(e->KeywordSet(3)) //CHAR xtype=NC_CHAR; else if(e->KeywordSet(4)) //GDL_DOUBLE xtype=NC_DOUBLE; else if(e->KeywordSet(5)) //GDL_FLOAT xtype=NC_FLOAT; else if(e->KeywordSet(6)) //GDL_LONG xtype=NC_INT; else if(e->KeywordSet(7)) //SHORT xtype=NC_SHORT; // LENGTH keyword support DLong length; if (val->Type() != GDL_STRING) { length = val->N_Elements(); e->AssureLongScalarKWIfPresent(1, length); if (length > val->N_Elements()) e->Throw("LENGTH keyword value (" + i2s(length) + ") exceedes the data length (" + i2s(val->N_Elements()) + ")"); } if(val->Type() == GDL_BYTE) { DByteGDL * bvar=static_cast(val); status=nc_put_att_uchar(cdfid,varid, attname.c_str(),xtype, (size_t)length, (const unsigned char *)&(*bvar)[0]); } else if(val->Type() == GDL_STRING) { DString cvar; e->AssureScalarPar(val_num,cvar); length = cvar.length(); e->AssureLongScalarKWIfPresent(1, length); if (length > cvar.length()) e->Throw("LENGTH keyword value (" + i2s(length) + ") exceedes the data length (" + i2s(cvar.length()) + ")"); if (length < cvar.length()) cvar.resize(length); status=nc_put_att_text(cdfid,varid, attname.c_str(), cvar.length(), (char *)cvar.c_str()); } else if(val->Type() == GDL_INT) { DIntGDL * ivar=static_cast(val); status=nc_put_att_short(cdfid,varid, attname.c_str(), xtype, (size_t)length, &(*ivar)[0]); } else if(val->Type() == GDL_LONG) { DLongGDL * lvar=static_cast(val); status=nc_put_att_int(cdfid,varid, attname.c_str(),xtype, (size_t)length, &(*lvar)[0]); } else if(val->Type() == GDL_FLOAT) { DFloatGDL * fvar=static_cast(val); status=nc_put_att_float(cdfid,varid, attname.c_str(),xtype, (size_t)length, &(*fvar)[0]); } else if(val->Type() == GDL_DOUBLE) { DDoubleGDL * dvar=static_cast(val); status=nc_put_att_double(cdfid,varid, attname.c_str(),xtype, (size_t)length, &(*dvar)[0]); } ncdf_handle_error(e, status,"NCDF_ATTPUT"); return; } // }}} BaseGDL* ncdf_attcopy(EnvT* e) // {{{ { size_t nParam=e->NParam(3); int status,add; //incdf DLong integer,incdf,outcdf,invar,outvar; e->AssureLongScalarPar(0, incdf); add=0; if(e->KeywordSet(0)) //in_global invar=NC_GLOBAL; if(e->KeywordSet(1)) //out_global outvar=NC_GLOBAL; if(e->KeywordSet(0) && e->KeywordSet(1) && nParam > 3) { throw GDLException(e->CallingNode(), "NCDF_ATTCOPY: Too many variables error 1"); } else if((e->KeywordSet(0) || e->KeywordSet(1)) && nParam > 4) { throw GDLException(e->CallingNode(), "NCDF_ATTCOPY: Too many variables error 2"); } else if(e->KeywordSet(0) && !e->KeywordSet(1) && nParam == 4) { e->AssureLongScalarPar(2, outcdf); // Check type of varid BaseGDL* p3 = e->GetParDefined( 3); if (p3->Type() != GDL_STRING) { // Numeric e->AssureLongScalarPar(3, outvar); } else { // String DString var_name; e->AssureScalarPar(3, var_name); status=nc_inq_varid(outcdf, var_name.c_str(), &outvar); ncdf_handle_error(e,status,"NCDF_ATTCOPY"); } } else if(!e->KeywordSet(0) && e->KeywordSet(1) && nParam == 4) { // Check type of varid BaseGDL* p1 = e->GetParDefined( 1); if (p1->Type() != GDL_STRING) { // Numeric e->AssureLongScalarPar(1, invar); } else { // String DString var_name; e->AssureScalarPar(1, var_name); status=nc_inq_varid(incdf, var_name.c_str(), &invar); ncdf_handle_error(e,status,"NCDF_ATTCOPY"); } } else if(!e->KeywordSet(0) && !e->KeywordSet(1) && nParam == 5) { e->AssureLongScalarPar(3, outcdf); // Check type of varid BaseGDL* p1 = e->GetParDefined( 1); if (p1->Type() != GDL_STRING) { // Numeric e->AssureLongScalarPar(1, invar); } else { // String DString var_name; e->AssureScalarPar(1, var_name); status=nc_inq_varid(incdf, var_name.c_str(), &invar); ncdf_handle_error(e,status,"NCDF_ATTCOPY"); } // Check type of varid BaseGDL* p4 = e->GetParDefined( 4); if (p4->Type() != GDL_STRING) { // Numeric e->AssureLongScalarPar(4, outvar); } else { // String DString var_name; e->AssureScalarPar(4, var_name); status=nc_inq_varid(outcdf, var_name.c_str(), &outvar); ncdf_handle_error(e,status,"NCDF_ATTCOPY"); } } //Here, //we have, incdf, invar, outvar DString name; if(!e->KeywordSet(0)) add=1; e->AssureStringScalarPar(1+add, name); //name //outcdf e->AssureLongScalarPar(2+add, outcdf); //All variables are done. status=nc_copy_att(incdf,invar, name.c_str(), outcdf,outvar); ncdf_handle_error(e, status,"NCDF_ATTCOPY"); if(status == NC_NOERR) return new DIntGDL(outvar); return new DIntGDL(-1); } // }}} void ncdf_attdel(EnvT* e) // {{{ { size_t nParam=e->NParam(2); int status; BaseGDL* at;//name DString attname; BaseGDL* val;//value; //get the cdfid, which must be given. DLong cdfid, varid; e->AssureLongScalarPar(0, cdfid); varid=0; if(e->KeywordSet(0) && nParam == 3) { throw GDLException(e->CallingNode(), "NCDF_ATTDEL: Too many variables error 1"); } else if(!e->KeywordSet(0) && nParam == 2) { throw GDLException(e->CallingNode(), "NCDF_ATTDEL: Not enough variables error 2"); } else if(e->KeywordSet(0)) //global { e->AssureStringScalarPar(1, attname); varid=NC_GLOBAL; } else { BaseGDL* p1 = e->GetParDefined( 1); if (p1->Type() != GDL_STRING) { // Numeric e->AssureLongScalarPar(1, varid); } else { // String DString var_name; e->AssureScalarPar(1, var_name); status=nc_inq_varid(cdfid, var_name.c_str(), &varid); ncdf_handle_error(e,status,"NCDF_ATTNAME"); } e->AssureStringScalarPar(2, attname); } //we have the cdfid, varid, attname status=nc_del_att(cdfid,varid,attname.c_str()); ncdf_handle_error(e, status,"NCDF_ATTDEL"); return; } // }}} void ncdf_attrename(EnvT* e) // {{{ { size_t nParam=e->NParam(3); int status; BaseGDL* at;//name DString attname; DString newname; BaseGDL* val;//value; //get the cdfid, which must be given. DLong cdfid, varid; e->AssureLongScalarPar(0, cdfid); varid=0; if(e->KeywordSet(0) && nParam == 4) { throw GDLException(e->CallingNode(), "NCDF_ATTRENAME: Too many variables error 1"); } else if(!e->KeywordSet(0) && nParam == 3) { throw GDLException(e->CallingNode(), "NCDF_ATTRENAME: Not enough variables error 2"); } else if(e->KeywordSet(0)) //global { e->AssureStringScalarPar(1, attname); e->AssureStringScalarPar(2, newname); varid=NC_GLOBAL; } else { // Check type of varid BaseGDL* p1 = e->GetParDefined( 1); if (p1->Type() != GDL_STRING) { // Numeric e->AssureLongScalarPar(1, varid); } else { // String DString var_name; e->AssureScalarPar(1, var_name); status=nc_inq_varid(cdfid, var_name.c_str(), &varid); ncdf_handle_error(e,status,"NCDF_ATTNAME"); } e->AssureStringScalarPar(2, attname); e->AssureStringScalarPar(3, newname); } //we have the cdfid, varid, attname,newname status=nc_rename_att(cdfid,varid, attname.c_str(), newname.c_str()); ncdf_handle_error(e, status,"NCDF_ATTRENAME"); return; } // }}} } #endif gdl-0.9.4/src/print.cpp0000664000175000017500000001611112162632107013351 0ustar marcmarc/*************************************************************************** print.cpp - GDL PRINT(F) functions ------------------- begin : July 22 2002 copyright : (C) 2002 by Marc Schellens email : m_schellens@users.sf.net ***************************************************************************/ /*************************************************************************** * * * 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. * * * ***************************************************************************/ #include "includefirst.hpp" #include #include "datatypes.hpp" #include "envt.hpp" #include "getfmtast.hpp" #include "basic_pro.hpp" #include "objects.hpp" #include "FMTOut.hpp" #include "terminfo.hpp" #include "gdljournal.hpp" #include "dinterpreter.hpp" #ifndef MSG_NOSIGNAL #define MSG_NOSIGNAL 0x2000 #endif namespace lib { using namespace std; void print_vmsCompat( EnvT* e, int* parOffset) { // SA: handling special VMS-compatibility syntax, e.g.: print, '$(F)', 100 // (if FORMAT not defined, more than 2 params, first param is scalar string // and begins with "$(" then first param minus "$" is treated as FORMAT) if (e->GetKW(0) == NULL && e->NParam() > 1 + *parOffset) { BaseGDL* par = e->GetParDefined(*parOffset); if (par->Type() == GDL_STRING && par->Scalar() && (*static_cast(par))[0].compare(0,2,"$(") == 0) { e->SetKeyword("FORMAT", new DStringGDL((*static_cast(par))[0].c_str()+1)); (*parOffset)++; } } } void printf( EnvT* e) { SizeT nParam=e->NParam(); if( nParam < 1) e->Throw( "Incorrect number of arguments."); DLong lun; e->AssureLongScalarPar( 0, lun); ostream* os; ostringstream oss; bool stdLun = check_lun( e, lun); SizeT width; int sockNum = -1; if( stdLun) { if( lun == 0) e->Throw( "Cannot write to stdin. Unit: "+i2s( lun)); os = (lun == -1)? &cout : &cerr; width = TermWidth(); } else { if( fileUnits[ lun-1].F77()) e->Throw( "Formatted IO not allowed with F77_UNFORMATTED " "files. Unit: "+i2s( lun)); if( fileUnits[ lun-1].Xdr() != NULL) e->Throw( "Formatted IO not allowed with XDR " "files. Unit: "+i2s( lun)); sockNum = fileUnits[ lun-1].SockNum(); if (sockNum == -1) { if( fileUnits[ lun-1].Compress()) os = &fileUnits[ lun-1].OgzStream(); else os = &fileUnits[ lun-1].OStream(); } else os = &oss; width = fileUnits[ lun-1].Width(); } int parOffset = 1; print_vmsCompat(e, &parOffset); print_os( os, e, parOffset, width); // Socket send if (sockNum != -1) { int status = send(sockNum, oss.rdbuf()->str().c_str(), oss.rdbuf()->str().size(), MSG_NOSIGNAL); if (status != oss.rdbuf()->str().size()) e->Throw( "SEND error Unit: "+i2s( lun)+":"+oss.rdbuf()->str()); } if( stdLun) { GDLInterpreter* ip = e->Interpreter(); write_journal( ip->GetClearActualLine()); write_journal_comment( e, parOffset, width); } } void print( EnvT* e) { SizeT width = TermWidth(); int parOffset = 0; print_vmsCompat(e, &parOffset); print_os( &cout, e, parOffset, width); GDLInterpreter* ip = e->Interpreter(); write_journal( ip->GetClearActualLine()); write_journal_comment( e, parOffset, width); } void print_os( ostream* os, EnvT* e, int parOffset, SizeT width) { // FORMAT keyword if( e->GetKW( 0) != NULL) { DString fmtString; e->AssureScalarKW( 0, fmtString); if( fmtString != "") { try { RefFMTNode fmtAST = GetFMTAST( fmtString); #ifdef GDL_DEBUG antlr::print_tree pt; cout << "Format parser output:" << endl; pt.pr_tree(static_cast(fmtAST)); cout << "Format Parser end." << endl; #endif // formatted output ignores WIDTH FMTOut Formatter( fmtAST, os, e, parOffset); return; } catch( antlr::ANTLRException& ex) { e->Throw( ex.getMessage()); } } } //else // default-format output { int nParam = e->NParam(); if( nParam == parOffset) { (*os) << endl; return; } BaseGDL* par; bool lastParScalar = false; bool anyArrayBefore = e->GetParDefined( parOffset)->Rank() > 0; SizeT actPos = 0; for( SizeT i=parOffset; i parOffset) lastParScalar = /*par->Type() == GDL_STRING &&*/ par->Scalar(); par=e->GetParDefined( i); if (lastParScalar && anyArrayBefore && par->Rank() != 0) (*os) << endl; // e.g. print,[1],1,[1] anyArrayBefore |= par->Rank() != 0; par->ToStream( *os, width, &actPos); // debug // (*os) << flush; } bool singleNullChar = (par->Type() == GDL_STRING && !lastParScalar && (nParam-parOffset)>1 && (*static_cast(par))[0] == ""); // } if( (par->Dim().Rank() == 0 && !singleNullChar) || par->Type() == GDL_STRUCT) { (*os) << endl; } } } // SA: we're better than IDL! - we accept more than 20 parameters ;) void pm(EnvT* e) { int nParam = e->NParam(); if (nParam == 0) return; // GDL magick (based on the Python interface code) static int printIx = LibProIx("PRINT"); EnvT* env = new EnvT(NULL, libProList[printIx]); Guard env_guard(env); BaseGDL* par; env->SetNextPar(&par); // passing on the FORMAT keyword static int formatIx = e->KeywordIx("FORMAT"); if (e->GetKW(formatIx) != NULL) { if (e->GetKW(formatIx)->Rank() != 0) e->Throw("FORMAT keyword must be a scalar"); env->SetKeyword("FORMAT", &e->GetKW(formatIx)); } // // is it needed here? MS: not anymore :-) // StackSizeGuard guard( GDLInterpreter::CallStack()); // GDLInterpreter::CallStack().push_back(env); // printing the title if TITLE keyword present static int titleIx = e->KeywordIx("TITLE"); if (e->GetKW(titleIx) != NULL) { par = e->GetKW(titleIx); static_cast(env->GetPro())->Pro()( env); } // looping over the parameters for (SizeT i = 0; i < nParam; ++i) { if (e->GetParDefined(i)->N_Elements() <= 1) { par = e->GetParDefined(i); static_cast(env->GetPro())->Pro()(static_cast(env)); } else { if (e->GetParDefined(i)->Type() == GDL_STRUCT) e->Throw("Transposing arrays of structures is undefined"); par = e->GetParDefined(i)->Transpose(NULL); static_cast(env->GetPro())->Pro()(static_cast(env)); delete par; } } } } // namespace gdl-0.9.4/src/pro/0000775000175000017500000000000012221570143012306 5ustar marcmarcgdl-0.9.4/src/pro/ploterr.pro0000664000175000017500000002257512174053013014531 0ustar marcmarc;+ ; NAME: ploterr ; ; PURPOSE: plot points with (symetrical) error bars ; ; This is a fully compatible procedure to the original one provide by ; IDL. This version contains several useful extensions (/hat, ; x_errors, _extra ...) ; ; CATEGORY: plotting ; ; CALLING SEQUENCE: ploterr [,x], y, y_error [,x_error][,psym=psym][,type=type] ; ; INPUTS: Y (mandatory) ; y_error (mandatory) ; ; OPTIONAL INPUTS: x (optional) ; x_error (optional) ; ; Inititals KEYWORD PARAMETERS (compatibles with the IDL version of PLOTERR) ; psym (default : 7) ; type (0 lin/lin, 1 log/lin, 2 lin/log 3 log/log) ; ; Extended KEYWORD PARAMETERS (specific to this version) ; for the errors bars : ; hat <-- /hat adds a small line at error bar ends ; length_of_hat <-- 1 or 2 positives values ; bar_color <-- we can plot the bars with a different color ; for the plot : ; xrange <-- explicit use of !X.range ; yrange <-- explicit use of !X.range ; xlog <-- alternative to Type Key ; ylog <-- alternative to Type Key ; _extra <-- allow to provide paramters to PLOT ; for the procedure : ; help <-- return list of keywords ; test <-- for debugging purpose ; ; OUTPUTS: none ; ; OPTIONAL OUTPUTS: none ; ; COMMON BLOCKS: none ; ; SIDE EFFECTS: none (but some PLOT variables may changed) ; ; RESTRICTIONS: - if sizes are differents, smaller size is used ; - if not enough points, no plot ; - arrays cannot be of type string ; - we convert the rrors to ABS(error) ; - take care that: ; -- if 2 vectors (in this order): Y, Yerrors ; -- if 3 vectors (in this order): X, Y, Yerrors ; -- if 4 vectors (in this order): X, Y, Yerrors, Xerrors ; ; PROCEDURE: - checks the number of input vectors ; - plot the data ; - oplot the errors ; ; EXAMPLE: see test_ploterr.pro ; ; nbp=10 & y=REPLICATE(1.,nbp) & yerr=RANDOMN(seed,10) & x=10+findgen(10)*2. ; ; ploterr, y, yerr ; ploterr, y, yerr, /hat ; ploterr, x, y, yerr ; ploterr, x, y, yerr, yerr/3., /hat ; ; MODIFICATION HISTORY: ; - 26/02/2006 created by Alain Coulais (ARSC) ; ;- ; LICENCE: ; Copyright (C) 2006, Alain Coulais ; 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. ;- ; pro PLOTERR, x, y, y_error, x_error, psym=psym, type=type, $ xrange=xrange, yrange=yrange, xlog=xlog, ylog=ylog, $ hat=hat, length_of_hat=length_of_hat, bar_color=bar_color, $ _extra=_extra, help=help, test=test ; ON_ERROR,2 ; if KEYWORD_SET(help) then begin print, 'pro PLOTERR, x, y, y_error, x_error, psym=psym, type=type, $' print, ' xrange=xrange, yrange=yrange, xlog=xlog, ylog=ylog, $' print, ' hat=hat, length_of_hat=length_of_hat, bar_color=bar_color, $' print, ' _extra=_extra, help=help, test=test' return endif ; ; we have some prefered default ; if (N_ELEMENTS(type) EQ 0) then type = 0 if (N_ELEMENTS(psym) eq 0) then psym = 7 ; ; only "y" and "err" are mandatory ; nb_inputs=N_PARAMS(0) ; if (nb_inputs LT 2) then begin mess='Must be called with 2-5 parameters: ' mess=mess+'[X,] Y, Y_ERR [,X_ERR] [,PSYM [,TYPE]] ...' message, mess return endif ; ; Here, we have ONLY Y and Y_error ; if (nb_inputs EQ 2) then begin y_new=x y_err=y nbp_y=N_ELEMENTS(y_new) nbp_ey=N_ELEMENTS(y_err) ;; the 2 missing fields nbp_x=MIN([nbp_y, nbp_ey]) nbp_ex=nbp_ey ;; we have to generate a X vector x_new=FINDGEN(nbp_x) endif ; ; We have X, Y and Y_error ; if (nb_inputs EQ 3) then begin x_new=x y_new=y y_err=ABS(y_error) nbp_x=N_ELEMENTS(x_new) nbp_y=N_ELEMENTS(y_new) nbp_ey=N_ELEMENTS(y_err) ;; only one missing field nbp_ex=nbp_ey endif ; ; a priori without X_error flag_x=0 ; We have the 4 info: X, Y, Y_error and X_error ; if (nb_inputs EQ 4) then begin ;; if we have X_error, we switch on the flag flag_x=1 x_new=x y_new=y y_err=ABS(y_error) x_err=ABS(x_error) nbp_x=N_ELEMENTS(x_new) nbp_y=N_ELEMENTS(y_new) nbp_ey=N_ELEMENTS(y_err) nbp_ex=N_ELEMENTS(x_err) endif ; ; If we may would like to check pre-processing ... ; if KEYWORD_SET(test) then STOP ; nbp_min=MIN([nbp_x,nbp_y,nbp_ey,nbp_ex]) if (nbp_min LT 2) then message, 'Not enough points to plot.' ; ; we limit the range for all array up to "nbp_min" ; if (nbp_x GT nbp_min) then x_new=x_new[0:nbp_min-1] if (nbp_y GT nbp_min) then y_new=y_new[0:nbp_min-1] if (nbp_ey GT nbp_min) then y_err=y_err[0:nbp_min-1] ; ; we need 2 arrays for the top and the bottom of Errors ; y_low=y_new-y_err y_hig=y_new+y_err ; use NaN with PLOTS to go fast! null=replicate(!values.d_nan,nbp_min) ; ; Eventually, we have also 2 arrays for X-errors if (flag_x EQ 1) then begin if (nbp_ex GT nbp_min) then x_err=x_err[0:nbp_min-1] x_low=x_new-x_err x_hig=x_new+x_err endif ; ; --------------------- ; managment of plot type ; if !{x|y}.type EQ 0 --> Lin ; if !{x|y}.type EQ 1 --> Log ; ; since GDL does not have the "xtype" and "ytype" keywords for PLOT ; As it was for GDL 0.8.11, we use instead xlog and ylog ! ; if (N_ELEMENTS(type) EQ 1) then begin if (type GT 0) then begin xlog = type/2 ylog = type and 1 endif endif ; ; Do we have a pre-set !y.range ? ; if (N_ELEMENTS(yrange) NE 2) then begin if (!y.range[0] EQ !y.range[1]) then begin yrange=[MIN(y_low), MAX(y_hig)] endif else begin yrange=!y.range endelse endif ; ; Do we have a pre-set !y.range ? ; if (N_ELEMENTS(xrange) NE 2) then begin if (!x.range[0] EQ !x.range[1]) then begin if (flag_x EQ 1) then begin xrange=[MIN(x_low), MAX(x_hig)] endif else begin xrange=[MIN(x_new),MAX(x_new)] endelse endif else begin xrange=!x.range endelse endif ; ; we now do the plot of the data themselves ! ; PLOT, x_new, y_new, xlog=xlog, ylog=ylog, $ xrange=xrange, yrange=yrange, psym=psym, _extra=_extra ; ; shall we switch to another color ? ; if (N_ELEMENTS(bar_color) EQ 1) then begin ref_color=!p.color !p.color=bar_color endif ; ; we overplot the error bars ; ; begin of basic PLOTERR feature (only on Y axis ...) ; speedup trick by GD - to be tested - x_new2=reform(transpose([[x_new],[x_new],[null]]),3*nbp_min) y_new2=reform(transpose([[y_low],[y_hig],[null]]),3*nbp_min) plots,x_new2,y_new2 ;for i=0,(nbp_min-1) do PLOTS,[x_new[i], x_new[i]], [y_low[i], y_hig[i]] ; ; end of basic PLOTERR feature ; begin of extra PLOTERR features ! ; if (flag_x EQ 1) then begin x_new3=reform(transpose([[x_low],[x_hig],[null]]),3*nbp_min) y_new3=reform(transpose([[y_new],[y_new],[null]]),3*nbp_min) plots,x_new3,y_new3 ; for i=0,(nbp_min-1) do PLOTS,[x_low[i], x_hig[i]], [y_new[i], y_new[i]] endif ; if KEYWORD_SET(hat) then begin ;; ;; we have to manage the length of the hat (Keyword length_of_hat) ;; we compute first a default and switch off a flag ;; x_half_def=(!X.crange[1]-!X.crange[0])/100. y_half_def=(!Y.crange[1]-!Y.crange[0])/100. ;; useful only if x_err ... flag_length_hat=0 ;; ;; the "length_of_hat" is the FULL length --> /2. ;; if (N_ELEMENTS(length_of_hat) EQ 1) then begin if (length_of_hat GT 0.) then begin flag_length_hat=1 x_half=length_of_hat/2. y_half=x_half ;; useful only if x_err ... endif endif if (N_ELEMENTS(length_of_hat) EQ 2) then begin if ((length_of_hat[0] GT 0.) AND (length_of_hat[1] GT 0.)) then begin flag_length_hat=1 x_half=length_of_hat[0]/2. y_half=length_of_hat[1]/2. ;; useful only if x_err ... endif endif ;; ;; what is the state of the flag ? ;; if (flag_length_hat EQ 0) then begin x_half=x_half_def y_half=y_half_def endif ;; ;; Now, since the length of the hat is known, we plot ;; ;; first we plot the Horizontal hats of the Vertical bars ;; x_hatlow=x_new-x_half x_hathig=x_new+x_half x_new4=reform(transpose([[x_hatlow],[x_hathig],[null],[x_hatlow],[x_hathig],[null]]),6*nbp_min) y_new4=reform(transpose([[y_low],[y_low],[null],[y_hig],[y_hig],[null]]),6*nbp_min) plots,x_new4,y_new4 ; for i=0,(nbp_min-1) do begin ; PLOTS,[x_hatlow[i], x_hathig[i]], [y_low[i], y_low[i]] ; PLOTS,[x_hatlow[i], x_hathig[i]], [y_hig[i], y_hig[i]] ; endfor ;; ;; second we plot the Vertical hats of the Horizontal bars ;; if (flag_x EQ 1) then begin y_hatlow=y_new-y_half y_hathig=y_new+y_half y_new5=reform(transpose([[y_hatlow],[y_hathig],[null],[y_hatlow],[y_hathig],[null]]),6*nbp_min) x_new5=reform(transpose([[x_low],[x_low],[null],[x_hig],[x_hig],[null]]),6*nbp_min) plots,x_new5,y_new5 ; for i=0,(nbp_min-1) do begin ; PLOTS,[x_low[i], x_low[i]], [y_hatlow[i], y_hathig[i]] ; PLOTS,[x_hig[i], x_hig[i]], [y_hatlow[i], y_hathig[i]] ; endfor endif endif ; if (N_ELEMENTS(bar_color) EQ 1) then !p.color=ref_color ; if KEYWORD_SET(test) then STOP ; end ; gdl-0.9.4/src/pro/file_delete.pro0000664000175000017500000000722611412332052015274 0ustar marcmarc;+ ; NAME: FILE_DELETE ; ; ; ; RESTRICTIONS: only for Unix (Unix, Linux and Mac OS X) systems ; ; MODIFICATION HISTORY: ; - April 2009: created by Alain Coulais, request by Igor C. ; - June 2010: modified by Lea Noreskal ;- ; LICENCE: ; Copyright (C) 2009, Alain Coulais ; 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. ;- ; --------------------------------- ; pro FILE_DELETE_ONE, list_of_files, allow_nonexistent=allow_nonexistent, $ quiet=quiet, verbose=verbose , recursive=recursive, $ noexpand_path=noexpand_path ; command='\rm ' option='' ; if KEYWORD_SET(allow_nonexistent) then begin option=option+'f' endif ; if KEYWORD_SET(recursive) then begin option=option+'r' endif ; if KEYWORD_SET(verbose) then begin option=option+'v' endif ; if (STRLEN(option) GT 0) then begin option='-'+option endif for ii=0,N_ELEMENTS(list_of_files)-1 do begin ; escape special char nameescp=escape_special_char(list_of_files[ii]) ; if (Not KEYWORD_SET(noexpand_path)) then begin struct=FILE_INFO(list_of_files[ii]) if(struct.exists) then nameescp=escape_special_char(struct.name) endif ; ; empty directory emptdir='' if (FILE_TEST(nameescp , /directory) and (Not KEYWORD_SET(recursive)) ) then begin res = FILE_SEARCH(list_of_files[ii] , '*' , COUNT=nb) if ((nb eq 0) and (Not KEYWORD_SET(recursive))) then begin emptdir=' -r' endif endif res = FILE_INFO(nameescp) ;if (FILE_TEST(nameescp) EQ 1) then begin if ((res.EXISTS eq 1) and (res.WRITE ne 0)) then begin SPAWN, command+option+emptdir+' '+nameescp, result, result_error if KEYWORD_SET(verbose) or NOT(KEYWORD_SET(quiet)) then print,'% FILE_DELETE: Removed file: ', nameescp ;list_of_files[ii] ;print, 'res:', result, result_error endif else begin if ((KEYWORD_SET(verbose)) or (NOT(KEYWORD_SET(allow_nonexistent) or KEYWORD_SET(quiet)))) then begin print, 'problem with =', list_of_files[ii] , ' , no existing file or forbidden deletion' endif endelse endfor end ; ; --------------------------------- ; pro FILE_DELETE, files0, files1, files2, files3, files4, files5, files6, files7, files8, files9, $ files10, files11, files12, files13, files14, files15, files16, files17, files18, files19, $ files20, files21, files22, files23, files24, files25, files26, files27, files28, files29, $ allow_nonexistent=allow_nonexistent, noexpand_path=noexpand_path, recursive=recursive, $ quiet=quiet, verbose=verbose, help=help, test=test ; if (N_PARAMS() LT 1) then begin print, '% FILE_DELETE: Incorrect number of arguments.' return endif ; if KEYWORD_SET(help) then begin print, 'FUNCTION FILE_DELETE, file1, file2, ...' print, ' allow_nonexistent=allow_nonexistent, noexpand_path=noexpand_path, recursive=recursive, $' print, ' quiet=quiet, verbose=verbose, help=help, test=test' return endif ; ;if KEYWORD_SET(noexpand_path) then begin ; print, 'Sorry, Keyword NOEXPAND_PATH is not available now.' ; return ;endif ; for __i__=0, N_PARAMS()-1 do begin files = STRCOMPRESS('files' + string(__i__), /remove_all) stat=EXECUTE('FILE_DELETE_ONE,'+files+',allow_nonexistent=allow_nonexistent, quiet=quiet, verbose=verbose, recursive=recursive, noexpand_path=noexpand_path') endfor ; if KEYWORD_SET(test) then STOP ; end gdl-0.9.4/src/pro/trace.pro0000664000175000017500000000352211532520202014123 0ustar marcmarc;$Id: trace.pro,v 1.2 2011/02/27 19:05:38 slayoo Exp $ function trace, matrix,double=double_keyword ;+ ; ; ; ; NAME: ; trace ; ; PURPOSE: ; Calculates the trace of the input matrix 'matrix' ; ; ; CATEGORY: ; Mathematics: Matrices ; ; CALLING SEQUENCE: ; result = trace(matrix) ; ; ; ; ; KEYWORD PARAMETERS: ; DOUBLE_KEYWORD : Keyword for double precision calculation ; ; OUTPUTS: ; Result is the trace of the matrix ; ; ; ; RESTRICTIONS: ; The input matrix must be n x n ; ; ; PROCEDURE: ; Sum over the diagonal elements of the input matrix, return the result ; ; EXAMPLE: ; i=identity(4) ; 4 x 4 identity matrix ; r=trace(i) ; print, r ; 4.0000 ; ; MODIFICATION HISTORY: ; Written by: 2004-03-20 Christopher Lee. ; ; ;- ; LICENCE: ; Copyright (C) 2004, ; 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. ; ; ;- On_error, 2 s=size(matrix) if(s[0] ne 2 and s[1] eq s[2]) then begin printf, "ERROR: need 2 dimensions" stop endif n=s[1] type=s[s[0]+1] if(type eq 4 or type eq 5) then begin ;real matrix tr=keyword_set(double_keyword) or type eq 5? 0.0d: 0.0 if(keyword_set(double_keyword) and type ne 5) then $ for i=0L, n-1 do tr=tr+double(matrix[i,i]) $ else $ for i=0L, n-1 do tr=tr+matrix[i,i] endif else if(type eq 6 or type eq 9) then begin ;complex matrix tr=keyword_set(double_keyword) or type eq 9? dcomplex(0.0,0.0): complex(0.0,0.0) if(keyword_set(double_keyword) and type ne 9) then $ for i=0L, n-1 do tr=tr+dcomplex(matrix[i,i]) $ else $ for i=0L, n-1 do tr=tr+matrix[i,i] endif return, tr end gdl-0.9.4/src/pro/py_plot.pro0000664000175000017500000000107411325566007014530 0ustar marcmarc;; simple example file for using python's matplotlib package from GDL pro PY_PLOT,x,y,XLABEL=xlabel,YLABEL=ylabel,TITLE=title,GRID=grid on_error, 2 if N_ELEMENTS( xlabel) eq 1 then begin PYTHON,"matplotlib.matlab","xlabel",STRING(xlabel) endif if N_ELEMENTS( ylabel) eq 1 then begin PYTHON,"matplotlib.matlab","ylabel",STRING(ylabel) endif if N_ELEMENTS( title) eq 1 then begin PYTHON,"matplotlib.matlab","title",STRING(title) endif if KEYWORD_SET( grid) then begin PYTHON,"matplotlib.matlab","grid",1 endif PYTHON,"python_plot","py_plot",x,y end gdl-0.9.4/src/pro/uniq.pro0000664000175000017500000000302611325566007014015 0ustar marcmarc;$Id: uniq.pro,v 1.2 2010/01/20 11:41:59 slayoo Exp $ ;+ ; ; ; ; NAME: ; UNIQ ; ; ; PURPOSE: ; Returns subscripts of unique elements of an array ; To be used with SORT ; ; CATEGORY: ; General ; ; CALLING SEQUENCE: ; res = UNIQ( Array [, Index]) ;; if Array is sorted ; res = UNIQ( Array, SORT( Array)) ;; if Array is unsorted ; ; ; KEYWORD PARAMETERS: ; None ; ; OUTPUTS: ; Indices of uniq elements of Array ; Array must be sorted. If Array is unsorted use: ; res = UNIQ( Array, SORT( Array)) ; ; OPTIONAL OUTPUTS: ; None. ; ; ; COMMON BLOCKS: ; None. ; ; SIDE EFFECTS: ; None. ; ; ; RESTRICTIONS: ; None. ; ; ; PROCEDURE: ; ; ; EXAMPLE: ; ; ; ; MODIFICATION HISTORY: ; Written by: Marc Schellens ; ; ; ;- ; LICENCE: ; Copyright (C) 2004, ; 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. ; ; ;- function UNIQ, arr, index on_error, 2 nEl = n_elements( arr) if nEl le 1 then return,0 if n_params() eq 1 then begin ix = where(arr ne shift(arr, -1)) if ix[0] ne -1 then return, ix $ else return, nEl-1 endif else begin tmp = arr[ index] ix = where(tmp ne shift(tmp,-1)) if ix[0] ne -1 then return, index[ix] $ else return, nEl-1 endelse end gdl-0.9.4/src/pro/skip_lun.pro0000664000175000017500000000742010775161566014700 0ustar marcmarc;+ ; NAME: SKIP_LUN ; ; PURPOSE: skip N lines or N bytes in a opened file ; ; CATEGORY: I/O ; ; CALLING SEQUENCE: ; ; SKIP_LUN, FromUnit [, Num] [, /EOF] [, /LINES] [, /TRANSFER_COUNT=variable] ; ; INPUTS: -- Unit: the logical unit of the file ; ; OPTIONAL INPUTS: -- num: the number of lines or bytes to be skipped. ; If not provided, go to EOF(). ; ; KEYWORD PARAMETERS: -- /EOF ; -- /lines ; -- /TRANSFER_COUNT ; ; Extra Parameters: -- /test : will stop at end to help finding problems ; -- /help : print a small help and return (doing nothing) ; ; OUTPUTS: none ; ; OPTIONAL OUTPUTS: none ; ; COMMON BLOCKS: none ; ; SIDE EFFECTS: May-be the Byte case is not well done when EOF() ; may be reached (Don't know how to do) ; ; RESTRICTIONS: should not be used on compress files ; ; PROCEDURE: ; - with /line keyword set: ; -- if line numbers negative, return 0 ; -- if keyword EOF not set and EOF reached before line number, return 0 ; ; EXAMPLE: SKIP_LUN, nlun, 8, /lines ; ; MODIFICATION HISTORY: ; 18-May-2007 : written by Alain Coulais (AC) ; because SKIP_LUN is used in Astron since V 5.6 ; 01-April-2008 : improvments ; ; LICENCE: ; Copyright (C) 2007, Alain Coulais ; 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. ; ;- pro SKIP_LUN, LunNumber, skip_value, eof=eof, lines=lines, $ transfer_count=transfer_count, help=help, test=test ; on_error,2 ; if KEYWORD_SET(help) then begin print, 'pro SKIP_LUN, LunNumber, skip_value, eof=eof, lines=lines, $' print, ' transfer_count=transfer_count, help=help, test=test' return endif ; ; checking the consistencies of input parameters ; if (N_ELEMENTS(LunNumber) EQ 0) then begin MESSAGE,'SKIP_LUN: Variable is undefined:'+STRING(LunNumber) endif if (N_ELEMENTS(LunNumber) GT 1) then begin MESSAGE,'SKIP_LUN: Expression must be a scalar or 1 element array in this context:'+STRING(LunNumber) endif ; if (N_PARAMS() EQ 1) then eof=1 ; if (N_PARAMS() EQ 2 ) then begin if (N_ELEMENTS(skip_value) EQ 0) then begin MESSAGE,'SKIP_LUN: Variable is undefined: '+STRING(skip_value) endif if (N_ELEMENTS(skip_value) GT 1) then begin MESSAGE,'SKIP_LUN: Expression must be a scalar or 1 element array in this context: '+STRING(skip_value) endif endif ; ; is this file really opened ? ; fstat_info=FSTAT(LunNumber) ; if (fstat_info.open NE 1) then begin MESSAGE,' File unit is not open: '+STRING(LunNumber) endif ; ; internal debug flag ;debug=1 ; void_line='' ; if KEYWORD_SET(lines) then begin i=0L if KEYWORD_SET(eof) then begin while NOT(EOF(LunNumber)) do begin i=i+1L readf, LunNumber, void_line endwhile transfer_count=i endif else begin if (skip_value LT 0) then begin transfer_count=0 return endif while NOT(EOF(LunNumber)) AND (i LT skip_value) do begin i=i+1L readf, LunNumber, void_line endwhile ;; we must return "Zero" if EOF encoutered ;; before reaching the expected line if (i EQ skip_value) then begin transfer_count=i endif else begin transfer_count=0 MESSAGE, '% SKIP_LUN: End of file encountered. Unit:'+STRING(LunNumber)+', File: '+fstat_info.name endelse endelse endif else begin ;; Byte case ;; (I don't know how to manage EOF() in this case ...) print, 'Please contribute to this branch if needed' POINT_LUN, LunNumber, skip_value endelse ; if KEYWORD_SET(test) then STOP ; end gdl-0.9.4/src/pro/read_jpeg.pro0000664000175000017500000001405712012457361014763 0ustar marcmarc;$Id: read_jpeg.pro,v 1.14 2012/08/14 14:21:37 alaingdl Exp $ pro READ_JPEG, filename, unit=unit, image, colortable, buffer=buffer, $ colors=colors, dither=dither, grayscale=grayscale, order=order, $ true=true, two_pass_quantize=two_pass_quantize, $ help=help, test=test, debug=debug ; ON_ERROR, 2 ;+ ; ; NAME: READ_JPEG ; ; PURPOSE: Reads a jpeg file into memory ; ; CATEGORY: Images (IO) ; ; CALLING SEQUENCE: ; READ_JPEG, filename, image, colortable ; ; KEYWORD PARAMETERS: ; UNIT: not supported yet ; BUFFER: not supported yet ; COLORS: Number of colors to dither to (8->256) ; DITHER: Method of dithering to use ; GRAYSCALE: Return a grayscale image ; ORDER: flip the image in the vertical ; TRUE: Interleaving (1:pixel, 2:line, 3:band) ; TWO_PASS_QUANTIZE: Not supported yet ; ; OUTPUTS: For true color images, data is a three dimensional array ; with interleaving set by TRUE keyword ; ; OPTIONAL OUTPUTS: For pseudocolor only ; COLORTABLE: the colortable produced (ncolors,3) ; ; ; SIDE EFFECTS: ; ; ; RESTRICTIONS: ; Requires ImageMagick (that means that GDL must have been ; compiled with ImageMagick) ; ; PROCEDURE: ; Use ImageMagick to read the data as requested ; ; EXAMPLE: An image of Saturn should be around in the GDL CVS ; file=FILE_WHICH('Saturn.jpg') ; READ_JPEG, file, image ; ; MODIFICATION HISTORY: ; Written by: Christopher Lee 2004-05-17 ; 2006-May-02, Joel Gales : Add convert to byte if 16-bit image ; 2011-Aug-18, Alain Coulais : More checks on inputs, verify if ; compiled with ImageMagick support ! ; 2011-Nov-09, Alain Coulais : correction for bug 3435468 ; Grayscale (2D case) ; 2012-Feb-07, Alain Coulais : new test cases in testsuite: ; test_read_standard_images.pro : 2 JPEG and 4 PNG (2 with transparency) ; The transpose for 2D image is no more need. ; ;- ; LICENCE: ; Copyright (C) 2004, 2011, 2012 ; 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. ; ;- ; if KEYWORD_SET(help) then begin print, 'pro READ_JPEG, filename, unit=unit, image, colortable, buffer=buffer, $' print, ' colors=colors, dither=dither, grayscale=grayscale, order=order, $' print, ' true=true, two_pass_quantize=two_pass_quantize, $' print, ' help=help, test=test, debug=debug' return endif ; ; Do we have access to ImageMagick functionnalities ?? ; if (MAGICK_EXISTS() EQ 0) then begin MESSAGE, /continue, "GDL was compiled without ImageMagick support." MESSAGE, "You must have ImageMagick support to use this functionaly." endif ; ; AC 2011-Aug-18: this test will be wrong when UNIT will be available if (N_PARAMS() EQ 0) then MESSAGE, "Incorrect number of arguments." ; if (N_ELEMENTS(filename) GT 1) then MESSAGE, "Only one file at once !" if (STRLEN(filename) EQ 0) then MESSAGE, "Null filename not allowed." ; if ((FILE_INFO(filename)).exists EQ 0) then MESSAGE, "Error opening file. File: "+filename if (FILE_TEST(filename, /regular) EQ 0) then MESSAGE, "Not a regular File: "+filename ; ; testing whether the format is as expected ; if ~MAGICK_PING(filename, 'JPEG') then begin MESSAGE, /continue, "JPEG error: Not a JPEG file:" if MAGICK_PING(filename, 'PNG') then MESSAGE, "seems to be a PNG file" if MAGICK_PING(filename, 'GIF') then MESSAGE, "seems to be a GIF file" if MAGICK_PING(filename, 'PDF') then MESSAGE, "seems to be a PDF file" MESSAGE, "unknown/untested format file" endif ; if KEYWORD_SET(unit) then MESSAGE, "Keyword UNIT not supported" if KEYWORD_SET(buffer) then MESSAGE, "Keyword BUFFER not supported" ; if (not KEYWORD_SET(unit)) then mid=MAGICK_OPEN(filename) ; ;;DITHER if necessary if (KEYWORD_SET(grayscale)) then begin MAGICK_QUANTIZE, mid, /GRAYSCALE endif else begin if (KEYWORD_SET(colors)) then begin if ((colors LT 8) OR (colors GT 256)) then MESSAGE, "COLORS must be in the range 8 to 256" if (KEYWORD_SET(two_pass_quantize)) then MESSAGE, "TWO_PASS_QUANTIZE not supported by ImageMagick." MAGICK_QUANTIZE, mid, colors, dither=dither endif endelse ; ;;flip if order is set if (KEYWORD_SET(order)) then MAGICK_FLIP, mid ; if (MAGICK_INDEXEDCOLOR(mid)) then begin image=MAGICK_READINDEXES(mid) MAGICK_READCOLORMAPRGB, mid, red, green, blue colortable=[[red],[green],[blue]] ;; ;; try to catch a problem in ImageMagick ;; (should be renormalized in, but not, as is on 28/01/2012) ;; bug report 3471918 (see min/max) if (KEYWORD_SET(grayscale)) then begin temp=image for ii=0, N_ELEMENTS(red)-1 do begin ok=WHERE(image EQ ii, nbp) if nbp GT 0 then temp[OK]=red[ii] endfor image=temp endif endif else begin image=MAGICK_READ(mid) endelse ; if KEYWORD_SET(debug) then STOP ; ; if 16-bit (unsigned short int) image convert to byte sz = SIZE(image) type = sz[sz[0]+1] if ((type EQ 2) OR (type EQ 12)) then begin print, 'Converting 16-bit image to byte' image = image / 256 image = BYTE(image) endif ; if (not KEYWORD_SET(unit)) then MAGICK_CLOSE, mid ; ; this is no more need, code changed in MAGICK_READINDEXES ;if (sz[0] EQ 2) then begin ; image=ROTATE(image,7) ;endif if (sz[0] EQ 3) then begin ;; "rotate" image to agree with IDL (JMG 08/18/04) tmp = image[0,*,*] image[0,*,*] = image[2,*,*] image[2,*,*] = tmp ;; if KEYWORD_SET(TRUE) then begin if (TRUE eq 1) then t=[0,1,2] if (TRUE eq 2) then t=[1,0,2] if (TRUE eq 3) then t=[1,2,0] ;; image=TRANSPOSE(image, t) ;; image=transpose(image[[2,1,0],*,*], t) endif endif if (sz[0] GT 3) then begin MESSAGE, /continue, $ "Dimensions of image > 3 : we don't know how to process now" endif ;else begin ; image = image[[2,1,0],*,*] ;endelse ; if KEYWORD_SET(test) then STOP ; end gdl-0.9.4/src/pro/congrid.pro0000664000175000017500000001262711742014746014476 0ustar marcmarc; part of GNU Data Language - GDL ;------------------------------------------------------------- ;+ ; NAME: ; CONGRID ; PURPOSE: ; Shrink or expands an array (any dimensions) to any size, ; however only the first 3 dims (max) will be resized. ; CATEGORY: ; Array Manipulation. ; CALLING SEQUENCE: ; t2 = CONGRID(t,mx[,my[,mZ]]) ; INPUTS: ; t = input array. in ; mx, my, mz = new (output) array size. in ; t2 = resulting array. out ; KEYWORD PARAMETERS: ; /INTERPOLATE means do bilinear interpolation. Kept for ; compatibility but unused: interpolation IS linear. ; CUBIC=cubic: use a cubic interpolation. Currently limited by ; the availability of cubic interpolation in GDL's INTERPOLATE. ; /CENTERED means assume pixels centered. This means ; the pixel at (0,[0,[0]]) is clipped to 1/4 size. ; Default is that pixel start (not center) is at index.' ; MISSING=missing gives a value for undefined pixels. ; /MINUS_ONE: option will be ignored. MISSING can be used instead. ; /HELP gives this help.' ; ; NOTE: ; CONGRID performs a resampling. Does not conserve Fluxes. ; OUTPUTS: ; t2 = resulting array. out ; ; MODIFICATION HISTORY: ; Written by: 2011-12-17 G. Duvert (Initial import) ; ;- ; LICENCE: ; Copyright (C) 2011 ; 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. ; ;- function CONGRID, t, mx, my, mz, $ CENTER=center, $ INTERP=interp, $ CUBIC = cubic, $ MINUS_ONE=minus_one, $ MISSING=missing, $ HELP=help, test=test npar=N_PARAMS() if (npar lt 2) or (npar gt 4) or KEYWORD_SET(help) then begin print,' Shrink or expands an array (any dimensions) to any size,' print,' however only the first 3 dims (max) will be resized.' print,' CALLING SEQUENCE:' print,' t2 = congrid2(t,mx[,my][,mz])' print,' t = input array. in' print,' mx, my, mz = new (output) array size. in' print,' t2 = resulting array. out' print,' Keywords:' print,' /INTERPOLATE means do bilinear interpolation. Kept for' print,' compatibility but unused: interpolation IS linear.' print,' /CENTERED means assume pixels centered. This means' print,' the pixel at (0,[0,[0]]) is clipped to 1/4 size.' print,' Default is that pixel start (not center) is at index.' print,' CUBIC=cubic: use a cubic interpolation. Currently limited by' print,' the availability of cubic interpolation in INTERPOLATE.' print,' /CENTERED means assume pixels centered. This means' print,' the pixel at (0,[0,[0]]) is clipped to 1/4 size.' print,' Default is that pixel start (not center) is at index.' print,' MISSING=missing gives a value for undefined pixels.' print,' /MINUS_ONE: option will be ignored. MISSING can be used instead.' print, ' /HELP gives this help.' print,' NOTE: CONGRID performs a resampling. Does not conserve Fluxes.' return,'' endif ; ON_ERROR, 2 ;Return to caller if error ; ndim = SIZE(t, /N_DIMENSIONS) dims = SIZE(t, /DIMENSIONS) ; if(ndim gt 3) then $ MESSAGE, 'Warning, array dimensions >3, using non-standard CONGRID extension.', /informational ; cflag = KEYWORD_SET(centered) ; 0=start, 1=centered. minone = KEYWORD_SET(minus_one) nnbor = ~KEYWORD_SET(interp) ; nearest neighbor is default for 1 and 2 dim ; ; if (npar gt ndim+1) then message, 'Too many output dimensions.' ; nopt=0 IF (N_ELEMENTS(mx) NE 0) THEN BEGIN fx= (minone gt 0)? 1.0D*(dims[0]-1)/(mx-1) : 1.0D*dims[0]/mx x = (cflag gt 0) ?fx*FINDGEN(mx)+0.5 : fx*FINDGEN(mx) nopt=1 ENDIF ; ; if 2 dim my MUST be present! IF (N_ELEMENTS(my) EQ 0 && ndim ge 2) THEN MESSAGE, '2nd dimension not specified.' IF (N_ELEMENTS(my) NE 0 && ndim ge 2) THEN BEGIN fy= (minone gt 0)? 1.0D*(dims[1]-1)/(my-1) : 1.0D*dims[1]/my y = (cflag gt 0) ?fy*FINDGEN(my)+0.5 : fy*FINDGEN(my) nopt=2 ENDIF ; ; if 3 dim mz MUST be present! IF (N_ELEMENTS(mz) EQ 0 && ndim ge 3) THEN MESSAGE, '3rd dimension not specified.' IF (N_ELEMENTS(mz) NE 0 && ndim ge 3) THEN BEGIN fz= (minone gt 0) ? 1.0D*(dims[2]-1)/(mz-1) : 1.0D*dims[2]/mz z = (cflag gt 0) ?fz*FINDGEN(mz)+0.5 : fz*FINDGEN(mz) nopt=3 ENDIF ; IF (nopt lt ndim) THEN BEGIN ;; create a transposition vector p=SHIFT(INDGEN(ndim),-nopt) temp=TRANSPOSE(t,p) CASE nopt OF 3: temp2 = INTERPOLATE(temp,x,y,z,/grid,cubic=cubic,missing=missing) 2: temp2 = INTERPOLATE(temp,x,y,/grid,nearest_neighbour=nnbor,cubic=cubic,missing=missing) 1: temp2 = INTERPOLATE(temp,x,/grid,nearest_neighbour=nnbor,cubic=cubic,missing=missing) ENDCASE p=SHIFT(INDGEN(ndim),nopt) t2=TRANSPOSE(temp2,p) ENDIF ELSE BEGIN CASE nopt OF 3: t2 = INTERPOLATE(t,x,y,z,/grid,cubic=cubic,missing=missing) 2: t2 = INTERPOLATE(t,x,y,/grid,nearest_neighbour=nnbor,cubic=cubic,missing=missing) 1: t2 = INTERPOLATE(t,x,/grid,nearest_neighbour=nnbor,cubic=cubic,missing=missing) ENDCASE ENDELSE ; if KEYWORD_SET(test) then STOP ; return,t2 ; end gdl-0.9.4/src/pro/file_copy.pro0000664000175000017500000001215211412332052014776 0ustar marcmarc;+ ; NAME: FILE_COPY ; ; RESTRICTIONS: only for Unix (Unix, Linux and Mac OS X) systems ; ;- ; LICENCE: ; Copyright (C) 2010, Lea Noreskal; contact: Alain Coulais ; 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. ;- ; --------------------------------- ; pro FILE_COPY, source, dest, require_directory=require_directory, $ allow_same=allow_same, noexpand_path=noexpand_path, recursive=recursive, $ overwrite=overwrite, quiet=quiet, verbose=verbose, help=help, test=test ;, $ ;not ready : force=force, copy_named_pipe=copy_named_pipe, copy_symlink=copy_symlink ; if (N_PARAMS() LT 2) then BEGIN print, '% FILE_COPY: Incorrect number of arguments.' return endif ; if (Not KEYWORD_SET(noexpand_path)) then begin flist='' for ii=0,N_ELEMENTS(source)-1 do begin dir=FILE_SEARCH(FILE_DIRNAME(source[ii]),/fully) res=FILE_SEARCH(dir, FILE_BASENAME(source[ii]), /fully) for jj=0,N_ELEMENTS(res)-1 do begin if(FILE_DIRNAME(res[jj], /MARK_DIRECTORY) eq dir) then flist=[flist, res[jj]] ; ;print, 'dir ', dir, ' res ', FILE_DIRNAME(res[jj]) endfor endfor if(N_ELEMENTS(flist) gt 1) then source=flist[1:*]; print, flist ;; ; ... for ii=0,N_ELEMENTS(dest)-1 do begin struct=FILE_INFO(dest[ii]) if(struct.exists) then dest[ii]=escape_special_char(struct.name) endfor ;... endif ; either dest has the same size as source or it is a directory destIsDir=0 ; 0 if dest is an array, 1 if it is a directory if ( N_ELEMENTS(source) ne N_ELEMENTS(dest)) then begin if( (N_ELEMENTS(dest) gt 1) $ or (FILE_TEST(dest[0], /directory) eq 0) ) then begin print, '% FILE_COPY: Arrays source and dest must have same size, or dest must be a directory' return endif ; N_elements(dest) = 1 and dest is a directory destIsDir=1 endif ; ; if KEYWORD_SET(help) then begin print, 'FUNCTION FILE_DELETE, source, dest,' print, ' allow_same=allow_same, noexpand_path=noexpand_path, recursive=recursive, $' print, ' overwrite=overwrite, require_directory=require directory, quiet=quiet, verbose=verbose, help=help, test=test' ;print, ' UNIX-Only Keywords: [/COPY_NAMED_PIPE] [, /COPY_SYMLINK] [, /FORCE] ' return endif ; command='\cp ' option='-' ;if KEYWORD_SET(allow_same) then begin ; print, 'Sorry, Keyword allow_same is not available now.' ; return ;endif ; if KEYWORD_SET(require_directory) then begin ; verify if dest contains only directories for ii=0, N_ELEMENTS(dest)-1 do begin if ( FILE_TEST(dest[ii], /directory) eq 0 ) then begin print, '% FILE_COPY: require_directory, ', dest[ii], ' is not a valid directory ' return endif endfor endif ; if KEYWORD_SET(recursive) then begin option=option+'r' endif ; ;if KEYWORD_SET(noexpand_path) then begin ; print, 'Sorry, Keyword NOEXPAND_PATH is not available now.' ; return ;endif ; ;cp=0; ;if KEYWORD_SET(overwrite) then begin ;endif ; if KEYWORD_SET(copy_named_pipe) then begin print, 'Sorry, Keyword copy_named_pipe is not available now.' return endif ; if KEYWORD_SET(copy_symlink) then begin option=option+'d' endif ; if KEYWORD_SET(force) then begin option=option+'f' endif ; ;if KEYWORD_SET(quiet) then begin ; print, 'Sorry, Keyword quiet is not available now.' ; return ;endif ; if KEYWORD_SET(verbose) then begin option=option+'v' endif ; ; if (STRLEN(option) GT 1 ) then begin command=command+option ;print, 'opt >', option, ' Comm : ', command endif ; for ii=0, N_ELEMENTS(source)-1 do begin if not KEYWORD_SET(recursive) then begin if (FILE_TEST(source[ii], /directory) eq 1 ) then begin if (KEYWORD_SET(verbose) or not KEYWORD_SET(quiet)) then print, '% FILE_COPY: ', source[ii], ' is a directory, use option /recursive' return endif endif ; escape special characters snameesc=escape_special_char(source[ii]) destname=dest[0] ; dest is a directory ; if(destIsDir eq 0) then destname=dest[ii] ; dest is an array with several destination ; dnameesc=escape_special_char(destname) ;if(KEYWORD_SET(allow_same) and (snameesc eq dnameesc)) > ne rien faire ;verify if it is possible to copy, without keyword overwrite cp=1; if ((Not KEYWORD_SET(overwrite)) and FILE_TEST(destname,/directory)) then begin ;sname=get_filename(source[ii]) ; sname=FILE_BASENAME(source[ii]) res = FILE_SEARCH(destname, sname, COUNT=nb) ;print ,'RES : ' , res, ' sname : ', sname if (nb ne 0) then cp=0 ; there is not same files in directory endif ;copy if((cp eq 1) and (not KEYWORD_SET(allow_same) or (snameesc ne dnameesc))) then SPAWN, command+' '+snameesc+' '+dnameesc if(cp eq 0 and (KEYWORD_SET(verbose) or not KEYWORD_SET(quiet))) then print, '% FILE_COPY: ', source[ii] ,' overwrite not allowed ' endfor ; if KEYWORD_SET(test) then STOP ; end gdl-0.9.4/src/pro/get_login_info.pro0000664000175000017500000000076511707531133016026 0ustar marcmarc; ; Under GNU GPL v2 or later ; Alain C., 24-Jan-2012 ; ; tested on various Linux and OSX ... ; function GET_LOGIN_INFO ; machine_name='Unknow' user_name='Unknow' ; ; it seems that it is better to use 'hostname' insteed 'hostname -s' ; SPAWN, 'hostname', resu, exit_status=exit_status if (exit_status EQ 0) then machine_name=resu ; SPAWN, 'whoami', resu, exit_status=exit_status if (exit_status EQ 0) then user_name=resu ; return, {MACHINE_NAME: machine_name, $ USER_NAME: user_name} ; end ; gdl-0.9.4/src/pro/read_dicom.pro0000664000175000017500000000321411325566007015126 0ustar marcmarc;$Id: read_dicom.pro,v 1.2 2010/01/20 11:41:59 slayoo Exp $ function read_dicom, filename, red, green, blue, image_index=image_index on_error, 2 ;+ ; ; ; ; NAME: READ_DICOM ; ; ; PURPOSE: Reads a dicom file into memory ; ; ; ; CATEGORY: Images (IO) ; ; ; CALLING SEQUENCE: data=read_dicom(filename,red,green,blue,[IMAGE_INDEX=index]) ; ; ; ; ; ; KEYWORD PARAMETERS: ; IMAGE_INDEX : The image index to retrieve ; ; ; OUTPUTS: For true color images, data is a three dimensional array ; with pixel interleaving (i.e [3,columns,rows]) ; ; ; ; OPTIONAL OUTPUTS: For pseudocolor only ; red : the Red colormap vector (for PseudoColor images) ; green: the Green colormap vector (for PseudoColor images) ; blue : the Blue colormap vector (for PseudoColor images) ; ; ; SIDE EFFECTS: ; ; ; RESTRICTIONS: ; Requires ImageMagick ; ; ; PROCEDURE: ; Use ImageMagick to read the data as requested ; ; EXAMPLE: ; ; ; ; MODIFICATION HISTORY: ; Written by: Christopher Lee 2004-05-26 ; ; ; ;- ; LICENCE: ; Copyright (C) 2004, ; 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. ; ; ;- f=filename if(keyword_set(IMAGE_INDEX)) then f=filename+"["+string(IMAGE_INDEX)+"]" mid=magick_open(f) if(magick_IndexedColor(mid)) then begin data=magick_readIndexes(mid) magick_readcolormapRGB,mid,red,green,blue endif else begin data=magick_read(mid) endelse magick_close,mid return, data end gdl-0.9.4/src/pro/file_basename_old.pro0000664000175000017500000000723412164333713016454 0ustar marcmarc; ; Since First July 2013, because a C++ internal version is available ; this file is OBSOLETING, will be removed in the future !! ; ; ;+ ; NAME: FILE_BASENAME ; ; PURPOSE: The FILE_BASENAME function returns the basename of a file ; path. A file path is a string containing one or more segments ; consisting of names separated by directory delimiter characters ; (slash (/) under UNIX, or backslash (\) under Microsoft ; Windows). The basename is the final rightmost segment of the file ; path; it is usually a file, but can also be a directory name. ; ; FILE_BASENAME is based on the standard UNIX basename(1) utility. ; CATEGORY: UNIX utility. ; ; CALLING SEQUENCE: Result = FILE_BASENAME(Path [, RemoveSuffix] [, /FOLD_CASE]) ; ; INPUTS: Path: A scalar string or string array containing paths for ; which the basename is desired. ; ; OPTIONAL INPUTS: RemoveSuffix: An optional scalar string or ; 1-element string array specifying a filename suffix to be removed ; from the end of the basename, if present. ; ; KEYWORD PARAMETERS: /FOLD_CASE is not available now (and useless ; for Unix). return -1 if activated ; ; OUTPUTS: A scalar string or string array containing the basename for ; each element of the Path argument. ; ; OPTIONAL OUTPUTS: none ; ; COMMON BLOCKS: none ; ; SIDE EFFECTS: none ; ; RESTRICTIONS: only for Unix (Unix, Linux and Mac OS X) systems ; ; Rules used by FILE_BASENAME ; FILE_BASENAME makes a copy of the input file path string, then ; modifies the copy according to the following rules: ; - If Path is a NULL string, then FILE_BASENAME returns a NULL ; string. ; - If Path consists entirely of directory delimiter characters, the ; result of FILE_BASENAME is a single directory delimiter character. ; - If there are any trailing directory delimiter characters, they ; are removed. ; - If any directory delimiter characters remain, all characters up ; to and including the last directory delimiter are removed. ; - If the RemoveSuffix argument is present, is not identical to the ; characters remaining, and matches the suffix of the characters ; remaining, the suffix is removed. Otherwise, the Result is not ; modified by this step. ; ; PROCEDURE: ; ; EXAMPLE: ; ; print, file_basename('/usr/local/rsi/idl/lib/dist.pro', '.pro') ; GDL prints: ; dist ; ; MODIFICATION HISTORY: ; - Sept 2007: created by Sebastien Masson ; - Sept 2007: managing insufficient numbers of parameters, /help ; - June 2010: escape special characters by Lea Noreskal ; ;- ; LICENCE: ; Copyright (C) 2007, Sebastien Masson ; 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. ;- ; FUNCTION FILE_BASENAME_OLD, Path, RemoveSuffix, $ FOLD_CASE = fold_case, help=help ; ON_ERROR, 2 ; if KEYWORD_SET(help) then begin print, 'FUNCTION FILE_BASENAME, Path, [RemoveSuffix], [/FOLD_CASE], [/help]' return, -1 endif ; if ((N_PARAMS() LT 1) OR (N_PARAMS() GT 2)) then begin MESSAGE, 'Incorrect number of arguments.' endif ; IF KEYWORD_SET(fold_case) then begin MESSAGE, 'Sorry, Keyword FOLD_CASE is not available now.' endif ; sfx = N_ELEMENTS(RemoveSuffix) NE 0 ? RemoveSuffix : '' result = STRARR(N_ELEMENTS(Path)) ; for i = 0, N_ELEMENTS(path) - 1 do begin if STRTRIM(path[i], 2) ne '' then begin SPAWN, '\basename ' + ESCAPE_SPECIAL_CHAR(path[i]) + ' ' + ESCAPE_SPECIAL_CHAR(sfx), res result[i] = TEMPORARY(res) endif else result[i] = path[i] endfor ; return, SIZE(path, /n_dim) eq 0 ? result[0] : result ; end gdl-0.9.4/src/pro/README.txt0000664000175000017500000000225011335101546014005 0ustar marcmarc some informations about these files and this directory 1/ procedures from the IDL library Most of the files here are re-implementation of the open source files available in the IDL lib directory. Since the original library is under Copyright, we cannot copy it directly in GDL. Then we need to develop a clone for some of the most useful procedures in this library. Some of these routines can be found and downloaded from http://idlastro.gsfc.nasa.gov/idllibsrch.html but we cannot include them now in GDL. Please see STATUS for a list of the files, if they are needed, or not, written (in GDL or C++) with perfect clone or less perfect Please see UrgentNeed.txt for the most urgent needed procedures. You can notify me (at : alaingdl AT users.sourceforge.net ) if you start to work on one of these procedures. I can help you to put them in the CVS. 2/ Other files some other files are put here, which are not in the IDL lib. path, but correspond to procedures available in IDL, in binary (executable build in) form. Here they are re-implemented in GDL langage. e.g.: save.pro restore.pro read_jpeg.pro read_png.pro write_jpeg.pro write_png.pro file_lines.pro tvscl.pro smooth.pro gdl-0.9.4/src/pro/meanabsdev.pro0000664000175000017500000000254710271112705015144 0ustar marcmarc;$Id: meanabsdev.pro,v 1.2 2005/07/25 07:33:25 m_schellens Exp $ function meanabsdev, x, double=double, NaN=NaN ;+ ; ; ; ; NAME: ; meanabsdev ; ; PURPOSE: ; Calculates the mean absolute deviation of the input data ; ; ; CATEGORY: ; Mathematics: Statistics ; ; CALLING SEQUENCE: ; Result=meanabsdev(x) ; ; ; KEYWORD PARAMETERS: ; DOUBLE : Keyword for double precision calculation ; NAN : Flag to ignore IEEE Floating point NaN ; ; OUTPUTS: ; Result is the mean absolute deviation of input data ; ; ; RESTRICTIONS: ; The input x needs to be an array of numbers (i.e not strings, ; struct, ptr, object) ; ; PROCEDURE: ; mean absolute deviation = (1/N) sum(abs(x-mean(x))), ; Uses the MOMENT function ; ; EXAMPLE: ; a=findgen(100) ; result=meanabsdev(a) ; print, result ; 25.0000 ; ; MODIFICATION HISTORY: ; 20-Mar-2004 : Written by Christopher Lee ; 18-Jul-2005 : PC, moment.pro update ; ; LICENCE: ; Copyright (C) 2004, ; 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. ; ; ;- on_error, 2 junk = moment(x, mdev=mdev, double=double, NaN=NaN) return, mdev end gdl-0.9.4/src/pro/read_ascii.pro0000664000175000017500000003164612141740661015132 0ustar marcmarc;+ ; NAME: READ_ASCII ; ; ; PURPOSE: Reads an ASCII file. The output is a structure whose tags contains ; columns (1D array) from the file. Its use is flexible: the user can ; specify the types, and tag names of the fields and he/she also can ; group columns into a single tag (2D array). ; ; ; CATEGORY: IO ; ; ; CALLING SEQUENCE: ; structure=read_ascii(filename, count=, data_start=, delimiter=, ; missing_value=, comment_symbol=, record_start= ; num_records=, template=, header=, verbose=) ; ; ; INPUT: ; filename Name of the ASCII file to be read ; ; ; KEYED INPUTS: ; data_start Specify the number of lines that constitute the header ; These lines will be discarded as records, but are available ; with the header keyword ; ; delimeter If set (or non equal to ''), the records will be split ; according to the supplied delimiter locations and the length ; of the fields is not necessarily the same for all records. ; Otherwise, template.fieldlocations will be used to identify ; the fields (columns). If the template is not provided, the ; delimiter default is ' ' ; ; missing_value Specify the value that will be used for missing or ; non-numeric values ; ; comment_symbol Comment symbol. The part of the line that begins with ; the comment symbol and ends to the end of line is discarded ; Default is ';' ; ; record_start Record number of the first record to be read (starts from 0) ; ; num_record Number of records to be read ; ; template structure that defines how the file will be processed ; the tags datastart, delimiter, missingvalue and commentsymbol ; can be overridden by the keywords data_start, delimiter, ; missing_value and comment_symbol. ; ; template.VERSION template version number (not used) ; template.FIELDCOUNT=n number of fields ; template.FIELDNAMES[n] field names ; template.FIELDTYPES[n] field integer types ; template.FIELDGROUPS[n] group ID. fields can be grouped into a single tag ; template.FIELDLOCATIONS[n] start positions of the fields ; template.DATASTART see data_start keyed input ; template.DELIMITER see delimiter keyed input ; template.MISSINGVALUE see missing_value keyed input ; template.COMMENTSYMBOL see comment_symbol keyed input ; ; if field of different types are grouped together, the following priority ; if assumed to determine the tag type: ; BYTE