Logo Search packages:      
Sourcecode: acon version File versions  Download package

arabicfont.c

/*
 * acon a utility to facilitate the right to left writing
 * Copyright 1999 Ahmed Abdel-Hamid Mohamed <ahmedam@mail.usa.com>
 *
 * This program is free software; you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License along with
 * this program; if not, write to the Free Software Foundation, Inc., 675 Mass
 * Ave, Cambridge, MA 02139, USA.
 *
 */

#include <stdio.h>
#include <sys/ioctl.h>
#include <linux/vt.h>
#include <linux/kd.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <sys/stat.h>
#include "acon.h"
#include "child.h"
#include "render.h"
#include "acon.h"


/* 8x32 font*/
unsigned char fonttable[]={
/*0  */     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*1  */     0,0,126,129,165,129,129,189,153,129,129,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*2  */     0,0,126,255,219,255,255,195,231,255,255,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*3  */     0,0,0,0,108,254,254,254,254,124,56,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*4  */     0,0,0,0,16,56,124,254,124,56,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*5  */     0,0,0,24,60,60,231,231,231,24,24,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*6  */     0,0,0,24,60,126,255,255,126,24,24,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*7  */     0,0,0,0,0,0,24,60,60,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*8  */     255,255,255,255,255,255,231,195,195,231,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*9  */     0,0,0,0,0,60,102,66,66,102,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*10 */     255,255,255,255,255,195,153,189,189,153,195,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*11 */     0,0,30,14,26,50,120,204,204,204,204,120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*12 */     0,0,60,102,102,102,102,60,24,126,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*13 */     0,0,63,51,63,48,48,48,48,112,240,224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*14 */     0,0,127,99,127,99,99,99,99,103,231,230,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*15 */     0,0,0,24,24,219,60,231,60,219,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*16 */     0,0,64,96,112,124,127,124,112,96,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*17 */     0,0,1,3,7,31,127,31,7,3,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*18 */     0,0,24,60,126,24,24,24,126,60,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*19 */     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*20 */     0,0,63,107,107,107,59,11,11,11,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*21 */     0,62,99,48,28,54,99,99,54,28,6,99,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*22 */     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*23 */     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*24 */     0,0,24,60,126,24,24,24,24,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*25 */     0,0,24,24,24,24,24,24,126,60,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*26 */     0,0,0,0,12,6,127,6,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*27 */     0,0,0,0,24,48,127,48,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*28 */     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*29 */     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*30 */     0,0,0,8,28,28,62,62,127,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*31 */     0,0,0,127,127,62,62,28,28,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*32 */     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*33 */     0,0,24,60,60,60,24,24,0,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*34 */     0,102,102,102,36,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*35 */     0,0,108,108,254,108,108,108,254,108,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*36 */     24,24,124,198,194,192,124,6,134,198,124,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*37 */     0,0,0,0,194,198,12,24,48,102,198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*38 */     0,0,56,108,108,56,118,220,204,204,118,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*39 */     0,48,48,48,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*40 */     0,0,12,24,48,48,48,48,48,24,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*41 */     0,0,48,24,12,12,12,12,12,24,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*42 */     0,0,0,0,102,60,255,60,102,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*43 */     0,0,0,0,24,24,126,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*44 */     0,0,0,0,0,0,0,0,24,24,24,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*45 */     0,0,0,0,0,0,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*46 */     0,0,0,0,0,0,0,0,0,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*47 */     0,0,2,6,12,24,48,96,192,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*48 */     0,0,124,198,206,222,246,230,198,198,124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*49 */     0,0,24,56,120,24,24,24,24,24,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*50 */     0,0,124,198,6,12,24,48,96,198,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*51 */     0,0,124,198,6,6,60,6,6,198,124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*52 */     0,0,12,28,60,108,204,254,12,12,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*53 */     0,0,254,192,192,192,252,6,6,198,124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*54 */     0,0,56,96,192,192,252,198,198,198,124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*55 */     0,0,254,198,6,12,24,48,48,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*56 */     0,0,124,198,198,198,124,198,198,198,124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*57 */     0,0,124,198,198,198,126,6,6,12,120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*58 */     0,0,0,24,24,0,0,0,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*59 */     0,0,0,24,24,0,0,0,24,24,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*60 */     0,0,6,12,24,48,96,48,24,12,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*61 */     0,0,0,0,0,126,0,0,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*62 */     0,0,96,48,24,12,6,12,24,48,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*63 */     0,0,124,198,198,12,24,24,0,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*64 */     0,0,124,198,198,222,222,222,220,192,124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*65 */     0,0,16,56,108,198,198,254,198,198,198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*66 */     0,0,252,102,102,102,124,102,102,102,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*67 */     0,0,60,102,194,192,192,192,194,102,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*68 */     0,0,248,108,102,102,102,102,102,108,248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*69 */     0,0,254,102,98,104,120,104,98,102,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*70 */     0,0,254,102,98,104,120,104,96,96,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*71 */     0,0,60,102,194,192,192,222,198,102,58,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*72 */     0,0,198,198,198,198,254,198,198,198,198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*73 */     0,0,60,24,24,24,24,24,24,24,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*74 */     0,0,30,12,12,12,12,12,204,204,120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*75 */     0,0,230,102,108,108,120,108,108,102,230,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*76 */     0,0,240,96,96,96,96,96,98,102,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*77 */     0,0,198,238,254,254,214,198,198,198,198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*78 */     0,0,198,230,246,254,222,206,198,198,198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*79 */     0,0,56,108,198,198,198,198,198,108,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*80 */     0,0,252,102,102,102,124,96,96,96,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*81 */     0,0,124,198,198,198,198,214,222,124,12,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*82 */     0,0,252,102,102,102,124,108,102,102,230,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*83 */     0,0,124,198,198,96,56,12,198,198,124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*84 */     0,0,126,126,90,24,24,24,24,24,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*85 */     0,0,198,198,198,198,198,198,198,198,124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*86 */     0,0,198,198,198,198,198,198,108,56,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*87 */     0,0,198,198,198,198,214,214,254,124,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*88 */     0,0,198,198,108,56,56,56,108,198,198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*89 */     0,0,102,102,102,102,60,24,24,24,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*90 */     0,0,254,198,140,24,48,96,194,198,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*91 */     0,0,60,48,48,48,48,48,48,48,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*92 */     0,0,128,192,224,112,56,28,14,6,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*93 */     0,0,60,12,12,12,12,12,12,12,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*94 */     16,56,108,198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*95 */     0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*96 */     48,48,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*97 */     0,0,0,0,0,120,12,124,204,204,118,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*98 */     0,0,224,96,96,120,108,102,102,102,124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*99 */     0,0,0,0,0,124,198,192,192,198,124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*100*/     0,0,28,12,12,60,108,204,204,204,118,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*101*/     0,0,0,0,0,124,198,254,192,198,124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*102*/     0,0,56,108,100,96,240,96,96,96,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*103*/     0,0,0,0,0,118,204,204,204,124,12,204,120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*104*/     0,0,224,96,96,108,118,102,102,102,230,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*105*/     0,0,24,24,0,56,24,24,24,24,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*106*/     0,0,6,6,0,14,6,6,6,6,102,102,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*107*/     0,0,224,96,96,102,108,120,108,102,230,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*108*/     0,0,56,24,24,24,24,24,24,24,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*109*/     0,0,0,0,0,236,254,214,214,214,198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*110*/     0,0,0,0,0,220,102,102,102,102,102,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*111*/     0,0,0,0,0,124,198,198,198,198,124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*112*/     0,0,0,0,0,220,102,102,102,124,96,96,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*113*/     0,0,0,0,0,118,204,204,204,124,12,12,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*114*/     0,0,0,0,0,220,118,102,96,96,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*115*/     0,0,0,0,0,124,198,112,28,198,124,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*116*/     0,0,16,48,48,252,48,48,48,54,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*117*/     0,0,0,0,0,204,204,204,204,204,118,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*118*/     0,0,0,0,0,102,102,102,102,60,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*119*/     0,0,0,0,0,198,198,214,214,254,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*120*/     0,0,0,0,0,198,108,56,56,108,198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*121*/     0,0,0,0,0,198,198,198,198,126,6,12,248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*122*/     0,0,0,0,0,254,204,24,48,102,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*123*/     0,0,14,24,24,24,112,24,24,24,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*124*/     0,0,24,24,24,24,0,24,24,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*125*/     0,0,112,24,24,24,14,24,24,24,112,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*126*/     0,0,118,220,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*127*/     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*128*/     24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*129*/     0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*130*/     24,24,24,24,24,24,24,255,24,24,24,24,24,24,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*131*/     24,24,24,24,24,24,24,248,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*132*/     24,24,24,24,24,24,24,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*133*/     0,0,0,0,0,0,0,248,24,24,24,24,24,24,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*134*/     0,0,0,0,0,0,0,31,24,24,24,24,24,24,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*135*/     24,24,24,24,24,24,24,248,24,24,24,24,24,24,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*136*/     24,24,24,24,24,24,24,31,24,24,24,24,24,24,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*137*/     24,24,24,24,24,24,24,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*138*/     0,0,0,0,0,0,0,255,24,24,24,24,24,24,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*139*/     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*140*/     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*141*/     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*142*/     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*143*/     0,0,0,0,0,0,12,30,19,137,132,132,252,120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*144*/     0,0,0,0,0,12,30,146,139,133,252,120,0,108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*145*/     0,0,0,0,0,65,73,73,127,54,48,32,224,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*146*/     0,0,24,102,0,65,73,73,127,54,48,32,224,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*147*/     0,0,0,0,6,15,145,225,126,60,32,32,224,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*148*/     0,0,6,0,6,15,145,225,126,60,32,32,224,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*149*/     0,0,0,0,0,0,0,0,0,4,4,4,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*150*/     63,64,8,8,8,8,8,8,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*151*/     0,0,0,0,62,63,9,6,249,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*152*/     0,0,12,0,62,63,9,6,249,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*153*/     0,0,0,240,248,72,48,48,79,135,128,128,126,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*154*/     0,48,0,240,248,72,48,48,79,135,128,128,126,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*155*/     0,0,0,2,7,9,9,10,255,251,10,9,7,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*156*/     0,56,108,100,96,240,96,96,96,96,230,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*157*/     24,32,28,32,8,8,8,8,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*158*/     8,24,12,8,8,8,8,8,7,51,64,48,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*159*/     16,48,24,16,16,16,16,16,15,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*160*/     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*161*/     0,32,24,28,6,2,2,2,127,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*162*/     0,62,64,12,12,6,2,2,127,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*163*/     12,16,12,16,4,6,2,2,127,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*164*/     0,0,8,28,12,6,2,2,127,63,0,12,16,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*165*/     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*166*/     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*167*/     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*168*/     10,20,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*169*/     6,38,92,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*170*/     0,0,0,0,0,0,0,0,0,0,0,10,20,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*171*/     2,4,8,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*172*/     6,6,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*173*/     0,0,0,0,0,0,0,0,0,0,0,2,4,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*174*/     42,42,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*175*/     0,56,108,108,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*176*/     0,0,0,0,0,0,0,24,60,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*177*/     0,32,48,56,24,8,8,8,8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*178*/     0,33,127,126,56,24,8,8,8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*179*/     0,73,73,118,56,24,8,8,8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*180*/     0,14,28,48,48,30,24,48,48,63,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*181*/     0,0,0,12,30,35,67,67,71,126,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*182*/     0,124,62,2,2,2,2,2,3,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*183*/     0,34,99,99,99,34,20,28,8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*184*/     0,8,8,8,28,20,34,99,99,99,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*185*/     0,28,62,38,62,30,2,2,3,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*186*/     0,0,0,0,8,16,16,24,28,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*187*/     0,0,4,8,16,16,24,28,8,0,8,28,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*188*/     20,40,80,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*189*/     0,6,38,92,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*190*/     0,0,0,0,0,0,0,0,255,255,0,0,20,40,80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*191*/     0,28,54,99,98,32,16,8,8,0,8,28,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*192*/     0,6,8,6,8,1,3,3,254,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*193*/     0,0,0,0,0,12,30,48,30,28,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*194*/     63,64,8,8,8,8,8,8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*195*/     24,32,28,32,8,8,8,8,8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*196*/     0,24,32,24,32,12,30,17,31,15,2,124,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*197*/     8,24,12,8,8,8,8,8,0,12,16,12,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*198*/     0,0,96,128,96,140,30,19,137,132,132,252,120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*199*/     8,24,12,8,8,8,8,8,8,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*200*/     0,0,0,0,0,129,129,129,255,126,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*201*/     0,0,51,0,6,15,17,17,31,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*202*/     0,0,0,54,0,129,129,129,255,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*203*/     0,0,24,102,0,129,129,129,255,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*204*/     0,0,0,0,0,56,127,15,16,32,70,64,63,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*205*/     0,0,0,0,0,56,127,15,16,32,64,64,63,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*206*/     0,0,0,24,0,56,127,15,16,32,64,64,63,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*207*/     0,0,0,0,12,30,3,1,35,126,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*208*/     0,0,12,0,12,30,3,1,35,126,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*209*/     0,0,0,0,0,2,7,3,1,1,2,124,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*210*/     0,0,0,6,0,2,7,3,1,1,2,124,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*211*/     0,0,0,0,0,0,17,21,31,10,132,132,252,120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*212*/     0,0,0,4,17,0,17,21,31,10,132,132,252,120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*213*/     0,0,0,0,0,14,17,63,30,8,132,132,252,120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*214*/     0,0,0,6,0,14,17,63,30,8,132,132,252,120,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*215*/     16,48,24,16,18,23,27,17,254,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*216*/     16,51,24,16,18,23,27,17,254,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*217*/     0,0,0,48,120,64,64,56,64,128,128,128,126,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*218*/     0,48,0,48,120,64,64,56,64,128,128,128,126,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*219*/     1,2,4,8,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*220*/     3,3,14,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*221*/     0,0,0,0,0,0,0,0,255,255,0,1,2,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*222*/     21,21,10,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*223*/     12,18,12,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*224*/     0,0,0,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*225*/     0,0,6,0,2,7,5,135,129,255,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*226*/     0,0,27,0,4,14,9,11,7,65,66,124,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*227*/     1,3,1,25,33,25,33,1,129,129,255,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*228*/     1,3,3,1,1,1,1,1,129,129,255,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*229*/     0,0,0,0,12,22,7,31,34,32,32,32,32,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*230*/     0,0,0,24,0,1,3,35,65,65,65,126,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*231*/     0,0,0,0,6,15,17,17,31,14,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*232*/     0,0,0,0,0,12,30,17,31,15,2,124,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*233*/     0,0,0,0,3,7,8,14,71,65,65,126,60,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*234*/     0,0,0,3,7,8,14,71,65,65,126,60,0,54,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*235*/     0,0,0,0,0,1,3,3,254,252,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*236*/     0,0,0,51,0,1,3,3,254,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*237*/     0,0,12,51,0,1,3,3,254,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*238*/     0,0,0,0,0,24,63,7,248,240,0,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*239*/     0,0,0,0,0,24,63,7,248,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*240*/     0,0,0,24,0,24,63,7,248,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*241*/     0,0,0,0,0,17,21,21,255,234,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*242*/     0,0,12,51,0,17,21,21,255,234,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*243*/     0,0,0,0,2,7,43,49,254,220,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*244*/     0,0,12,0,2,7,43,49,254,220,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*245*/     0,0,0,0,6,15,16,16,255,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*246*/     0,0,6,0,6,15,16,16,255,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*247*/     0,12,0,12,30,19,31,1,255,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*248*/     0,0,51,0,6,15,9,7,255,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*249*/     1,3,4,8,16,16,14,1,255,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*250*/     1,3,3,1,1,1,1,1,254,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*251*/     0,0,0,0,0,12,22,19,251,230,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*252*/     0,0,0,3,0,1,3,3,254,252,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*253*/     0,0,0,56,28,10,21,21,249,239,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*254*/     0,0,0,0,0,1,3,3,254,252,0,51,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
/*255*/     0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};

