Subversion Repositories Kolibri OS

Rev

Rev 2664 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2664 Rev 2665
Line 38... Line 38...
38
        xor     eax,eax
38
	xor	eax,eax
39
        mov     [source_start],eax
39
	mov	[source_start],eax
40
        mov     [display_buffer],eax
40
	mov	[display_buffer],eax
41
        mov     [hash_tree],eax
41
	mov	[hash_tree],eax
42
        mov     [macro_status],al
42
	mov	[error],eax
-
 
43
	mov	[macro_status],al
43
        mov     esi,[input_file]
44
	mov	esi,[input_file]
44
        mov     edx,esi
45
	mov	edx,esi
45
        call    open
46
	call	open
46
        jc      main_file_not_found
47
	jc	main_file_not_found
47
        mov     edi,[memory_start]
48
	mov	edi,[memory_start]
Line 868... Line 869...
868
        cmp     al,'{'
869
	cmp	al,'{'
869
        je      found_macro_block
870
	je	found_macro_block
870
        jmp     invalid_macro_arguments
871
	jmp	invalid_macro_arguments
871
      macro_argument_with_default_value:
872
      macro_argument_with_default_value:
872
        call    skip_macro_argument_value
873
	or	[default_argument_value],-1
-
 
874
	call	skip_macro_argument_value
873
        inc     esi
875
	inc	esi
874
        jmp     macro_argument_end
876
	jmp	macro_argument_end
875
      skip_macro_argument_value:
877
      skip_macro_argument_value:
876
        cmp     byte [esi],'<'
878
	cmp	byte [esi],'<'
877
        jne     simple_argument
879
	jne	simple_argument
Line 906... Line 908...
906
        or      al,al
908
	or	al,al
907
        jz      argument_value_end
909
	jz	argument_value_end
908
        cmp     al,','
910
	cmp	al,','
909
        je      argument_value_end
911
	je	argument_value_end
910
        or      ebp,ebp
912
	cmp	[default_argument_value],0
-
 
913
	je	invalid_macro_arguments
-
 
914
	cmp	al,'{'
-
 
915
	je	argument_value_end
-
 
916
	or	ebp,ebp
911
        jz      invalid_macro_arguments
917
	jz	invalid_macro_arguments
912
        cmp     al,']'
918
	cmp	al,']'
913
        je      argument_value_end
919
	je	argument_value_end
914
        jmp     invalid_macro_arguments
920
	jmp	invalid_macro_arguments
915
      simple_argument:
921
      simple_argument:
Line 921... Line 927...
921
        cmp     al,22h
927
	cmp	al,22h
922
        je      argument_string
928
	je	argument_string
923
        cmp     al,1Ah
929
	cmp	al,1Ah
924
        je      argument_symbol
930
	je	argument_symbol
925
        or      ebp,ebp
931
	cmp	[default_argument_value],0
-
 
932
	je	simple_argument
-
 
933
	cmp	al,'{'
-
 
934
	je	argument_value_end
-
 
935
	or	ebp,ebp
926
        jz      simple_argument
936
	jz	simple_argument
927
        cmp     al,']'
937
	cmp	al,']'
928
        je      argument_value_end
938
	je	argument_value_end
929
      argument_symbol:
939
      argument_symbol:
930
        movzx   eax,byte [esi]
940
	movzx	eax,byte [esi]
Line 1498... Line 1508...
1498
        call    add_macro_symbol
1508
	call	add_macro_symbol
1499
        add     esi,ecx
1509
	add	esi,ecx
1500
        xchg    esi,ebx
1510
	xchg	esi,ebx
1501
        mov     [edx+12],esi
1511
	mov	[edx+12],esi
1502
        push    ebp
1512
	mov	[default_argument_value],0
1503
        xor     ebp,ebp
-
 
1504
        call    skip_macro_argument_value
1513
	call	skip_macro_argument_value
1505
        pop     ebp
1514
	call	finish_macro_argument
1506
        call    finish_macro_argument
-
 
1507
        xchg    esi,ebx
1515
	xchg	esi,ebx
1508
        cmp     byte [esi],'='
1516
	cmp	byte [esi],'='
1509
        je      argument_with_default_value
1517
	je	argument_with_default_value
1510
        cmp     byte [esi],'*'
1518
	cmp	byte [esi],'*'
1511
        jne     macro_argument_ok
1519
	jne	macro_argument_ok
