<commit_before>/* $Id$

    Copyright (C) 1993, 1994, 1995  by 
    <NAME>, <NAME>, <NAME>.

    Internal (private) macros and prototypes for the PLplot package.  This
    header file must be included before all others, including system header
    files.  This file is typically needed when including driver specific
    header files (e.g. pltkd.h).

    This software may be freely copied, modified and redistributed without
    fee provided that this copyright notice is preserved intact on all
    copies and modified copies. 
 
    There is no warranty or other guarantee of fitness of this software.
    It is provided solely "as is". The author(s) disclaim(s) all
    responsibility and liability with respect to this software's usage or
    its effect upon hardware or computer systems. 
*/

#ifndef __PLPLOTP_H__
#define __PLPLOTP_H__

/*--------------------------------------------------------------------------*\
 *        SYSTEM-SPECIFIC SETTINGS
 * 
 * Here we enable or disable based on system specific capabilities of
 * PLPLOT.  At present there are only two different "optional"
 * capabilities.  They are:
 *
 * POSIX_TTY	Defined if POSIX.1 tty control functions are available. 
 * STDC_HEADERS	Defined if libc is ANSI-compliant.
 *
 * POSIX.1 tty control functions are used by some of the drivers, e.g. to
 * switch to character-oriented (CBREAK) i/o (notably the tek driver and
 * all its variants).  It is usable without this but not as powerful.  The
 * reason for using this is that some supported systems are still not
 * POSIX.1 compliant (and some may never be).
 *
 * ANSI libc calls are used for: (a) setting up handlers to be called
 * before program exit (via the "atexit" call), and (b) for seek
 * operations.  Again, the code is usable without these.  An ANSI libc
 * should be available, given the requirement of an ANSI compiler.  Some
 * reasons why not: (a) the vendor didn't supply a complete ANSI
 * environment, or (b) the ANSI libc calls are buggy, or (c) you ported
 * gcc to your system but not glibc (for whatever reason).  Note: without
 * an ANSI C lib, if you ^C out of a program using one of the PLplot tek
 * drivers, your terminal may be left in a strange state.
\*--------------------------------------------------------------------------*/

#include "plplot/plConfig.h"
#ifdef caddr_t
#undef caddr_t
typedef char * caddr_t;
#endif

/* System headers */

#include <ctype.h>
#include <math.h>
#include <string.h>

#ifdef _POSIX_SOURCE
#define POSIX_TTY
#endif

/* Hacks to deal with non-ANSI libc */

#if defined (STDC_HEADERS) && ! defined(USE_FSEEK)
#define STDC_FPOS_T
#endif

#ifdef STDC_FPOS_T
#define FPOS_T fpos_t
#define pl_fsetpos(a,b) fsetpos(a, b)
#define pl_fgetpos(a,b) fgetpos(a, b)

#else
#define FPOS_T long
#define pl_fsetpos(a,b) fseek(a, *b, 0)
#define pl_fgetpos(a,b) (-1L == (*b = ftell(a)))
#endif

/* Include all externally-visible definitions and prototypes */
/* plplot.h also includes some handy system header files */

#include "plplot/plplot.h"

/* plstream definition */

#include "plplot/plstrm.h"

/* If not including this file from inside of plcore.h, declare plsc */

#ifndef __PLCORE_H__
extern PLStream	*plsc;
#include "plplot/pldebug.h"
#endif

/*--------------------------------------------------------------------------*\
 *                       Utility macros
\*--------------------------------------------------------------------------*/

#ifndef TRUE
#define TRUE  1
#define FALSE 0
#endif

/* Used to help ensure everything malloc'ed gets freed */

#define free_mem(a) \
    if (a != NULL) { free((void *) a); a = NULL; }

/* Allows multi-argument setup calls to not affect selected arguments */

#define plsetvar(a, b) \
    if (b != PL_NOTSET) a = b;

/* Lots of cool math macros */

#ifndef MAX
#define MAX(a,b)    (((a) > (b)) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a,b)    (((a) < (b)) ? (a) : (b))
#endif
#ifndef ABS
#define ABS(a)      ((a)<0 ? -(a) : (a))
#endif
#ifndef ROUND
#define ROUND(a)    (PLINT)((a)<0. ? ((a)-.5) : ((a)+.5))
#endif
#ifndef BETW
#define BETW(ix,ia,ib)  (((ix)<=(ia)&&(ix)>=(ib)) || ((ix)>=(ia)&&(ix)<=(ib)))
#endif
#ifndef SSQR
#define SSQR(a,b)       sqrt((a)*(a)+(b)*(b))
#endif
#ifndef SIGN
#define SIGN(a)         ((a)<0 ? -1 : 1)
#endif

/* A coordinate value that should never occur */

#define UNDEFINED -9999999

/*--------------------------------------------------------------------------*\
 *                       PLPLOT control macros
\*--------------------------------------------------------------------------*/

/* Some constants */

#define PL_MAXPOLY	256	/* Max segments in polyline or polygon */
#define PL_NSTREAMS	100	/* Max number of concurrent streams. */
#define PL_RGB_COLOR	1<<7	/* A hack */

#define TEXT_MODE	0
#define GRAPHICS_MODE	1
#ifndef PI
#define PI		3.1415926535897932384
#endif

/* These define the metafile & X driver (virtual) coordinate systems */

