~burner/xsb/debianized-xsb

« back to all changes in this revision

Viewing changes to build/private_builtin.in

  • 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:      private_builtin.c
 
2
** Author(s): Work of thousands
 
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: private_builtin.in,v 1.9 2005/05/31 19:00:21 kifer Exp $
 
22
** 
 
23
*/
 
24
 
 
25
 
 
26
/* This file is never committed into the repository, so you can put
 
27
   experimental code here.
 
28
   It is also a place for private builtins that you might be using for
 
29
   debugging. 
 
30
   Note: even though this is a single builtin, YOU CAN SIMULATE ANY
 
31
   NUMBER OF BUILTINS WITH IT.  */
 
32
 
 
33
#include "xsb_config.h"
 
34
#include "xsb_debug.h"
 
35
 
 
36
#include <stdio.h>
 
37
#include <signal.h>
 
38
#include <errno.h>
 
39
#include <string.h>
 
40
#include <stdlib.h>
 
41
#ifndef WIN_NT
 
42
#include <unistd.h> 
 
43
#endif
 
44
#include <sys/stat.h>
 
45
 
 
46
#include "setjmp_xsb.h"
 
47
#include "auxlry.h"
 
48
#include "cell_xsb.h"
 
49
#include "error_xsb.h"
 
50
#include "cinterf.h"
 
51
#include "memory.h"
 
52
#include "psc_xsb.h"
 
53
#include "heap_xsb.h"
 
54
#include "register.h"
 
55
#include "flags_xsb.h"
 
56
 
 
57
/* The folowing function must be defined. What's inside doesn't matter */
 
58
xsbBool private_builtin(void)
 
59
{
 
60
  /*
 
61
  ctop_string(1, "abc");
 
62
  */
 
63
  return TRUE;
 
64
}
 
65
 
 
66
/* Here is an example of how to hang multiple pseudo-builtins
 
67
   off of private_builtin/11 */
 
68
 
 
69
/*
 
70
#define PRINT_LS            1
 
71
#define PRINT_TR            2
 
72
#define PRINT_HEAP          3
 
73
#define PRINT_CP            4
 
74
#define PRINT_REGS          5
 
75
#define PRINT_ALL_STACKS    6
 
76
#define EXP_HEAP            7
 
77
#define MARK_HEAP           8
 
78
#define GC_HEAP             9
 
79
*/
 
80
 
 
81
/* Arg 1 is the OP code. The rest are real arguments to the builtin */
 
82
/*
 
83
xsbBool private_builtin(void)
 
84
{
 
85
  switch (ptoc_int(1)) {
 
86
  case PRINT_LS: print_ls(1) ; return TRUE ;
 
87
  case PRINT_TR: print_tr(1) ; return TRUE ;
 
88
  case PRINT_HEAP: print_heap(0,2000,1) ; return TRUE ;
 
89
  case PRINT_CP: print_cp(1) ; return TRUE ;
 
90
  case PRINT_REGS: print_regs(10,1) ; return TRUE ;
 
91
  case PRINT_ALL_STACKS: print_all_stacks() ; return TRUE ;
 
92
  case EXP_HEAP: glstack_realloc(glstack.size + 1,0) ; return TRUE ;
 
93
  case MARK_HEAP: mark_heap(ptoc_int(2),&tmpval) ; return TRUE ;
 
94
  case GC_HEAP: return(gc_heap(0)) ;
 
95
  }
 
96
}
 
97
*/
 
98
 
 
99
/* To use these bultins, you must have a .P file with the following
 
100
   information: */
 
101
 
 
102
/*
 
103
print_ls :- private_builtin(1,_,_,_,_,_,_,_,_,_,_).
 
104
print_tr :- private_builtin(1,_,_,_,_,_,_,_,_,_,_).
 
105
print_heap :- private_builtin(1,_,_,_,_,_,_,_,_,_,_).
 
106
print_cp :- private_builtin(1,_,_,_,_,_,_,_,_,_,_).
 
107
print_regs :- private_builtin(1,_,_,_,_,_,_,_,_,_,_).
 
108
print_all_stacks :- private_builtin(1,_,_,_,_,_,_,_,_,_,_).
 
109
exp_heap :- private_builtin(1,_,_,_,_,_,_,_,_,_,_).
 
110
mark_heap(A) :- private_builtin(1,A,_,_,_,_,_,_,_,_,_).
 
111
gc_heap :- private_builtin(1,_,_,_,_,_,_,_,_,_,_).
 
112
*/