~burner/xsb/debianized-xsb

« back to all changes in this revision

Viewing changes to emu/system_xsb.h

  • Committer: Michael R. Head
  • Date: 2006-09-06 22:11:55 UTC
  • Revision ID: burner@n23-20060906221155-7e398d23438a7ee4
Add the files from the 3.0.1 release package

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* File:      system_xsb.h
 
2
** Author(s): kifer
 
3
** Contact:   xsb-contact@cs.sunysb.edu
 
4
** 
 
5
** Copyright (C) The Research Foundation of SUNY, 1999
 
6
** 
 
7
** XSB is free software; you can redistribute it and/or modify it under the
 
8
** terms of the GNU Library General Public License as published by the Free
 
9
** Software Foundation; either version 2 of the License, or (at your option)
 
10
** any later version.
 
11
** 
 
12
** XSB is distributed in the hope that it will be useful, but WITHOUT ANY
 
13
** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
14
** FOR A PARTICULAR PURPOSE.  See the GNU Library General Public License for
 
15
** more details.
 
16
** 
 
17
** You should have received a copy of the GNU Library General Public License
 
18
** along with XSB; if not, write to the Free Software Foundation,
 
19
** Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
20
**
 
21
** $Id: system_xsb.h,v 1.12 2005/01/14 18:31:33 ruim Exp $
 
22
** 
 
23
*/
 
24
 
 
25
 
 
26
#ifdef __cplusplus
 
27
extern "C" {
 
28
#endif
 
29
 
 
30
#ifndef fileno                          /* fileno may be a  macro */
 
31
extern int    fileno(FILE *f);          /* this is defined in POSIX */
 
32
#endif
 
33
 
 
34
/* In WIN_NT, this gets redefined into _fdopen by wind2unix.h */
 
35
extern FILE *fdopen(int fildes, const char *type);
 
36
 
 
37
#ifndef WIN_NT
 
38
extern int kill(pid_t pid, int sig);
 
39
#endif
 
40
#ifdef _cplusplus
 
41
}
 
42
#endif
 
43
 
 
44
#ifdef WIN_NT
 
45
#define PIPE(filedes_array)  _pipe(filedes_array, 5*MAXBUFSIZE, _O_TEXT)
 
46
#define WAIT(pid, status)    _cwait(&status, pid, 0)
 
47
#define KILL_FAILED(pid)     !TerminateProcess((HANDLE) pid,-1) /* -1=retval */
 
48
#else
 
49
#define PIPE(filedes_array)  pipe(filedes_array)
 
50
#define WAIT(pid, status)    waitpid(pid, &status, 0)
 
51
#define KILL_FAILED(pid)     kill(pid, SIGKILL) < 0
 
52
#endif
 
53
 
 
54
#ifdef __cplusplus
 
55
}
 
56
#endif
 
57
 
 
58
#define FREE_PROC_TABLE_CELL(pid)   ((pid < 0) \
 
59
                                     || ((process_status(pid) != RUNNING) \
 
60
                                         && (process_status(pid) != STOPPED)))
 
61
 
 
62
/* return codes from xsb_spawn */
 
63
#define  PIPE_TO_PROC_FAILED    -1
 
64
#define  PIPE_FROM_PROC_FAILED  -2
 
65
#define  SUB_PROC_FAILED        -3
 
66
 
 
67
#define MAX_SUBPROC_PARAMS 50  /* max # of cmdline params in a subprocess */
 
68
 
 
69
#define MAX_SUBPROC_NUMBER 40  /* max number of subrocesses allowed       */
 
70
 
 
71
 
 
72
#define RUNNING                1
 
73
#define STOPPED                2
 
74
#define EXITED_NORMALLY        3
 
75
#define EXITED_ABNORMALLY      4
 
76
#define ABORTED                5
 
77
#define INVALID                6
 
78
#define UNKNOWN                7