|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T X
Length: 5049 (0x13b9) Types: TextFile Names: »XCnvCTToWC.3«
└─⟦276d19d6e⟧ Bits:30007243 EUUGD5_I: X11R5 └─⟦4856bf7e7⟧ »./mit-4/mit-4.00« └─⟦635ff9e7e⟧ └─⟦this⟧ »mit/doc/I18N/Xsi/Xlc/XCnvCTToWC.3«
.\" $Header: XCnvCTToWC.3,v 1.4 91/02/04 09:35:26 morisaki Exp $ .\" $Date: 91/02/04 09:35:26 $ .\" Copyright 1990, 1991 by OMRON Corporation. .\" Copyright 1991 by the Massachusetts Institute of Technology. .TH Xlocale 3X11 "" "June 30, 1990" .SH NAME .B XConvertCTToWC \- conversion from CT string to WC string. .SH SYNOPSIS .B int XConvertCTToWC\f2(ct_str, ct_bytes, wc_str, wc_len, .br .B \f2scanned_bytes, isostate) .br .B char \f2*ct_str\f3; .br .B int \f2ct_bytes\f3; .br .B wchar \f2*wc_str\f3; .br .B int \f2*wc_len\f3; .br .B int \f2*scanned_bytes\f3; .br .B char \f2**isostate\f3; .br .SH ARGUMENTS .IP \fIct_str\fP 1i In: CT string. .br .IP \fIct_bytes\fP 1i In: length of CT strings, counted in bytes. .br .IP \fIwc_str\fP 1i Out: conversion buffer of result wchar string. .br .IP \fIwc_len\fP 1i In/Out: as "In" it is length of buffer wc_str passed by caller; as "Out" it is the returned number of converted wchars. .br .IP \fIscanned_bytes\fP 1i Number of CT bytes converted when the function returns. .br .IP \fIisostate\fP 1i In/Out: as "In" it is the state at the beginning of the CT string; as "Out" it is the current state stopped at last converted CT encoding. The state is defined internally by Xlib. If this pointer is null, the function will assume the state to be the default CT state. Of course, nothing will be put in the null pointer. Do not modify or free this data .br .SH DESCRIPTION The .B XConvertCTToWC converts the string encoded in CT to string encoded in wchar. After a successful conversion, the null character WNULL will be appended to wc_str if there is room for it in the buffer. The terminator WNULL of wchar string is not counted in length of output buffer wc_len. .PP The returned isostate will point to a state of the encoding in the internal table, so do not modify or free this pointer. .PP When function returns at any time, scanned_bytes always remembers where stopped, and isostate always remembers the current CT state if it is not null pointer. .PP The caller of this funcion has to provide the output buffer wc_str, and store the buffer length(in wchars) into wc_len as input. By using scanned_bytes and isostate, the caller can break a large CT string into pieces, and convert one piece at a time. .PP In other hand caller can pass any broken CT string to this function for doing conversion. For example, caller can still be trying of conversion when the error BadBuffer is occurred(output buffer was exhausted). Usually, the application passes the NULL to isostate for first conversion as the following: .IP "" " " char *isostate = NULL; .br \f3XmbConvertCTToCCS(ct_str, ct_len, mb_str, &mb_len, &scanned, &isostate)\f2 .PP The conversion function returns the value of variable isostate to use for the conversion of the next unconverted piece of the same string. And so on. .PP If the value of isostate is invalid or null-pointer, the function will suppose the default state of CT as initial. The default state of CT is defined in 3 cases of encoding: .IP "" 2 1\. no control sequence, GL and GR of Latin-1 is supposed. .IP 2\. control sequence of Latin-1 GL only, GR of Latin-1 is supposed too. .IP 3\. control sequence of Latin-2 GR only, GL of Latin-1 is supposed too. .PP The function returns the BadBuffer meaning that the output buffer wc_str was exhausted. The function returns the BadTerminate meaning that the CT string ct_str is terminated uncompletely, e.g., uncompleted ESC sequence or uncompleted code point ended at tail of ct_str. .PP Only in both the case of BadBuffer and BadTerminate the caller can move pointer ct_str to (ct_str + *scanned_bytes), then continue to do conversion. And function ensure that the wc_str stores the already converted wchar string; wc_len counts the number of them in wchars(not bytes); the isostate stores the last state of encoding. .PP The function returns a number greate than zero meaning a number of wrong codepoints recovered by the funcition. The wrong codepoint will be recovered with the first codepoint of the charset at which the wrong codepoint occurs. After replaced, the function will continue to do conversion untill one of the results Success, BadTerminate, BadBuffer or BadEncoding is met. .PP The funcition returns BadEncoding meaning for unrecoverable wrong code which is actually wrong escape sequence, or not registered by system yet. .PP Both the null character and ct_bytes will terminate the conversion. .PP All error status are defined to be less than zero, i.e.: .IP "" 2 #define Success 0 .IP #define BadBuffer -1 .IP #define BadTerminate -2 .IP #define BadEncoding -3 .SH RETURNED VALUE The .B XConvertCTToWC will return the following values: .TP .B Success successful conversion. .TP .B BadBuffer output buffer(wc_str) was exhausted. .TP .B BadTerminate .TP .B BadEncoding wrong escape sequence function can not recover. .TP .B "> 0" unconvertable compound text was met. .SH SEE ALSO Refer to "CT and WC" for their definitions.