/********* Default mapping ***********/

/*The iso to codepage translation tables*/
struct Sisocp def_isocp[]={
/*punctuations  groub 1*/
    {255 ,1},
    {32,32},
    {0xa0,0xa0},
    {0xa4,0x24},
    {0xac,0xba},
      {0xbb,0xbb},
      {0xbf,0xbf},
      
/*alphabetic
      not connected with next  groub 3*/
      {255,3},
      {0xc2,0xc2},
      {0xc3,0xc3},
      {0xc4,0xc4},
      {0xc5,0xc5},
      {0xc7,0xc7},
      {0xc9,0xc9},
      {0xcf,0xcf},
      {0xd0,0xd0},
      {0xd1,0xd1},
      {0xd2,0xd2},
      {0xe8,0xe8},

/*not connected also with previous (Hamza)*/
      {255,7},
      {0xc1,0xc1},

/*connected with next  groub 4*/
      {255,2},
      {0xc6,0xc6},
      {0xc8,0xc8},
      {0xca,0xca},
      {0xcb,0xcb},
      {0xcc,0xcc},
      {0xcd,0xcd},
      {0xce,0xce},
      {0xd3,0xd3},
      {0xd4,0xd4},
      {0xd5,0xd5},
      {0xd6,0xd6},
      {0xd7,0xd7},
      {0xd8,0xd8},
      {0xd9,0xd9},
      {0xda,0xda},
      {0xe0,0xe0},
      {0xe1,0xe1},
      {0xe2,0xe2},
      {0xe3,0xe3},
      {0xe4,0xe4},
      {0xe5,0xe5},
      {0xe6,0xe6},
      {0xe7,0xe7},
      {0xe9,0xe9},
      {0xea,0xea},
      
/*tashkil  groub 4*/
      {255,4},
      {0xeb,0xa8},
      {0xec,0xa9},
      {0xed,0xaa},
      {0xee,0xab},
      {0xef,0xac},
      {0xf0,0xad},
      {0xf1,0xae},
      {0xf2,0xaf},
      
/*numbers  groub 6*/
      {255,6},
      {48,48},
      {49,49},
      {50,50},
      {51,51},
      {52,52},
      {53,53},
      {54,54},
      {55,55},
      {56,56},
      {57,57},
      {58,58},

/*special characters which follow the direction of writing  groub 5*/
      {255,5},
      {0xa0,0xa0},
      {0x21,0x21},
      {0x22,0x22},
      {0x23,0x23},
      {0x24,0x24},
      {0x25,0x25},
      {0x26,0x26},
      {0x27,0x27},
      {0x28,0x28},
      {0x29,0x29},
      {0x2a,0x2a},
      {0x2b,0x2b},
      {0x2c,0x2c},
      {0x2d,0x2d},
      {0x2e,0x2e},
      {0x2f,0x2f},
      {0x3a,0x3a},
      {0x3b,0x3b},
      {0x3c,0x3c},
      {0x3d,0x3d},
      {0x3e,0x3e},
      {0x3f,0x3f},
      {0x5b,0x5b},
      {0x5c,0x5c},
      {0x5d,0x5d},
      {0x5e,0x5e},
      {0x5f,0x5f},
      {0x60,0x60},
      {0x7b,0x7b},
      {0x7c,0x7c},
      {0x7d,0x7d},
      {0x7e,0x7e},

/*none movable characters (graph)*/
      {255,10},
      {179,0x80},
      {180,0x87},
      {0x81,0x81},
      {0x82,0x82},
      {0x83,0x83},
      {0x84,0x84},
      {0x85,0x85},
      {0x86,0x86},
      {0x88,0x88},
      {0x89,0x89},
      {0x8a,0x8a},
/*end, groub 255*/
    {255,255}
};

