Rev 3131 | Rev 3859 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3131 | Rev 3832 | ||
---|---|---|---|
Line 539... | Line 539... | ||
539 | ;;------------------------------------------------------------------------------------------------;; |
539 | ;;------------------------------------------------------------------------------------------------;; |
540 | ;< eax = -1 (error) / 0 ;; |
540 | ;< eax = -1 (error) / 0 ;; |
541 | ;;================================================================================================;; |
541 | ;;================================================================================================;; |
542 | locals |
542 | locals |
543 | buf rb 16 |
543 | buf rb 16 |
- | 544 | bNeg rd 1 |
|
544 | endl |
545 | endl |
Line 545... | Line 546... | ||
545 | 546 | ||
Line 546... | Line 547... | ||
546 | push ecx edx edi |
547 | push ecx edx edi |
547 | 548 | ||
- | 549 | lea edi, [buf] |
|
548 | lea edi, [buf] |
550 | add edi, 15 |
- | 551 | ||
549 | add edi, 15 |
552 | mov eax, [_val] |
550 | mov eax, [_val] |
553 | mov [bNeg],0 |
551 | or eax, eax |
554 | or eax, eax |
552 | jns @f |
555 | jns @f |
553 | mov byte[edi], '-' |
- | |
- | 556 | mov [bNeg],1 |
|
554 | neg eax |
557 | neg eax |
555 | inc edi |
558 | |
556 | @@: mov ecx, 10 |
559 | @@: mov ecx, 10 |
557 | @@: xor edx, edx |
560 | @@: xor edx, edx |
558 | idiv ecx |
561 | idiv ecx |
559 | add dl, '0' |
562 | add dl, '0' |
560 | mov [edi], dl |
563 | mov [edi], dl |
561 | dec edi |
564 | dec edi |
- | 565 | or eax, eax |
|
- | 566 | jnz @b |
|
- | 567 | ||
- | 568 | cmp [bNeg],0 |
|
- | 569 | je @f |
|
- | 570 | mov byte[edi], '-' |
|
562 | or eax, eax |
571 | dec edi |
563 | jnz @b |
572 | @@: |
564 | lea eax, [buf] |
573 | lea eax, [buf] |
565 | add eax, 15 |
574 | add eax, 15 |
Line -... | Line 575... | ||
- | 575 | sub eax, edi |
|
- | 576 | inc edi |
|
566 | sub eax, edi |
577 | |
Line 567... | Line 578... | ||
567 | inc edi |
578 | |
568 | 579 | ||
569 | stdcall ini.set_str, [_f_name], [_sec_name], [_key_name], edi, eax |
580 | stdcall ini.set_str, [_f_name], [_sec_name], [_key_name], edi, eax |
Line 662... | Line 673... | ||
662 | 673 | ||
663 | pop edi edx ecx |
674 | pop edi edx ecx |
664 | ret |
675 | ret |
Line -... | Line 676... | ||
- | 676 | endp |
|
- | 677 | ||
- | 678 | ||
- | 679 | ;;================================================================================================;; |
|
- | 680 | proc ini.del_section _f_name, _sec_name ;/////////////////////////////////////////////////////////;; |
|
- | 681 | ;;------------------------------------------------------------------------------------------------;; |
|
- | 682 | ;? Delete section and all key in this section ;; |
|
- | 683 | ;;------------------------------------------------------------------------------------------------;; |
|
- | 684 | ;> _f_name = ini filename |
|
- | 685 | ;> _sec_name = section name |
|
- | 686 | ;;------------------------------------------------------------------------------------------------;; |
|
- | 687 | ;< eax = 0 - success ;; |
|
- | 688 | ;< -1 - file not found ;; |
|
- | 689 | ;< 1 - section not found ;; |
|
- | 690 | ;;================================================================================================;; |
|
- | 691 | locals |
|
- | 692 | funcFile rb 25 |
|
- | 693 | fileInfo rb 40 |
|
- | 694 | begMem rd 1 |
|
- | 695 | endMem rd 1 |
|
- | 696 | begDel rd 1 |
|
- | 697 | endDel rd 1 |
|
- | 698 | endl |
|
- | 699 | push ebx ecx edi esi |
|
- | 700 | mov dword[funcFile],5 ;get file info |
|
- | 701 | mov dword[funcFile+4],0 |
|
- | 702 | mov dword[funcFile+8],0 |
|
- | 703 | mov dword[funcFile+12],0 |
|
- | 704 | lea eax,[fileInfo] |
|
- | 705 | mov dword[funcFile+16],eax |
|
- | 706 | mov byte[funcFile+20],0 |
|
- | 707 | m2m dword[funcFile+21],[_f_name] |
|
- | 708 | lea ebx,[funcFile] |
|
- | 709 | mcall 70 |
|
- | 710 | test eax,eax |
|
- | 711 | jz @f |
|
- | 712 | ||
- | 713 | or eax,-1 |
|
- | 714 | pop esi edi ecx ebx |
|
- | 715 | ret |
|
- | 716 | @@: |
|
- | 717 | ||
- | 718 | mov ecx,dword[fileInfo+32] ;allocation mem for all file |
|
- | 719 | mcall 68,12 |
|
- | 720 | ||
- | 721 | mov [begMem],eax |
|
- | 722 | mov [endMem],eax |
|
- | 723 | add [endMem],ecx |
|
- | 724 | ||
- | 725 | mov dword[funcFile],0 ;read file to buffer |
|
- | 726 | mov dword[funcFile+12],ecx |
|
- | 727 | mov dword[funcFile+16],eax |
|
- | 728 | lea ebx,[funcFile] |
|
- | 729 | mcall 70 |
|
- | 730 | ||
- | 731 | mov edi,[begMem] ;search begin section |
|
- | 732 | .searchSect: |
|
- | 733 | mov al,'[' |
|
- | 734 | repne scasb |
|
- | 735 | test ecx,ecx |
|
- | 736 | jnz @f |
|
- | 737 | ||
- | 738 | pop esi edi ecx ebx |
|
- | 739 | mov eax,1 |
|
- | 740 | ret |
|
- | 741 | @@: |
|
- | 742 | mov [begDel],edi |
|
- | 743 | mov esi,[_sec_name] |
|
- | 744 | @@: |
|
- | 745 | lodsb |
|
- | 746 | test al,al |
|
- | 747 | jz @f |
|
- | 748 | scasb |
|
- | 749 | jne .searchSect |
|
- | 750 | jmp @b |
|
- | 751 | @@: |
|
- | 752 | cmp byte[edi],']' |
|
- | 753 | jne .searchSect |
|
- | 754 | ||
- | 755 | dec [begDel] |
|
- | 756 | ||
- | 757 | mov edi,[begDel] ;search end section |
|
- | 758 | inc edi |
|
- | 759 | .searchEndSect: |
|
- | 760 | mov al,'[' |
|
- | 761 | repne scasb |
|
- | 762 | ||
- | 763 | dec edi |
|
- | 764 | mov [endDel],edi |
|
- | 765 | ||
- | 766 | test ecx,ecx |
|
- | 767 | jnz @f |
|
- | 768 | jmp .SaveToFile |
|
- | 769 | @@: |
|
- | 770 | ||
- | 771 | ||
- | 772 | mov esi,[endDel] |
|
- | 773 | mov edi,[begDel] |
|
- | 774 | @@: lodsb |
|
- | 775 | stosb |
|
- | 776 | cmp esi,[endMem] |
|
- | 777 | jb @b |
|
- | 778 | ||
- | 779 | .SaveToFile: |
|
- | 780 | mov eax,dword[funcFile+12] |
|
- | 781 | sub eax,[endDel] |
|
- | 782 | add eax,[begDel] |
|
- | 783 | ||
- | 784 | mov dword[funcFile],2 ;write buffer to file |
|
- | 785 | mov dword[funcFile+12],eax |
|
- | 786 | m2m dword[funcFile+16],[begMem] |
|
- | 787 | lea ebx,[funcFile] |
|
- | 788 | mcall 70 |
|
- | 789 | ||
- | 790 | xor eax,eax |
|
- | 791 | pop esi edi ecx ebx |
|
- | 792 | ret |
|
- | 793 | endp |
|
- | 794 | ||
- | 795 | ||
665 | endp |
796 | |
666 | 797 | ||
667 | ;;================================================================================================;; |
798 | ;;================================================================================================;; |
668 | proc ini.get_shortcut _f_name, _sec_name, _key_name, _def_val, _modifiers ;///////////////////////;; |
799 | proc ini.get_shortcut _f_name, _sec_name, _key_name, _def_val, _modifiers ;///////////////////////;; |
669 | ;;------------------------------------------------------------------------------------------------;; |
800 | ;;------------------------------------------------------------------------------------------------;; |
Line 841... | Line 972... | ||
841 | } |
972 | } |
842 | macro shortcut_name [name] |
973 | macro shortcut_name [name] |
843 | { |
974 | { |
844 | shortcut_name_with_handler name, .name_handler |
975 | shortcut_name_with_handler name, .name_handler |
845 | } |
976 | } |
- | 977 | ||
846 | ; all names here must be in english |
978 | ; all names here must be in english |
847 | ; ... or modify lowercasing in macro and in comparison |
979 | ; ... or modify lowercasing in macro and in comparison |
848 | .names_table: |
980 | .names_table: |
849 | ; generic modifiers |
981 | ; generic modifiers |
850 | shortcut_name_with_handler 'Ctrl', .ctrl_handler |
982 | shortcut_name_with_handler 'Ctrl', .ctrl_handler |
Line 918... | Line 1050... | ||
918 | ini.get_int , 'ini_get_int' , \ |
1050 | ini.get_int , 'ini_get_int' , \ |
919 | ini.get_color , 'ini_get_color' , \ |
1051 | ini.get_color , 'ini_get_color' , \ |
920 | ini.set_str , 'ini_set_str' , \ |
1052 | ini.set_str , 'ini_set_str' , \ |
921 | ini.set_int , 'ini_set_int' , \ |
1053 | ini.set_int , 'ini_set_int' , \ |
922 | ini.set_color , 'ini_set_color' , \ |
1054 | ini.set_color , 'ini_set_color' , \ |
923 | ini.get_shortcut , 'ini_get_shortcut'>>>>>>>>>>> |
1055 | ini.get_shortcut , 'ini_get_shortcut' , \ |
- | 1056 | ini.del_section , 'ini_del_section'>>>>>>>>>>>>>> |
|
- | 1057 | ||
924 | 1058 |