#define PIXELS_X	32768		/* Number of virtual pixels in x */
#define PIXELS_Y	32768		/* Number of virtual pixels in x */<commit_msg>Fix that problem that has been showing up on Linux where caddr_t is multiply typdef'd, producing an annoying warning when building PLplot.<commit_after>/* $Id$

    Copyright (C) 1993, 1994, 1995  by 
    <NAME>, <NAME>, <NAME>.

    Internal (private) macros and prototypes for the PLplot package.  This
    header file must be included before all others, including system header
    files.  This file is typically needed when including driver specific
    header files (e.g. pltkd.h).

    This software may be freely copied, modified and redistributed without
    fee provided that this copyright notice is preserved intact on all
    copies and modified copies. 
 
    There is no warranty or other guarantee of fitness of this software.
    It is provided solely "as is". The author(s) disclaim(s) all
    responsibility and liability with respect to this software's usage or
    its effect upon hardware or computer systems. 
*/

#ifndef __PLPLOTP_H__
#define __PLPLOTP_H__

/*--------------------------------------------------------------------------*\
 *        SYSTEM-SPECIFIC SETTINGS
 * 
 * Here we enable or disable based on system specific capabilities of
 * PLPLOT.  At present there are only two different "optional"
 * capabilities.  They are:
 *
 * POSIX_TTY	Defined if POSIX.1 tty control functions are available. 
 * STDC_HEADERS	Defined if libc is ANSI-compliant.
 *
 * POSIX.1 tty control functions are used by some of the drivers, e.g. to
 * switch to character-oriented (CBREAK) i/o (notably the tek driver and
 * all its variants).  It is usable without this but not as powerful.  The
 * reason for using this is that some supported systems are still not
 * POSIX.1 compliant (and some may never be).
 *
 * ANSI libc calls are used for: (a) setting up handlers to be called
 * before program exit (via the "atexit" call), and (b) for seek
 * operations.  Again, the code is usable without these.  An ANSI libc
 * should be available, given the requirement of an ANSI compiler.  Some
 * reasons why not: (a) the vendor didn't supply a complete ANSI
 * environment, or (b) the ANSI libc calls are buggy, or (c) you ported
 * gcc to your system but not glibc (for whatever reason).  Note: without
 * an ANSI C lib, if you ^C out of a program using one of the PLplot tek
 * drivers, your terminal may be left in a strange state.
\*--------------------------------------------------------------------------*/

#include "plplot/plConfig.h"
#ifdef caddr_t
#undef caddr_t
#ifndef __USE_BSD
typedef char * caddr_t;
#endif
#endif

/* System headers */

#include <ctype.h>
#include <math.h>
#include <string.h>

#ifdef _POSIX_SOURCE
#define POSIX_TTY
#endif

/* Hacks to deal with non-ANSI libc */

#if defined (STDC_HEADERS) && ! defined(USE_FSEEK)
#define STDC_FPOS_T
#endif

#ifdef STDC_FPOS_T
#define FPOS_T fpos_t
#define pl_fsetpos(a,b) fsetpos(a, b)
#define pl_fgetpos(a,b) fgetpos(a, b)

#else
#define FPOS_T long
#define pl_fsetpos(a,b) fseek(a, *b, 0)
#define pl_fgetpos(a,b) (-1L == (*b = ftell(a)))
#endif

/* Include all externally-visible definitions and prototypes */
/* plplot.h also includes some handy system header files */

#include "plplot/plplot.h"

/* plstream definition */

#include "plplot/plstrm.h"

/* If not including this file from inside of plcore.h, declare plsc */

#ifndef __PLCORE_H__
extern PLStream	*plsc;
#include "plplot/pldebug.h"
#endif

/*--------------------------------------------------------------------------*\
 *                       Utility macros
\*--------------------------------------------------------------------------*/

#ifndef TRUE
#define TRUE  1
#define FALSE 0
#endif

/* Used to help ensure everything malloc'ed gets freed */

#define free_mem(a) \
    if (a != NULL) { free((void *) a); a = NULL; }

/* Allows multi-argument setup calls to not affect selected arguments */

#define plsetvar(a, b) \
    if (b != PL_NOTSET) a = b;

/* Lots of cool math macros */

#ifndef MAX
#define MAX(a,b)    (((a) > (b)) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a,b)    (((a) < (b)) ? (a) : (b))
#endif
#ifndef ABS
#define ABS(a)      ((a)<0 ? -(a) : (a))
#endif
#ifndef ROUND
#define ROUND(a)    (PLINT)((a)<0. ? ((a)-.5) : ((a)+.5))
#endif
#ifndef BETW
#define BETW(ix,ia,ib)  (((ix)<=(ia)&&(ix)>=(ib)) || ((ix)>=(ia)&&(ix)<=(ib)))
#endif
#ifndef SSQR
#define SSQR(a,b)       sqrt((a)*(a)+(b)*(b))
#endif
#ifndef SIGN
#define SIGN(a)         ((a)<0 ? -1 : 1)
#endif

/* A coordinate value that should never occur */

#define PL_UNDEFINED -9999999

/*--------------------------------------------------------------------------*\
 *                       PLPLOT control macros
\*--------------------------------------------------------------------------*/

/* Some constants */

#define PL_MAXPOLY	256	/* Max segments in polyline or polygon */
#define PL_NSTREAMS	100	/* Max number of concurrent streams. */
#define PL_RGB_COLOR	1<<7	/* A hack */

#define TEXT_MODE	0
#define GRAPHICS_MODE	1
#ifndef PI
#define PI		3.1415926535897932384
#endif

/* These define the metafile & X driver (virtual) coordinate systems */

#define PIXELS_X	32768		/* Number of virtual pixels in x */
#define PIXELS_Y	32768		/* Number of virtual pixels in x */
{'fraction_non_alphanumeric': 0.19262654832731885, 'fraction_numerical': 0.014239734711791671, 'mean_word_length': 2.4548517520215634, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '760389', 'n_tokens_mistral': 3346, 'n_tokens_neox': 3136, 'n_words': 1228}