/*characters forms table*/
struct Slforms def_lforms[]={
      {0xa8,0xa8,0xa8,0xbc,0xa8},
      {0xa9,0xa9,0xa9,0xbd,0xa9},
      {0xaa,0xaa,0xaa,0xbe,0xaa},
      {0xab,0xab,0xab,0xdb,0xab},
      {0xac,0xac,0xac,0xdc,0xac},
      {0xad,0xad,0xad,0xdd,0xad},
      {0xae,0xae,0xae,0xde,0xae},
      {0xaf,0xaf,0xaf,0xdf,0xaf},
      {0xc2,0xc2,0xc2,0x96,0x96},
      {0xc3,0xc3,0xc3,0x9d,0x9d},
      {0xc5,0xc5,0xc5,0x9e,0x9e},
      {0xc6,0xc6,0xc0,0xc0,0xc6},
      {0xc7,0xc7,0xc7,0x9f,0x9f},
      {0xc8,0xc8,0xeb,0xeb,0xc8},
      {0xca,0xca,0xec,0xec,0xca},
      {0xcb,0xcb,0xed,0xed,0xcb},
      {0xcc,0xcc,0xee,0xee,0xcc},
      {0xcd,0xcd,0xef,0xef,0xcd},
      {0xce,0xce,0xf0,0xf0,0xce},
      {0xd3,0xd3,0xf1,0xf1,0xd3},
      {0xd4,0xd4,0xf2,0xf2,0xd4},
      {0xd5,0xd5,0xf3,0xf3,0xd5},
      {0xd6,0xd6,0xf4,0xf4,0xd6},
      {0xd9,0xd9,0xf5,0x97,0x99},
      {0xda,0xda,0xf6,0x98,0x9a},
      {0xe1,0xe1,0xf7,0xf7,0xe1},
      {0xe2,0xe2,0xf8,0xf8,0xe2},
      {0xe3,0xe3,0xf9,0xf9,0xe3},
      {0xe4,0xe4,0xfa,0xfa,0xe4},
      {0xe5,0xe5,0xfb,0xfb,0xe5},
      {0xe6,0xe6,0xfc,0xfc,0xe6},
      {0xe7,0xe7,0xfd,0x9b,0xe7},
      {0xe9,0xe9,0xfe,0xfe,0x8f},
      {0xea,0xea,0xfe,0xfe,0x90},
      {255,255,255,255,255}
};


