Commit | Line | Data |
---|---|---|
8a5ae618 MD |
1 | /* classes: h_files */ |
2 | ||
3 | #ifndef SRCPROPH | |
4 | #define SRCPROPH | |
5 | /* Copyright (C) 1995,1996 Mikael Djurfeldt | |
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 | |
19 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
20 | * | |
21 | * As a special exception, the Free Software Foundation gives permission | |
22 | * for additional uses of the text contained in its release of GUILE. | |
23 | * | |
24 | * The exception is that, if you link the GUILE library with other files | |
25 | * to produce an executable, this does not by itself cause the | |
26 | * resulting executable to be covered by the GNU General Public License. | |
27 | * Your use of that executable is in no way restricted on account of | |
28 | * linking the GUILE library code into it. | |
29 | * | |
30 | * This exception does not however invalidate any other reasons why | |
31 | * the executable file might be covered by the GNU General Public License. | |
32 | * | |
33 | * This exception applies only to the code released by the | |
34 | * Free Software Foundation under the name GUILE. If you copy | |
35 | * code from other Free Software Foundation releases into a copy of | |
36 | * GUILE, as the General Public License permits, the exception does | |
37 | * not apply to the code that you add in this way. To avoid misleading | |
38 | * anyone as to the status of such modified files, you must delete | |
39 | * this exception notice from them. | |
40 | * | |
41 | * If you write modifications of your own for GUILE, it is your choice | |
42 | * whether to permit this exception to apply to your modifications. | |
43 | * If you do not wish that, delete this exception notice. | |
44 | * | |
45 | * The author can be reached at djurfeldt@nada.kth.se | |
46 | * Mikael Djurfeldt, SANS/NADA KTH, 10044 STOCKHOLM, SWEDEN | |
47 | */ | |
48 | \f | |
49 | ||
b4309c3c | 50 | #include "libguile/__scm.h" |
8a5ae618 MD |
51 | |
52 | \f | |
53 | ||
8a5ae618 MD |
54 | /* {The old whash table interface} |
55 | * *fixme* This is a temporary solution until weak hash table access | |
56 | * has been optimized for speed (which is quite necessary, if they are | |
57 | * used for recording of source code positions...) | |
58 | */ | |
59 | ||
60 | #define scm_whash_handle SCM | |
61 | ||
9fec1f77 | 62 | #define scm_whash_get_handle(whash, key) scm_hash_fn_get_handle (whash, key, scm_ihashq, scm_sloppy_assq, 0) |
8a5ae618 MD |
63 | #define SCM_WHASHFOUNDP(h) ((h) != SCM_BOOL_F) |
64 | #define SCM_WHASHREF(whash, handle) SCM_CDR (handle) | |
65 | #define SCM_WHASHSET(whash, handle, obj) SCM_SETCDR (handle, obj) | |
9fec1f77 MD |
66 | #define scm_whash_create_handle(whash, key) scm_hash_fn_create_handle_x (whash, key, SCM_UNSPECIFIED, scm_ihashq, scm_sloppy_assq, 0) |
67 | #define scm_whash_lookup(whash, obj) scm_hash_fn_ref (whash, obj, SCM_BOOL_F, scm_ihashq, scm_sloppy_assq, 0) | |
68 | #define scm_whash_insert(whash, key, obj) \ | |
69 | { \ | |
70 | register SCM w = (whash); \ | |
71 | SCM_WHASHSET (w, scm_whash_create_handle (w, key), obj); \ | |
72 | } \ | |
73 | ||
8a5ae618 MD |
74 | |
75 | /* {Source properties} | |
76 | */ | |
77 | ||
9fec1f77 | 78 | extern long scm_tc16_srcprops; |
8a5ae618 MD |
79 | |
80 | typedef struct scm_srcprops | |
81 | { | |
82 | unsigned long pos; | |
83 | SCM fname; | |
84 | SCM copy; | |
85 | SCM plist; | |
86 | } scm_srcprops; | |
87 | ||
88 | #define SRCPROPS_CHUNKSIZE 2047 /* Number of srcprops per chunk */ | |
89 | typedef struct scm_srcprops_chunk | |
90 | { | |
91 | struct scm_srcprops_chunk *next; | |
92 | scm_srcprops srcprops[1]; | |
93 | } scm_srcprops_chunk; | |
94 | ||
9fec1f77 | 95 | #define SRCPROPSP(p) (SCM_TYP16 (p) == scm_tc16_srcprops) |
8a5ae618 MD |
96 | #define SRCPROPBRK(p) ((1L << 16) & SCM_CAR (p) ? SCM_BOOL_T : SCM_BOOL_F) |
97 | #define SRCPROPPOS(p) ((scm_srcprops *) SCM_CDR (p))->pos | |
98 | #define SRCPROPLINE(p) (SRCPROPPOS(p) >> 12) | |
99 | #define SRCPROPCOL(p) (SRCPROPPOS(p) & 0x0fffL) | |
100 | #define SRCPROPFNAME(p) ((scm_srcprops *) SCM_CDR (p))->fname | |
101 | #define SRCPROPCOPY(p) ((scm_srcprops *) SCM_CDR (p))->copy | |
102 | #define SRCPROPPLIST(p) ((scm_srcprops *) SCM_CDR (p))->plist | |
898a256f MD |
103 | #define SETSRCPROPBRK(p) (SCM_SETOR_CAR (p, (1L << 16))) |
104 | #define CLEARSRCPROPBRK(p) SCM_SETAND_CAR (p, ~(1L << 16)) | |
8a5ae618 MD |
105 | #define SRCPROPMAKPOS(l,c) (((l) << 12) + (c)) |
106 | #define SETSRCPROPPOS(p,l,c) (SRCPROPPOS (p) = SRCPROPMAKPOS (l, c)) | |
107 | #define SETSRCPROPLINE(p,l) SETSRCPROPPOS (p, l, SRCPROPCOL (p)) | |
108 | #define SETSRCPROPCOL(p,c) SETSRCPROPPOS (p, SRCPROPLINE (p), c) | |
109 | ||
110 | #define SRCBRKP(x) (SCM_NIMP (t.arg1 = scm_whash_lookup (scm_source_whash, (x)))\ | |
111 | && SRCPROPSP (t.arg1)\ | |
112 | && (1L << 16) & SCM_CAR (t.arg1)) | |
113 | ||
114 | #define PROCTRACEP(x) SCM_NFALSEP (scm_procedure_property (x, scm_i_trace)) | |
115 | ||
34019bd6 MD |
116 | extern SCM scm_i_filename; |
117 | extern SCM scm_i_copy; | |
118 | extern SCM scm_i_line; | |
119 | extern SCM scm_i_column; | |
120 | extern SCM scm_i_breakpoint; | |
121 | ||
8a5ae618 MD |
122 | \f |
123 | ||
1cc91f1b JB |
124 | |
125 | extern SCM scm_srcprops_to_plist SCM_P ((SCM obj)); | |
126 | extern SCM scm_make_srcprops SCM_P ((int line, int col, SCM fname, SCM copy, SCM plist)); | |
127 | extern SCM scm_source_property SCM_P ((SCM obj, SCM key)); | |
128 | extern SCM scm_set_source_property_x SCM_P ((SCM obj, SCM key, SCM datum)); | |
129 | extern SCM scm_source_properties SCM_P ((SCM obj)); | |
130 | extern SCM scm_set_source_properties_x SCM_P ((SCM obj, SCM props)); | |
131 | extern void scm_finish_srcprop SCM_P ((void)); | |
132 | extern void scm_init_srcprop SCM_P ((void)); | |
8a5ae618 MD |
133 | |
134 | #endif /* SRCPROPH */ |