Line 1521... Line 1529...
1521
        cmp     byte [eax],'<'
1529
	cmp	byte [eax],'<'
1522
        jne     argument_value_length_ok
1530
	jne	argument_value_length_ok
1523
        inc     dword [edx+12]
1531
	inc	dword [edx+12]
1524
        sub     ecx,2
1532
	sub	ecx,2
1525
      argument_value_length_ok:
1533
	or	ecx,80000000h
-
 
1534
      argument_value_length_ok:
1526
        mov     [edx+8],ecx
1535
	mov	[edx+8],ecx
1527
        ret
1536
	ret
1528
      argument_with_default_value:
1537
      argument_with_default_value:
1529
        inc     esi
1538
	inc	esi
1530
        push    esi
1539
	push	esi
1531
        call    skip_macro_argument_value
1540
	or	[default_argument_value],-1
-
 
1541
	call	skip_macro_argument_value
1532
        pop     eax
1542
	pop	eax
1533
        cmp     dword [edx+8],0
1543
	cmp	dword [edx+8],0
1534
        jne     macro_argument_ok
1544
	jne	macro_argument_ok
1535
        mov     [edx+12],eax
1545
	mov	[edx+12],eax
1536
        call    finish_macro_argument
1546
	call	finish_macro_argument
Line 1635... Line 1645...
1635
        mov     al,')'
1645
	mov	al,')'
1636
        stosb
1646
	stosb
1637
        push    esi
1647
	push	esi
1638
        mov     esi,[esp+4]
1648
	mov	esi,[esp+4]
1639
        mov     [value_size],8
1649
	mov	[error_line],0
-
 
1650
	mov	[value_size],0
1640
        call    calculate_expression
1651
	call	calculate_expression
1641
        mov     eax,[edi]
1652
	cmp	[error_line],0
-
 
1653
	je	value_precalculated
-
 
1654
	jmp	[error]
-
 
1655
      value_precalculated:
-
 
1656
	mov	eax,[edi]
1642
        mov     ecx,[edi+4]
1657
	mov	ecx,[edi+4]
1643
        pop     esi edi
1658
	cdq
1644
        cdq
-
 
1645
        cmp     edx,ecx
1659
	cmp	edx,ecx
1646
        jne     value_out_of_range
1660
	jne	value_out_of_range
1647
        ret
1661
	cmp	dl,[edi+13]
-
 
1662
	jne	value_out_of_range
-
 
1663
	pop	esi edi
-
 
1664
	ret
1648
do_irp:
1665
do_irp:
1649
        cmp     byte [esi],1Ah
1666
	cmp	byte [esi],1Ah
1650
        jne     invalid_macro_arguments
1667
	jne	invalid_macro_arguments
1651
        movzx   eax,byte [esi+1]
1668
	movzx	eax,byte [esi+1]
1652
        lea     esi,[esi+2+eax]
1669
	lea	esi,[esi+2+eax]
Line 1663... Line 1680...
1663
        jne     invalid_macro_arguments
1680
	jne	invalid_macro_arguments
1664
        jmp     irp_parameters_start
1681
	jmp	irp_parameters_start
1665
      irp_with_default_value:
1682
      irp_with_default_value:
1666
        xor     ebp,ebp
1683
	xor	ebp,ebp
1667
        call    skip_macro_argument_value
1684
	or	[default_argument_value],-1
-
 
1685
	call	skip_macro_argument_value
1668
        inc     esi
1686
	inc	esi
1669
      irps_name_ok:
1687
      irps_name_ok:
1670
        cmp     al,','
1688
	cmp	al,','
1671
        jne     invalid_macro_arguments
1689
	jne	invalid_macro_arguments
1672
        mov     al,[esi]
1690
	mov	al,[esi]
Line 2488... Line 2506...
2488
        dec     edi
2506
	dec	edi
2489
        jmp     cut_current_file_name
2507
	jmp	cut_current_file_name
2490
      current_file_path_ok:
2508
      current_file_path_ok:
2491
        mov     esi,[esp+4]
2509
	mov	esi,[esp+4]
2492
        call    preprocess_path
2510
	call	expand_path
2493
        pop     edx
2511
	pop	edx
2494
        mov     esi,edx
2512
	mov	esi,edx
2495
        call    open
2513
	call	open
2496
        jnc     include_path_ok
2514
	jnc	include_path_ok
