2 struct CompiledMacroHeader
\r
3 shared_namespace dd ?
\r
5 label_argument_leaf dd ?
\r
8 struct CompiledMacroArgument
\r
10 default_value_length dd ?
\r
11 default_value_offset dd ?
\r
14 struct UnresolvedJump
\r
17 ; source_context SourceContext
\r
20 struct MatchedExcerpt
\r
23 recognition_context dd ?
\r
31 define_calm_instruction:
\r
32 mov dl,DBLOCK_CALMINSTRUCTION
\r
33 mov ecx,sizeof.MacroData
\r
34 call add_directive_block
\r
35 mov edx,[ebx+SymbolTree_Leaf.branch]
\r
36 call get_symbol_namespace
\r
37 mov [alm_namespace],ebx
\r
38 or [assembly_mode],AMODE_CALM_DEFINITION
\r
39 mov [calm_definition_active],0
\r
40 test [assembly_mode],AMODE_SKIP
\r
42 test [assembly_mode],AMODE_DEFINITION
\r
43 jnz add_line_to_macro
\r
44 mov eax,[calm_code_buffer.memory_start]
\r
45 mov [calm_code_cursor],eax
\r
46 mov eax,[calm_literals_buffer.memory_start]
\r
47 mov [calm_literals_cursor],eax
\r
48 mov eax,[calm_auxiliary_buffer.memory_start]
\r
49 mov [calm_auxiliary_cursor],eax
\r
50 call move_to_next_symbol
\r
53 je calm_labeled_instruction
\r
54 and [argument_start],0
\r
55 mov dl,SYMCLASS_INSTRUCTION
\r
56 get_calm_instruction_identifier:
\r
57 call get_macro_definition_symbol
\r
58 jc invalid_identifier
\r
61 mov ecx,[alm_namespace]
\r
62 call get_local_anchor
\r
63 call get_symbol_namespace
\r
64 or [ebx+SymbolTree_Root.flags],NAMESPACE_CALM
\r
65 mov [new_local_namespace],ebx
\r
67 mov edi,[calm_code_buffer.memory_start]
\r
68 mov [edi+CompiledMacroHeader.shared_namespace],ebx
\r
69 or [symbol_definition],1
\r
70 mov ebx,[argument_start]
\r
72 jz calm_instruction_label_argument_ok
\r
75 mov dl,SYMCLASS_EXPRESSION
\r
76 mov ebx,[new_local_namespace]
\r
77 call identify_symbol_in_namespace
\r
84 jne invalid_argument
\r
85 call update_value_definition
\r
87 mov [value_type],VALTYPE_RESERVED
\r
91 calm_instruction_label_argument_ok:
\r
92 mov [edi+CompiledMacroHeader.label_argument_leaf],ebx
\r
93 add edi,sizeof.CompiledMacroHeader
\r
94 calm_instruction_argument_declaration:
\r
95 call move_to_next_symbol
\r
96 jc calm_instruction_arguments_declared
\r
97 mov dl,SYMCLASS_EXPRESSION
\r
99 mov ebx,[new_local_namespace]
\r
100 call identify_symbol_in_namespace
\r
102 jc invalid_argument
\r
104 jz invalid_argument
\r
105 mov edx,calm_code_buffer
\r
106 mov ecx,sizeof.CompiledMacroArgument+4
\r
107 call reserve_workspace
\r
108 mov [edi+CompiledMacroArgument.symbol_leaf],ebx
\r
109 call update_value_definition
\r
111 mov [value_type],VALTYPE_RESERVED
\r
116 call move_to_next_symbol
\r
117 jc calm_instruction_argument_ready
\r
119 je calm_instruction_argument_default_value
\r
121 je calm_instruction_argument_default_value
\r
123 jne calm_instruction_argument_ready
\r
126 calm_instruction_argument_ready:
\r
127 mov [edi+CompiledMacroArgument.default_value_length],edx
\r
128 add edi,sizeof.CompiledMacroArgument
\r
129 call move_to_next_symbol
\r
130 jc calm_instruction_arguments_declared
\r
133 je calm_instruction_greedy_argument
\r
135 jne invalid_argument
\r
136 call move_to_next_symbol
\r
137 jc invalid_argument
\r
138 jmp calm_instruction_argument_declaration
\r
139 calm_instruction_argument_default_value:
\r
141 mov [calm_code_cursor],edi
\r
142 mov edx,calm_literals_buffer
\r
143 mov edi,[calm_literals_cursor]
\r
146 add ecx,1+sizeof.RecognitionContext
\r
147 call reserve_workspace
\r
148 mov [calm_literals_cursor],edi
\r
149 call move_to_next_symbol
\r
150 jc calm_plain_default_value
\r
152 je calm_enclosed_default_value
\r
153 calm_plain_default_value:
\r
156 mov [breakpoint_token],'&'
\r
157 call extract_piece_of_line
\r
158 jmp calm_default_value_ready
\r
159 calm_enclosed_default_value:
\r
163 mov [breakpoint_token],0
\r
164 call extract_piece_of_line
\r
166 jne invalid_argument
\r
168 calm_default_value_ready:
\r
170 xchg edi,[calm_literals_cursor]
\r
173 sub eax,[calm_literals_buffer.memory_start]
\r
174 mov edi,[calm_code_cursor]
\r
175 mov [edi+CompiledMacroArgument.default_value_offset],eax
\r
176 jmp calm_instruction_argument_ready
\r
177 calm_instruction_greedy_argument:
\r
180 jmp call_instruction_begin_code
\r
181 calm_labeled_instruction:
\r
183 call move_to_next_symbol
\r
184 jc missing_argument
\r
185 mov [argument_start],esi
\r
186 mov edi,[expression_workspace.memory_start]
\r
189 mov [breakpoint_token],dh
\r
190 call cut_piece_of_line
\r
192 jne invalid_argument
\r
194 mov dl,SYMCLASS_STRUCTURE
\r
195 jmp get_calm_instruction_identifier
\r
196 calm_instruction_arguments_declared:
\r
199 call_instruction_begin_code:
\r
200 mov [calm_code_cursor],edi
\r
201 mov eax,[new_local_namespace]
\r
202 mov [current_context.base_namespace],eax
\r
203 and [calm_line_number],0
\r
204 mov [calm_definition_active],1
\r
205 jmp instruction_assembled
\r
207 assemble_alm_instruction:
\r
208 or [alm_statement],1
\r
209 mov ebx,[source_context]
\r
210 mov eax,[ebx+SourceContext.number_of_entries]
\r
212 imul eax,sizeof.SourceEntry
\r
213 test [ebx+sizeof.SourceContext+eax+SourceEntry.flags],SRCF_ALM_STATEMENT
\r
214 jnz identify_alm_instruction
\r
215 inc [calm_line_number]
\r
216 identify_alm_instruction:
\r
217 call move_to_next_symbol
\r
219 call get_alm_identifier
\r
220 jc unrecognized_alm_instruction
\r
221 mov dl,SYMCLASS_INSTRUCTION
\r
222 call identify_alm_symbol
\r
224 call get_available_value
\r
226 test [edx+ValueDefinition.flags],VAL_UNCONDITIONAL
\r
227 jnz execute_alm_instruction
\r
228 test [assembly_mode],AMODE_SKIP
\r
230 test [assembly_mode],AMODE_DEFINITION
\r
231 jnz add_line_to_macro
\r
232 execute_alm_instruction:
\r
233 cmp [edx+ValueDefinition.type],VALTYPE_CALM
\r
235 cmp [edx+ValueDefinition.type],VALTYPE_SYMBOLIC
\r
237 cmp [edx+ValueDefinition.type],VALTYPE_NATIVE_COMMAND
\r
238 jne unrecognized_alm_instruction
\r
239 jmp [edx+ValueDefinition.value]
\r
241 call move_to_next_symbol
\r
242 jc unrecognized_alm_instruction
\r
244 jne unrecognized_alm_instruction
\r
246 test [assembly_mode],AMODE_SKIP
\r
247 jnz identify_alm_instruction
\r
248 test [assembly_mode],AMODE_DEFINITION
\r
249 jnz add_label_to_macro
\r
250 call identify_calm_location
\r
251 jc unrecognized_alm_instruction
\r
252 call create_constant_value_definition
\r
255 mov [edx+ValueDefinition.type],VALTYPE_PLAIN
\r
256 mov eax,[calm_code_cursor]
\r
257 sub eax,[calm_code_buffer.memory_start]
\r
258 mov [edx+ValueDefinition.value],eax
\r
259 mov eax,[current_pass]
\r
260 mov [edx+ValueDefinition.pass],eax
\r
261 jmp identify_alm_instruction
\r
262 unrecognized_alm_instruction:
\r
263 test [assembly_mode],AMODE_SKIP
\r
265 test [assembly_mode],AMODE_DEFINITION
\r
266 jnz add_line_to_macro
\r
267 mov edx,_unexpected_instruction
\r
268 call register_error
\r
270 get_alm_identifier:
\r
272 call move_to_next_symbol
\r
273 jc malformed_alm_identifier
\r
277 je alm_numeric_name
\r
279 jne malformed_alm_identifier
\r
280 call check_concatenation
\r
281 jnc get_alm_identifier
\r
282 malformed_alm_identifier:
\r
290 mov eax,[ebx+4+ecx]
\r
291 mov [case_sensitive_hash],eax
\r
292 mov eax,[ebx+4+ecx+4]
\r
293 mov [case_insensitive_hash],eax
\r
294 alm_check_for_concatenation:
\r
296 call move_to_next_symbol
\r
297 jc alm_identifier_ok
\r
299 jne alm_identifier_ok
\r
300 call check_concatenation
\r
301 jc alm_identifier_ok
\r
302 call move_to_next_symbol
\r
303 jc alm_identifier_ok
\r
305 je alm_concatenation
\r
307 je alm_concatenation
\r
309 mov [symbol_data],ebx
\r
310 cmp ebx,[assembly_workspace.memory_start]
\r
311 je alm_identifier_volatile
\r
312 mov [name_volatile],0
\r
315 alm_identifier_volatile:
\r
319 mov [name_volatile],1
\r
323 mov edx,assembly_workspace
\r
324 cmp ebx,[edx+Workspace.memory_start]
\r
325 je alm_name_segment
\r
326 mov edi,[edx+Workspace.memory_start]
\r
329 call reserve_workspace
\r
335 mov ebx,[edx+Workspace.memory_start]
\r
339 je alm_attach_numeric_segment
\r
345 mov edx,assembly_workspace
\r
346 call reserve_workspace
\r
349 mov ecx,[case_sensitive_hash]
\r
350 mov edx,[case_insensitive_hash]
\r
355 xor dl,[characters+eax]
\r
361 mov [case_sensitive_hash],ecx
\r
362 mov [case_insensitive_hash],edx
\r
364 jmp alm_check_for_concatenation
\r
367 mov ebx,[assembly_workspace.memory_start]
\r
370 mov [case_sensitive_hash],eax
\r
371 mov [case_insensitive_hash],eax
\r
372 alm_attach_numeric_segment:
\r
375 lea esi,[esi+4+ecx]
\r
378 call convert_number_back
\r
381 jmp alm_append_name
\r
382 identify_alm_symbol:
\r
383 mov [symbol_class],dl
\r
385 mov esi,[symbol_data]
\r
388 mov edx,[case_insensitive_hash]
\r
389 mov ebx,[alm_namespace]
\r
390 mov [name_kind],NAME_CASEINSENSITIVE
\r
392 and [symbol_required],0
\r
393 and [symbol_expected],0
\r
394 call scan_namespace
\r
397 identify_calm_location:
\r
398 mov [symbol_class],SYMCLASS_CALM_LOCATION
\r
400 mov esi,[symbol_data]
\r
403 mov edx,[case_sensitive_hash]
\r
404 mov ebx,[current_context.base_namespace]
\r
407 or [symbol_required],1
\r
408 or [symbol_expected],1
\r
409 call scan_namespace
\r
414 mov [value],calm_jyes
\r
415 jmp assemble_alm_jump
\r
417 mov [value],calm_jno
\r
418 jmp assemble_alm_jump
\r
420 mov [value],calm_jump
\r
422 test [assembly_mode],AMODE_CALM_DEFINITION
\r
423 jz unexpected_instruction
\r
424 call move_to_next_symbol
\r
425 jc missing_argument
\r
426 call get_alm_identifier
\r
427 jc invalid_argument
\r
428 call identify_calm_location
\r
429 jc invalid_argument
\r
430 mov edx,[ebx+SymbolTree_Leaf.definition]
\r
432 jz alm_unresolved_jump
\r
433 mov eax,[edx+ValueDefinition.pass]
\r
434 cmp eax,[current_pass]
\r
435 jne alm_unresolved_jump
\r
436 mov ebx,[edx+ValueDefinition.value]
\r
438 mov edi,[calm_code_cursor]
\r
439 mov edx,calm_code_buffer
\r
441 call reserve_workspace
\r
442 mov eax,[calm_line_number]
\r
448 mov [calm_code_cursor],edi
\r
449 jmp instruction_assembled
\r
450 alm_unresolved_jump:
\r
452 mov edx,calm_auxiliary_buffer
\r
453 mov edi,[calm_auxiliary_cursor]
\r
454 mov esi,[source_context]
\r
455 mov ecx,[esi+SourceContext.number_of_entries]
\r
456 imul ecx,sizeof.SourceEntry
\r
457 add ecx,sizeof.SourceContext
\r
458 add ecx,sizeof.UnresolvedJump
\r
459 call reserve_workspace
\r
460 mov [calm_auxiliary_cursor],edi
\r
461 mov eax,[calm_code_cursor]
\r
463 sub eax,[calm_code_buffer.memory_start]
\r
464 mov [edi+UnresolvedJump.offset],eax
\r
465 add edi,sizeof.UnresolvedJump
\r
466 call clone_source_context
\r
468 xchg edi,[calm_auxiliary_cursor]
\r
470 mov [edi+UnresolvedJump.entry_length],ecx
\r
475 test [assembly_mode],AMODE_CALM_DEFINITION
\r
476 jz unexpected_unconditional_alm_instruction
\r
477 call move_to_next_symbol
\r
478 jc finish_calm_definition
\r
479 call get_alm_identifier
\r
480 jc invalid_argument
\r
481 mov dl,SYMCLASS_STRUCTURE
\r
482 call identify_alm_symbol
\r
483 jc invalid_argument
\r
484 mov edx,[ebx+SymbolTree_Leaf.definition]
\r
485 cmp [edx+ValueDefinition.type],VALTYPE_NATIVE_COMMAND
\r
486 jne invalid_argument
\r
487 cmp [edx+ValueDefinition.value],alm_end
\r
488 jne invalid_argument
\r
489 finish_calm_definition:
\r
490 mov dl,DBLOCK_CALMINSTRUCTION
\r
491 call find_directive_block
\r
492 jc unexpected_unconditional_alm_instruction
\r
493 call close_directive_block
\r
494 and [assembly_mode],not AMODE_CALM_DEFINITION
\r
495 test [assembly_mode],AMODE_DEFINITION
\r
496 jnz add_line_to_macro
\r
497 cmp [calm_definition_active],0
\r
498 je instruction_assembled
\r
500 mov esi,[calm_auxiliary_buffer.memory_start]
\r
501 resolve_calm_jumps:
\r
502 cmp esi,[calm_auxiliary_cursor]
\r
503 je calm_jumps_resolved
\r
504 mov eax,[esi+UnresolvedJump.offset]
\r
505 add eax,[calm_code_buffer.memory_start]
\r
507 mov edx,[ebx+SymbolTree_Leaf.definition]
\r
509 jz unresolvable_calm_jump
\r
510 mov ecx,[edx+ValueDefinition.pass]
\r
511 cmp ecx,[current_pass]
\r
512 jne unresolvable_calm_jump
\r
513 mov ebx,[edx+ValueDefinition.value]
\r
515 resolve_next_calm_jump:
\r
516 add esi,[esi+UnresolvedJump.entry_length]
\r
517 jmp resolve_calm_jumps
\r
518 unresolvable_calm_jump:
\r
519 mov edx,[calm_code_cursor]
\r
520 sub edx,[calm_code_buffer.memory_start]
\r
522 add esi,sizeof.UnresolvedJump
\r
523 mov edx,_undefined_jump_target
\r
524 call register_delayed_error
\r
525 sub esi,sizeof.UnresolvedJump
\r
526 jmp resolve_next_calm_jump
\r
527 calm_jumps_resolved:
\r
528 mov ebx,[current_context.base_namespace]
\r
529 mov edx,[ebx+SymbolTree_Root.parent_branch]
\r
530 mov eax,[edx+SymbolTree_Foliage.root]
\r
531 mov [current_context.base_namespace],eax
\r
532 mov edi,[calm_code_cursor]
\r
533 mov edx,calm_code_buffer
\r
534 mov ecx,[calm_literals_cursor]
\r
535 mov esi,[calm_literals_buffer.memory_start]
\r
538 call reserve_workspace
\r
539 mov eax,[calm_line_number]
\r
543 mov ebx,[calm_code_buffer.memory_start]
\r
546 mov [ebx+CompiledMacroHeader.literals_offset],eax
\r
547 mov ecx,[calm_literals_cursor]
\r
550 mov ebx,[macro_leaf]
\r
552 jz calm_definition_done
\r
553 call create_value_definition
\r
555 jz calm_definition_done
\r
556 mov esi,[calm_code_buffer.memory_start]
\r
559 mov [value_type],VALTYPE_CALM
\r
561 mov al,[macro_flags]
\r
562 or [edx+ValueDefinition.flags],al
\r
563 calm_definition_done:
\r
565 jmp instruction_assembled
\r
566 unexpected_unconditional_alm_instruction:
\r
567 test [assembly_mode],AMODE_SKIP
\r
569 test [assembly_mode],AMODE_DEFINITION
\r
570 jnz add_line_to_macro
\r
571 jmp unexpected_instruction
\r
574 test [assembly_mode],AMODE_CALM_DEFINITION
\r
575 jz unexpected_instruction
\r
576 call move_to_next_symbol
\r
577 jc missing_argument
\r
578 or [symbol_definition],1
\r
579 mov dl,SYMCLASS_EXPRESSION
\r
580 mov ebx,[current_context.base_namespace]
\r
581 call identify_symbol_in_namespace
\r
582 jc invalid_argument
\r
584 jz invalid_argument
\r
585 call update_value_definition
\r
589 mov [value_type],VALTYPE_RESERVED
\r
594 call move_to_next_symbol
\r
595 jc instruction_assembled
\r
597 jne invalid_argument
\r
602 mov [value],calm_assemble
\r
603 jmp assemble_alm_operation_on_variable
\r
605 mov [value],calm_stringify
\r
606 assemble_alm_operation_on_variable:
\r
607 test [assembly_mode],AMODE_CALM_DEFINITION
\r
608 jz unexpected_instruction
\r
609 and [symbol_definition],0
\r
610 mov dl,SYMCLASS_EXPRESSION
\r
611 call identify_symbol
\r
612 jc invalid_identifier
\r
614 jz invalid_identifier
\r
615 mov edi,[calm_code_cursor]
\r
616 mov edx,calm_code_buffer
\r
618 call reserve_workspace
\r
619 mov eax,[calm_line_number]
\r
625 mov [calm_code_cursor],edi
\r
626 jmp instruction_assembled
\r
629 test [assembly_mode],AMODE_CALM_DEFINITION
\r
630 jz unexpected_instruction
\r
631 and [symbol_definition],0
\r
632 mov dl,SYMCLASS_EXPRESSION
\r
633 call identify_symbol
\r
634 jc invalid_identifier
\r
636 jz invalid_identifier
\r
637 call move_to_next_symbol
\r
638 jc missing_argument
\r
640 jne instruction_assembled
\r
642 call move_to_next_symbol
\r
643 mov edi,[calm_code_cursor]
\r
644 mov edx,calm_code_buffer
\r
646 call reserve_workspace
\r
647 mov eax,[calm_line_number]
\r
649 mov eax,calm_arrange
\r
653 mov edx,calm_literals_buffer
\r
654 mov ebx,[calm_literals_cursor]
\r
656 sub eax,[edx+Workspace.memory_start]
\r
658 mov [calm_code_cursor],edi
\r
663 call reserve_workspace
\r
664 mov [breakpoint_token],0
\r
666 mov [calm_literals_cursor],edi
\r
668 mov edi,[calm_code_cursor]
\r
669 sub eax,[calm_literals_buffer.memory_start]
\r
671 mov [calm_code_cursor],edi
\r
672 jmp instruction_assembled
\r
675 ; esi - first token of the pattern in the preprocessed line
\r
676 ; edi - buffer with enough space to hold twice the length of the preprocessed text left in line
\r
677 ; [breakpoint_token] = initial byte of symbol that should end the pattern
\r
679 ; esi - after the processed portion of line (might be at [line_end])
\r
680 ; edi - in the buffer after the stored pattern
\r
684 cmp al,[breakpoint_token]
\r
685 je pattern_breakpoint
\r
688 je parse_pattern_literal
\r
690 je parse_reference_in_pattern
\r
692 je ignore_context_in_pattern
\r
694 je whitespace_in_pattern
\r
696 literal_token_in_pattern:
\r
698 je copy_pattern_data
\r
700 je copy_pattern_data
\r
708 whitespace_in_pattern:
\r
713 je whitespace_in_pattern
\r
714 cmp al,[breakpoint_token]
\r
715 je pattern_breakpoint
\r
717 jne store_whitespace_in_pattern
\r
719 jmp whitespace_in_pattern
\r
720 store_whitespace_in_pattern:
\r
723 jmp token_in_pattern
\r
724 pattern_breakpoint:
\r
730 add esi,sizeof.RecognitionContext
\r
733 mov [embedded_context],eax
\r
736 and [embedded_context],0
\r
741 ignore_context_in_pattern:
\r
744 ignore_context_in_pattern_literal:
\r
746 parse_pattern_literal:
\r
748 je error_in_parsed_pattern
\r
751 je ignore_context_in_pattern_literal
\r
753 je parse_hard_space_in_pattern
\r
756 je copy_pattern_data
\r
757 jmp literal_token_in_pattern
\r
758 parse_hard_space_in_pattern:
\r
762 parse_reference_in_pattern:
\r
764 call detect_numeric_symbol
\r
765 jc numeric_name_in_pattern
\r
767 mov [name_token],esi
\r
769 mov dx,SYMCLASS_EXPRESSION
\r
770 mov [name_volatile],0
\r
776 mov eax,[embedded_context]
\r
778 jz use_current_namespace_in_pattern
\r
779 mov eax,[eax+RecognitionContext.base_namespace]
\r
780 jmp namespace_in_pattern_ok
\r
781 use_current_namespace_in_pattern:
\r
782 mov eax,[current_context.base_namespace]
\r
783 namespace_in_pattern_ok:
\r
784 mov [recognition_context.base_namespace],eax
\r
785 call recognize_symbol
\r
789 mov eax,[name_token]
\r
795 numeric_name_in_pattern:
\r
799 error_in_parsed_pattern:
\r
800 mov edx,_invalid_argument
\r
801 call register_error
\r
805 test [assembly_mode],AMODE_CALM_DEFINITION
\r
806 jz unexpected_instruction
\r
807 call move_to_next_symbol
\r
808 jc missing_argument
\r
809 mov edx,calm_literals_buffer
\r
810 mov edi,[calm_literals_cursor]
\r
814 call reserve_workspace
\r
815 mov [calm_literals_cursor],edi
\r
816 mov [breakpoint_token],','
\r
818 xchg edi,[calm_literals_cursor]
\r
819 mov [pattern_start],edi
\r
821 je missing_argument
\r
824 jne invalid_argument
\r
825 and [symbol_definition],0
\r
826 mov dl,SYMCLASS_EXPRESSION
\r
827 call identify_symbol
\r
828 jc invalid_identifier
\r
830 jz invalid_identifier
\r
832 call move_to_next_symbol
\r
837 call move_to_next_symbol
\r
838 jc invalid_argument
\r
843 jne invalid_argument
\r
844 call move_to_next_symbol
\r
845 jc invalid_argument
\r
850 jne invalid_argument
\r
851 mov esi,[pattern_start]
\r
852 ensure_no_brackets_in_pattern:
\r
853 cmp esi,[calm_literals_cursor]
\r
857 je invalid_argument
\r
859 je invalid_argument
\r
861 je skip_reference_in_pattern
\r
863 jmp ensure_no_brackets_in_pattern
\r
864 skip_reference_in_pattern:
\r
866 jmp ensure_no_brackets_in_pattern
\r
869 mov word [brackets],dx
\r
871 mov edi,[calm_code_cursor]
\r
872 mov edx,calm_code_buffer
\r
874 call reserve_workspace
\r
875 mov eax,[calm_line_number]
\r
881 mov ebx,[calm_literals_buffer.memory_start]
\r
882 mov eax,[pattern_start]
\r
885 mov eax,[calm_literals_cursor]
\r
890 mov [calm_code_cursor],edi
\r
891 jmp instruction_assembled
\r
894 test [assembly_mode],AMODE_CALM_DEFINITION
\r
895 jz unexpected_instruction
\r
896 and [symbol_definition],0
\r
897 mov dl,SYMCLASS_EXPRESSION
\r
898 call identify_symbol
\r
899 jc invalid_identifier
\r
901 jz invalid_identifier
\r
902 call move_to_next_symbol
\r
903 jc missing_argument
\r
905 jne instruction_assembled
\r
907 call move_to_next_symbol
\r
908 mov edi,[calm_code_cursor]
\r
909 mov edx,calm_code_buffer
\r
911 call reserve_workspace
\r
912 mov eax,[calm_line_number]
\r
914 mov eax,calm_compute
\r
920 mov [calm_code_cursor],edi
\r
921 mov edi,[expression_workspace.memory_start]
\r
922 and [leave_opening_parentheses],0
\r
923 or [use_raw_values],1
\r
924 call parse_expression
\r
925 and [use_raw_values],0
\r
927 mov esi,[expression_workspace.memory_start]
\r
930 mov edi,[calm_code_cursor]
\r
931 mov edx,calm_code_buffer
\r
932 call reserve_workspace
\r
933 mov [calm_code_cursor],edi
\r
934 call convert_parsed_expression
\r
936 jc no_computable_expression
\r
938 xchg edi,[calm_code_cursor]
\r
941 jmp instruction_assembled
\r
942 no_computable_expression:
\r
943 sub [calm_code_cursor],8+8
\r
945 convert_parsed_expression:
\r
948 jz parsed_expression_converted
\r
949 cmp al,EXPR_SYMBOL_VALUE
\r
950 je copy_parsed_symbol
\r
951 cmp al,EXPR_OPERATOR
\r
952 je copy_parsed_operator
\r
954 je copy_parsed_value
\r
956 je copy_parsed_value
\r
958 je copy_parsed_value
\r
959 cmp al,EXPR_MISSING_PARENTHESIS
\r
960 je expression_missing_parenthesis
\r
961 jmp invalid_expression
\r
963 or eax,EXPRF_CALM_LITERAL
\r
966 test eax,EXPRF_VALUE_IN_WORKSPACE
\r
967 jnz parsed_value_in_workspace
\r
969 jnz parsed_value_pointer_ok
\r
970 jmp invalid_expression
\r
971 parsed_value_in_workspace:
\r
972 add ebx,[value_workspace.memory_start]
\r
973 and eax,not EXPRF_VALUE_IN_WORKSPACE
\r
974 parsed_value_pointer_ok:
\r
976 je parsed_float_to_copy
\r
979 jmp parsed_value_length_ok
\r
980 parsed_float_to_copy:
\r
981 mov ecx,sizeof.FloatData
\r
982 parsed_value_length_ok:
\r
984 mov edx,[calm_literals_cursor]
\r
986 sub eax,[calm_literals_buffer.memory_start]
\r
991 mov edx,calm_literals_buffer
\r
992 call reserve_workspace
\r
996 mov [calm_literals_cursor],edi
\r
999 jmp convert_parsed_expression
\r
1000 copy_parsed_symbol:
\r
1001 mov al,EXPR_SYMBOL
\r
1005 jz invalid_expression
\r
1008 jmp convert_parsed_expression
\r
1009 copy_parsed_operator:
\r
1012 jmp convert_parsed_expression
\r
1013 parsed_expression_converted:
\r
1019 test [assembly_mode],AMODE_CALM_DEFINITION
\r
1020 jz unexpected_instruction
\r
1021 mov edi,[calm_code_cursor]
\r
1022 mov edx,calm_code_buffer
\r
1024 sub eax,[edx+Workspace.memory_start]
\r
1025 mov [calm_rollback_offset],eax
\r
1027 call reserve_workspace
\r
1028 mov eax,[calm_line_number]
\r
1030 mov eax,calm_check
\r
1032 mov [calm_code_cursor],edi
\r
1033 or [use_raw_values],1
\r
1034 mov ebx,[condition_stack_base]
\r
1037 mov [condition_stack],ebx
\r
1038 parse_alm_condition:
\r
1039 call peek_at_constituent_value
\r
1040 jc calm_condition_parsed
\r
1042 jne parse_alm_logical_value
\r
1043 and [current_constituent],0
\r
1045 call push_to_condition_stack
\r
1046 jmp parse_alm_condition
\r
1047 alm_logical_value_empty:
\r
1049 jz calm_condition_parsed
\r
1050 call push_to_condition_stack
\r
1051 jmp parse_alm_condition
\r
1052 parse_alm_logical_value:
\r
1053 call parse_logical_value
\r
1054 jc alm_logical_value_empty
\r
1055 jecxz convert_logical_value
\r
1056 call push_to_condition_stack
\r
1057 convert_logical_value:
\r
1058 mov [calm_source_pointer],esi
\r
1059 mov esi,[expression_workspace.memory_start]
\r
1063 add ecx,[condition_stack]
\r
1064 sub ecx,[condition_stack_base]
\r
1065 mov edi,[calm_code_cursor]
\r
1066 mov edx,calm_code_buffer
\r
1067 call reserve_workspace
\r
1070 mov [calm_code_cursor],edi
\r
1071 mov eax,[comparator]
\r
1073 convert_argument_sequences:
\r
1074 call convert_parsed_expression
\r
1075 jc condition_malformed
\r
1076 cmp esi,[expression_end]
\r
1077 jb convert_argument_sequences
\r
1079 xchg edi,[calm_code_cursor]
\r
1082 mov esi,[calm_source_pointer]
\r
1083 parse_alm_logical_operator:
\r
1084 call get_constituent_value
\r
1085 jc calm_condition_parsed
\r
1087 je close_subconditions
\r
1091 jne condition_malformed
\r
1094 jmp prepare_stack_for_logical_operator
\r
1097 prepare_stack_for_logical_operator:
\r
1098 mov ebx,[condition_stack]
\r
1101 jge push_logical_operator
\r
1102 mov [condition_stack],ebx
\r
1103 mov edi,[calm_code_cursor]
\r
1106 mov [calm_code_cursor],edi
\r
1107 jmp prepare_stack_for_logical_operator
\r
1108 push_logical_operator:
\r
1109 call push_to_condition_stack
\r
1110 jmp parse_alm_condition
\r
1111 close_subconditions:
\r
1112 mov ebx,[condition_stack]
\r
1115 jl store_logical_operator
\r
1116 je condition_malformed
\r
1118 jnz parse_alm_logical_operator
\r
1119 mov [condition_stack],ebx
\r
1120 jmp parse_alm_logical_operator
\r
1121 store_logical_operator:
\r
1122 mov edi,[calm_code_cursor]
\r
1124 mov [condition_stack],ebx
\r
1126 mov [calm_code_cursor],edi
\r
1127 jmp close_subconditions
\r
1128 push_to_condition_stack:
\r
1129 mov ebx,[condition_stack]
\r
1132 cmp [condition_stack_end],ebx
\r
1133 je grow_condition_stack
\r
1134 mov [condition_stack],ebx
\r
1136 grow_condition_stack:
\r
1137 mov eax,[condition_stack_base]
\r
1141 mov [condition_stack_base],eax
\r
1143 mov [condition_stack],ebx
\r
1145 mov [condition_stack_end],ecx
\r
1147 calm_condition_parsed:
\r
1148 mov edi,[calm_code_cursor]
\r
1149 mov ebx,[condition_stack]
\r
1151 sub ecx,[condition_stack_base]
\r
1152 mov edx,calm_code_buffer
\r
1153 call reserve_workspace
\r
1154 finish_calm_condition:
\r
1158 jg condition_malformed
\r
1160 jne finish_calm_condition
\r
1161 mov [calm_code_cursor],edi
\r
1162 and [use_raw_values],0
\r
1163 jmp instruction_assembled
\r
1164 condition_malformed:
\r
1165 and [use_raw_values],0
\r
1166 mov edi,[calm_rollback_offset]
\r
1167 add edi,[calm_code_buffer.memory_start]
\r
1168 mov [calm_code_cursor],edi
\r
1169 mov edx,_invalid_expression
\r
1170 call register_error
\r
1174 test [assembly_mode],AMODE_CALM_DEFINITION
\r
1175 jz unexpected_instruction
\r
1176 mov [value],calm_publish_variable
\r
1177 call move_to_next_symbol
\r
1178 jc missing_argument
\r
1180 jne get_identifier_variable
\r
1182 mov [value],calm_publish_stack
\r
1183 get_identifier_variable:
\r
1184 and [symbol_definition],0
\r
1185 mov dl,SYMCLASS_EXPRESSION
\r
1186 call identify_symbol
\r
1187 jc invalid_identifier
\r
1189 jz invalid_identifier
\r
1190 mov [label_leaf],ebx
\r
1191 call move_to_next_symbol
\r
1192 jc missing_argument
\r
1194 jne get_value_variable
\r
1195 mov eax,calm_publish_constant
\r
1197 cmp eax,calm_publish_variable
\r
1198 jne invalid_argument
\r
1200 call move_to_next_symbol
\r
1201 jc missing_argument
\r
1202 get_value_variable:
\r
1204 jne missing_argument
\r
1206 mov dl,SYMCLASS_EXPRESSION
\r
1207 call identify_symbol
\r
1208 jc invalid_identifier
\r
1210 jz invalid_identifier
\r
1211 mov edi,[calm_code_cursor]
\r
1212 mov edx,calm_code_buffer
\r
1214 call reserve_workspace
\r
1215 mov eax,[calm_line_number]
\r
1219 mov eax,[label_leaf]
\r
1223 mov [calm_code_cursor],edi
\r
1224 jmp instruction_assembled
\r
1227 test [assembly_mode],AMODE_CALM_DEFINITION
\r
1228 jz unexpected_instruction
\r
1229 call move_to_next_symbol
\r
1230 jc missing_argument
\r
1231 and [symbol_definition],0
\r
1232 mov dl,SYMCLASS_EXPRESSION
\r
1233 call identify_symbol
\r
1234 jc invalid_identifier
\r
1236 jz invalid_identifier
\r
1237 mov [label_leaf],ebx
\r
1239 call move_to_next_symbol
\r
1240 jc alm_transform_arguments_ready
\r
1242 jne alm_transform_arguments_ready
\r
1244 mov dl,SYMCLASS_EXPRESSION
\r
1245 call identify_symbol
\r
1246 jc invalid_identifier
\r
1248 jz invalid_identifier
\r
1249 call get_symbol_namespace
\r
1250 alm_transform_arguments_ready:
\r
1251 mov edi,[calm_code_cursor]
\r
1252 mov edx,calm_code_buffer
\r
1254 call reserve_workspace
\r
1255 mov eax,[calm_line_number]
\r
1257 mov eax,calm_transform
\r
1259 mov eax,[label_leaf]
\r
1263 mov [calm_code_cursor],edi
\r
1264 jmp instruction_assembled
\r
1267 test [assembly_mode],AMODE_CALM_DEFINITION
\r
1268 jz unexpected_instruction
\r
1269 call move_to_next_symbol
\r
1270 jc missing_argument
\r
1272 and [symbol_definition],0
\r
1274 je alm_take_destination_ready
\r
1275 mov dl,SYMCLASS_EXPRESSION
\r
1276 call identify_symbol
\r
1277 jc invalid_identifier
\r
1279 jz invalid_identifier
\r
1280 call move_to_next_symbol
\r
1281 jc missing_argument
\r
1283 jne missing_argument
\r
1284 alm_take_destination_ready:
\r
1285 mov [label_leaf],ebx
\r
1287 mov dl,SYMCLASS_EXPRESSION
\r
1288 call identify_symbol
\r
1289 jc invalid_identifier
\r
1291 jz invalid_identifier
\r
1292 mov edi,[calm_code_cursor]
\r
1293 mov edx,calm_code_buffer
\r
1295 call reserve_workspace
\r
1296 mov eax,[calm_line_number]
\r
1300 mov eax,[label_leaf]
\r
1304 mov [calm_code_cursor],edi
\r
1305 jmp instruction_assembled
\r
1308 test [assembly_mode],AMODE_CALM_DEFINITION
\r
1309 jz unexpected_instruction
\r
1310 and [symbol_definition],0
\r
1311 mov ebx,[current_context.base_namespace]
\r
1312 mov edx,[ebx+SymbolTree_Root.parent_branch]
\r
1314 jz alm_call_context_ready
\r
1315 mov eax,[edx+SymbolTree_Foliage.root]
\r
1316 mov [current_context.base_namespace],eax
\r
1317 alm_call_context_ready:
\r
1318 mov dl,SYMCLASS_INSTRUCTION
\r
1320 call identify_symbol
\r
1321 pop [current_context.base_namespace]
\r
1322 jc invalid_identifier
\r
1324 jz invalid_identifier
\r
1325 cmp [ebx+SymbolTree_Leaf.class],SYMCLASS_INSTRUCTION
\r
1326 je alm_call_instruction_ok
\r
1327 mov edx,[ebx+SymbolTree_Leaf.branch]
\r
1328 mov eax,[edx+SymbolTree_Foliage.root]
\r
1329 test [eax+SymbolTree_Root.flags],NAMESPACE_CALM
\r
1330 jz alm_call_predicted_instruction
\r
1331 mov ebx,[ebx+SymbolTree_Leaf.fallback_parent]
\r
1333 jz invalid_identifier
\r
1334 alm_call_predicted_instruction:
\r
1336 mov [symbol_class],SYMCLASS_INSTRUCTION
\r
1337 or [symbol_required],1
\r
1338 or [symbol_expected],1
\r
1339 call scan_symbol_branch
\r
1340 jc invalid_identifier
\r
1342 mark_instruction_fallbacks:
\r
1343 mov edx,[edi+SymbolTree_Leaf.fallback_neighbour]
\r
1345 jz instruction_fallback_neighbour_ok
\r
1346 or [edx+SymbolTree_Leaf.extra_flags],SYMX_INSTRUCTION_PREDICTED
\r
1347 instruction_fallback_neighbour_ok:
\r
1348 mov edi,[edi+SymbolTree_Leaf.fallback_parent]
\r
1350 jz alm_call_instruction_ok
\r
1351 or [edi+SymbolTree_Leaf.extra_flags],SYMX_INSTRUCTION_PREDICTED
\r
1352 jmp mark_instruction_fallbacks
\r
1353 alm_call_instruction_ok:
\r
1354 mov edi,[calm_code_cursor]
\r
1355 mov edx,calm_code_buffer
\r
1357 call reserve_workspace
\r
1358 mov eax,[calm_line_number]
\r
1364 alm_call_argument:
\r
1365 call move_to_next_symbol
\r
1366 jc alm_call_arguments_ready
\r
1368 jne alm_call_invalid_argument
\r
1370 mov edx,calm_code_buffer
\r
1372 call reserve_workspace
\r
1373 call move_to_next_symbol
\r
1374 jc alm_call_empty_argument
\r
1376 je alm_call_empty_argument
\r
1378 mov dl,SYMCLASS_EXPRESSION
\r
1379 call identify_symbol
\r
1381 jc alm_call_invalid_argument
\r
1383 jz alm_call_invalid_argument
\r
1386 jmp alm_call_argument
\r
1387 alm_call_empty_argument:
\r
1390 jmp alm_call_argument
\r
1391 alm_call_invalid_argument:
\r
1392 mov edx,_invalid_argument
\r
1393 call register_error
\r
1394 alm_call_arguments_ready:
\r
1397 mov [calm_code_cursor],edi
\r
1398 jmp instruction_assembled
\r
1401 test [assembly_mode],AMODE_CALM_DEFINITION
\r
1402 jz unexpected_instruction
\r
1403 mov edi,[calm_code_cursor]
\r
1404 mov edx,calm_code_buffer
\r
1406 call reserve_workspace
\r
1407 mov eax,[calm_line_number]
\r
1411 mov [calm_code_cursor],edi
\r
1412 jmp instruction_assembled
\r
1415 mov eax,[current_pass]
\r
1416 mov [ebx+SymbolTree_Leaf.last_use_pass],eax
\r
1417 mov eax,[ebx+SymbolTree_Leaf.branch]
\r
1418 mov [instruction_branch],eax
\r
1419 mov [calm_value],edx
\r
1420 mov [calm_source_pointer],esi
\r
1421 mov esi,[edx+ValueDefinition.value]
\r
1422 mov eax,[esi+CompiledMacroHeader.literals_offset]
\r
1424 mov [calm_literals],eax
\r
1425 mov [breakpoint_token],0
\r
1426 mov ebx,[esi+CompiledMacroHeader.label_argument_leaf]
\r
1428 jz calm_label_argument_ok
\r
1429 call update_value_definition
\r
1431 jz calm_label_argument_ok
\r
1435 push [embedded_context]
\r
1436 mov eax,[line_context]
\r
1437 mov [embedded_context],eax
\r
1438 mov esi,[line_start]
\r
1439 mov ecx,[label_instruction_start]
\r
1440 mov [line_end],ecx
\r
1442 add ecx,1+sizeof.RecognitionContext
\r
1443 mov edx,assembly_workspace
\r
1444 mov edi,[edx+Workspace.memory_start]
\r
1445 call reserve_workspace
\r
1447 mov [breakpoint_token],dl
\r
1448 call extract_piece_of_line
\r
1449 pop [embedded_context]
\r
1452 mov [value_type],VALTYPE_SYMBOLIC
\r
1453 mov esi,[assembly_workspace.memory_start]
\r
1458 calm_label_argument_ok:
\r
1459 add esi,sizeof.CompiledMacroHeader
\r
1463 jbe calm_arguments_defined
\r
1464 get_calm_argument:
\r
1465 mov edx,assembly_workspace
\r
1466 mov edi,[edx+Workspace.memory_start]
\r
1467 mov ecx,[line_end]
\r
1468 sub ecx,[calm_source_pointer]
\r
1469 add ecx,1+sizeof.RecognitionContext
\r
1470 call reserve_workspace
\r
1471 mov eax,[esi+sizeof.CompiledMacroArgument]
\r
1472 xchg esi,[calm_source_pointer]
\r
1474 jz get_calm_greedy_argument
\r
1475 call extract_argument_value
\r
1476 jmp calm_argument_value_cut
\r
1477 get_calm_greedy_argument:
\r
1479 call extract_piece_of_line
\r
1480 calm_argument_value_cut:
\r
1481 xchg esi,[calm_source_pointer]
\r
1482 mov ebx,[esi+CompiledMacroArgument.symbol_leaf]
\r
1483 call update_value_definition
\r
1485 jz calm_argument_ok
\r
1487 sub ecx,[assembly_workspace.memory_start]
\r
1489 jnz calm_argument_value_ready
\r
1490 or ecx,[esi+CompiledMacroArgument.default_value_length]
\r
1491 jz calm_argument_value_ready
\r
1493 je missing_argument
\r
1495 mov esi,[esi+CompiledMacroArgument.default_value_offset]
\r
1496 add esi,[calm_literals]
\r
1497 jmp calm_assign_argument_value
\r
1498 calm_argument_value_ready:
\r
1500 mov esi,[assembly_workspace.memory_start]
\r
1501 calm_assign_argument_value:
\r
1502 mov [value_type],VALTYPE_SYMBOLIC
\r
1506 add esi,sizeof.CompiledMacroArgument
\r
1510 jbe calm_arguments_defined
\r
1511 xchg esi,[calm_source_pointer]
\r
1512 call move_to_next_symbol
\r
1513 jc calm_next_argument
\r
1515 jne invalid_argument
\r
1517 calm_next_argument:
\r
1518 xchg esi,[calm_source_pointer]
\r
1519 jmp get_calm_argument
\r
1520 calm_arguments_defined:
\r
1522 and [calm_instruction_number],0
\r
1523 call create_source_entry
\r
1524 jc calm_exceeded_stack_limit
\r
1525 mov edx,[calm_value]
\r
1526 mov [ebx+SourceEntry.type],SOURCE_CALM
\r
1527 mov [ebx+SourceEntry.text],edx
\r
1528 sub esi,[edx+ValueDefinition.value]
\r
1529 mov [ebx+SourceEntry.offset],esi
\r
1530 or [edx+ValueDefinition.flags],VAL_IN_USE
\r
1531 inc [edx+ValueDefinition.reference_count]
\r
1532 mov eax,[parameter_namespace]
\r
1533 mov [ebx+SourceEntry.local_namespace],eax
\r
1534 mov esi,[calm_source_pointer]
\r
1535 mov ecx,[instruction_branch]
\r
1537 jz instruction_assembled
\r
1538 mov [ebx+SourceEntry.name],ecx
\r
1539 or [ebx+SourceEntry.name_length],-1
\r
1540 jmp instruction_assembled
\r
1541 calm_exceeded_stack_limit:
\r
1542 mov edx,_stack_limit_exceeded
\r
1543 call register_error
\r
1546 calm_virtual_machine:
\r
1547 mov al,[ebx+SourceEntry.saved_result]
\r
1548 mov [calm_result],al
\r
1549 mov edx,[ebx+SourceEntry.text]
\r
1550 mov [calm_value],edx
\r
1551 mov esi,[edx+ValueDefinition.value]
\r
1552 mov eax,[esi+CompiledMacroHeader.literals_offset]
\r
1554 mov [calm_literals],eax
\r
1555 add esi,[ebx+SourceEntry.offset]
\r
1556 calm_execution_unit:
\r
1558 mov [calm_instruction_number],eax
\r
1563 mov ebx,[source_context]
\r
1564 mov ecx,[ebx+SourceContext.number_of_entries]
\r
1566 ; jz internal_error
\r
1567 mov [ebx+SourceContext.number_of_entries],ecx
\r
1568 imul ecx,sizeof.SourceEntry
\r
1569 mov edx,[ebx+sizeof.SourceContext+ecx+SourceEntry.text]
\r
1570 and [edx+ValueDefinition.flags],not VAL_IN_USE
\r
1571 dec [edx+ValueDefinition.reference_count]
\r
1576 mov [label_leaf],eax
\r
1581 mov esi,[calm_literals]
\r
1584 mov [pattern_end],eax
\r
1585 mov edi,[assembly_workspace.memory_start]
\r
1586 arrange_by_pattern:
\r
1587 mov edx,assembly_workspace
\r
1588 mov ecx,[pattern_end]
\r
1590 call reserve_workspace
\r
1592 cmp esi,[pattern_end]
\r
1593 je assign_arranged_value
\r
1596 je arrange_by_reference
\r
1598 je downgrade_hard_space
\r
1601 je copy_arranged_token_data
\r
1603 je copy_arranged_token_data
\r
1605 je copy_arranged_token_data
\r
1613 copy_arranged_token_data:
\r
1616 downgrade_hard_space:
\r
1620 arrange_by_reference:
\r
1622 call use_available_value
\r
1623 jc arrange_missing_value
\r
1624 mov al,[edx+ValueDefinition.type]
\r
1625 cmp al,VALTYPE_NUMERIC
\r
1626 je arrange_numeric_value
\r
1627 cmp al,VALTYPE_SYMBOLIC
\r
1628 jne arrange_unsupported_value
\r
1629 mov ecx,[edx+ValueDefinition.value_length]
\r
1630 jecxz arrange_empty_value
\r
1631 add ecx,1+sizeof.RecognitionContext
\r
1633 mov edx,assembly_workspace
\r
1634 call reserve_workspace
\r
1637 mov esi,[edx+ValueDefinition.value]
\r
1638 mov ecx,[edx+ValueDefinition.value_length]
\r
1641 cmp esi,[pattern_end]
\r
1642 je assign_arranged_value
\r
1646 assert sizeof.RecognitionContext and 11b = 0
\r
1647 mov ecx,sizeof.RecognitionContext shr 2
\r
1649 jmp arrange_by_pattern
\r
1650 arrange_numeric_value:
\r
1651 mov eax,[edx+ValueDefinition.value]
\r
1653 cmp dword [eax+4+ecx],0
\r
1654 jne arrange_unsupported_value
\r
1655 test byte [eax+4+ecx-1],80h
\r
1656 jnz arrange_unsupported_value
\r
1659 mov edx,assembly_workspace
\r
1661 call reserve_workspace
\r
1669 jmp arrange_by_pattern
\r
1670 arrange_empty_value:
\r
1673 arrange_unsupported_value:
\r
1674 mov edx,_invalid_symbol_value
\r
1675 jmp arrange_failed_reference
\r
1676 arrange_missing_value:
\r
1677 mov edx,_undefined_symbol
\r
1678 arrange_failed_reference:
\r
1679 call register_error
\r
1684 mov eax,[eax+SymbolTree_Leaf.branch]
\r
1685 cmp [eax+SymbolTree_Foliage.name_kind],NAME_CASEINSENSITIVE
\r
1690 assign_arranged_value:
\r
1691 mov ebx,[label_leaf]
\r
1692 call update_value_definition
\r
1694 jz arranged_value_assigned
\r
1695 mov [value_type],VALTYPE_SYMBOLIC
\r
1697 mov esi,[assembly_workspace.memory_start]
\r
1700 arranged_value_assigned:
\r
1702 jmp calm_execution_unit
\r
1705 and [calm_result],0
\r
1711 mov edi,[calm_literals]
\r
1714 mov [pattern_end],eax
\r
1716 mov [brackets],eax
\r
1717 call use_available_value
\r
1718 jc calm_undefined_symbol
\r
1719 mov al,[edx+ValueDefinition.type]
\r
1720 cmp al,VALTYPE_RESERVED
\r
1721 je calm_undefined_symbol
\r
1722 cmp al,VALTYPE_SYMBOLIC
\r
1723 jne calm_invalid_value
\r
1726 inc [edx+ValueDefinition.reference_count]
\r
1727 mov esi,[edx+ValueDefinition.value]
\r
1728 mov ecx,[edx+ValueDefinition.value_length]
\r
1730 mov [line_end],ecx
\r
1731 mov ebx,[expression_workspace.memory_start]
\r
1732 and [matched_context],0
\r
1733 and [stored_position],0
\r
1734 calm_match_with_pattern:
\r
1735 cmp edi,[pattern_end]
\r
1736 je calm_end_of_pattern
\r
1739 jne calm_exact_match
\r
1740 calm_wildcard_match:
\r
1741 and [stored_position],0
\r
1743 cmp edi,[pattern_end]
\r
1744 je calm_required_wildcard_match
\r
1745 cmp byte [edi],'?'
\r
1746 je calm_optional_wildcard_match
\r
1747 calm_required_wildcard_match:
\r
1748 cmp esi,[line_end]
\r
1749 je calm_match_done
\r
1750 call calm_consume_whitespace
\r
1751 jz calm_match_done
\r
1753 mov edx,expression_workspace
\r
1754 mov ecx,sizeof.MatchedExcerpt
\r
1755 call reserve_workspace
\r
1758 mov ecx,[matched_context]
\r
1759 mov [ebx+MatchedExcerpt.symbol_leaf],eax
\r
1760 mov [ebx+MatchedExcerpt.recognition_context],ecx
\r
1761 mov [ebx+MatchedExcerpt.data_start],esi
\r
1763 call calm_consume_token
\r
1764 jc calm_match_done
\r
1765 mov [ebx+MatchedExcerpt.data_end],esi
\r
1766 add ebx,sizeof.MatchedExcerpt
\r
1767 jmp calm_match_with_pattern
\r
1768 calm_optional_wildcard_match:
\r
1770 mov edx,expression_workspace
\r
1771 mov ecx,sizeof.MatchedExcerpt
\r
1772 call reserve_workspace
\r
1776 mov ecx,[matched_context]
\r
1777 mov [ebx+MatchedExcerpt.symbol_leaf],eax
\r
1778 mov [ebx+MatchedExcerpt.recognition_context],ecx
\r
1779 mov [ebx+MatchedExcerpt.data_start],esi
\r
1780 mov [ebx+MatchedExcerpt.data_end],esi
\r
1781 add ebx,sizeof.MatchedExcerpt
\r
1782 jmp calm_match_with_pattern
\r
1784 cmp esi,[line_end]
\r
1785 je calm_end_of_text
\r
1788 jne found_token_to_match
\r
1790 mov [matched_context],esi
\r
1791 add esi,sizeof.RecognitionContext
\r
1792 jmp calm_exact_match
\r
1793 found_token_to_match:
\r
1794 cmp [stored_position],0
\r
1795 jne calm_match_position_stored
\r
1796 mov [stored_position],esi
\r
1797 mov ecx,[matched_context]
\r
1798 mov [stored_context],ecx
\r
1799 mov [stored_pattern],edi
\r
1800 calm_match_position_stored:
\r
1802 je calm_match_whitespace
\r
1804 je calm_skip_pattern_whitespace
\r
1806 jne calm_token_mismatch
\r
1808 je calm_match_name_tokens
\r
1810 je calm_match_string_tokens
\r
1812 je calm_match_string_tokens
\r
1814 jne calm_match_with_pattern
\r
1820 lea edi,[edi+4+eax]
\r
1821 cmp byte [edi],'?'
\r
1822 jne calm_compare_token_contents
\r
1824 jmp calm_compare_token_contents
\r
1825 calm_match_string_tokens:
\r
1830 calm_compare_token_contents:
\r
1832 je calm_match_with_pattern
\r
1840 jne calm_retract_match
\r
1841 jmp calm_match_with_pattern
\r
1842 calm_match_name_tokens:
\r
1847 cmp byte [edi],'?'
\r
1848 je calm_case_insensitive_match
\r
1850 je calm_match_with_pattern
\r
1856 jne calm_name_mismatch
\r
1860 jne calm_name_mismatch
\r
1862 jne calm_name_mismatch
\r
1864 jmp calm_match_with_pattern
\r
1865 calm_name_mismatch:
\r
1867 jmp calm_retract_match
\r
1868 calm_case_insensitive_match:
\r
1871 je calm_match_with_pattern
\r
1877 jne calm_name_mismatch
\r
1879 mov eax,[esi+ecx+4]
\r
1880 cmp eax,[edi+ecx+4]
\r
1881 jne calm_name_mismatch
\r
1883 calm_compare_case_insensitively:
\r
1885 mov dl,[characters+eax]
\r
1888 cmp dl,[characters+eax]
\r
1890 loop calm_compare_case_insensitively
\r
1892 jmp calm_match_with_pattern
\r
1893 calm_match_converted_number:
\r
1894 call convert_number_to_match
\r
1895 jmp calm_compare_token_contents
\r
1896 calm_match_with_converted_number:
\r
1898 call convert_number_to_match
\r
1900 jmp calm_compare_token_contents
\r
1901 calm_match_whitespace:
\r
1903 je calm_optional_whitespace
\r
1905 je calm_required_whitespace
\r
1906 cmp [stored_pattern],edi
\r
1907 jne calm_retract_match
\r
1908 call calm_consume_whitespace
\r
1909 jz calm_match_done
\r
1910 and [stored_position],0
\r
1911 jmp calm_match_with_pattern
\r
1912 calm_optional_whitespace:
\r
1914 cmp edi,[pattern_end]
\r
1915 je calm_whitespace_matched
\r
1916 cmp byte [edi],0A0h
\r
1917 jne calm_whitespace_matched
\r
1918 calm_required_whitespace:
\r
1920 cmp edi,[pattern_end]
\r
1921 je calm_whitespace_matched
\r
1922 cmp byte [edi],20h
\r
1923 jne calm_whitespace_matched
\r
1925 calm_whitespace_matched:
\r
1926 call calm_consume_whitespace
\r
1927 jz calm_end_of_text
\r
1928 jmp calm_match_with_pattern
\r
1929 calm_skip_pattern_whitespace:
\r
1931 jmp calm_match_with_pattern
\r
1932 calm_token_mismatch:
\r
1934 je calm_match_converted_number
\r
1936 je calm_match_with_converted_number
\r
1937 calm_retract_match:
\r
1939 xchg esi,[stored_position]
\r
1940 mov ecx,[stored_context]
\r
1941 mov [matched_context],ecx
\r
1942 mov edi,[stored_pattern]
\r
1943 call calm_consume_whitespace
\r
1944 jz calm_match_done
\r
1945 calm_expand_wildcard_match:
\r
1946 cmp ebx,[expression_workspace.memory_start]
\r
1947 je calm_match_done
\r
1948 call calm_consume_token
\r
1949 jc calm_match_done
\r
1950 mov [ebx-sizeof.MatchedExcerpt+MatchedExcerpt.data_end],esi
\r
1951 jmp calm_match_with_pattern
\r
1952 calm_consume_whitespace:
\r
1955 je calm_consume_context_token
\r
1957 jne calm_whitespace_consumed
\r
1959 cmp esi,[line_end]
\r
1960 jne calm_consume_whitespace
\r
1961 calm_whitespace_consumed:
\r
1963 calm_consume_context_token:
\r
1965 mov [matched_context],esi
\r
1966 add esi,sizeof.RecognitionContext
\r
1967 cmp esi,[line_end]
\r
1968 jne calm_consume_whitespace
\r
1970 calm_consume_token:
\r
1972 mov edx,[brackets]
\r
1974 consume_token_content:
\r
1976 je consume_closing
\r
1978 je consume_opening
\r
1980 je consume_token_with_data
\r
1982 je consume_token_with_data
\r
1984 je consume_token_with_data
\r
1986 je consume_internal_token
\r
1988 je consume_context_token
\r
1992 consume_token_with_data:
\r
1997 consume_internal_token:
\r
2003 consume_context_token:
\r
2004 add esi,sizeof.RecognitionContext
\r
2015 cmp esi,[line_end]
\r
2016 je consume_unsatisfied
\r
2018 jmp consume_token_content
\r
2019 consume_unsatisfied:
\r
2022 calm_end_of_pattern:
\r
2023 cmp esi,[line_end]
\r
2024 je calm_match_found
\r
2027 je calm_end_of_pattern
\r
2029 jne calm_another_token_to_match
\r
2030 add esi,sizeof.RecognitionContext
\r
2031 jmp calm_end_of_pattern
\r
2032 calm_another_token_to_match:
\r
2034 cmp [stored_position],0
\r
2035 je calm_expand_wildcard_match
\r
2036 jmp calm_retract_match
\r
2038 cmp edi,[pattern_end]
\r
2039 je calm_match_found
\r
2042 je calm_wildcard_match
\r
2044 jne calm_match_done
\r
2046 jmp calm_end_of_text
\r
2048 or [calm_result],1
\r
2050 mov [value_type],VALTYPE_SYMBOLIC
\r
2051 calm_assign_matched_values:
\r
2052 cmp esi,[expression_workspace.memory_start]
\r
2053 je calm_match_done
\r
2054 sub esi,sizeof.MatchedExcerpt
\r
2055 mov ebx,[esi+MatchedExcerpt.symbol_leaf]
\r
2056 call update_value_definition
\r
2058 jz calm_assign_matched_values
\r
2060 mov eax,[esi+MatchedExcerpt.recognition_context]
\r
2061 mov ecx,[esi+MatchedExcerpt.data_end]
\r
2062 mov esi,[esi+MatchedExcerpt.data_start]
\r
2064 jz calm_matched_value_ready
\r
2066 jz calm_matched_value_ready
\r
2068 je calm_matched_value_ready
\r
2071 mov edx,assembly_workspace
\r
2072 mov edi,[edx+Workspace.memory_start]
\r
2073 add ecx,1+sizeof.RecognitionContext
\r
2074 call reserve_workspace
\r
2077 assert sizeof.RecognitionContext and 11b = 0
\r
2078 mov ecx,sizeof.RecognitionContext shr 2
\r
2083 mov esi,[assembly_workspace.memory_start]
\r
2085 calm_matched_value_ready:
\r
2088 jmp calm_assign_matched_values
\r
2091 dec [edx+ValueDefinition.reference_count]
\r
2093 jmp calm_execution_unit
\r
2097 mov [label_leaf],eax
\r
2101 mov edi,[calculation_workspace.memory_start]
\r
2102 and [value_position],0
\r
2103 call calculate_parsed_expression
\r
2105 jc calm_compute_done
\r
2106 mov al,byte [edi+ExpressionTerm.attributes]
\r
2107 cmp al,EXPR_STRING
\r
2108 je calm_computed_string
\r
2110 je calm_computed_float
\r
2111 call convert_terms_to_numeric_value
\r
2112 mov [value_type],VALTYPE_NUMERIC
\r
2113 calm_computed_value_ready:
\r
2115 mov ebx,[label_leaf]
\r
2116 call update_value_definition
\r
2118 jz calm_compute_done
\r
2121 calm_compute_done:
\r
2123 jmp calm_execution_unit
\r
2124 calm_computed_string:
\r
2125 call get_term_value
\r
2129 mov [value_type],VALTYPE_STRING
\r
2130 jmp calm_computed_value_ready
\r
2131 calm_computed_float:
\r
2132 call get_term_value
\r
2134 mov ecx,sizeof.FloatData
\r
2135 mov [value_type],VALTYPE_FLOAT
\r
2136 jmp calm_computed_value_ready
\r
2141 jz calm_execution_unit
\r
2143 calm_evaluate_logical_value:
\r
2144 call evaluate_stored_logical_value
\r
2145 mov [calm_result],al
\r
2147 find_next_logical_value:
\r
2150 jz calm_execution_unit
\r
2151 jns next_logical_value_found
\r
2153 jne find_next_logical_value
\r
2154 xor [calm_result],1
\r
2155 jmp find_next_logical_value
\r
2156 next_logical_value_found:
\r
2159 skip_next_logical_value:
\r
2162 skip_logical_operator:
\r
2164 assert BOOL_NEG = -1
\r
2166 jg skip_next_logical_value
\r
2167 je skip_logical_operator
\r
2169 jnz skip_logical_operator
\r
2173 cmp [calm_result],0
\r
2174 jne find_next_logical_value
\r
2176 jmp calm_evaluate_logical_value
\r
2178 cmp [calm_result],0
\r
2179 je find_next_logical_value
\r
2181 jmp calm_evaluate_logical_value
\r
2184 cmp [calm_result],0
\r
2187 jmp calm_execution_unit
\r
2189 cmp [calm_result],0
\r
2192 jmp calm_execution_unit
\r
2195 mov edx,[calm_value]
\r
2196 add eax,[edx+ValueDefinition.value]
\r
2198 jmp calm_execution_unit
\r
2203 mov eax,[current_pass]
\r
2204 mov [ebx+SymbolTree_Leaf.last_use_pass],eax
\r
2205 mov eax,[ebx+SymbolTree_Leaf.branch]
\r
2206 mov [instruction_branch],eax
\r
2207 call use_available_value
\r
2208 jc calm_undefined_symbol
\r
2209 mov al,[edx+ValueDefinition.type]
\r
2210 cmp al,VALTYPE_SYMBOLIC
\r
2211 jne calm_invalid_value
\r
2212 call create_source_entry
\r
2213 jc calm_assemble_exceeded_stack_limit
\r
2214 mov [ebx+SourceEntry.type],SOURCE_MACRO
\r
2215 or [ebx+SourceEntry.flags],SRCF_PREPROCESSED
\r
2216 mov [ebx+SourceEntry.text],edx
\r
2217 or [edx+ValueDefinition.flags],VAL_IN_USE
\r
2218 inc [edx+ValueDefinition.reference_count]
\r
2219 mov eax,[calm_instruction_number]
\r
2220 mov [ebx-sizeof.SourceEntry+SourceEntry.line_number],eax
\r
2221 mov edx,[ebx-sizeof.SourceEntry+SourceEntry.text]
\r
2222 mov ecx,[edx+ValueDefinition.value]
\r
2224 mov [ebx-sizeof.SourceEntry+SourceEntry.offset],esi
\r
2225 mov eax,[ebx-sizeof.SourceEntry+SourceEntry.local_namespace]
\r
2226 mov [ebx+SourceEntry.local_namespace],eax
\r
2227 mov al,[calm_result]
\r
2228 mov [ebx-sizeof.SourceEntry+SourceEntry.saved_result],al
\r
2229 mov ecx,[instruction_branch]
\r
2232 mov [ebx+SourceEntry.name],ecx
\r
2233 or [ebx+SourceEntry.name_length],-1
\r
2235 calm_undefined_symbol:
\r
2236 mov edx,_undefined_symbol
\r
2237 jmp calm_execution_error
\r
2238 calm_invalid_value:
\r
2239 mov edx,_invalid_symbol_value
\r
2240 jmp calm_execution_error
\r
2241 calm_assemble_exceeded_stack_limit:
\r
2242 mov edx,_stack_limit_exceeded
\r
2243 calm_execution_error:
\r
2244 call register_error
\r
2245 jmp calm_execution_unit
\r
2248 mov [calm_result],0
\r
2250 mov [label_leaf],eax
\r
2253 mov [transforming_namespace],eax
\r
2254 call get_available_value
\r
2255 jc calm_undefined_symbol
\r
2256 cmp [edx+ValueDefinition.type],VALTYPE_SYMBOLIC
\r
2257 jne calm_invalid_value
\r
2259 call clear_line_embeddings
\r
2260 mov esi,[edx+ValueDefinition.value]
\r
2261 mov [line_start],esi
\r
2263 mov [embedded_context],eax
\r
2264 mov [line_context],eax
\r
2265 mov ecx,[edx+ValueDefinition.value_length]
\r
2267 mov [line_end],ecx
\r
2268 mov edi,[assembly_workspace.memory_start]
\r
2269 mov [hidden_context],0
\r
2270 transform_symbolic_value:
\r
2271 and [symbol_definition],0
\r
2272 mov dl,SYMCLASS_EXPRESSION
\r
2274 mov eax,[embedded_context]
\r
2275 mov [line_context],eax
\r
2276 mov ebx,[transforming_namespace]
\r
2278 jz transform_identify
\r
2279 call identify_symbol_in_namespace
\r
2280 jmp transform_identification_done
\r
2281 transform_identify:
\r
2282 call identify_symbol
\r
2283 transform_identification_done:
\r
2284 jc symbolic_value_transformed
\r
2286 jnz ready_to_transform
\r
2289 ready_to_transform:
\r
2292 jz untransformed_literal
\r
2293 mov [further_whitespace],ecx
\r
2294 call get_available_value
\r
2295 jc untransformed_literal
\r
2296 cmp [edx+ValueDefinition.type],VALTYPE_SYMBOLIC
\r
2297 jne untransformed_literal
\r
2298 mov eax,[current_pass]
\r
2299 mov [ebx+SymbolTree_Leaf.last_use_pass],eax
\r
2300 mov [calm_result],1
\r
2301 mov [line_start],esi
\r
2302 mov esi,[edx+ValueDefinition.value]
\r
2303 mov ecx,[edx+ValueDefinition.value_length]
\r
2305 add ecx,[further_whitespace]
\r
2306 add ecx,1+sizeof.RecognitionContext
\r
2307 mov edx,assembly_workspace
\r
2308 call reserve_workspace
\r
2310 jz symbol_transformed
\r
2312 xchg al,[hidden_context]
\r
2314 jnz reset_hidden_context
\r
2315 cmp [line_context],0
\r
2316 je copy_transformed_value
\r
2317 reset_hidden_context:
\r
2319 call reset_transformed_context
\r
2320 copy_transformed_value:
\r
2323 symbol_transformed:
\r
2324 mov ecx,[further_whitespace]
\r
2327 mov esi,[line_start]
\r
2328 jmp transform_symbolic_value
\r
2329 untransformed_literal:
\r
2331 xchg esi,[line_start]
\r
2334 add ecx,1+sizeof.RecognitionContext
\r
2335 mov edx,assembly_workspace
\r
2336 call reserve_workspace
\r
2338 xchg al,[hidden_context]
\r
2340 jz copy_untransformed_literal
\r
2341 mov edx,[line_context]
\r
2342 call reset_transformed_context
\r
2343 copy_untransformed_literal:
\r
2346 jmp transform_symbolic_value
\r
2347 reset_transformed_context:
\r
2350 je transformed_context_ok
\r
2352 assert sizeof.RecognitionContext and 11b = 0
\r
2353 mov ecx,sizeof.RecognitionContext shr 2
\r
2355 jz clear_transformed_context
\r
2359 transformed_context_ok:
\r
2361 clear_transformed_context:
\r
2365 symbolic_value_transformed:
\r
2367 cmp [calm_result],0
\r
2368 je calm_transform_done
\r
2369 mov ebx,[label_leaf]
\r
2370 call update_value_definition
\r
2372 jz calm_transform_done
\r
2373 mov esi,[assembly_workspace.memory_start]
\r
2376 mov [value_type],VALTYPE_SYMBOLIC
\r
2378 calm_transform_done:
\r
2380 jmp calm_execution_unit
\r
2384 mov [label_leaf],eax
\r
2386 call get_available_value
\r
2387 jc calm_undefined_symbol
\r
2388 mov al,[edx+ValueDefinition.type]
\r
2389 cmp al,VALTYPE_SYMBOLIC
\r
2390 jne calm_invalid_value
\r
2391 mov eax,[edx+ValueDefinition.value]
\r
2392 mov [symbol_value_start],eax
\r
2393 mov ecx,[edx+ValueDefinition.value_length]
\r
2395 mov [symbol_value_end],ecx
\r
2397 call convert_symbolic_value_to_string
\r
2399 mov ebx,[label_leaf]
\r
2400 call update_value_definition
\r
2402 jz calm_stringify_done
\r
2404 mov [value_type],VALTYPE_STRING
\r
2406 calm_stringify_done:
\r
2408 jmp calm_execution_unit
\r
2410 calm_publish_constant:
\r
2411 mov edi,create_constant_value_definition
\r
2413 calm_publish_stack:
\r
2414 mov edi,create_value_definition
\r
2416 calm_publish_variable:
\r
2417 mov edi,update_value_definition
\r
2422 mov [label_leaf],eax
\r
2423 call use_available_value
\r
2424 jc calm_undefined_symbol
\r
2425 mov al,[edx+ValueDefinition.type]
\r
2426 cmp al,VALTYPE_SYMBOLIC
\r
2427 jne calm_invalid_value
\r
2429 call clear_line_embeddings
\r
2430 mov esi,[edx+ValueDefinition.value]
\r
2431 mov [line_start],esi
\r
2432 mov ecx,[edx+ValueDefinition.value_length]
\r
2434 mov [line_end],ecx
\r
2435 and [symbol_definition],0
\r
2436 mov dl,SYMCLASS_EXPRESSION
\r
2437 call identify_symbol
\r
2440 jc calm_invalid_identifier
\r
2442 jz calm_invalid_identifier
\r
2443 cmp eax,[line_end]
\r
2444 jne calm_invalid_identifier
\r
2445 xchg ebx,[label_leaf]
\r
2446 call use_available_value
\r
2447 jc calm_undefined_symbol
\r
2448 mov al,[edx+ValueDefinition.type]
\r
2449 cmp al,VALTYPE_SYMBOLIC
\r
2450 jb calm_invalid_value
\r
2451 cmp al,VALTYPE_AREA
\r
2452 ja calm_invalid_value
\r
2453 mov [value_type],al
\r
2455 mov ebx,[label_leaf]
\r
2458 jz calm_execution_unit
\r
2461 mov esi,[eax+ValueDefinition.value]
\r
2462 mov ecx,[eax+ValueDefinition.value_length]
\r
2465 jmp calm_execution_unit
\r
2466 calm_invalid_identifier:
\r
2467 mov edx,_invalid_identifier
\r
2468 call register_error
\r
2469 jmp calm_execution_unit
\r
2477 call remove_value_definition
\r
2478 setnc [calm_result]
\r
2479 jmp calm_execution_unit
\r
2484 mov eax,[current_pass]
\r
2485 mov [ebx+SymbolTree_Leaf.last_use_pass],eax
\r
2486 mov eax,[ebx+SymbolTree_Leaf.branch]
\r
2487 mov [instruction_branch],eax
\r
2488 call use_available_value
\r
2489 jc calm_call_undefined
\r
2490 mov al,[edx+ValueDefinition.type]
\r
2491 cmp al,VALTYPE_CALM
\r
2492 jne calm_call_invalid
\r
2493 call create_source_entry
\r
2494 jc calm_call_exceeded_stack_limit
\r
2495 mov eax,[parameter_namespace]
\r
2496 mov [ebx+SourceEntry.local_namespace],eax
\r
2497 mov ecx,[instruction_branch]
\r
2500 mov [ebx+SourceEntry.name],ecx
\r
2501 or [ebx+SourceEntry.name_length],-1
\r
2503 mov [ebx+SourceEntry.type],SOURCE_CALM
\r
2504 mov [ebx+SourceEntry.text],edx
\r
2505 or [edx+ValueDefinition.flags],VAL_IN_USE
\r
2506 inc [edx+ValueDefinition.reference_count]
\r
2508 mov esi,[edx+ValueDefinition.value]
\r
2509 mov eax,[esi+CompiledMacroHeader.literals_offset]
\r
2511 mov [calm_value],edx
\r
2512 mov [calm_literals],eax
\r
2513 add esi,sizeof.CompiledMacroHeader
\r
2515 process_call_arguments:
\r
2519 jbe call_arguments_ready
\r
2522 jz omitted_call_argument
\r
2525 je omitted_call_argument
\r
2526 call use_available_value
\r
2527 jc missing_argument_value
\r
2529 mov ebx,[esi+CompiledMacroArgument.symbol_leaf]
\r
2530 call update_value_definition
\r
2533 mov esi,[eax+ValueDefinition.value]
\r
2534 mov ecx,[eax+ValueDefinition.value_length]
\r
2535 mov al,[eax+ValueDefinition.type]
\r
2536 assign_call_argument:
\r
2538 jz call_argument_assigned
\r
2539 mov [value_type],al
\r
2541 call_argument_assigned:
\r
2543 next_call_argument:
\r
2544 add esi,sizeof.CompiledMacroArgument
\r
2545 jmp process_call_arguments
\r
2546 missing_argument_value:
\r
2547 mov edx,_undefined_symbol
\r
2548 call register_error
\r
2549 jmp next_call_argument
\r
2550 omitted_call_argument:
\r
2551 mov ebx,[esi+CompiledMacroArgument.symbol_leaf]
\r
2552 call update_value_definition
\r
2554 mov ecx,[esi+CompiledMacroArgument.default_value_length]
\r
2555 mov esi,[esi+CompiledMacroArgument.default_value_offset]
\r
2556 add esi,[calm_literals]
\r
2557 mov al,VALTYPE_SYMBOLIC
\r
2559 jne assign_call_argument
\r
2562 mov edx,_invalid_argument
\r
2563 call register_error
\r
2565 jmp assign_call_argument
\r
2566 call_arguments_ready:
\r
2571 jz call_arguments_ok
\r
2572 mov edx,_invalid_argument
\r
2573 call register_error
\r
2574 skip_excess_arguments:
\r
2578 jnz skip_excess_arguments
\r
2579 call_arguments_ok:
\r
2581 mov eax,[calm_instruction_number]
\r
2582 mov [ebx-sizeof.SourceEntry+SourceEntry.line_number],eax
\r
2583 mov eax,[ebx-sizeof.SourceEntry+SourceEntry.text]
\r
2584 mov ecx,[eax+ValueDefinition.value]
\r
2586 mov [ebx-sizeof.SourceEntry+SourceEntry.offset],edi
\r
2587 mov al,[calm_result]
\r
2588 mov [ebx-sizeof.SourceEntry+SourceEntry.saved_result],al
\r
2589 jmp calm_execution_unit
\r
2590 calm_call_undefined:
\r
2591 mov edx,_undefined_symbol
\r
2592 jmp calm_call_error
\r
2593 calm_call_invalid:
\r
2594 mov edx,_invalid_symbol_value
\r
2595 jmp calm_call_error
\r
2596 calm_call_exceeded_stack_limit:
\r
2597 mov edx,_stack_limit_exceeded
\r
2599 call register_error
\r
2600 skip_call_arguments:
\r
2603 jnz skip_call_arguments
\r
2604 jmp calm_execution_unit