struct Sbraces def_braces[]={
      {'{','}'} , {'}','{'} , {'[',']'} , {']','['} , {'(',')'} , {')','('}
      , {'<','>'} , {'>','<'} , 
      {255,255}
};

/*Lam-Alef pairs*/
struct Spairs def_pairs[]={
      {0xfa,0x96,0xfa,0xa2},
      {0xfa,0x9d,0xfa,0xa3},
      {0xfa,0x9e,0xfa,0xa4},
      {0xfa,0x9f,0xfa,0xa1},
      {0xd3,0x20,0x91,0x95},
      {0xd4,0x20,0x92,0x95},
      {0xd5,0x20,0x93,0x95},
      {0xd6,0x20,0x94,0x95},
      {0xd3,0xa0,0x91,0x95},
      {0xd4,0xa0,0x92,0x95},
      {0xd5,0xa0,0x93,0x95},
      {0xd6,0xa0,0x94,0x95},

      {255,0,0,0}
};

unsigned int def_hendinums[]={
      0xb0,0xb1,0xb2,0xb3,0xb4,
      0xb5,0xb6,0xb7,0xb8,0xb9
};



/**********************Functions************************************************/

void loadfontmap(int ttyn)
{
      int tty,i;
      unsigned char fontmap[256],buf[12];

      for(i=0;i<256;i++)fontmap[i]=(unsigned char)i;
      
      sprintf(buf,"/dev/tty%d",ttyn);
      set_acon_id();
      if((tty=open(buf,O_RDWR))==-1)
      {
       printf("Error opening %s\n",buf);
            set_user_id();
       return ;
      }

      if(ioctl(tty,PIO_SCRNMAP,fontmap))
      {
          puts("Error in arabicfont.c:PIO_SCRNMAP\v");
          close(tty);
            set_user_id();
          return;
      }
      write(tty,"\033(K",3);
      set_user_id();

      close(tty);
}

