[31m-- aish is another attempt of A. i. written with Ada.[m
[31m-- Aish is Copyright (C) 2024 Manuel De Girardi ; [m
[31m--[m
[31m--   This program is free software; you can redistribute it and/or modify[m
[31m--   it under the terms of the GNU General Public License as published by[m
[31m--   the Free Software Foundation; either version 2 of the License, or[m
[31m--   (at your option) any later version.[m
[31m--[m
[31m--   This program is distributed in the hope that it will be useful,[m
[31m--   but WITHOUT ANY WARRANTY; without even the implied warranty of[m
[31m--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the[m
[31m--   GNU General Public License for more details.[m
[31m--[m
[31m--   You should have received a copy of the GNU General Public License[m
[31m--   along with this program; if not, write to the Free Software[m
[31m--   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA[m
[31m--[m
[31m-- Date := "2024-04-29 20:25:34"[m
[31m-- Version := "1.1.0r"[m
[01;34mwith[m Ada[31m.[mWide_Text_Io[31m;[m
[01;34mwith[m Ada[31m.[mText_Io[31m;[m
[01;34mwith[m Gnat[31m.[mCommand_Line[31m;[m
[01;34muse[m Gnat[31m;[m
[01;34muse[m Ada[31m;[m
[01;34mwith[m Ada[31m.[mCharacters[31m.[mHandling[31m;[m
[01;34muse[m Ada[31m.[mCharacters[31m.[mHandling[31m;[m
[01;34mwith[m Ada[31m.[mStrings[31m.[mUTF_Encoding[31m.[mStrings[31m;[m
[01;34muse[m Ada[31m.[mStrings[31m.[mUTF_Encoding[31m.[mStrings[31m;[m
[01;34mwith[m Ai[31m.[mErrors[31m;[m
[01;34muse[m Ai[31m.[mErrors[31m;[m
[01;34mpackage[m [01;34mbody[m Ai[31m.[mOptions [01;34mis[m
   [01;34mfunction[m Get_Options_From_Command_Line
     [31m-- To get Options_Kit_array_Type from argument in command_line ;[m
     
     [01;34mreturn[m Options_Kit [01;34mis[m
      
      Kit [31m:[m [01;34mconstant[m Options_Kit [31m:=[m Full_Line_Options_Kit[31m;[m
      
   [01;34mbegin[m
      [31m-- D'abord je traite les arguments de la ligne de commande ;                 --[m
  Opt [31m:[m
      [01;34mloop[m	 
	 [01;34mbegin[m
	    [01;34mloop[m
	       [01;34mbegin[m
		  [31m--case Command_Line.Getopt ("o x q h v w W F: f: R: r: l: m: M: c: C: i: n N U: s: S: e: H: P p d: t:") is[m
		  
		  [01;34mcase[m Command_Line[31m.[m[01;30mGetopt[m [31m([m[31m"h v F: N: i: a: r: t"[m[31m)[m [01;34mis[m
		     [01;34mwhen[m ASCII[31m.[mNUL [31m=>[m [01;34mexit[m Opt[31m;[m
			
		     [01;34mwhen[m [31m'F'[m [31m=>[m
			[01;34mif[m Command_Line[31m.[mFull_Switch [31m/=[m [31m"F"[m [01;34mthen[m
			   [01;34mraise[m Command_Line[31m.[mInvalid_Switch[31m;[m
			[01;34mend[m [01;34mif[m[31m;[m
			[01;30mKit[m[31m([mConfig_Filename[31m).[mIs_Setted [31m:=[m True[31m;[m
			[01;30mKit[m[31m([mConfig_Filename[31m).[mValue [31m:=[m
			  [01;34mnew[m [32mWide_String[m ' [31m([m[01;30mTo_Wide_String[m[31m([m[01;30mDecode[m[31m([mCommand_Line[31m.[mParameter[31m)));[m
			
		     [01;34mwhen[m [31m'h'[m [31m=>[m
			[01;34mif[m Command_Line[31m.[mFull_Switch [31m/=[m [31m"h"[m [01;34mthen[m		     
			   [01;34mraise[m Command_Line[31m.[mInvalid_Switch[31m;[m
			[01;34mend[m [01;34mif[m[31m;[m
			[01;30mKit[m[31m([mHelp[31m).[mIs_Setted [31m:=[m True[31m;[m		  
		     [01;34mwhen[m [31m'v'[m [31m=>[m
			[01;34mif[m Command_Line[31m.[mFull_Switch [31m/=[m [31m"v"[m [01;34mthen[m
			   [01;34mraise[m Command_Line[31m.[mInvalid_Switch[31m;[m
			[01;34mend[m [01;34mif[m[31m;[m
			[01;30mKit[m[31m([mVersion[31m).[mIs_Setted [31m:=[m True[31m;[m		  
		     [01;34mwhen[m [31m'N'[m [31m=>[m
			[01;34mif[m Command_Line[31m.[mFull_Switch [31m/=[m [31m"N"[m [01;34mthen[m
		     	   [01;34mraise[m Command_Line[31m.[mInvalid_Switch[31m;[m
		     	[01;34mend[m [01;34mif[m[31m;[m
		     	[01;30mKit[m[31m([mTerm_name[31m).[mIs_Setted [31m:=[m True[31m;[m			
		     	[01;30mKit[m[31m([mTerm_name[31m).[mValue [31m:=[m
		     	  [01;34mnew[m [32mWide_String[m ' [31m([m[01;30mTo_Wide_String[m[31m([m[01;30mDecode[m[31m([mCommand_Line[31m.[mParameter[31m)));[m
			
		     [01;34mwhen[m [31m'i'[m [31m=>[m
			[01;34mif[m Command_Line[31m.[mFull_Switch [31m/=[m [31m"i"[m [01;34mthen[m
			   [01;34mraise[m Command_Line[31m.[mInvalid_Switch[31m;[m
			[01;34mend[m [01;34mif[m[31m;[m
			[01;30mKit[m[31m([minitialize[31m).[mIs_Setted [31m:=[m True[31m;[m
			[01;30mKit[m[31m([minitialize[31m).[mValue [31m:=[m
			  [01;34mnew[m [32mWide_String[m ' [31m([m[01;30mTo_Wide_String[m[31m([m[01;30mDecode[m[31m([mCommand_Line[31m.[mParameter[31m)));[m			
		     [01;34mwhen[m [31m'a'[m [31m=>[m
			[01;34mif[m Command_Line[31m.[mFull_Switch [31m/=[m [31m"a"[m [01;34mthen[m
			   [01;34mraise[m Command_Line[31m.[mInvalid_Switch[31m;[m
			[01;34mend[m [01;34mif[m[31m;[m
			[01;30mKit[m[31m([mAdd[31m).[mIs_Setted [31m:=[m True[31m;[m
			[01;30mKit[m[31m([mAdd[31m).[mValue [31m:=[m
			  [01;34mnew[m [32mWide_String[m ' [31m([m[01;30mTo_Wide_String[m[31m([m[01;30mDecode[m[31m([mCommand_Line[31m.[mParameter[31m)));[m			
		     [01;34mwhen[m [31m'r'[m [31m=>[m
			[01;34mif[m Command_Line[31m.[mFull_Switch [31m/=[m [31m"r"[m [01;34mthen[m
			   [01;34mraise[m Command_Line[31m.[mInvalid_Switch[31m;[m
			[01;34mend[m [01;34mif[m[31m;[m
			[01;30mKit[m[31m([mRemove[31m).[mIs_Setted [31m:=[m True[31m;[m
			[01;30mKit[m[31m([mRemove[31m).[mValue [31m:=[m
			  [01;34mnew[m [32mWide_String[m ' [31m([m[01;30mTo_Wide_String[m[31m([m[01;30mDecode[m[31m([mCommand_Line[31m.[mParameter[31m)));[m			
		     [01;34mwhen[m [31m't'[m [31m=>[m
			[01;34mif[m Command_Line[31m.[mFull_Switch [31m/=[m [31m"t"[m [01;34mthen[m		     
			   [01;34mraise[m Command_Line[31m.[mInvalid_Switch[31m;[m
			[01;34mend[m [01;34mif[m[31m;[m
			[01;30mKit[m[31m([mTotal[31m).[mIs_Setted [31m:=[m True[31m;[m		  
		     [01;34mwhen[m [01;34mothers[m [31m=>[m
			[01;34mraise[m Program_Error[31m;[m         [31m-- cannot occur![m
		  [01;34mend[m [01;34mcase[m[31m;[m
		  
		  
	       [01;34mexception[m
		  [01;34mwhen[m Command_Line[31m.[mInvalid_Switch    [31m=>[m Text_Io[31m.[m[01;30mPut_Line[m [31m([m[31m"Invalid Switch "[m [31m&[m Command_Line[31m.[mFull_Switch[31m);[m
		     
		     [01;34mraise[m[31m;[m
		     
		  [01;34mwhen[m Command_Line[31m.[mInvalid_Parameter [31m=>[m
		     
		     [01;34mraise[m Spec_Error[31m;[m
		     		  
	       [01;34mend[m[31m;[m
		  
	    [01;34mend[m [01;34mloop[m[31m;[m      
	 [01;34mexception[m
	    [01;34mwhen[m Spec_Error [31m=>[m
	       Text_Io[31m.[m[01;30mPut_Line[m [31m([m[31m"No parameter for "[m [31m&[m Command_Line[31m.[mFull_Switch[31m);[m
	       [01;34mraise[m[31m;[m
	       
	 [01;34mend[m[31m;[m
      [01;34mend[m [01;34mloop[m opt[31m;[m
      
      [01;34mreturn[m Kit[31m;[m
      

      
      
   [01;34mend[m Get_Options_From_Command_Line[31m;[m
   [31m-- return Options_Kit;[m
   
   
   [01;34mfunction[m Get_Options_From_File
     [31m([mFilename [31m:[m [01;34min[m [32mWide_String[m[31m)[m
     [31m-- To get Options_Kit_array_Type from argument in file ;[m
     
     [01;34mreturn[m Options_Kit [01;34mis[m
      Kit [31m:[m [01;34mconstant[m Options_Kit [31m:=[m Full_File_Options_Kit[31m;[m
      File [31m:[m Wide_Text_Io[31m.[mFile_Type[31m;[m
   [01;34mbegin[m     
      
      Wide_Text_Io[31m.[m[01;30mOpen[m[31m([mFile[31m,[m Wide_Text_Io[31m.[mIn_File[31m,[m [01;30mTo_String[m[31m([mFilename[31m));[m
      [01;34mwhile[m [01;34mnot[m Wide_Text_Io[31m.[m[01;30mEnd_Of_File[m[31m([mFile[31m)[m [01;34mloop[m

	 [01;34mdeclare[m
	    Line   [31m:[m [01;34mconstant[m [32mWide_String[m [31m:=[m Wide_Text_Io[31m.[m[01;30mGet_Line[m[31m([mFile[31m);[m
	    Switch [31m:[m [01;34mconstant[m [32mCharacter[m [31m:=[m [01;30mTo_Character[m[31m([m[01;30mLine[m[31m([mLine'First[31m));[m
	    Parameter [31m:[m [01;34maccess[m [32mString[m[31m;[m
	 [01;34mbegin[m
	    
	    [01;34mif[m Line'Length [31m>[m [35m1[m [01;34mthen[m
	       Parameter [31m:=[m [01;34mnew[m [32mString[m [31m' (To_String(Line(Line'[mFirst[31m+[m[35m1[m[31m..[mLine'last[31m)));[m
	    [01;34mend[m [01;34mif[m[31m;[m
	    
	    [01;34mcase[m Switch [01;34mis[m
	    
	       [01;34mwhen[m [31m'F'[m [31m=>[m
		  
		  [01;30mKit[m[31m([mConfig_Filename[31m).[mIs_Setted [31m:=[m True[31m;[m
		  [01;30mKit[m[31m([mConfig_Filename[31m).[mValue [31m:=[m
		    [01;34mnew[m [32mWide_String[m ' [31m([m[01;30mTo_Wide_String[m[31m([m[01;30mDecode[m[31m([mParameter[31m.[m[01;34mall[m[31m)));[m
		  
	       [01;34mwhen[m [31m'h'[m [31m=>[m
		  
		  [01;30mKit[m[31m([mHelp[31m).[mIs_Setted [31m:=[m True[31m;[m
		  
	       [01;34mwhen[m [31m'v'[m [31m=>[m
		  
		  [01;30mKit[m[31m([mVersion[31m).[mIs_Setted [31m:=[m True[31m;[m
		  
	       [01;34mwhen[m [31m'N'[m [31m=>[m		  
		     
		     [01;30mKit[m[31m([mTerm_name[31m).[mIs_Setted [31m:=[m True[31m;[m
		     [01;30mKit[m[31m([mTerm_name[31m).[mValue [31m:=[m
		       [01;34mnew[m [32mWide_String[m ' [31m([m[01;30mTo_Wide_String[m[31m([m[01;30mDecode[m[31m([mParameter[31m.[m[01;34mall[m[31m)));[m
		     
	       [01;34mwhen[m [31m'i'[m [31m=>[m
		     
		     [01;30mKit[m[31m([mInitialize[31m).[mIs_Setted [31m:=[m True[31m;[m
		     [01;30mKit[m[31m([mInitialize[31m).[mValue [31m:=[m
		       [01;34mnew[m [32mWide_String[m ' [31m([m[01;30mTo_Wide_String[m[31m([m[01;30mDecode[m[31m([mParameter[31m.[m[01;34mall[m[31m)));[m
	       [01;34mwhen[m [31m'a'[m [31m=>[m
		     
		     [01;30mKit[m[31m([mAdd[31m).[mIs_Setted [31m:=[m True[31m;[m
		     [01;30mKit[m[31m([mAdd[31m).[mValue [31m:=[m
		       [01;34mnew[m [32mWide_String[m ' [31m([m[01;30mTo_Wide_String[m[31m([m[01;30mDecode[m[31m([mParameter[31m.[m[01;34mall[m[31m)));[m
	       [01;34mwhen[m [31m'r'[m [31m=>[m
		     
		     [01;30mKit[m[31m([mRemove[31m).[mIs_Setted [31m:=[m True[31m;[m
		     [01;30mKit[m[31m([mRemove[31m).[mValue [31m:=[m
		       [01;34mnew[m [32mWide_String[m ' [31m([m[01;30mTo_Wide_String[m[31m([m[01;30mDecode[m[31m([mParameter[31m.[m[01;34mall[m[31m)));[m
	       [01;34mwhen[m [31m't'[m [31m=>[m
		  [01;30mKit[m[31m([mTotal[31m).[mIs_Setted [31m:=[m True[31m;[m

	       [01;34mwhen[m [01;34mothers[m [31m=>[m
		  [01;34mnull[m[31m;[m
	    [01;34mend[m [01;34mcase[m[31m;[m

	    
	 [01;34mend[m[31m;[m
      [01;34mend[m [01;34mloop[m[31m;[m

      
      
      Wide_Text_Io[31m.[m[01;30mClose[m[31m([mFile[31m);[m
     [01;34mreturn[m Kit[31m;[m
   [01;34mend[m Get_Options_From_File[31m;[m
   [31m-- return Options_Kit;  [m

[01;34mend[m Ai[31m.[mOptions [31m;[m 
