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 libraries 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);
391 dbg_printValue(str,value,num)
399 fprintf(stderr,"%s value[%d] = %s\n",str,i,value[i]);
405 dmpscope(name,sc,num)
411 fprintf(stderr,"dmpscope %s\n",name);
413 fprintf(stderr,"%x %x %x %x \n",
417 sc[i].shift_direction);
419 fprintf(stderr,"dmpscope end\n");
423 static XlcCharSet srch_charset_define(name,new)
427 XlcCharSet charset = NULL;
429 charset = _fallcGetCharSet(name);
430 if (charset == NULL &&
431 (charset = _fallcCreateDefaultCharSet(name, ""))) {
432 _fallcAddCharSet(charset);
439 read_charset_define(lcd,gen)
441 XLCdGenericPart *gen;
444 char csd[16],cset_name[256];
451 for(i=0;;i++){ /* loop start */
453 sprintf(csd, "csd%d", i);
456 sprintf(name, "%s.%s", csd , "charset_name");
457 _fallcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
458 dbg_printValue(name,value,num);
460 snprintf(cset_name, sizeof(cset_name), "%s", value[0]);
461 snprintf(name, sizeof(name), "%s.%s", csd , "side");
462 _fallcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
464 dbg_printValue(name,value,num);
465 if( !_fallcNCompareISOLatin1(value[0], "none", 4) ){
467 strcat(cset_name,":none");
469 if( !_fallcNCompareISOLatin1(value[0], "GL", 2) ){
471 strcat(cset_name,":GL");
474 strcat(cset_name,":GR");
476 if (charsetd == NULL &&
477 (charsetd = srch_charset_define(cset_name,&new)) == NULL)
488 tmp = (char *)Xmalloc(strlen(cset_name)+1);
492 strcpy(tmp,cset_name);
493 charsetd->name = tmp;
496 charsetd->side = side ;
498 snprintf(name, sizeof(name), "%s.%s", csd , "length");
499 _fallcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
501 dbg_printValue(name,value,num);
502 charsetd->char_size = atoi(value[0]);
505 snprintf(name, sizeof(name), "%s.%s", csd , "gc_number");
506 _fallcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
508 dbg_printValue(name,value,num);
509 charsetd->set_size = atoi(value[0]);
511 /* string_encoding */
512 snprintf(name, sizeof(name), "%s.%s", csd , "string_encoding");
513 _fallcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
515 dbg_printValue(name,value,num);
516 if(!strcmp("False",value[0])){
517 charsetd->string_encoding = False;
519 charsetd->string_encoding = True;
523 snprintf(name, sizeof(name), "%s.%s", csd , "sequence");
524 _fallcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
526 dbg_printValue(name,value,num);
528 if(charsetd->ct_sequence){
529 Xfree(charsetd->ct_sequence);
532 tmp = (char *)Xmalloc(strlen(value[0])+1);
536 charsetd->ct_sequence = tmp;
537 string_to_encoding(value[0],tmp);
540 snprintf(name, sizeof(name), "%s.%s", csd , "encoding_name");
541 _fallcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num);
543 dbg_printValue(name,value,num);
545 if(charsetd->encoding_name){
546 Xfree(charsetd->encoding_name);
549 tmp = (char *)Xmalloc(strlen(value[0]) + 1);
550 strcpy(tmp,value[0]);
551 charsetd->encoding_name = tmp;
552 charsetd->xrm_encoding_name =
553 falrmStringToQuark(tmp);
560 faladd_conversion(gen)
561 XLCdGenericPart *gen;
566 if (num = gen->segment_conv_num){
567 new_list = (SegConv) Xrealloc(gen->segment_conv,
568 (num + 1) * sizeof(SegConvRec));
570 new_list = (SegConv) Xmalloc(sizeof(SegConvRec));
573 if (new_list == NULL)
576 gen->segment_conv = new_list;
577 gen->segment_conv_num = num + 1;
579 return (&new_list[num]);
583 read_segmentconversion(lcd,gen)
585 XLCdGenericPart *gen;
593 for(i=0 ; ; i++){ /* loop start */
595 sprintf(conv, "conv%d", i);
598 sprintf(name, "%s.%s", conv , "length");
599 _fallcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num);
602 if (conversion == NULL &&
603 (conversion = faladd_conversion(gen)) == NULL) {
606 dbg_printValue(name,value,num);
614 conversion->length = atoi(value[0]);
616 /* source_encoding */
617 sprintf(name, "%s.%s", conv , "source_encoding");
618 _fallcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num);
621 dbg_printValue(name,value,num);
622 tmp = (char *)Xmalloc(strlen(value[0])+1);
626 strcpy(tmp,value[0]);
627 conversion->source_encoding = tmp;
628 conversion->source = srch_charset_define(tmp,&new);
630 tmp = (char *)Xmalloc(strlen(conversion->source_encoding)+1);
634 strcpy(tmp,conversion->source_encoding);
635 conversion->source->name = tmp;
638 /* destination_encoding */
639 sprintf(name, "%s.%s", conv , "destination_encoding");
640 _fallcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num);
643 dbg_printValue(name,value,num);
644 tmp = (char *)Xmalloc(strlen(value[0])+1);
648 strcpy(tmp,value[0]);
649 conversion->destination_encoding = tmp;
650 conversion->dest = srch_charset_define(tmp,&new);
652 tmp = (char *)Xmalloc(
653 strlen(conversion->destination_encoding)+1);
657 strcpy(tmp,conversion->destination_encoding);
658 conversion->dest->name = tmp;
662 sprintf(name, "%s.%s", conv , "range");
663 _fallcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num);
666 dbg_printValue(name,value,num);
667 sscanf(value[0],"\\x%lx,\\x%lx",
668 &(conversion->range.start),
669 &(conversion->range.end));
672 sprintf(name, "%s.%s", conv , "conversion");
673 _fallcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num);
676 dbg_printValue(name,value,num);
678 falparse_scopemaps(value[0],&conversion->conv_num);
685 static ExtdSegment create_ctextseg(value,num)
690 char side_str[128],*ptr;
691 char cset_name[128],*tmp;
694 ret = (ExtdSegment)Xmalloc(sizeof(ExtdSegmentRec));
698 if(strchr(value[0],':')){
699 ret->name = (char *)Xmalloc(strlen(value[0])+1);
700 if(ret->name == NULL){
704 strcpy(ret->name,value[0]);
705 ptr = strchr(ret->name,':');
708 if( !_fallcNCompareISOLatin1(ptr, "none", 4) ){
709 ret->side = XlcNONE ;
710 snprintf(cset_name,sizeof(cset_name),"%s:%s",ret->name,"none");
712 if( !_fallcNCompareISOLatin1(ptr, "GL", 2) ){
714 snprintf(cset_name,sizeof(cset_name),"%s:%s",ret->name,"GL");
717 snprintf(cset_name,sizeof(cset_name),"%s:%s",ret->name,"GR");
720 ret->name = (char *)Xmalloc(strlen(value[0])+1);
721 if(ret->name == NULL){
725 strcpy(ret->name,value[0]);
727 ret->area = (FontScope)Xmalloc((num - 1)*sizeof(FontScopeRec));
728 if(ret->area == NULL){
733 ret->area_num = num - 1;
736 sscanf(value[i],"\\x%lx,\\x%lx", &scope[i-1].start, &scope[i-1].end);
738 ret->charset = srch_charset_define(cset_name,&new);
740 tmp = (char *)Xmalloc(strlen(cset_name)+1);
747 strcpy(tmp,cset_name);
748 ret->charset->name = tmp;
758 XLCdGenericPart *gen = XLC_GENERIC_PART(lcd);
765 gen->codeset_num = 0;
767 /***** wc_encoding_mask *****/
768 _fallcGetResource(lcd, "XLC_XLOCALE", "wc_encoding_mask", &value, &num);
770 if (string_to_ulong(value[0], &l) == False)
772 gen->wc_encode_mask = l;
774 /***** wc_shift_bits *****/
775 _fallcGetResource(lcd, "XLC_XLOCALE", "wc_shift_bits", &value, &num);
777 gen->wc_shift_bits = atoi(value[0]);
778 if (gen->wc_shift_bits < 1)
779 gen->wc_shift_bits = 8;
780 #ifndef X_NOT_STDC_ENV
781 /***** use_stdc_env *****/
782 _fallcGetResource(lcd, "XLC_XLOCALE", "use_stdc_env", &value, &num);
783 if (num > 0 && !_fallcCompareISOLatin1(value[0], "True"))
784 gen->use_stdc_env = True;
786 gen->use_stdc_env = False;
787 /***** force_convert_to_mb *****/
788 _fallcGetResource(lcd, "XLC_XLOCALE", "force_convert_to_mb", &value, &num);
789 if (num > 0 && !_fallcCompareISOLatin1(value[0], "True"))
790 gen->force_convert_to_mb = True;
792 gen->force_convert_to_mb = False;
796 CodeSetRec *codeset = NULL;
800 sprintf(cs, "cs%d", i);
802 /***** codeset.side *****/
803 sprintf(name, "%s.%s", cs , "side");
804 _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
808 if (codeset == NULL && (codeset = add_codeset(gen)) == NULL)
812 if( !_fallcNCompareISOLatin1(value[0], "none", 4) ){
813 codeset->side = XlcNONE ;
815 if( !_fallcNCompareISOLatin1(value[0], "GL", 2) ){
816 codeset->side = XlcGL ;
818 codeset->side = XlcGR ;
821 tmp = strrchr(value[0], ':');
822 if (tmp != NULL && !_fallcCompareISOLatin1(tmp + 1, "Default")) {
823 if (codeset->side == XlcGR)
824 gen->initial_state_GR = codeset;
826 gen->initial_state_GL = codeset;
830 /***** codeset.length *****/
831 sprintf(name, "%s.%s", cs , "length");
832 _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
834 if (codeset == NULL && (codeset = add_codeset(gen)) == NULL)
836 codeset->length = atoi(value[0]);
837 if (codeset->length < 1)
841 /***** codeset.mb_encoding *****/
842 sprintf(name, "%s.%s", cs, "mb_encoding");
843 _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
856 if (codeset == NULL && (codeset = add_codeset(gen)) == NULL)
858 for ( ; num-- > 0; value++) {
861 int type = E_SS; /* for BC */
862 for (j = 0; shifts[j].str; j++) {
863 if (!_fallcNCompareISOLatin1(tmp, shifts[j].str,
864 strlen(shifts[j].str))) {
865 type = shifts[j].type;
866 tmp += strlen(shifts[j].str);
870 if (string_to_encoding(tmp, encoding) == False)
872 add_parse_list(gen, type, encoding, codeset);
876 /***** codeset.wc_encoding *****/
877 sprintf(name, "%s.%s", cs, "wc_encoding");
878 _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
880 if (codeset == NULL && (codeset = add_codeset(gen)) == NULL)
882 if (string_to_ulong(value[0], &l) == False)
884 codeset->wc_encoding = l;
887 /***** codeset.ct_encoding *****/
888 sprintf(name, "%s.%s", cs, "ct_encoding");
889 _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
894 if (codeset == NULL && (codeset = add_codeset(gen)) == NULL)
896 for ( ; num-- > 0; value++) {
897 string_to_encoding(*value, name);
899 if ((encoding = strchr(name, ':')) &&
900 (encoding = strchr(encoding + 1, ':'))) {
902 charset = _fallcAddCT(name, encoding);
904 if (charset == NULL) {
905 charset = _fallcGetCharSet(name);
906 if (charset == NULL &&
907 (charset = _fallcCreateDefaultCharSet(name, ""))) {
908 charset->side = codeset->side;
909 charset->char_size = codeset->length;
910 _fallcAddCharSet(charset);
914 if (add_charset(codeset, charset) == False)
924 /***** 3.4.2 byteM (1 <= M <= length)*****/
925 for(M=1; M-1 < codeset->length; M++){
929 sprintf(name,"%s.%s%d",cs,"byte",M);
930 _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
934 codeset->byteM = NULL ;
938 (ByteInfoListRec *)Xmalloc(
939 (codeset->length)*sizeof(ByteInfoListRec));
940 if(codeset->byteM == NULL){
946 dbg_printValue(name,value,num);
947 (codeset->byteM)[M-1].M = M;
948 (codeset->byteM)[M-1].byteinfo_num = num;
949 (codeset->byteM)[M-1].byteinfo =
950 (ByteInfo)Xmalloc( num * sizeof(ByteInfoRec));
951 for(ii = 0 ; ii < num ; ii++){
953 tmpb = (codeset->byteM)[M-1].byteinfo ;
954 /* default 0x00 - 0xff */
955 sscanf(value[ii], "\\x%lx,\\x%lx", (long unsigned *) &start, (long unsigned *) &end);
956 tmpb[ii].start = (unsigned char)start;
957 tmpb[ii].end = (unsigned char)end;
964 /***** codeset.mb_conversion *****/
965 sprintf(name, "%s.%s", cs, "mb_conversion");
966 _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
968 dbg_printValue(name,value,num);
969 codeset->mbconv = Xmalloc(sizeof(ConversionRec));
970 codeset->mbconv->convlist =
971 falparse_scopemaps(value[0],&(codeset->mbconv->conv_num));
972 dmpscope("mb_conv",codeset->mbconv->convlist,
973 codeset->mbconv->conv_num);
974 /* [\x%x,\x%x]->\x%x,... */
976 /***** codeset.ct_conversion *****/
977 sprintf(name, "%s.%s", cs, "ct_conversion");
978 _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
980 dbg_printValue(name,value,num);
981 codeset->ctconv = Xmalloc(sizeof(ConversionRec));
982 codeset->ctconv->convlist =
983 falparse_scopemaps(value[0],&(codeset->ctconv->conv_num));
984 dmpscope("ctconv",codeset->ctconv->convlist,
985 codeset->ctconv->conv_num);
986 /* [\x%x,\x%x]->\x%x,... */
988 /***** codeset.ct_conversion_file *****/
989 sprintf(name, "%s.%s", cs, "ct_conversion_file");
990 _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
992 dbg_printValue(name,value,num);
993 /* [\x%x,\x%x]->\x%x,... */
995 /***** codeset.ct_extended_segment *****/
996 sprintf(name, "%s.%s", cs, "ct_extended_segment");
997 _fallcGetResource(lcd, "XLC_XLOCALE", name, &value, &num);
999 dbg_printValue(name,value,num);
1000 codeset->ctextseg = create_ctextseg(value,num);
1001 /* [\x%x,\x%x]->\x%x,... */
1003 /* For VW/UDC end */
1007 read_charset_define(lcd,gen); /* For VW/UDC */
1008 read_segmentconversion(lcd,gen); /* For VW/UDC */
1022 XLCdPublicMethods superclass = (XLCdPublicMethods) _fallcPublicMethods;
1024 XLC_PUBLIC_METHODS(lcd)->superclass = superclass;
1026 if (superclass->pub.initialize) {
1027 if ((*superclass->pub.initialize)(lcd) == False)
1031 if(load_generic(lcd) == False)
1036 /* VW/UDC start 95.01.08 */
1043 if(codeset->byteM == NULL) {
1046 blst = codeset->byteM;
1047 for(i=0;i<codeset->length;i++){
1048 if(blst[i].byteinfo){
1049 Xfree(blst[i].byteinfo);
1050 blst[i].byteinfo = NULL;
1053 Xfree(codeset->byteM);
1054 codeset->byteM = NULL;
1057 freeConversion(codeset)
1061 Conversion mbconv,ctconv;
1062 if( codeset->mbconv ) {
1063 mbconv = codeset->mbconv;
1065 if(mbconv->convlist){
1066 Xfree(mbconv->convlist);
1067 mbconv->convlist = NULL;
1070 codeset->mbconv = NULL;
1072 if( codeset->ctconv ) {
1073 ctconv = codeset->ctconv;
1075 if(ctconv->convlist){
1076 Xfree(ctconv->convlist);
1077 ctconv->convlist = NULL;
1080 codeset->ctconv = NULL;
1084 freeExtdSegment(codeset)
1088 ExtdSegment ctextseg;
1089 if(codeset->ctextseg == NULL) {
1092 ctextseg = codeset->ctextseg;
1094 Xfree(ctextseg->name);
1095 ctextseg->name = NULL;
1098 Xfree(ctextseg->area);
1099 ctextseg->area = NULL;
1101 Xfree(codeset->ctextseg);
1102 codeset->ctextseg = NULL;
1105 freeParseInfo(codeset)
1109 ParseInfo parse_info;
1110 if(codeset->parse_info == NULL) {
1113 parse_info = codeset->parse_info;
1114 if(parse_info->encoding){
1115 Xfree(parse_info->encoding);
1116 parse_info->encoding = NULL;
1118 Xfree(codeset->parse_info);
1119 codeset->parse_info = NULL;
1122 destroy_CodeSetList(gen)
1123 XLCdGenericPart *gen ;
1125 CodeSet *codeset = gen->codeset_list;
1127 if(gen->codeset_num == 0) {
1130 for(i=0;i<gen->codeset_num;i++){
1131 freeByteM(codeset[i]);
1132 freeConversion(codeset[i]);
1133 freeExtdSegment(codeset[i]);
1134 freeParseInfo(codeset[i]);
1135 if(codeset[i]->charset_list){
1136 Xfree(codeset[i]->charset_list);
1137 codeset[i]->charset_list = NULL;
1139 Xfree(codeset[i]); codeset[i]=NULL;
1141 Xfree(codeset); gen->codeset_list = NULL;
1145 destroy_SegConv(gen)
1146 XLCdGenericPart *gen ;
1148 SegConv seg = gen->segment_conv;
1150 if(gen->segment_conv_num == 0) {
1153 for(i=0;i<gen->segment_conv_num;i++){
1154 if(seg[i].source_encoding){
1155 Xfree(seg[i].source_encoding);
1156 seg[i].source_encoding = NULL;
1158 if(seg[i].destination_encoding){
1159 Xfree(seg[i].destination_encoding);
1160 seg[i].destination_encoding = NULL;
1163 Xfree(seg[i].conv); seg[i].conv = NULL;
1166 Xfree(seg); gen->segment_conv = NULL;
1173 XLCdGenericPart *gen = XLC_GENERIC_PART(lcd);
1174 destroy_SegConv(gen);
1175 destroy_CodeSetList(gen);
1176 if(gen->mb_parse_table){
1177 Xfree(gen->mb_parse_table);
1178 gen->mb_parse_table = NULL;
1180 if(gen->mb_parse_list){
1181 Xfree(gen->mb_parse_list);
1182 gen->mb_parse_list = NULL;
1185 /* VW/UDC end 95.01.08 */
1190 XLCdPublicMethods superclass = XLC_PUBLIC_METHODS(lcd)->superclass;
1192 destroy_gen(lcd); /* ADD 1996.01.08 */
1193 if (superclass && superclass->pub.destroy)
1194 (*superclass->pub.destroy)(lcd);