int setfont(int tty,int height,char *data)
{
      int err;
#ifdef PIO_FONTX
      struct consolefontdesc fdesc;
      fdesc.charcount=256;
      fdesc.charheight=height;
      fdesc.chardata=data;

      set_acon_id();
      err=ioctl(tty,PIO_FONTX,&fdesc);
      set_user_id();
#else
      set_acon_id();
      err=ioctl(tty,PIO_FONT,data);
      set_user_id();
#endif
      return err;
}

struct consolefontdesc oldfontdesc;
char oldfont[32*256];
int returnoldfont=1;
void saveoldfont(int tty)
{
      oldfontdesc.charcount=256;
      oldfontdesc.chardata=oldfont;

      set_acon_id();
      returnoldfont=ioctl(tty,GIO_FONTX,&oldfontdesc);
      set_user_id();
      if(returnoldfont)
            printf("Acon: can't save old font\n");
}
void restoreoldfont(int tty)
{
      set_acon_id();
      if(!returnoldfont)
            ioctl(tty,PIO_FONTX,&oldfontdesc);
      set_user_id();
}

char font[8192];
int fontwidth=0;
void loadfont(int tty,char *path)
{
#ifdef LOADFONT
      static char oldpath[200]={1,0};

      if(path && strlen(path)<200)
      {
            if(!needrefreshconsole && fontwidth && !strcmp(path,oldpath))
            {
                  setfont(tty,fontwidth,font);
                  return;
            }
            strcpy(oldpath,path);
      }
      if(!path)
      {
            oldpath[0]=0;
      }

      if(!path)
      {
      /*load default*/
            if(setfont(tty,16,fonttable))
            {
                puts("Error in arabicfont.c:PIO_FONT\v");
                return;
            }
      }
      else
      {
            char tmp[300];
            int i,z,y;
            FILE *fp;
            struct stat fst;

            y=16; /*Only support 8x16 fonts now*/

            if(path[0]!='/')
                  sprintf(tmp,"%s/fonts/%s",DATAPATH,path);
            else
                  strcpy(tmp,path);
            set_user_id();
            if((fp=fopen(tmp,"r"))==NULL)
            {
                  printf("Can't open font file %s\n",path);
                  fontwidth=0;
                  /*load default*/
                  setfont(tty,16,fonttable);
                  return;
            }
            fstat(fileno(fp),&fst);
            if(fst.st_size%256 || !fst.st_size)
            {
                  printf("Unknown font file %s format\n",path);
                  fontwidth=0;
                  /*load default*/
                  setfont(tty,16,fonttable);
                  fclose(fp);
                  return;
            }

            for(i=0;i<256;i++)
                  for(z=0;z<16;z++)
                        font[i*32+z]=fgetc(fp),font[i*32+z+16]=0;

            fontwidth=fst.st_size/256;
            if(setfont(tty,fontwidth,font))
                puts("Error in arabicfont.c:PIO_FONT\v");

/*          printf(" %s font is loaded\n",tmp);*/
            fclose(fp);
      }
#endif
}

