2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* lcGeneric.c 1.4 - Fujitsu source for CDEnext 96/02/29 18:02:54 */
24 /* $XConsortium: _fallcGeneric.c /main/2 1996/09/27 19:03:31 drk $ */
26 * Copyright 1992, 1993 by TOSHIBA Corp.
28 * Permission to use, copy, modify, and distribute this software and its
29 * documentation for any purpose and without fee is hereby granted, provided
30 * that the above copyright notice appear in all copies and that both that
31 * copyright notice and this permission notice appear in supporting
32 * documentation, and that the name of TOSHIBA not be used in advertising
33 * or publicity pertaining to distribution of the software without specific,
34 * written prior permission. TOSHIBA make no representations about the
35 * suitability of this software for any purpose. It is provided "as is"
36 * without express or implied warranty.
38 * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40 * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
46 * Author: Katsuhisa Yano TOSHIBA Corp.
47 * mopi@osa.ilab.toshiba.co.jp
50 * Copyright 1995 by FUJITSU LIMITED
51 * This is source code modified by FUJITSU LIMITED under the Joint
52 * Development Agreement for the CDEnext PST.
53 * This is unpublished proprietry source code of FUJITSU LIMITED
55 * Modifier: Takanori Tateno FUJITSU LIMITED
60 #include "_fallibint.h"
61 #include "_fallcGeneric.h"
64 static Bool initialize();
65 static void destroy();
67 static XLCdPublicMethodsRec genericMethods = {
68 { NULL }, /* use default methods */
78 XLCdMethods _fallcGenericMethods = (XLCdMethods) &genericMethods;
86 XLCdPublicMethods new;
88 lcd = (XLCd) Xmalloc(sizeof(XLCdRec));
91 bzero((char *) lcd, sizeof(XLCdRec));
93 lcd->core = (XLCdCore) Xmalloc(sizeof(XLCdGenericRec));
94 if (lcd->core == NULL)
96 bzero((char *) lcd->core, sizeof(XLCdGenericRec));
98 new = (XLCdPublicMethods) Xmalloc(sizeof(XLCdPublicMethodsRec));
101 *new = *((XLCdPublicMethods) methods);
102 lcd->methods = (XLCdMethods) new;
112 string_to_encoding(str, encoding)
122 switch (*(str + 1)) {
131 value = strtol(str + 2, &next, base);
132 if (str + 2 != next) {
133 *((unsigned char *) encoding++) = (unsigned char) value;
138 *encoding++ = *str++;
147 string_to_ulong(str, value)
149 unsigned long *value;
172 *value = (unsigned) strtol(tmp1, NULL, base);
178 add_charset(codeset, charset)
182 XlcCharSet *new_list;
185 if (num = codeset->num_charsets)
186 new_list = (XlcCharSet *) Xrealloc(codeset->charset_list,
187 (num + 1) * sizeof(XlcCharSet));
189 new_list = (XlcCharSet *) Xmalloc(sizeof(XlcCharSet));
191 if (new_list == NULL)
194 new_list[num] = charset;
195 codeset->charset_list = new_list;
196 codeset->num_charsets = num + 1;
203 XLCdGenericPart *gen;
205 CodeSet new, *new_list;
208 new = (CodeSet) Xmalloc(sizeof(CodeSetRec));
211 bzero((char *) new, sizeof(CodeSetRec));
213 if (num = gen->codeset_num)
214 new_list = (CodeSet *) Xrealloc(gen->codeset_list,
215 (num + 1) * sizeof(CodeSet));
217 new_list = (CodeSet *) Xmalloc(sizeof(CodeSet));
219 if (new_list == NULL)
223 gen->codeset_list = new_list;
224 gen->codeset_num = num + 1;
235 add_parse_list(gen, type, encoding, codeset)
236 XLCdGenericPart *gen;
241 ParseInfo new, *new_list;
246 str = (char *) Xmalloc(strlen(encoding) + 1);
249 strcpy(str, encoding);
251 new = (ParseInfo) Xmalloc(sizeof(ParseInfoRec));
254 bzero((char *) new, sizeof(ParseInfoRec));
256 if (gen->mb_parse_table == NULL) {
257 gen->mb_parse_table = (unsigned char *) Xmalloc(256); /* 2^8 */
258 if (gen->mb_parse_table == NULL)
260 bzero((char *) gen->mb_parse_table, 256);
263 if (num = gen->mb_parse_list_num)
264 new_list = (ParseInfo *) Xrealloc(gen->mb_parse_list,
265 (num + 2) * sizeof(ParseInfo));
267 new_list = (ParseInfo *) Xmalloc(2 * sizeof(ParseInfo));
270 if (new_list == NULL)
274 new_list[num + 1] = NULL;
275 gen->mb_parse_list = new_list;
276 gen->mb_parse_list_num = num + 1;
278 ch = (unsigned char) *str;
279 if (gen->mb_parse_table[ch] == 0)
280 gen->mb_parse_table[ch] = num + 1;
284 new->codeset = codeset;
286 if (codeset->parse_info == NULL)
287 codeset->parse_info = new;
303 XLCdGenericPart *gen = XLC_GENERIC_PART(lcd);
305 ParseInfo *parse_info;
308 if (gen->mb_parse_table)
309 Xfree(gen->mb_parse_table);
310 if (num = gen->mb_parse_list_num) {
311 for (parse_info = gen->mb_parse_list; num-- > 0; parse_info++) {
312 if ((*parse_info)->encoding)
313 Xfree((*parse_info)->encoding);
316 Xfree(gen->mb_parse_list);
319 if (num = gen->codeset_num)
320 Xfree(gen->codeset_list);
324 #define FORWARD (unsigned long)'+'
325 #define BACKWARD (unsigned long)'-'
327 static char *getscope(str,scp)
331 char buff[256],*next;
332 unsigned long start=0,end=0,dest=0,shift=0,direction=0;
333 sscanf(str,"[\\x%lx,\\x%lx]->\\x%lx", &start, &end, &dest);
336 shift = dest - start;
337 direction = FORWARD ;
339 shift = start - dest;
340 direction = BACKWARD;
350 if(*str == ',' && *(str+1) == '['){
358 static int count_scopemap(str)
363 for(ptr=str;*ptr;ptr++){
370 FontScope falparse_scopemaps(str,size)
375 FontScope scope,sc_ptr;
377 num = count_scopemap(str);
378 scope = (FontScope )Xmalloc(num * sizeof(FontScopeRec));
382 for (i=0,str_sc=str,sc_ptr=scope;
383 i < num; i++,sc_ptr++){
384 str_sc = getscope(str_sc,sc_ptr);
390 dbg_printValue(str,value,num)
398 fprintf(stderr,"%s value[%d] = %s\n",str,i,value[i]);
403 dmpscope(name,sc,num)
409 fprintf(stderr,"dmpscope %s\n",name);
411 fprintf(stderr,"%x %x %x %x \n",
415 sc[i].shift_direction);
417 fprintf(stderr,"dmpscope end\n");
421 static XlcCharSet srch_charset_define(name,new)
425 XlcCharSet charset = NULL;
427 charset = _fallcGetCharSet(name);
428 if (charset == NULL &&
429 (charset = _fallcCreateDefaultCharSet(name, ""))) {
430 _fallcAddCharSet(charset);
436 static read_charset_define(lcd,gen)
438 XLCdGenericPart *gen;
441 char csd[16],cset_name[256];
448 for(i=0;;i++){ /* loop start */
450 sprintf(csd, "csd%d", i);
453 sprintf(name, "%s.%s", csd , "charset_name");
454 _fallcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
455 dbg_printValue(name,value,num);
457 strcpy(cset_name,value[0]);
458 sprintf(name, "%s.%s", csd , "side");
459 _fallcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
461 dbg_printValue(name,value,num);
462 if( !_fallcNCompareISOLatin1(value[0], "none", 4) ){
464 strcat(cset_name,":none");
466 if( !_fallcNCompareISOLatin1(value[0], "GL", 2) ){
468 strcat(cset_name,":GL");
471 strcat(cset_name,":GR");
473 if (charsetd == NULL &&
474 (charsetd = srch_charset_define(cset_name,&new)) == NULL)
485 tmp = (char *)Xmalloc(strlen(cset_name)+1);
489 strcpy(tmp,cset_name);
490 charsetd->name = tmp;
493 charsetd->side = side ;
495 sprintf(name, "%s.%s", csd , "length");
496 _fallcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
498 dbg_printValue(name,value,num);
499 charsetd->char_size = atoi(value[0]);
502 sprintf(name, "%s.%s", csd , "gc_number");
503 _fallcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
505 dbg_printValue(name,value,num);
506 charsetd->set_size = atoi(value[0]);
508 /* string_encoding */
509 sprintf(name, "%s.%s", csd , "string_encoding");
510 _fallcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
512 dbg_printValue(name,value,num);
513 if(!strcmp("False",value[0])){
514 charsetd->string_encoding = False;
516 charsetd->string_encoding = True;
520 sprintf(name, "%s.%s", csd , "sequence");
521 _fallcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
523 dbg_printValue(name,value,num);
525 if(charsetd->ct_sequence){
526 Xfree(charsetd->ct_sequence);
529 tmp = (char *)Xmalloc(strlen(value[0])+1);
533 charsetd->ct_sequence = tmp;
534 string_to_encoding(value[0],tmp);
537 sprintf(name, "%s.%s", csd , "encoding_name");
538 _fallcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
540 dbg_printValue(name,value,num);
542 if(charsetd->encoding_name){
543 Xfree(charsetd->encoding_name);
546 tmp = (char *)Xmalloc(strlen(value[0]+1));
547 strcpy(tmp,value[0]);
548 charsetd->encoding_name = tmp;
549 charsetd->xrm_encoding_name =
550 falrmStringToQuark(tmp);
557 faladd_conversion(gen)
558 XLCdGenericPart *gen;
563 if (num = gen->segment_conv_num){
564 new_list = (SegConv) Xrealloc(gen->segment_conv,
565 (num + 1) * sizeof(SegConvRec));
567 new_list = (SegConv) Xmalloc(sizeof(SegConvRec));
570 if (new_list == NULL)
573 gen->segment_conv = new_list;
574 gen->segment_conv_num = num + 1;
576 return (&new_list[num]);
579 static read_segmentconversion(lcd,gen)
581 XLCdGenericPart *gen;
589 for(i=0 ; ; i++){ /* loop start */
591 sprintf(conv, "conv%d", i);
594 sprintf(name, "%s.%s", conv , "length");
595 _fallcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num);
598 if (conversion == NULL &&
599 (conversion = faladd_conversion(gen)) == NULL) {
602 dbg_printValue(name,value,num);
610 conversion->length = atoi(value[0]);
612 /* source_encoding */
613 sprintf(name, "%s.%s", conv , "source_encoding");
614 _fallcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num);
617 dbg_printValue(name,value,num);
618 tmp = (char *)Xmalloc(strlen(value[0])+1);
622 strcpy(tmp,value[0]);
623 conversion->source_encoding = tmp;
624 conversion->source = srch_charset_define(tmp,&new);
626 tmp = (char *)Xmalloc(strlen(conversion->source_encoding)+1);
630 strcpy(tmp,conversion->source_encoding);
631 conversion->source->name = tmp;
634 /* destination_encoding */
635 sprintf(name, "%s.%s", conv , "destination_encoding");
636 _fallcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num);
639 dbg_printValue(name,value,num);
640 tmp = (char *)Xmalloc(strlen(value[0])+1);
644 strcpy(tmp,value[0]);
645 conversion->destination_encoding = tmp;
646 conversion->dest = srch_charset_define(tmp,&new);
648 tmp = (char *)Xmalloc(
649 strlen(conversion->destination_encoding)+1);
653 strcpy(tmp,conversion->destination_encoding);
654 conversion->dest->name = tmp;
658 sprintf(name, "%s.%s", conv , "range");
659 _fallcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num);
662 dbg_printValue(name,value,num);
663 sscanf(value[0],"\\x%lx,\\x%lx",
664 &(conversion->range.start),
665 &(conversion->range.end));
668 sprintf(name, "%s.%s", conv , "conversion");
669 _fallcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num);
672 dbg_printValue(name,value,num);
674 falparse_scopemaps(value[0],&conversion->conv_num);
679 static ExtdSegment create_ctextseg(value,num)
684 char side_str[128],*ptr;
685 char cset_name[128],*tmp;
688 ret = (ExtdSegment)Xmalloc(sizeof(ExtdSegmentRec));
692 if(strchr(value[0],':')){
693 ret->name = (char *)Xmalloc(strlen(value[0])+1);
694 if(ret->name == NULL){
697 strcpy(ret->name,value[0]);
698 ptr = strchr(ret->name,':');
701 if( !_fallcNCompareISOLatin1(ptr, "none", 4) ){
702 ret->side = XlcNONE ;
703 sprintf(cset_name,"%s:%s",ret->name,"none");
705 if( !_fallcNCompareISOLatin1(ptr, "GL", 2) ){
707 sprintf(cset_name,"%s:%s",ret->name,"GL");
710 sprintf(cset_name,"%s:%s",ret->name,"GR");
713 ret->name = (char *)Xmalloc(strlen(value[0])+1);
714 if(ret->name == NULL){
717 strcpy(ret->name,value[0]);
719 ret->area = (FontScope)Xmalloc((num - 1)*sizeof(FontScopeRec));
720 if(ret->area == NULL){
723 ret->area_num = num - 1;
726 sscanf(value[i],"\\x%lx,\\x%lx", &scope[i-1].start, &scope[i-1].end);
728 ret->charset = srch_charset_define(cset_name,&new);
730 tmp = (char *)Xmalloc(strlen(cset_name)+1);
734 strcpy(tmp,cset_name);
735 ret->charset->name = tmp;
745 XLCdGenericPart *gen = XLC_GENERIC_PART(lcd);
752 gen->codeset_num = 0;
754 /***** wc_encoding_mask *****/
755 _fallcGetResource(lcd, "XLC_XLOCALE", "wc_encoding_mask", &value, &num);
757 if (string_to_ulong(value[0], &l) == False)
759 gen->wc_encode_mask = l;
761 /***** wc_shift_bits *****/
762 _fallcGetResource(lcd, "XLC_XLOCALE", "wc_shift_bits", &value, &num);
764 gen->wc_shift_bits = atoi(value[0]);
765 if (gen->wc_shift_bits < 1)
766 gen->wc_shift_bits = 8;
767 #ifndef X_NOT_STDC_ENV
768 /***** use_stdc_env *****/
769 _fallcGetResource(lcd, "XLC_XLOCALE", "use_stdc_env", &value, &num);
770 if (num > 0 && !_fallcCompareISOLatin1(value[0], "True"))
771 gen->use_stdc_env = True;
773 gen->use_stdc_env = False;
774 /***** force_convert_to_mb *****/
775 _fallcGetResource(lcd, "XLC_XLOCALE", "force_convert_to_mb", &value, &num);
776 if (num > 0 && !_fallcCompareISOLatin1(value[0], "True"))
777 gen->force_convert_to_mb = True;
779 gen->force_convert_to_mb = False;
783 CodeSetRec *codeset = NULL;
787 sprintf(cs, "cs%d", i);
789 /***** codeset.side *****/
790 sprintf(name, "%s.%s", cs , "side");
791 _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
795 if (codeset == NULL && (codeset = add_codeset(gen)) == NULL)
799 if( !_fallcNCompareISOLatin1(value[0], "none", 4) ){
800 codeset->side = XlcNONE ;
802 if( !_fallcNCompareISOLatin1(value[0], "GL", 2) ){
803 codeset->side = XlcGL ;
805 codeset->side = XlcGR ;
808 tmp = strrchr(value[0], ':');
809 if (tmp != NULL && !_fallcCompareISOLatin1(tmp + 1, "Default")) {
810 if (codeset->side == XlcGR)
811 gen->initial_state_GR = codeset;
813 gen->initial_state_GL = codeset;
817 /***** codeset.length *****/
818 sprintf(name, "%s.%s", cs , "length");
819 _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
821 if (codeset == NULL && (codeset = add_codeset(gen)) == NULL)
823 codeset->length = atoi(value[0]);
824 if (codeset->length < 1)
828 /***** codeset.mb_encoding *****/
829 sprintf(name, "%s.%s", cs, "mb_encoding");
830 _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
843 if (codeset == NULL && (codeset = add_codeset(gen)) == NULL)
845 for ( ; num-- > 0; value++) {
848 int type = E_SS; /* for BC */
849 for (j = 0; shifts[j].str; j++) {
850 if (!_fallcNCompareISOLatin1(tmp, shifts[j].str,
851 strlen(shifts[j].str))) {
852 type = shifts[j].type;
853 tmp += strlen(shifts[j].str);
857 if (string_to_encoding(tmp, encoding) == False)
859 add_parse_list(gen, type, encoding, codeset);
863 /***** codeset.wc_encoding *****/
864 sprintf(name, "%s.%s", cs, "wc_encoding");
865 _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
867 if (codeset == NULL && (codeset = add_codeset(gen)) == NULL)
869 if (string_to_ulong(value[0], &l) == False)
871 codeset->wc_encoding = l;
874 /***** codeset.ct_encoding *****/
875 sprintf(name, "%s.%s", cs, "ct_encoding");
876 _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
881 if (codeset == NULL && (codeset = add_codeset(gen)) == NULL)
883 for ( ; num-- > 0; value++) {
884 string_to_encoding(*value, name);
886 if ((encoding = strchr(name, ':')) &&
887 (encoding = strchr(encoding + 1, ':'))) {
889 charset = _fallcAddCT(name, encoding);
891 if (charset == NULL) {
892 charset = _fallcGetCharSet(name);
893 if (charset == NULL &&
894 (charset = _fallcCreateDefaultCharSet(name, ""))) {
895 charset->side = codeset->side;
896 charset->char_size = codeset->length;
897 _fallcAddCharSet(charset);
901 if (add_charset(codeset, charset) == False)
911 /***** 3.4.2 byteM (1 <= M <= length)*****/
912 for(M=1; M-1 < codeset->length; M++){
916 sprintf(name,"%s.%s%d",cs,"byte",M);
917 _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
921 codeset->byteM = NULL ;
925 (ByteInfoListRec *)Xmalloc(
926 (codeset->length)*sizeof(ByteInfoListRec));
927 if(codeset->byteM == NULL){
933 dbg_printValue(name,value,num);
934 (codeset->byteM)[M-1].M = M;
935 (codeset->byteM)[M-1].byteinfo_num = num;
936 (codeset->byteM)[M-1].byteinfo =
937 (ByteInfo)Xmalloc( num * sizeof(ByteInfoRec));
938 for(ii = 0 ; ii < num ; ii++){
940 tmpb = (codeset->byteM)[M-1].byteinfo ;
941 /* default 0x00 - 0xff */
942 sscanf(value[ii],"\\x%lx,\\x%lx",&start,&end);
943 tmpb[ii].start = (unsigned char)start;
944 tmpb[ii].end = (unsigned char)end;
951 /***** codeset.mb_conversion *****/
952 sprintf(name, "%s.%s", cs, "mb_conversion");
953 _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
955 dbg_printValue(name,value,num);
956 codeset->mbconv = Xmalloc(sizeof(ConversionRec));
957 codeset->mbconv->convlist =
958 falparse_scopemaps(value[0],&(codeset->mbconv->conv_num));
959 dmpscope("mb_conv",codeset->mbconv->convlist,
960 codeset->mbconv->conv_num);
961 /* [\x%x,\x%x]->\x%x,... */
963 /***** codeset.ct_conversion *****/
964 sprintf(name, "%s.%s", cs, "ct_conversion");
965 _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
967 dbg_printValue(name,value,num);
968 codeset->ctconv = Xmalloc(sizeof(ConversionRec));
969 codeset->ctconv->convlist =
970 falparse_scopemaps(value[0],&(codeset->ctconv->conv_num));
971 dmpscope("ctconv",codeset->ctconv->convlist,
972 codeset->ctconv->conv_num);
973 /* [\x%x,\x%x]->\x%x,... */
975 /***** codeset.ct_conversion_file *****/
976 sprintf(name, "%s.%s", cs, "ct_conversion_file");
977 _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
979 dbg_printValue(name,value,num);
980 /* [\x%x,\x%x]->\x%x,... */
982 /***** codeset.ct_extended_segment *****/
983 sprintf(name, "%s.%s", cs, "ct_extended_segment");
984 _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
986 dbg_printValue(name,value,num);
987 codeset->ctextseg = create_ctextseg(value,num);
988 /* [\x%x,\x%x]->\x%x,... */
994 read_charset_define(lcd,gen); /* For VW/UDC */
995 read_segmentconversion(lcd,gen); /* For VW/UDC */
1009 XLCdPublicMethods superclass = (XLCdPublicMethods) _fallcPublicMethods;
1011 XLC_PUBLIC_METHODS(lcd)->superclass = superclass;
1013 if (superclass->pub.initialize) {
1014 if ((*superclass->pub.initialize)(lcd) == False)
1018 if(load_generic(lcd) == False)
1023 /* VW/UDC start 95.01.08 */
1030 if(codeset->byteM == NULL) {
1033 blst = codeset->byteM;
1034 for(i=0;i<codeset->length;i++){
1035 if(blst[i].byteinfo){
1036 Xfree(blst[i].byteinfo);
1037 blst[i].byteinfo = NULL;
1040 Xfree(codeset->byteM);
1041 codeset->byteM = NULL;
1044 freeConversion(codeset)
1048 Conversion mbconv,ctconv;
1049 if( codeset->mbconv ) {
1050 mbconv = codeset->mbconv;
1052 if(mbconv->convlist){
1053 Xfree(mbconv->convlist);
1054 mbconv->convlist = NULL;
1057 codeset->mbconv = NULL;
1059 if( codeset->ctconv ) {
1060 ctconv = codeset->ctconv;
1062 if(ctconv->convlist){
1063 Xfree(ctconv->convlist);
1064 ctconv->convlist = NULL;
1067 codeset->ctconv = NULL;
1071 freeExtdSegment(codeset)
1075 ExtdSegment ctextseg;
1076 if(codeset->ctextseg == NULL) {
1079 ctextseg = codeset->ctextseg;
1081 Xfree(ctextseg->name);
1082 ctextseg->name = NULL;
1085 Xfree(ctextseg->area);
1086 ctextseg->area = NULL;
1088 Xfree(codeset->ctextseg);
1089 codeset->ctextseg = NULL;
1092 freeParseInfo(codeset)
1096 ParseInfo parse_info;
1097 if(codeset->parse_info == NULL) {
1100 parse_info = codeset->parse_info;
1101 if(parse_info->encoding){
1102 Xfree(parse_info->encoding);
1103 parse_info->encoding = NULL;
1105 Xfree(codeset->parse_info);
1106 codeset->parse_info = NULL;
1109 destroy_CodeSetList(gen)
1110 XLCdGenericPart *gen ;
1112 CodeSet *codeset = gen->codeset_list;
1114 if(gen->codeset_num == 0) {
1117 for(i=0;i<gen->codeset_num;i++){
1118 freeByteM(codeset[i]);
1119 freeConversion(codeset[i]);
1120 freeExtdSegment(codeset[i]);
1121 freeParseInfo(codeset[i]);
1122 if(codeset[i]->charset_list){
1123 Xfree(codeset[i]->charset_list);
1124 codeset[i]->charset_list = NULL;
1126 Xfree(codeset[i]); codeset[i]=NULL;
1128 Xfree(codeset); gen->codeset_list = NULL;
1132 destroy_SegConv(gen)
1133 XLCdGenericPart *gen ;
1135 SegConv seg = gen->segment_conv;
1137 if(gen->segment_conv_num == 0) {
1140 for(i=0;i<gen->segment_conv_num;i++){
1141 if(seg[i].source_encoding){
1142 Xfree(seg[i].source_encoding);
1143 seg[i].source_encoding = NULL;
1145 if(seg[i].destination_encoding){
1146 Xfree(seg[i].destination_encoding);
1147 seg[i].destination_encoding = NULL;
1150 Xfree(seg[i].conv); seg[i].conv = NULL;
1153 Xfree(seg); gen->segment_conv = NULL;
1160 XLCdGenericPart *gen = XLC_GENERIC_PART(lcd);
1161 destroy_SegConv(gen);
1162 destroy_CodeSetList(gen);
1163 if(gen->mb_parse_table){
1164 Xfree(gen->mb_parse_table);
1165 gen->mb_parse_table = NULL;
1167 if(gen->mb_parse_list){
1168 Xfree(gen->mb_parse_list);
1169 gen->mb_parse_list = NULL;
1172 /* VW/UDC end 95.01.08 */
1177 XLCdPublicMethods superclass = XLC_PUBLIC_METHODS(lcd)->superclass;
1179 destroy_gen(lcd); /* ADD 1996.01.08 */
1180 if (superclass && superclass->pub.destroy)
1181 (*superclass->pub.destroy)(lcd);