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