home *** CD-ROM | disk | FTP | other *** search
- /*
- ******************************************************************************
- * NCSA ImageTool 1.1 beta
- * Thu Sep 20 16:58:25 CDT 1990
- *
- * NCSA ImageTool 1.1 beta source code and documentation are in the public
- * domain.
- * Specifically, we give to the public domain all rights for future licensing
- * of the source code, all resale rights, and all publishing rights.
- *
- * We ask, but do not require, that the following message be included in all
- * derived works:
- *
- * Portions developed at the National Center for Supercomputing Applications at
- * the University of Illinois at Urbana-Champaign.
- *
- * THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
- * SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
- * WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
- *
- ******************************************************************************
- */
- /* cat > headers/const.h << "EOF" */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* const.h: global defines and typedefs for */
- /* ImageTool 1.1 */
- /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
- /* SCCS information: %W% %G% - NCSA */
-
- #define DEFAULT_FILE ".imagetool_defaults"
- #define ORIGINXY 5
- #define ZFAC 2
- #define NMARKERS 5
- #define ERANGE 3
- #define MAXBUFSIZE 1500
- #define MAXTABLE 9
- #define NMAXHOSTS 4
- #define NMAXPRINTERS 4
- #define MAXNAMELEN 256
- #define MAXFRAMES 200
-
- #define CR 13 /* return for search pattern completion */
- #define ESC 27 /* escape for file-name completion */
- #define CTRL_A 1 /* control-C for "Clear" */
- #define CTRL_C 3 /* control-A for "Animate" */
- #define CTRL_L 12 /* control-L for "Load" */
- #define CTRL_R 18 /* control-R for "Restore" */
- #define CTRL_S 19 /* control-S for "Scale" */
- #define CTRL_V 22 /* control-V for "View" */
-
- /* image format */
- #define RAW 1
- /*
- #define SUN 2
- #define NCSA 3
- */
- #define FLOAT 4
-
- /* graph mode constant */
- #define PLOT_NONE 0
- #define PLOT_XY 1
- #define PLOT_CON 2
- #define PLOT_3D 3
-
- /* color editing mode */
- #define CEDIT_NONE 0
- #define CEDIT_CONT 1
- #define CEDIT_FIDDLE 2
-
- /* error and warning codes for imagetool - not used in 1.1 */
- /* #define E_NONE 0 */ /* successful return code */
- /* #define E_UNKNOWN 1 */ /* unknown error */
- /* #define E_MISSFNAME 2 */ /* file name missing */
- /* #define E_NOFILE 3 */ /* file not existing */
- /* #define E_MULFILE 4 */ /* multiple file names */
- /* #define E_MISSFSIZE 5 */ /* file sizes missing */
- /* #define E_TOOLARGE 6 */ /* image too large to fit */
- /* #define E_NOFOPEN 7 */ /* open failure for readable file */
- /* #define E_NOFOPENW 8 */ /* open failure for writable file */
- /* #define E_MEMCREAT 9 */ /* mem_create() fails */
- /* #define E_MALLOC 10 */ /* malloc() or calloc() fails */
- /* #define E_NOFREAD 11 */ /* file reading fails */
- /* #define E_NOFWRITE 12 */ /* file writing fails */
- /* #define E_LOGNEG 13 */ /* negative for logarithmic */
- /* #define E_TEMPNAM 14 */ /* tempnam() fails */
- /* #define E_TEXTSTORE 15 */ /* textsw_store() fails */
- /* #define E_CHDIR 16 */ /* chdir() fails */
- /* #define E_SYNTAX 17 */ /* syntax error with Unix name string */
- /* #define E_NOCONNECT 18 */ /* no ftp connection */
- /* #define E_NODEFSYM 19 */ /* unknown symbol in default file */
- /* #define E_NOFONT 20 */ /* font not found */
-
- /* #define W_FEWREAD 25 */ /* fewer bytes read from file */
- /* #define W_FEWWRITE 26 */ /* fewer bytes written to file */
- /* #define W_NOFORMAT 27 */ /* image format not supported */
- /* #define W_NOFACTOR 28 */ /* expansion factors missing */
- /* #define W_NODEFAULTS 29 */ /* no defaults setup */
-
- #define in_rect(x,y,z) ((x > z->r_left && x < z->r_left + z->r_width && \
- y > z->r_top && y < z->r_top + z->r_height))
-
- /* Define the path to the ImageTool 1.0 help file directory */
- /* Use User Defaults in ImageTool 1.1 */
- /* #define HELP_DIR "/usr/local/lib/imagetool/help" */
-
- /* plotting mode constants and typedefs */
-
- #define XPLOT_MIN 100
- #define XPLOT_MAX 500
- #define XPLENGTH 400
-
- #define YPLOT_MIN 50
- #define YPLOT_MAX 450
- #define YPLENGTH 400
-
- #define XPLOT_MARGIN 60
- #define YPLOT_MARGIN 15
- #define MARKER_LENGTH 3
-
- #define ERR 0.000005
-
- typedef short bool;
-
- #define PI 3.1415926535897932384626433
- #define LARGE 2147483647 /* 2^31 - 1 */
- #define CANVAS_XSIZ 1150 /* sun terminal horizontal resolution */
- #define CANVAS_YSIZ 900 /* sun terminal vertical resolution */
- #define TRUE 1
- #define FALSE 0
-
- #define LW_STROKE 100 /* every so often, flush lw buffer */
- #define LW_HEIGHT 792 /* in postscript machine units */
- #define LW_WIDTH 612 /* see manual: inside laser writer */
-
- #define PRECISION CANVAS_XSIZ /* the bigger, the slower */
-
- #define ABS(a) ((a) > 0 ? (a) : -(a))
- #define ROUND(a) (int)((a) > 0 ? ((a) + 0.5) : ((a) - 0.5))
- #define TORAD(a) (((double)(a) * PI) / 180.0)
-
- #ifndef MAX
- #define MAX(a,b) ((a) > (b) ? (a) : (b))
- #define MIN(a,b) ((a) < (b) ? (a) : (b))
- #endif
-
- typedef struct {
- float x, y, z;
- } Point;
-
- typedef struct {
- int x, y;
- } Raster;
-
- typedef struct {
- float clip_xmin, clip_ymin;
- float clip_xmax, clip_ymax;
- } Clipper;
-
- #define alpnum_round(c,u,l) ((c) - (u) + (l))
-
- #define STRIP 0177
- #define MAXDIR 64
- #define BYTESPERWORD 4
- #define BUFFERSIZ 10240
-
- /* ~~~~~~~~~~~~~~~~~~~~ 1.1 additions ~~~~~~~~~~~~~~~~~~~~ */
-
- #define DEFAULT_FONT_PANEL "/ImageTool/Font_panel"
- #define DEFAULT_FONT_PANEL_BUTTON "/ImageTool/Font_panel_button"
- #define DEFAULT_FONT_MENU "/ImageTool/Font_menu"
- #define DEFAULT_HELP_DIR "/ImageTool/Help_dir"
- #define DEFAULT_PALETTE_FILE "/ImageTool/Palette_file"
- #define DEFAULT_IMAGE_DIR "/ImageTool/Image_dir"
- #define MESSAGE_LIMIT "/ImageTool/Message_limit"
-
- #define DEFAULT_MESSAGE_LIMIT 20
- #define ABSOLUTE_MESSAGE_LIMIT 100
-
- #define TYPE_DIR 0
- #define TYPE_FILE 1
-
- #define REGULAR 0
- #define DEFAULT 1
-
- #define pal_msg1 (type == REGULAR) ? "palette" : "(default) palette"
- #define pal_msg2 (type == REGULAR) ? "Palette" : "(Default) palette"
-
- #define BUG_EMAIL_ADDRESS "/ImageTool/Bug_email_address"
-
- #define DEFAULT_BUG_EMAIL_ADDRESS "bugs@ncsa.uiuc.edu"
-
- #define PIXDEPTH 8 /* pixel depth - either 8 or 32 */
-
- #define CTRL_N 14 /* control-N for "Get name" */
-
- enum img_type {RAWI, RIS8, SDS2D};
- enum rect_vertical {LEFT, RIGHT};
- enum rect_horizontal {TOP, BOTTOM};
- enum desired_img_type {FIRST, HDFR8, HDFS2};
- enum pal_type {PAL_UNKNOWN, PAL_RAW, PAL_HDF, PAL_RIS8};
- /* EOF */
-