(instr_source,instr_line,sieve_get_locus): New functions
Showing
1 changed file
with
33 additions
and
0 deletions
... | @@ -39,6 +39,28 @@ instr_nop (sieve_machine_t mach) | ... | @@ -39,6 +39,28 @@ instr_nop (sieve_machine_t mach) |
39 | (unsigned long) (mach->pc - 1)); | 39 | (unsigned long) (mach->pc - 1)); |
40 | } | 40 | } |
41 | 41 | ||
42 | void | ||
43 | instr_source (sieve_machine_t mach) | ||
44 | { | ||
45 | mach->locus.source_file = SIEVE_ARG (mach, 0, string); | ||
46 | if (INSTR_DEBUG (mach)) | ||
47 | sieve_debug (mach, "%4lu: SOURCE %s\n", | ||
48 | (unsigned long) (mach->pc - 1), | ||
49 | mach->locus.source_file); | ||
50 | SIEVE_ADJUST (mach, 1); | ||
51 | } | ||
52 | |||
53 | void | ||
54 | instr_line (sieve_machine_t mach) | ||
55 | { | ||
56 | mach->locus.source_line = SIEVE_ARG (mach, 0, line); | ||
57 | if (INSTR_DEBUG (mach)) | ||
58 | sieve_debug (mach, "%4lu: LINE %lu\n", | ||
59 | (unsigned long) (mach->pc - 1), | ||
60 | (unsigned long) mach->locus.source_line); | ||
61 | SIEVE_ADJUST (mach, 1); | ||
62 | } | ||
63 | |||
42 | static int | 64 | static int |
43 | instr_run (sieve_machine_t mach) | 65 | instr_run (sieve_machine_t mach) |
44 | { | 66 | { |
... | @@ -200,6 +222,17 @@ sieve_get_data (sieve_machine_t mach) | ... | @@ -200,6 +222,17 @@ sieve_get_data (sieve_machine_t mach) |
200 | return mach->data; | 222 | return mach->data; |
201 | } | 223 | } |
202 | 224 | ||
225 | int | ||
226 | sieve_get_locus (sieve_machine_t mach, sieve_locus_t *loc) | ||
227 | { | ||
228 | if (mach->source_list) | ||
229 | { | ||
230 | *loc = mach->locus; | ||
231 | return 0; | ||
232 | } | ||
233 | return 1; | ||
234 | } | ||
235 | |||
203 | message_t | 236 | message_t |
204 | sieve_get_message (sieve_machine_t mach) | 237 | sieve_get_message (sieve_machine_t mach) |
205 | { | 238 | { | ... | ... |
-
Please register or sign in to post a comment