int my_system(char *cmd)
{
      int null,tmpout,tmperror,ret;

/*Redirect standard output and error to null device*/
      if((null=open("/dev/null",O_RDWR))==-1)
            return -1;

      tmpout=dup(STDOUT_FILENO);
      tmperror=dup(STDERR_FILENO);

      dup2(null,STDOUT_FILENO);
      dup2(null,STDERR_FILENO);

      ret=system(cmd);

/*restore standard output and error*/
      dup2(tmpout,STDOUT_FILENO);
      dup2(tmperror,STDERR_FILENO);

      close(tmpout);
      close(tmperror);
      close(null);
      
      return ret;
}

void loadkeys(int tty,char *path)
{
#ifdef USELOADKEYS
      char tmp[300];
      static char oldpath[200]={1,0};

      if(!needrefreshconsole && path && strlen(path)<200)
      {
            if(!strcmp(path,oldpath))
                  return;
            strcpy(oldpath,path);
      }
      if(!needrefreshconsole && !path)
      {
            if(!oldpath[0])
                  return;
            oldpath[0]=0;
      }

      if(path)
      {
            if(path[0]!='/')
                  sprintf(tmp,"loadkeys %s/keymaps/%s >& /dev/null",DATAPATH,path);
            else
                  sprintf(tmp,"loadkeys %s >& /dev/null",path);
      }
      else
            sprintf(tmp,"loadkeys %s/keymaps/iso8859-6.map",DATAPATH);
      
      if(my_system(tmp))
            printf("Error executing : %s \n",tmp);
#endif
}

