Commit | Line | Data |
---|---|---|
8a5ae618 MD |
1 | /* classes: h_files */ |
2 | ||
b29058ff DH |
3 | #ifndef SCM_SRCPROP_H |
4 | #define SCM_SRCPROP_H | |
5 | ||
2b829bbb | 6 | /* Copyright (C) 1995,1996,2000,2001, 2006 Free Software Foundation, Inc. |
b29058ff | 7 | * |
73be1d9e MV |
8 | * This library is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU Lesser General Public | |
10 | * License as published by the Free Software Foundation; either | |
11 | * version 2.1 of the License, or (at your option) any later version. | |
b29058ff | 12 | * |
73be1d9e | 13 | * This library is distributed in the hope that it will be useful, |
8a5ae618 | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
73be1d9e MV |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | * Lesser General Public License for more details. | |
b29058ff | 17 | * |
73be1d9e MV |
18 | * You should have received a copy of the GNU Lesser General Public |
19 | * License along with this library; if not, write to the Free Software | |
92205699 | 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
73be1d9e | 21 | */ |
d3a6bc94 | 22 | |
8a5ae618 MD |
23 | \f |
24 | ||
b4309c3c | 25 | #include "libguile/__scm.h" |
8a5ae618 MD |
26 | |
27 | \f | |
28 | ||
8a5ae618 MD |
29 | /* {The old whash table interface} |
30 | * *fixme* This is a temporary solution until weak hash table access | |
31 | * has been optimized for speed (which is quite necessary, if they are | |
32 | * used for recording of source code positions...) | |
33 | */ | |
34 | ||
35 | #define scm_whash_handle SCM | |
36 | ||
9fec1f77 | 37 | #define scm_whash_get_handle(whash, key) scm_hash_fn_get_handle (whash, key, scm_ihashq, scm_sloppy_assq, 0) |
7888309b | 38 | #define SCM_WHASHFOUNDP(h) (scm_is_true (h)) |
8a5ae618 MD |
39 | #define SCM_WHASHREF(whash, handle) SCM_CDR (handle) |
40 | #define SCM_WHASHSET(whash, handle, obj) SCM_SETCDR (handle, obj) | |
9fec1f77 MD |
41 | #define scm_whash_create_handle(whash, key) scm_hash_fn_create_handle_x (whash, key, SCM_UNSPECIFIED, scm_ihashq, scm_sloppy_assq, 0) |
42 | #define scm_whash_lookup(whash, obj) scm_hash_fn_ref (whash, obj, SCM_BOOL_F, scm_ihashq, scm_sloppy_assq, 0) | |
43 | #define scm_whash_insert(whash, key, obj) \ | |
d3a6bc94 | 44 | do { \ |
9fec1f77 MD |
45 | register SCM w = (whash); \ |
46 | SCM_WHASHSET (w, scm_whash_create_handle (w, key), obj); \ | |
d3a6bc94 | 47 | } while (0) |
9fec1f77 | 48 | |
8a5ae618 MD |
49 | |
50 | /* {Source properties} | |
51 | */ | |
52 | ||
33b001fd | 53 | SCM_API scm_t_bits scm_tc16_srcprops; |
8a5ae618 | 54 | |
92c2555f | 55 | typedef struct scm_t_srcprops |
8a5ae618 MD |
56 | { |
57 | unsigned long pos; | |
58 | SCM fname; | |
59 | SCM copy; | |
60 | SCM plist; | |
92c2555f | 61 | } scm_t_srcprops; |
8a5ae618 MD |
62 | |
63 | #define SRCPROPS_CHUNKSIZE 2047 /* Number of srcprops per chunk */ | |
92c2555f | 64 | typedef struct scm_t_srcprops_chunk |
8a5ae618 | 65 | { |
92c2555f MV |
66 | struct scm_t_srcprops_chunk *next; |
67 | scm_t_srcprops srcprops[1]; | |
68 | } scm_t_srcprops_chunk; | |
1be6b49c | 69 | |
f5710d53 | 70 | #define SCM_SOURCE_PROPERTY_FLAG_BREAK 1 |
e038c042 | 71 | |
f5710d53 MV |
72 | #define SRCPROPSP(p) (SCM_SMOB_PREDICATE (scm_tc16_srcprops, (p))) |
73 | #define SRCPROPBRK(p) (SCM_SMOB_FLAGS (p) & SCM_SOURCE_PROPERTY_FLAG_BREAK) | |
74 | #define SRCPROPPOS(p) ((scm_t_srcprops *) SCM_SMOB_DATA (p))->pos | |
8a5ae618 MD |
75 | #define SRCPROPLINE(p) (SRCPROPPOS(p) >> 12) |
76 | #define SRCPROPCOL(p) (SRCPROPPOS(p) & 0x0fffL) | |
f5710d53 MV |
77 | #define SRCPROPFNAME(p) ((scm_t_srcprops *) SCM_SMOB_DATA (p))->fname |
78 | #define SRCPROPCOPY(p) ((scm_t_srcprops *) SCM_SMOB_DATA (p))->copy | |
79 | #define SRCPROPPLIST(p) ((scm_t_srcprops *) SCM_SMOB_DATA (p))->plist | |
e038c042 | 80 | #define SETSRCPROPBRK(p) \ |
f5710d53 MV |
81 | (SCM_SET_SMOB_FLAGS ((p), \ |
82 | SCM_SMOB_FLAGS (p) | SCM_SOURCE_PROPERTY_FLAG_BREAK)) | |
e038c042 | 83 | #define CLEARSRCPROPBRK(p) \ |
f5710d53 MV |
84 | (SCM_SET_SMOB_FLAGS ((p), \ |
85 | SCM_SMOB_FLAGS (p) & ~SCM_SOURCE_PROPERTY_FLAG_BREAK)) | |
34d19ef6 HWN |
86 | #define SRCPROPMAKPOS(l, c) (((l) << 12) + (c)) |
87 | #define SETSRCPROPPOS(p, l, c) (SRCPROPPOS (p) = SRCPROPMAKPOS (l, c)) | |
88 | #define SETSRCPROPLINE(p, l) SETSRCPROPPOS (p, l, SRCPROPCOL (p)) | |
89 | #define SETSRCPROPCOL(p, c) SETSRCPROPPOS (p, SRCPROPLINE (p), c) | |
8a5ae618 | 90 | |
7888309b | 91 | #define PROCTRACEP(x) (scm_is_true (scm_procedure_property (x, scm_sym_trace))) |
8a5ae618 | 92 | |
33b001fd MV |
93 | SCM_API SCM scm_sym_filename; |
94 | SCM_API SCM scm_sym_copy; | |
95 | SCM_API SCM scm_sym_line; | |
96 | SCM_API SCM scm_sym_column; | |
97 | SCM_API SCM scm_sym_breakpoint; | |
34019bd6 | 98 | |
8a5ae618 MD |
99 | \f |
100 | ||
bc76d628 | 101 | SCM_API int scm_c_source_property_breakpoint_p (SCM form); |
33b001fd MV |
102 | SCM_API SCM scm_srcprops_to_plist (SCM obj); |
103 | SCM_API SCM scm_make_srcprops (long line, int col, SCM fname, SCM copy, SCM plist); | |
104 | SCM_API SCM scm_source_property (SCM obj, SCM key); | |
105 | SCM_API SCM scm_set_source_property_x (SCM obj, SCM key, SCM datum); | |
106 | SCM_API SCM scm_source_properties (SCM obj); | |
107 | SCM_API SCM scm_set_source_properties_x (SCM obj, SCM props); | |
108 | SCM_API void scm_finish_srcprop (void); | |
109 | SCM_API void scm_init_srcprop (void); | |
8a5ae618 | 110 | |
bc76d628 DH |
111 | #if SCM_ENABLE_DEPRECATED == 1 |
112 | #define SRCBRKP(x) (scm_source_property_breakpoint_p (x)) | |
113 | #endif | |
114 | ||
b29058ff | 115 | #endif /* SCM_SRCPROP_H */ |
89e00824 ML |
116 | |
117 | /* | |
118 | Local Variables: | |
119 | c-file-style: "gnu" | |
120 | End: | |
121 | */ |