| OLD | NEW |
| 1 /* | 1 /* |
| 2 ****************************************************************************** | 2 ****************************************************************************** |
| 3 * | 3 * |
| 4 * Copyright (C) 1998-2013, International Business Machines | 4 * Copyright (C) 1998-2014, International Business Machines |
| 5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
| 6 * | 6 * |
| 7 ****************************************************************************** | 7 ****************************************************************************** |
| 8 * | 8 * |
| 9 * File ustdio.h | 9 * File ustdio.h |
| 10 * | 10 * |
| 11 * Modification History: | 11 * Modification History: |
| 12 * | 12 * |
| 13 * Date Name Description | 13 * Date Name Description |
| 14 * 10/16/98 stephen Creation. | 14 * 10/16/98 stephen Creation. |
| 15 * 11/06/98 stephen Modified per code review. | 15 * 11/06/98 stephen Modified per code review. |
| 16 * 03/12/99 stephen Modified for new C API. | 16 * 03/12/99 stephen Modified for new C API. |
| 17 * 07/19/99 stephen Minor doc update. | 17 * 07/19/99 stephen Minor doc update. |
| 18 * 02/01/01 george Added sprintf & sscanf with all of its variants | 18 * 02/01/01 george Added sprintf & sscanf with all of its variants |
| 19 ****************************************************************************** | 19 ****************************************************************************** |
| 20 */ | 20 */ |
| 21 | 21 |
| 22 #ifndef USTDIO_H | 22 #ifndef USTDIO_H |
| 23 #define USTDIO_H | 23 #define USTDIO_H |
| 24 | 24 |
| 25 #include <stdio.h> | 25 #include <stdio.h> |
| 26 #include <stdarg.h> | 26 #include <stdarg.h> |
| 27 | 27 |
| 28 #include "unicode/utypes.h" | 28 #include "unicode/utypes.h" |
| 29 #include "unicode/ucnv.h" | 29 #include "unicode/ucnv.h" |
| 30 #include "unicode/utrans.h" | 30 #include "unicode/utrans.h" |
| 31 #include "unicode/localpointer.h" | 31 #include "unicode/localpointer.h" |
| 32 #include "unicode/unum.h" | 32 #include "unicode/unum.h" |
| 33 | 33 |
| 34 #if !UCONFIG_NO_CONVERSION |
| 35 |
| 34 /* | 36 /* |
| 35 TODO | 37 TODO |
| 36 The following is a small list as to what is currently wrong/suggestions for | 38 The following is a small list as to what is currently wrong/suggestions for |
| 37 ustdio. | 39 ustdio. |
| 38 | 40 |
| 39 * Make sure that * in the scanf format specification works for all formats. | 41 * Make sure that * in the scanf format specification works for all formats. |
| 40 * Each UFILE takes up at least 2KB. | 42 * Each UFILE takes up at least 2KB. |
| 41 Look into adding setvbuf() for configurable buffers. | 43 Look into adding setvbuf() for configurable buffers. |
| 42 * This library does buffering. The OS should do this for us already. Check on | 44 * This library does buffering. The OS should do this for us already. Check on |
| 43 this, and remove it from this library, if this is the case. Double buffering | 45 this, and remove it from this library, if this is the case. Double buffering |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 * will be used. | 236 * will be used. |
| 235 * @return A new UFILE, or NULL if an error occurred. | 237 * @return A new UFILE, or NULL if an error occurred. |
| 236 * @stable ICU 3.0 | 238 * @stable ICU 3.0 |
| 237 */ | 239 */ |
| 238 U_STABLE UFILE* U_EXPORT2 | 240 U_STABLE UFILE* U_EXPORT2 |
| 239 u_fopen(const char *filename, | 241 u_fopen(const char *filename, |
| 240 const char *perm, | 242 const char *perm, |
| 241 const char *locale, | 243 const char *locale, |
| 242 const char *codepage); | 244 const char *codepage); |
| 243 | 245 |
| 246 #ifndef U_HIDE_DRAFT_API |
| 247 /** |
| 248 * Open a UFILE with a UChar* filename |
| 249 * A UFILE is a wrapper around a FILE* that is locale and codepage aware. |
| 250 * That is, data written to a UFILE will be formatted using the conventions |
| 251 * specified by that UFILE's Locale; this data will be in the character set |
| 252 * specified by that UFILE's codepage. |
| 253 * @param filename The name of the file to open. |
| 254 * @param perm The read/write permission for the UFILE; one of "r", "w", "rw" |
| 255 * @param locale The locale whose conventions will be used to format |
| 256 * and parse output. If this parameter is NULL, the default locale will |
| 257 * be used. |
| 258 * @param codepage The codepage in which data will be written to and |
| 259 * read from the file. If this paramter is NULL the system default codepage |
| 260 * will be used. |
| 261 * @return A new UFILE, or NULL if an error occurred. |
| 262 * @draft ICU 54 |
| 263 */ |
| 264 U_DRAFT UFILE* U_EXPORT2 |
| 265 u_fopen_u(const UChar *filename, |
| 266 const char *perm, |
| 267 const char *locale, |
| 268 const char *codepage); |
| 269 #endif /* U_HIDE_DRAFT_API */ |
| 270 |
| 244 /** | 271 /** |
| 245 * Open a UFILE on top of an existing FILE* stream. The FILE* stream | 272 * Open a UFILE on top of an existing FILE* stream. The FILE* stream |
| 246 * ownership remains with the caller. To have the UFILE take over | 273 * ownership remains with the caller. To have the UFILE take over |
| 247 * ownership and responsibility for the FILE* stream, use the | 274 * ownership and responsibility for the FILE* stream, use the |
| 248 * function u_fadopt. | 275 * function u_fadopt. |
| 249 * @param f The FILE* to which this UFILE will attach and use. | 276 * @param f The FILE* to which this UFILE will attach and use. |
| 250 * @param locale The locale whose conventions will be used to format | 277 * @param locale The locale whose conventions will be used to format |
| 251 * and parse output. If this parameter is NULL, the default locale will | 278 * and parse output. If this parameter is NULL, the default locale will |
| 252 * be used. | 279 * be used. |
| 253 * @param codepage The codepage in which data will be written to and | 280 * @param codepage The codepage in which data will be written to and |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 | 459 |
| 433 /** | 460 /** |
| 434 * Returns an alias to the converter being used for this file. | 461 * Returns an alias to the converter being used for this file. |
| 435 * @param f The UFILE to get the value from | 462 * @param f The UFILE to get the value from |
| 436 * @return alias to the converter (The converter <EM>must not</EM> be modified o
r closed) | 463 * @return alias to the converter (The converter <EM>must not</EM> be modified o
r closed) |
| 437 * @stable ICU 3.0 | 464 * @stable ICU 3.0 |
| 438 */ | 465 */ |
| 439 U_STABLE UConverter* U_EXPORT2 u_fgetConverter(UFILE *f); | 466 U_STABLE UConverter* U_EXPORT2 u_fgetConverter(UFILE *f); |
| 440 | 467 |
| 441 #if !UCONFIG_NO_FORMATTING | 468 #if !UCONFIG_NO_FORMATTING |
| 442 #ifndef U_HIDE_DRAFT_API | |
| 443 /** | 469 /** |
| 444 * Returns an alias to the number formatter being used for this file. | 470 * Returns an alias to the number formatter being used for this file. |
| 445 * @param f The UFILE to get the value from | 471 * @param f The UFILE to get the value from |
| 446 * @return alias to the number formatter (The formatter <EM>must not</EM> be mod
ified or closed) | 472 * @return alias to the number formatter (The formatter <EM>must not</EM> be mod
ified or closed) |
| 447 * @draft ICU 51 | 473 * @stable ICU 51 |
| 448 */ | 474 */ |
| 449 U_DRAFT const UNumberFormat* U_EXPORT2 u_fgetNumberFormat(UFILE *f); | 475 U_STABLE const UNumberFormat* U_EXPORT2 u_fgetNumberFormat(UFILE *f); |
| 450 #endif /* U_HIDE_DRAFT_API */ | |
| 451 | 476 |
| 452 /* Output functions */ | 477 /* Output functions */ |
| 453 | 478 |
| 454 /** | 479 /** |
| 455 * Write formatted data to <TT>stdout</TT>. | 480 * Write formatted data to <TT>stdout</TT>. |
| 456 * @param patternSpecification A pattern specifying how <TT>u_printf</TT> will | 481 * @param patternSpecification A pattern specifying how <TT>u_printf</TT> will |
| 457 * interpret the variable arguments received and format the data. | 482 * interpret the variable arguments received and format the data. |
| 458 * @return The number of Unicode characters written to <TT>stdout</TT> | 483 * @return The number of Unicode characters written to <TT>stdout</TT> |
| 459 * @stable ICU 49 | 484 * @stable ICU 49 |
| 460 */ | 485 */ |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 978 * @return The number of items successfully converted and assigned, or EOF | 1003 * @return The number of items successfully converted and assigned, or EOF |
| 979 * if an error occurred. | 1004 * if an error occurred. |
| 980 * @see u_sscanf_u | 1005 * @see u_sscanf_u |
| 981 * @stable ICU 3.0 | 1006 * @stable ICU 3.0 |
| 982 */ | 1007 */ |
| 983 U_STABLE int32_t U_EXPORT2 | 1008 U_STABLE int32_t U_EXPORT2 |
| 984 u_vsscanf_u(const UChar *buffer, | 1009 u_vsscanf_u(const UChar *buffer, |
| 985 const UChar *patternSpecification, | 1010 const UChar *patternSpecification, |
| 986 va_list ap); | 1011 va_list ap); |
| 987 | 1012 |
| 1013 |
| 1014 #endif |
| 988 #endif | 1015 #endif |
| 989 #endif | 1016 #endif |
| 990 | 1017 |
| 991 | 1018 |
| OLD | NEW |