#define FEATURE_X11 1
#endif
-#ifdef _PACKAGE_ast
-#include <ast.h>
-#define HAVE_STRERROR 1
-#else
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
-#endif
#include <inttypes.h>
#include <math.h>
*************************************************************************/
%{
-#if defined(_PACKAGE_ast)
-#include <ast.h>
-#endif
#include <stdio.h>
typedef void *Tobj;
int Ireadgraph (int, Tonm_t *);
int Iwritegraph (int, Tonm_t *);
#endif
-#ifdef _PACKAGE_ast
-int Imatch (int, Tonm_t *);
-#endif
#ifdef FEATURE_CS
int C2Lreadcsmessage (int, Tonm_t *);
#endif
{ "readgraph", Ireadgraph, 1, 2 },
{ "writegraph", Iwritegraph, 3, 3 },
#endif
-#ifdef _PACKAGE_ast
- { "match", Imatch, 2, 2 },
-#endif
#ifdef FEATURE_CS
{ "readcsmessage", C2Lreadcsmessage, 1, 1 },
#endif
}
#endif
-#ifdef _PACKAGE_ast
-/* ast related functions */
-
-int Imatch (int argc, lvar_t *argv) {
- if (!T_ISSTRING (argv[0].o) || !T_ISSTRING (argv[1].o))
- return L_FAILURE;
- rtno = Tinteger (strmatch (Tgetstring (argv[0].o), Tgetstring (argv[1].o)));
- return L_SUCCESS;
-}
-#endif
-
static void growbufp (int newsize) {
if (!(bufp = realloc (
bufp, ((newsize + BUFINCR - 1) / BUFINCR) * BUFINCR * BUFSIZE
Agclos_t *clos; /* shared resources */
};
-
-#if defined(_PACKAGE_ast)
-/* fine control of object callbacks */
-# if defined(_BLD_cgraph) && defined(__EXPORT__)
-# define extern __EXPORT__
-# endif
-# if !defined(_BLD_cgraph) && defined(__IMPORT__)
-# define extern __IMPORT__
-# endif
-#endif
-
extern void agpushdisc(Agraph_t * g, Agcbdisc_t * disc, void *state);
extern int agpopdisc(Agraph_t * g, Agcbdisc_t * disc);
extern int agcallbacks(Agraph_t * g, int flag); /* return prev value */
#define TAILPORT_ID "tailport"
#define HEADPORT_ID "headport"
-#if defined(_PACKAGE_ast)
-# if !defined(_BLD_cgraph) && defined(__IMPORT__)
-# define extern __IMPORT__
-# endif
-#endif
#if defined(_MSC_VER) && !defined(CGRAPH_EXPORTS)
#define extern __declspec(dllimport)
#endif
* n - the order of the matrices A and Ainv
*/
-#if defined(_PACKAGE_ast)
-#include <ast.h>
-#else
-#endif
#include <stdlib.h>
#include "render.h"
extern int lu_decompose(double **a, int n);
** Written by Kiem-Phong Vo
*/
-#if PACKAGE_ast
-int _AST_already_has_them;
-#else
-
#if !_lib_atexit
#if _lib_onexit
#endif /*_lib_waitpid*/
-#endif /*!PACKAGE_ast */
#endif
/* note that the macro vt_threaded has effect on vthread.h */
#include <vthread.h>
-/* file system info */
-#if defined(_PACKAGE_ast)
-
-#include <ast.h>
-#include <ast_time.h>
-#include <ast_tty.h>
-#include <ls.h>
-
-#if _mem_st_blksize_stat
-#define _stat_blksize 1
-#endif
-
-#if _lib_localeconv && _hdr_locale
-#define _lib_locale 1
-#endif
-
-#else /*!defined(_PACKAGE_ast) */
-
#if defined(__mips) && __mips == 2 && !defined(_NO_LARGEFILE64_SOURCE)
#define _NO_LARGEFILE64_SOURCE 1
#endif
#include <unistd.h>
#endif
-#endif /*defined(_PACKAGE_ast)*/
-
#include <errno.h>
#include <ctype.h>
#define ESPIPE 29
#endif
/* see if we can use memory mapping for io */
-#if !defined(_PACKAGE_ast) && defined(_mmap_worthy)
+#if defined(_mmap_worthy)
# ifdef _LARGEFILE64_SOURCE
# undef mmap
# endif
#define SF_RADIX 64 /* maximum integer conversion base */
-#if defined(_PACKAGE_ast)
-#define SF_MAXINT INT_MAX
-#define SF_MAXLONG LONG_MAX
-#else
#define SF_MAXINT ((int)(((uint)~0) >> 1))
#define SF_MAXLONG ((long)(((ulong)~0L) >> 1))
-#endif
#define SF_MAXCHAR ((uchar)(~0))
#define max(x,y) ((x) > (y) ? (x) : (y))
/* fast functions for memory copy and memory clear */
-#if defined(_PACKAGE_ast)
-#define memclear(s,n) memzero(s,n)
-#else
#if _lib_bcopy && !_lib_memcpy
#define memcpy(to,fr,n) bcopy((fr),(to),(n))
#endif
#else
#define memclear(s,n) memset((s),'\0',(n))
#endif
-#endif /*defined(_PACKAGE_ast)*/
/* note that MEMCPY advances the associated pointers */
#define MEMCPY(to,fr,n) \
extern int munmap(void *, size_t);
#endif
-#if !defined(_PACKAGE_ast)
-
#ifdef WIN32
#undef SF_ERROR
#include <io.h>
extern int open(const char *, int, ...);
#endif
-#endif /* defined(_PACKAGE_ast) */
-
#endif /*_SFHDR_H*/
#ifdef __cplusplus
}
** Written by Kiem-Phong Vo
*/
-#if defined(_PACKAGE_ast)
-#include <ast_std.h>
-#else
#include <ast_common.h>
#include <stdarg.h>
#endif
#endif
-#endif /* defined(_PACKAGE_ast) */
-
/* Sfoff_t should be large enough for largest file address */
*/
/* the below is for protecting the application from SIGPIPE */
-#if defined(_PACKAGE_ast)
-#include <sig.h>
-#include <wait.h>
-#define Sfsignal_f Sig_handler_t
-#else
#include <signal.h>
typedef void (*Sfsignal_f) (int);
-#endif
static int _Sfsigp = 0; /* # of streams needing SIGPIPE protection */
/* done at exiting time */
CLOSE(p->file);
/* wait for process termination */
-#if defined(_PACKAGE_ast)
- sigcritical(1);
-#endif
#ifndef WIN32
while ((pid = waitpid(p->pid, &status, 0)) == -1
&& errno == EINTR);
#endif
if (pid < 0)
status = -1;
-#if defined(_PACKAGE_ast)
- sigcritical(0);
-#endif
#ifdef SIGPIPE
vtmtxlock(_Sfmutex);
*************************************************************************/
#include "sfhdr.h"
-#if !defined(_PACKAGE_ast)
#ifndef FIONREAD
#if _sys_ioctl
#include <sys/ioctl.h>
#endif
#endif
-#endif
/* Read/Peek a record from an unseekable device
**
** Written by Kiem-Phong Vo.
*/
-#if defined(_PACKAGE_ast)
-#include <proc.h>
-#else
-
#define EXIT_NOTFOUND 127
#define READ 0
_exit(EXIT_NOTFOUND);
}
-#endif /*defined(_PACKAGE_ast)*/
-
#ifndef WIN32
/**
* @param f
*/
Sfio_t *sfpopen(Sfio_t * f, const char *command, const char *mode)
{
-#if defined(_PACKAGE_ast)
- reg Proc_t *proc;
- reg int sflags;
- reg long flags;
- reg int bits;
- char *av[4];
-
- if (!command || !command[0] || !(sflags = _sftype(mode, NiL, NiL)))
- return 0;
-
- if (f == (Sfio_t *) (-1)) { /* stdio compatibility mode */
- f = NIL(Sfio_t *);
- bits = SF_STDIO;
- } else
- bits = 0;
-
- flags = 0;
- if (sflags & SF_READ)
- flags |= PROC_READ;
- if (sflags & SF_WRITE)
- flags |= PROC_WRITE;
- av[0] = "sh";
- av[1] = "-c";
- av[2] = (char *) command;
- av[3] = 0;
- if (!(proc = procopen(0, av, 0, 0, flags)))
- return 0;
- if (!(f = sfnew(f, NIL(void *), (size_t) SF_UNBOUND,
- (sflags & SF_READ) ? proc->rfd : proc->wfd, sflags)) ||
- ((f->bits |= bits),
- _sfpopen(f, (sflags & SF_READ) ? proc->wfd : -1, proc->pid)) < 0)
- {
- if (f)
- sfclose(f);
- procclose(proc);
- return 0;
- }
- procfree(proc);
- return f;
-#else
reg int pid, fd, pkeep, ckeep, sflags;
int stdio, parent[2], child[2];
Sfio_t sf;
}
return NIL(Sfio_t *);
}
-#endif /*defined(_PACKAGE_ast)*/
}
#endif
return 0;
}
-#if !defined(_PACKAGE_ast)
#include <time.h>
#define TMPDFLT "/tmp"
static char **Tmppath, **Tmpcur;
return dirs;
}
-#endif /*!defined(_PACKAGE_ast) */
-
static int _tmpfd(Sfio_t * f)
{
reg char *file;
reg int fd;
int t;
-#if !defined(_PACKAGE_ast)
/* set up path of dirs to create temp files */
if (!Tmppath && !(Tmppath = _sfgetpath("TMPPATH"))) {
if (!(Tmppath = (char **) malloc(2 * sizeof(char *))))
Tmpcur += 1;
if (!Tmpcur || !Tmpcur[0])
Tmpcur = Tmppath;
-#endif /*!defined(_PACKAGE_ast) */
file = NIL(char *);
fd = -1;
for (t = 0; t < 10; ++t) { /* compute a random name */
-#if !defined(_PACKAGE_ast)
static ulong Key, A;
if (A == 0 || t > 0) { /* get a quasi-random coefficient */
reg int r;
Key = A * Key + 987654321;
file = sfprints("%s/sf%3.3.32lu.%3.3.32lu",
Tmpcur[0], (Key >> 15) & 0x7fff, Key & 0x7fff);
-#else
- file = pathtmp(file, NiL, "sf", NiL);
-#endif /*!defined(_PACKAGE_ast) */
if (!file)
return -1;
if (fd >= 0)
_rmtmp(f, file);
-#if defined(_PACKAGE_ast)
- free(file);
-#endif /*defined(_PACKAGE_ast)*/
return fd;
}
#include <ast_common.h>
#include <errno.h>
-/* ast doesn't do threads yet */
-#if defined(_PACKAGE_ast) && !defined(vt_threaded)
-#define vt_threaded 0
-#endif
-
-
#if !defined(vt_threaded) || (defined(vt_threaded) && vt_threaded == 1)
#define _may_use_threads 1
#else
}
*next = '\0';
-#if defined(_PACKAGE_ast)
- return open(buf, O_WRONLY | O_CREAT | O_TRUNC, CREAT_MODE);
-#else
return creat(buf, CREAT_MODE);
-#endif
}
static void pfprint(void)
#define VMALLOC_VERSION 19990805L
-#if defined(_PACKAGE_ast)
-#include <ast_std.h>
-#else
#include <ast_common.h>
-#endif
typedef struct _vmalloc_s Vmalloc_t;
typedef struct _vmstat_s Vmstat_t;
** Any required functions for process exiting.
** Written by Kiem-Phong Vo, kpv@research.att.com (05/25/93).
*/
-#if defined(_PACKAGE_ast) || _lib_atexit
+#if _lib_atexit
int Vm_atexit_already_defined;
#else
#endif /* _lib_onexit || _lib_on_exit */
-#endif /*!PACKAGE_ast */
+#endif /*_lib_atexit */
** Written by Kiem-Phong Vo, kpv@research.att.com, 01/16/94.
*/
-
-#if defined(_PACKAGE_ast)
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
- __STDPP__directive pragma pp:hide getpagesize
-#else
-#define getpagesize ______getpagesize
-#endif
-
-#include <ast.h>
-
-#if defined(__STDPP__directive) && defined(__STDPP__hide)
- __STDPP__directive pragma pp:nohide getpagesize
-#else
-#undef getpagesize
-#endif
-
-#else
-
#include <ast_common.h>
#include "FEATURE/vmalloc"
-#endif /*defined(_PACKAGE_ast)*/
-
#undef free
#undef malloc
#undef realloc
extern Vmextern_t _Vmextern;
-
-#if !defined(_PACKAGE_ast)
-
extern size_t getpagesize(void);
#ifndef WIN32
#endif
extern void _cleanup(void);
-#endif /*!PACKAGE_ast */
-
/* for vmdcsbrk.c */
#if !_typ_ssize_t
typedef int ssize_t;