3 test [trace_mode],TRACE_DISPLAY
\r
4 jnz display_line_feed
\r
5 mov ecx,[display_data_length]
\r
6 jecxz display_data_shown
\r
7 mov esi,[display_buffer]
\r
17 mov esi,[first_error]
\r
20 jz display_data_shown
\r
22 mov eax,[esi+sizeof.Error+SourceContext.number_of_entries]
\r
24 jz show_error_message
\r
25 lea ebx,[esi+sizeof.Error+sizeof.SourceContext]
\r
27 imul eax,sizeof.SourceEntry
\r
29 mov [last_source_entry],eax
\r
30 test [trace_mode],TRACE_ERROR_STACK
\r
31 jnz show_source_context
\r
32 and [last_file_source_entry],0
\r
33 find_last_file_entry:
\r
34 cmp [eax+SourceEntry.type],SOURCE_FILE
\r
35 je last_file_entry_found
\r
37 je show_source_context
\r
38 sub eax,sizeof.SourceEntry
\r
39 jmp find_last_file_entry
\r
40 last_file_entry_found:
\r
41 mov [last_file_source_entry],eax
\r
42 show_source_context:
\r
44 cmp [ebx+SourceEntry.type],SOURCE_MEMORY
\r
45 je display_memory_source
\r
46 cmp [ebx+SourceEntry.type],SOURCE_MACRO
\r
47 jne display_source_name
\r
48 mov esi,_macro_source
\r
49 test [ebx+SourceEntry.flags],SRCF_PREPROCESSED
\r
50 jz display_source_type
\r
51 mov esi,_preprocessed_source
\r
52 display_source_type:
\r
54 call display_error_string
\r
55 display_source_name:
\r
56 mov esi,[ebx+SourceEntry.name]
\r
59 mov ecx,[ebx+SourceEntry.name_length]
\r
61 je display_source_symbol
\r
62 call display_error_string
\r
63 jmp display_line_number
\r
64 display_source_symbol:
\r
66 call show_symbol_name
\r
68 jmp display_line_number
\r
70 mov esi,_unnamed_source
\r
72 call display_error_string
\r
73 jmp display_line_number
\r
74 display_memory_source:
\r
75 mov esi,_memory_source
\r
77 call display_error_string
\r
78 display_line_number:
\r
79 mov esi,_line_number_prefix
\r
81 call display_error_string
\r
82 mov eax,[ebx+SourceEntry.line_number]
\r
85 call display_error_string
\r
86 mov esi,_line_number_suffix
\r
88 call display_error_string
\r
92 cmp [ebx+SourceEntry.line_number],0
\r
93 je skip_line_content
\r
94 test [trace_mode],TRACE_ERROR_STACK
\r
95 jnz show_source_line
\r
96 cmp ebx,[last_source_entry]
\r
97 je last_source_entry_line_content
\r
98 cmp ebx,[last_file_source_entry]
\r
104 find_next_source_entry:
\r
105 cmp ebx,[last_source_entry]
\r
106 je source_context_shown
\r
107 add ebx,sizeof.SourceEntry
\r
108 test [trace_mode],TRACE_ERROR_STACK
\r
109 jnz show_source_entry
\r
110 test [ebx+SourceEntry.flags],SRCF_PREPROCESSED
\r
111 jnz find_next_source_entry
\r
114 call display_error_string
\r
115 jmp show_source_context
\r
116 last_source_entry_line_content:
\r
117 test [esi+Error.flags],ERR_CUSTOM
\r
118 jnz skip_line_content
\r
120 cmp [ebx+SourceEntry.type],SOURCE_CALM
\r
121 je show_calm_source
\r
122 mov esi,_line_content_prefix
\r
124 call display_error_string
\r
125 call show_line_content
\r
127 jmp next_source_entry
\r
129 mov esi,_calm_source
\r
131 call display_error_string
\r
133 jmp next_source_entry
\r
134 source_context_shown:
\r
137 call display_error_string
\r
139 test [ebx+Error.flags],ERR_CUSTOM
\r
140 jnz show_error_message
\r
141 cmp [ebx+Error.preprocessed_length],0
\r
142 je show_error_message
\r
143 mov esi,_preprocessed_text_prefix
\r
145 call display_error_string
\r
146 mov esi,[ebx+Error.preprocessed_data]
\r
147 mov ecx,[ebx+Error.preprocessed_length]
\r
148 call show_preprocessed_line
\r
151 call display_error_string
\r
152 show_error_message:
\r
154 mov esi,_error_prefix
\r
155 test [ebx+Error.flags],ERR_CUSTOM
\r
156 jz display_error_prefix
\r
157 mov esi,_custom_error_prefix
\r
158 display_error_prefix:
\r
160 call display_error_string
\r
161 mov esi,[ebx+Error.message]
\r
162 test [ebx+Error.flags],ERR_CUSTOM
\r
163 jz format_error_message
\r
165 call display_error_string
\r
166 finish_error_message:
\r
167 mov esi,_message_suffix
\r
169 call display_error_string
\r
172 mov esi,[esi+Error.next]
\r
174 format_error_message:
\r
179 jz show_error_message_segment
\r
181 jne cut_error_message
\r
182 show_error_message_segment:
\r
188 call display_error_string
\r
192 jz finish_error_message
\r
195 je insert_string_into_error_message
\r
197 jne format_error_message
\r
199 mov ebx,[ebx+Error.symbol]
\r
200 mov ebx,[ebx+SymbolTree_Leaf.branch]
\r
201 call show_symbol_name
\r
203 jmp format_error_message
\r
204 insert_string_into_error_message:
\r
206 mov esi,[ebx+Error.symbol]
\r
208 call display_error_string
\r
210 jmp format_error_message
\r
214 ; ebx - SymbolTree_Foliage, may be null
\r
217 jz symbol_name_shown
\r
218 mov edi,[identifier_workspace.memory_start]
\r
219 cmp [ebx+SymbolTree_Foliage.name_kind],NAME_NUMERIC
\r
220 je next_name_segment
\r
221 compose_symbol_name:
\r
222 mov ecx,[ebx+SymbolTree_Foliage.name_length]
\r
223 mov edx,identifier_workspace
\r
224 mov al,[ebx+SymbolTree_Foliage.name_kind]
\r
225 cmp al,NAME_CASESENSITIVE
\r
226 je name_segment_to_copy
\r
227 cmp al,NAME_ABSTRACT
\r
228 je name_segment_copied
\r
229 cmp al,NAME_NUMERIC
\r
233 name_segment_to_copy:
\r
236 call reserve_workspace
\r
238 mov edx,[ebx+SymbolTree_Foliage.name_data]
\r
240 jecxz name_segment_copied
\r
244 jmp copy_name_segment
\r
247 mov esi,[ebx+SymbolTree_Foliage.name_data]
\r
250 jecxz dot_count_read
\r
259 call reserve_workspace
\r
263 name_segment_copied:
\r
264 mov edx,[ebx+SymbolTree_Foliage.root]
\r
265 mov ebx,[edx+SymbolTree_Root.parent_branch]
\r
266 test [edx+SymbolTree_Root.flags],NAMESPACE_LOCAL or NAMESPACE_CALM
\r
267 jnz mark_local_symbol_name
\r
269 jz symbol_name_ready
\r
273 jmp compose_symbol_name
\r
274 mark_local_symbol_name:
\r
277 test [edx+SymbolTree_Root.flags],NAMESPACE_CALM
\r
278 jz symbol_name_ready
\r
279 mov eax,[ebx+SymbolTree_Foliage.name_data]
\r
280 mov ebx,[eax+SymbolTree_Leaf.branch]
\r
282 jnz compose_symbol_name
\r
284 mov ebx,[identifier_workspace.memory_start]
\r
287 jz symbol_name_shown
\r
290 reverse_composed_name:
\r
293 jae show_composed_name
\r
298 jmp reverse_composed_name
\r
299 show_composed_name:
\r
300 call display_error_string
\r
307 ; ebx - SourceEntry
\r
308 cmp [ebx+SourceEntry.type],SOURCE_MACRO
\r
309 je show_line_from_macro
\r
310 mov esi,[ebx+SourceEntry.text]
\r
311 add esi,[ebx+SourceEntry.line_offset]
\r
312 mov ecx,[ebx+SourceEntry.number_of_attached_lines]
\r
314 mov [number_of_lines],ecx
\r
318 jz line_content_shown
\r
320 je line_content_shown
\r
324 je show_string_token
\r
326 je show_string_token
\r
328 jne show_basic_token
\r
329 cmp byte [esi+1],0Ah
\r
330 jne show_basic_token
\r
331 dec [number_of_lines]
\r
332 jnz show_attached_line
\r
335 call display_error_string
\r
341 call display_error_string
\r
348 call show_string_token_content
\r
353 show_string_token_content:
\r
356 show_string_segment:
\r
358 mov esi,_single_quote
\r
360 call display_error_string
\r
362 jecxz show_end_quote
\r
371 call display_error_string
\r
374 jnz show_string_segment
\r
377 je string_token_shown
\r
378 mov esi,_single_quote
\r
380 call display_error_string
\r
381 string_token_shown:
\r
383 show_attached_line:
\r
385 call display_error_string
\r
387 mov esi,_line_segment_prefix
\r
389 call display_error_string
\r
392 show_line_from_macro:
\r
393 mov edx,[ebx+SourceEntry.text]
\r
394 mov esi,[edx+ValueDefinition.value]
\r
395 mov ecx,[edx+ValueDefinition.value_length]
\r
396 mov eax,[ebx+SourceEntry.line_offset]
\r
399 jbe line_content_shown
\r
400 call show_preprocessed_line
\r
401 line_content_shown:
\r
404 show_preprocessed_line:
\r
406 ; esi - preprocessed tokens
\r
407 ; ecx = total length of preprocessed tokens
\r
409 mov [preprocessed_text_end],eax
\r
410 show_preprocessed_token:
\r
411 cmp esi,[preprocessed_text_end]
\r
412 jae preprocessed_line_shown
\r
415 jz preprocessed_line_shown
\r
417 je show_preprocessed_name_token
\r
419 je show_preprocessed_string_token
\r
421 je show_preprocessed_string_token
\r
423 je show_internal_number
\r
425 je show_context_token
\r
427 call display_error_string
\r
429 jmp show_preprocessed_token
\r
430 show_preprocessed_name_token:
\r
437 call display_error_string
\r
439 jmp show_preprocessed_token
\r
440 show_preprocessed_string_token:
\r
443 call show_string_token_content
\r
445 jmp show_preprocessed_token
\r
446 show_internal_number:
\r
450 call convert_number_back
\r
453 call display_error_string
\r
457 jmp show_preprocessed_token
\r
458 show_context_token:
\r
459 add esi,1+sizeof.RecognitionContext
\r
460 jmp show_preprocessed_token
\r
461 preprocessed_line_shown:
\r
466 ; edx:eax = unsigned number
\r
468 ; esi - temporary buffer containing decimal digits
\r
469 ; ecx = length of string (number of digits)
\r
470 mov edi,temporary_value+4
\r
474 mov edx,temporary_value
\r
476 call convert_number_back
\r