2497
        mov     ebp,[include_paths]
2515
	mov	ebp,[include_paths]
2498
      try_include_directories:
2516
      try_include_directories:
Line 2501... Line 2519...
2501
        cmp     byte [esi],0
2519
	cmp	byte [esi],0
2502
        je      try_in_current_directory
2520
	je	try_in_current_directory
2503
        push    ebp
2521
	push	ebp
2504
        push    edi
2522
	push	edi
2505
      copy_include_directory:
2523
	call	get_include_directory
2506
        lods    byte [esi]
2524
	mov	[esp+4],esi
2507
        cmp     al,';'
-
 
2508
        je      include_directory_ok
-
 
2509
        stos    byte [edi]
-
 
2510
        or      al,al
-
 
2511
        jnz     copy_include_directory
-
 
2512
        dec     esi
-
 
2513
        dec     edi
-
 
2514
      include_directory_ok:
-
 
2515
        cmp     byte [edi-1],'/'
-
 
2516
        je      path_separator_ok
-
 
2517
        cmp     byte [edi-1],'\'
-
 
2518
        je      path_separator_ok
-
 
2519
        mov     al,'/'
-
 
2520
        stos    byte [edi]
-
 
2521
      path_separator_ok:
-
 
2522
        mov     [esp+4],esi
-
 
2523
        mov     esi,[esp+8]
2525
	mov	esi,[esp+8]
2524
        call    preprocess_path
2526
	call	expand_path
2525
        pop     edx
2527
	pop	edx
2526
        mov     esi,edx
2528
	mov	esi,edx
2527
        call    open
2529
	call	open
2528
        pop     ebp
2530
	pop	ebp
2529
        jnc     include_path_ok
2531
	jnc	include_path_ok
2530
        jmp     try_include_directories
2532
	jmp	try_include_directories
2531
        mov     edi,esi
2533
	mov	edi,esi
2532
      try_in_current_directory:
2534
      try_in_current_directory:
2533
        mov     esi,[esp]
2535
	mov	esi,[esp]
2534
        push    edi
2536
	push	edi
2535
        call    preprocess_path
2537
	call	expand_path
2536
        pop     edx
2538
	pop	edx
2537
        mov     esi,edx
2539
	mov	esi,edx
2538
        call    open
2540
	call	open
2539
        jc      file_not_found
2541
	jc	file_not_found
2540
      include_path_ok:
2542
      include_path_ok:
2541
        mov     edi,[esp]
2543
	mov	edi,[esp]
Line 2551... Line 2553...
2551
        push    dword [macro_status]
2553
	push	dword [macro_status]
2552
        and     [macro_status],0Fh
2554
	and	[macro_status],0Fh
2553
        call    preprocess_file
2555
	call	preprocess_file
2554
        pop     eax
2556
	pop	eax
2555
        mov     [macro_status],al
2557
	and	al,0F0h
-
 
2558
	and	[macro_status],0Fh
-
 
2559
	or	[macro_status],al
2556
        jmp     line_preprocessed
2560
	jmp	line_preprocessed
2557
      preprocess_path:
2561
>
2558
        lods    byte [esi]
-
 
2559
        cmp     al,'%'
-
 
2560
        je      environment_variable
-
 
2561
        stos    byte [edi]
-
 
2562
        or      al,al
-
 
2563
        jnz     preprocess_path
-
 
2564
        cmp     edi,[memory_end]
-
 
2565
        ja      out_of_memory
-
 
2566
        ret
-
 
2567
      environment_variable:
-
 
2568
        mov     ebx,esi
-
 
2569
      find_variable_end:
-
 
2570
        lods    byte [esi]
-
 
2571
        or      al,al
-
 
2572
        jz      not_environment_variable
-
 
2573
        cmp     al,'%'
-
 
2574
        jne     find_variable_end
-
 
2575
        mov     byte [esi-1],0
-
 
2576
        push    esi
-
 
2577
        mov     esi,ebx
-
 
2578
        call    get_environment_variable
-
 
2579
        pop     esi
-
 
2580
        mov     byte [esi-1],'%'
-
 
2581
        jmp     preprocess_path
-
 
2582
      not_environment_variable:
-
 
2583
        mov     al,'%'
-
 
2584
        stos    byte [edi]
-
 
2585
        mov     esi,ebx
-
 
2586
        jmp     preprocess_path
-
 
2587
>
-