* win32-uname.c: Include "win32-uname.h", not "uname.h".
[bpt/guile.git] / libguile / srcprop.h
CommitLineData
8a5ae618
MD
1/* classes: h_files */
2
b29058ff
DH
3#ifndef SCM_SRCPROP_H
4#define SCM_SRCPROP_H
5
6/* Copyright (C) 1995,1996,2000,2001 Free Software Foundation, Inc.
7 *
8a5ae618
MD
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
b29058ff 12 *
8a5ae618
MD
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
b29058ff 17 *
8a5ae618
MD
18 * You should have received a copy of the GNU General Public License
19 * along with this software; see the file COPYING. If not, write to
82892bed
JB
20 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
21 * Boston, MA 02111-1307 USA
8a5ae618
MD
22 *
23 * As a special exception, the Free Software Foundation gives permission
24 * for additional uses of the text contained in its release of GUILE.
25 *
26 * The exception is that, if you link the GUILE library with other files
27 * to produce an executable, this does not by itself cause the
28 * resulting executable to be covered by the GNU General Public License.
29 * Your use of that executable is in no way restricted on account of
30 * linking the GUILE library code into it.
31 *
32 * This exception does not however invalidate any other reasons why
33 * the executable file might be covered by the GNU General Public License.
34 *
35 * This exception applies only to the code released by the
36 * Free Software Foundation under the name GUILE. If you copy
37 * code from other Free Software Foundation releases into a copy of
38 * GUILE, as the General Public License permits, the exception does
39 * not apply to the code that you add in this way. To avoid misleading
40 * anyone as to the status of such modified files, you must delete
41 * this exception notice from them.
42 *
43 * If you write modifications of your own for GUILE, it is your choice
44 * whether to permit this exception to apply to your modifications.
45 * If you do not wish that, delete this exception notice.
46 *
47 * The author can be reached at djurfeldt@nada.kth.se
82892bed 48 * Mikael Djurfeldt, SANS/NADA KTH, 10044 STOCKHOLM, SWEDEN */
d3a6bc94 49
8a5ae618
MD
50\f
51
b4309c3c 52#include "libguile/__scm.h"
8a5ae618
MD
53
54\f
55
8a5ae618
MD
56/* {The old whash table interface}
57 * *fixme* This is a temporary solution until weak hash table access
58 * has been optimized for speed (which is quite necessary, if they are
59 * used for recording of source code positions...)
60 */
61
62#define scm_whash_handle SCM
63
9fec1f77 64#define scm_whash_get_handle(whash, key) scm_hash_fn_get_handle (whash, key, scm_ihashq, scm_sloppy_assq, 0)
54778cd3 65#define SCM_WHASHFOUNDP(h) (!SCM_FALSEP (h))
8a5ae618
MD
66#define SCM_WHASHREF(whash, handle) SCM_CDR (handle)
67#define SCM_WHASHSET(whash, handle, obj) SCM_SETCDR (handle, obj)
9fec1f77
MD
68#define scm_whash_create_handle(whash, key) scm_hash_fn_create_handle_x (whash, key, SCM_UNSPECIFIED, scm_ihashq, scm_sloppy_assq, 0)
69#define scm_whash_lookup(whash, obj) scm_hash_fn_ref (whash, obj, SCM_BOOL_F, scm_ihashq, scm_sloppy_assq, 0)
70#define scm_whash_insert(whash, key, obj) \
d3a6bc94 71do { \
9fec1f77
MD
72 register SCM w = (whash); \
73 SCM_WHASHSET (w, scm_whash_create_handle (w, key), obj); \
d3a6bc94 74} while (0)
9fec1f77 75
8a5ae618
MD
76
77/* {Source properties}
78 */
79
92c2555f 80extern scm_t_bits scm_tc16_srcprops;
8a5ae618 81
92c2555f 82typedef struct scm_t_srcprops
8a5ae618
MD
83{
84 unsigned long pos;
85 SCM fname;
86 SCM copy;
87 SCM plist;
92c2555f 88} scm_t_srcprops;
8a5ae618
MD
89
90#define SRCPROPS_CHUNKSIZE 2047 /* Number of srcprops per chunk */
92c2555f 91typedef struct scm_t_srcprops_chunk
8a5ae618 92{
92c2555f
MV
93 struct scm_t_srcprops_chunk *next;
94 scm_t_srcprops srcprops[1];
95} scm_t_srcprops_chunk;
1be6b49c 96
e038c042
DH
97#define SCM_SOURCE_PROPERTY_FLAG_BREAK (1L << 16)
98
e841c3e0 99#define SRCPROPSP(p) (SCM_TYP16_PREDICATE (scm_tc16_srcprops, p))
e038c042
DH
100#define SRCPROPBRK(p) \
101 (SCM_BOOL (SCM_CELL_WORD_0 (p) & SCM_SOURCE_PROPERTY_FLAG_BREAK))
92c2555f 102#define SRCPROPPOS(p) ((scm_t_srcprops *) SCM_CELL_WORD_1 (p))->pos
8a5ae618
MD
103#define SRCPROPLINE(p) (SRCPROPPOS(p) >> 12)
104#define SRCPROPCOL(p) (SRCPROPPOS(p) & 0x0fffL)
92c2555f
MV
105#define SRCPROPFNAME(p) ((scm_t_srcprops *) SCM_CELL_WORD_1 (p))->fname
106#define SRCPROPCOPY(p) ((scm_t_srcprops *) SCM_CELL_WORD_1 (p))->copy
107#define SRCPROPPLIST(p) ((scm_t_srcprops *) SCM_CELL_WORD_1 (p))->plist
e038c042
DH
108#define SETSRCPROPBRK(p) \
109 (SCM_SET_CELL_WORD_0 ((p), SCM_CELL_WORD_0 (p) \
110 | SCM_SOURCE_PROPERTY_FLAG_BREAK))
111#define CLEARSRCPROPBRK(p) \
112 (SCM_SET_CELL_WORD_0 ((p), SCM_CELL_WORD_0 (p) \
113 & ~SCM_SOURCE_PROPERTY_FLAG_BREAK))
8a5ae618
MD
114#define SRCPROPMAKPOS(l,c) (((l) << 12) + (c))
115#define SETSRCPROPPOS(p,l,c) (SRCPROPPOS (p) = SRCPROPMAKPOS (l, c))
116#define SETSRCPROPLINE(p,l) SETSRCPROPPOS (p, l, SRCPROPCOL (p))
117#define SETSRCPROPCOL(p,c) SETSRCPROPPOS (p, SRCPROPLINE (p), c)
118
b29058ff 119#define SRCBRKP(x) (!SCM_IMP (t.arg1 = scm_whash_lookup (scm_source_whash, (x)))\
8a5ae618 120 && SRCPROPSP (t.arg1)\
54778cd3 121 && (SCM_CELL_WORD_0 (t.arg1) & (1L << 16)))
8a5ae618 122
b29058ff 123#define PROCTRACEP(x) (!SCM_FALSEP (scm_procedure_property (x, scm_sym_trace)))
8a5ae618 124
92e5aa0e
MD
125extern SCM scm_sym_filename;
126extern SCM scm_sym_copy;
127extern SCM scm_sym_line;
128extern SCM scm_sym_column;
129extern SCM scm_sym_breakpoint;
34019bd6 130
8a5ae618
MD
131\f
132
1cc91f1b 133
7862b07e 134extern SCM scm_srcprops_to_plist (SCM obj);
1be6b49c 135extern SCM scm_make_srcprops (long line, int col, SCM fname, SCM copy, SCM plist);
7866a09b
GB
136extern SCM scm_source_property (SCM obj, SCM key);
137extern SCM scm_set_source_property_x (SCM obj, SCM key, SCM datum);
138extern SCM scm_source_properties (SCM obj);
139extern SCM scm_set_source_properties_x (SCM obj, SCM props);
140extern void scm_finish_srcprop (void);
141extern void scm_init_srcprop (void);
8a5ae618 142
b29058ff 143#endif /* SCM_SRCPROP_H */
89e00824
ML
144
145/*
146 Local Variables:
147 c-file-style: "gnu"
148 End:
149*/