void loadfontmapping(int tty,char *path)
{
      char tmp[302];
      char *s;
      int i=0;
      FILE *fp;
      static char oldpath[200]={1,0};

      if(!needrefreshconsole && path && strlen(path)<200)
      {
            if(!strcmp(path,oldpath))
                  return;
            strcpy(oldpath,path);
      }
      if(!needrefreshconsole && !path)
      {
            if(!oldpath[0])
                  return;
            oldpath[0]=0;
      }
      
      if(!path)
      {
            memcpy(isocp,def_isocp,sizeof(def_isocp));
            memcpy(lforms,def_lforms,sizeof(def_lforms));
            memcpy(braces,def_braces,sizeof(def_braces));
            memcpy(pairs,def_pairs,sizeof(def_pairs));
            memcpy(hendinums,def_hendinums,sizeof(def_hendinums));
            return;
      }

      if(path[0]!='/')
            sprintf(tmp,"%s/translations/%s",DATAPATH,path);
      else
            strcpy(tmp,path);
      if((fp=fopen(tmp,"r"))==NULL)
      {
            printf("Can't open translation file %s\n",path);
            memcpy(isocp,def_isocp,sizeof(def_isocp));
            memcpy(lforms,def_lforms,sizeof(def_lforms));
            memcpy(braces,def_braces,sizeof(def_braces));
            memcpy(pairs,def_pairs,sizeof(def_pairs));
            memcpy(hendinums,def_hendinums,sizeof(def_hendinums));
            return;
      }

      isocp[0].iso=isocp[0].cp=lforms[0].alone=braces[0].in=pairs[i].old1=255;
      
      while(!feof(fp))
      {
            fgets(tmp,300,fp);
            s=tmp;

            /*Ignore comments*/
            if(strchr(s,'#'))*strchr(s,'#')=0;
            while(*s && isspace(*s))s++;
            /*If line is empty read another*/
            if(!s[0])continue;

            if(!strncmp(s,"translation",11))
            {
                  i=0;
                  do
                  {
                        fgets(tmp,300,fp);
                        s=tmp;

                        /*Ignore comments*/
                        if(strchr(s,'#'))*strchr(s,'#')=0;
                        while(*s && isspace(*s))s++;
                        /*If line is empty read another*/
                        if(!s[0])continue;
                        
                        if(!strncmp(s,"end",3))break;

                        if(sscanf(s,"%i %i",&isocp[i].iso,&isocp[i].cp)!=2)
                              printf("Syntax error in translation file '%s' : %s\n",path,s);
                        i++;
                  }while(!feof(fp) && i<259);
                  isocp[i].iso=isocp[i].cp=255;
            }
            
            else if(!strncmp(s,"lforms",6))
            {
                  int d;
                  i=0;
                  do
                  {
                        fgets(tmp,300,fp);
                        s=tmp;

                        /*Ignore comments*/
                        if(strchr(s,'#'))*strchr(s,'#')=0;
                        while(*s && isspace(*s))s++;
                        /*If line is empty read another*/
                        if(!s[0])continue;
                        
                        if(!strncmp(s,"end",3))break;

                        if((d=sscanf(s,"%i %i %i %i %i",&lforms[i].alone,&lforms[i].first,&lforms[i].middle,&lforms[i].last,&lforms[i].chr))==4)
                              lforms[i].chr=lforms[i].alone;
                        else if(d<4)
                              printf("Syntax error in translation file '%s' : %s\n",path,s);
                        i++;
                  }while(!feof(fp) && i<259);
                  lforms[i].alone=lforms[i].first=lforms[i].middle=lforms[i].last=255;
/*                printf("    lform n. = %d\n",i);*/
            }
                  
            else if(!strncmp(s,"braces",6))
            {
                  i=0;
                  do
                  {
                        fgets(tmp,300,fp);
                        s=tmp;

                        /*Ignore comments*/
                        if(strchr(s,'#'))*strchr(s,'#')=0;
                        while(*s && isspace(*s))s++;
                        /*If line is empty read another*/
                        if(!s[0])continue;
                        
                        if(!strncmp(s,"end",3))break;

                        if(sscanf(s,"%i %i",&braces[i].in,&braces[i].out)!=2)
                              printf("Syntax error in translation file '%s' : %s\n",path,s);

                        i++;
                  }while(!feof(fp) && i<99);
                  braces[i].in=braces[i].out=255;
/*                printf("    braces n. = %d\n",i);*/
            }
            
            else if(!strncmp(s,"pairs",5))
            {
                  i=0;
                  do
                  {
                        fgets(tmp,300,fp);
                        s=tmp;

                        /*Ignore comments*/
                        if(strchr(s,'#'))*strchr(s,'#')=0;
                        while(*s && isspace(*s))s++;
                        /*If line is empty read another*/
                        if(!s[0])continue;
                        
                        if(!strncmp(s,"end",3))break;

                        if(sscanf(s,"%i %i %i %i",&pairs[i].old1,&pairs[i].old2,&pairs[i].new1,&pairs[i].new2)!=4)
                              printf("Syntax error in translation file '%s' : %s\n",path,s);
                        
                        i++;
                  }while(!feof(fp) && i<99);
                  pairs[i].old1=pairs[i].old2=pairs[i].new2=255;
/*                printf("    pairs n. = %d\n",i);*/
            }
            
            else if(!strncmp(s,"hendinums",9))
            {
                  i=0;
                  do
                  {
                        fgets(tmp,300,fp);
                        s=tmp;

                        /*Ignore comments*/
                        if(strchr(s,'#'))*strchr(s,'#')=0;
                        while(*s && isspace(*s))s++;
                        /*If line is empty read another*/
                        if(!s[0])continue;
                        
                        if(!strncmp(s,"end",3))break;

                        if(sscanf(s,"%i",&hendinums[i])!=1)
                              printf("Syntax error in translation file '%s' : %s\n",path,s);

                        i++;
                  }while(!feof(fp) && i<11);
/*                printf("    hendi n. = %d\n",i);*/
            }

            else printf("Syntax error in translation file '%s' : %s\n",path,s);
      }
      fclose(fp);
}

Generated by  Doxygen 1.6.0   Back to index