* ACC.INC
* GM 2003
* <guido.milanese@mclink.it>
* Accents etc. according to different languages
* The returned string must be parsed by the calling program
* Up to '-' : lowercase accents
* After '-' : uppercase accents
* Options:	
*		es = Spanish
*		de = German
*		fr = French
*		it = Italian
*		XX = all accents of table 8859-XX (e.g. 8859-15)
*		en = no accents (English)

	DEFINE("acc(option)")
	digits = '1234567890'
* German	
	acc_de1 =  "������" ; acc_de2 = "������" ; acc_de = acc_de1 '-' acc_de2
* Spanish	
	acc_es1 =  "������" ; acc_es2 = "������" ; acc_es = acc_es1 '-' acc_es2
* French	
	acc_fr1 = "���������������������" 
	acc_fr2 = "���������������������" 
	acc_fr  = acc_fr1 '-' acc_fr2
* Italian	
	acc_it1 = "���������������" 
	acc_it2 = "���������������"
	acc_it  = acc_it1 '-' acc_it2
* All
	acc_001 = acc_de1 acc_es1 acc_fr1 acc_it1
	acc_002 = acc_de2 acc_es2 acc_fr2 acc_it2
	acc_00  = acc_001 '-' acc_002

* Complete table (e.g. 8859-15): builds string of chars
	k = 127
	chars8859 = ''	
ACC_DO	(
+	  (lt(k,255))
+	  (k = k + 1)
+	  (chars8859 = chars8859 char(k))
+	)	:s(ACC_DO)
	
								:(ACC_END)
				
ACC
* Trims spaces at begin and end of option
ACC_N	option ? ' ' = 						:s(ACC_N)
* If no option given, sets to all accents (option '00')
**	( ~(option ? any(&lcase digits)) (option = '00') )
* If a number is passed as option, means a complete table (e.g. 8859-1)
**	( (option ? any(digits)) (option = 'TA') )
	(
+		(~(option ? any(&lcase digits)) (option = '00')), 
+		( (option ? any(digits)) (option = 'TA') ),
+		(option = option)
+	)

* Checks option	
	(	
+	~(option  ? ("en" | "es" | "de" | "fr" | "it" | "TA" | "00"))
+	(terminal = 'Please supply a valid language identifier')
+	)			:s(freturn)
       				:($('ACC_' option))

ACC_ES  acc = acc_es						  :(return)
ACC_DE	acc = acc_de               				  :(return)
ACC_FR	acc = acc_fr                                              :(return)
ACC_IT	acc = acc_it                                 		  :(return)
ACC_EN	acc = '' '-' ''						  :(return)
ACC_TA	acc = chars8859 '-' ' '					  :(return)
ACC_00	acc = acc_00                                              :(return)
ACC_  	terminal = "Please supply a valid language identifier"	  :(freturn)
ACC_END