📄 fribidi_main.c
字号:
/* FriBidi - Library of BiDi algorithm * Copyright (C) 1999 Dov Grobgeld * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. *//*======================================================================// A main program for fribidi.//// Dov Grobgeld//----------------------------------------------------------------------*/#include <stdio.h>#include <stdlib.h>#include <stdarg.h>#include <glib.h>#include "fribidi.h"#define CASE(s) if(!strcmp(S_, s))void die(gchar *fmt, ...){ va_list ap; va_start(ap,fmt); vfprintf(stderr, fmt, ap); exit(-1);}#define UNI_ALEF 0x05D0#define UNI_TAV 0x05EAvoid charset_to_unicode(gint char_set, guchar *s, /* output */ FriBidiChar *us, int *length ){ int i; int len = strlen(s); if (char_set == 0) { /* Convert A-Z into hebrew characters */ for (i=0; i<len+1; i++) { guchar ch = s[i]; if (ch >= 'A' && ch <= 'Z') us[i] = ch - 'A' + UNI_ALEF; else us[i] = s[i]; } } else if (char_set == FRIBIDI_CHARSET_8859_6) fribidi_iso8859_6_to_unicode(s, us); else if (char_set == FRIBIDI_CHARSET_8859_8) fribidi_iso8859_8_to_unicode(s, us); else if (char_set == FRIBIDI_CHARSET_8859_6) fribidi_iso8859_6_to_unicode(s, us); else if (char_set == FRIBIDI_CHARSET_ISIRI_3342) fribidi_isiri_3342_to_unicode(s, us); else if (char_set == FRIBIDI_CHARSET_CP1255) fribidi_cp1255_to_unicode(s, us); else if (char_set == FRIBIDI_CHARSET_CP1256) fribidi_cp1256_to_unicode(s, us); else if (char_set == FRIBIDI_CHARSET_UTF8) *length = fribidi_utf8_to_unicode(s, us); else die("Sorry! Not implemented!\n");}void unicode_to_charset(gint char_set, FriBidiChar *us, int length, /* output */ gchar *s){ if (char_set == 0) { /* Convert hebrew characters into A-Z */ int i = 0; while(us[i]) { FriBidiChar ch = us[i]; if (ch >= UNI_ALEF && ch <= UNI_TAV) s[i] = ch-UNI_ALEF+'A'; else if (us[i] < 256) s[i] = us[i]; else s[i] = '
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -