diff options
author | Victor Chang <vichang@google.com> | 2021-07-29 16:19:18 +0100 |
---|---|---|
committer | Victor Chang <vichang@google.com> | 2021-07-30 13:11:53 +0100 |
commit | 9f5274665411978bff58fd31361be24b71201e7c (patch) | |
tree | 8fb05e45f8bf5a91a4702b6f6fe8e1771a463eb6 /tools | |
parent | 23d9f7a23793a0b009a5afd05af253b7ee1d941b (diff) | |
download | icu-9f5274665411978bff58fd31361be24b71201e7c.tar.gz |
Modify the docs to generate a correct NDK API refernece pages
- Add @addtogroup annotation to each header file. This is required to
show the header and all its functions in the NDK API reference page
- Implement ALIASES from Doxyfile by regex in generate_ndk.py
Bug: 168242257
Test: Manually verify the visible content generated from development/tools/ndk/build_ndk_docs.py
Change-Id: I14b97259e0cf9a62e387b2e439beba5266771cc1
Diffstat (limited to 'tools')
4 files changed, 179 insertions, 105 deletions
diff --git a/tools/icu4c_srcgen/doc_patches/patches/unicode/uloc.h.patch b/tools/icu4c_srcgen/doc_patches/patches/unicode/uloc.h.patch index 5c60e81ca..c9f87aec6 100644 --- a/tools/icu4c_srcgen/doc_patches/patches/unicode/uloc.h.patch +++ b/tools/icu4c_srcgen/doc_patches/patches/unicode/uloc.h.patch @@ -1,5 +1,5 @@ ---- libicu/ndk_headers/unicode/uloc.h 2021-01-19 16:37:46.343488297 +0000 -+++ libicu/ndk_headers/unicode/uloc.h 2021-01-19 16:37:46.447489035 +0000 +--- libicu/ndk_headers/unicode/uloc.h 2021-07-29 18:38:27.301302935 +0100 ++++ libicu/ndk_headers/unicode/uloc.h 2021-07-29 18:38:27.461304332 +0100 @@ -368,6 +368,9 @@ * and unchanged even when uloc_setDefault() is called. * The returned storage is owned by ICU, and must not be altered or deleted @@ -9,4 +9,4 @@ + * java.util.Locale#setDefault in java or by reverse JNI. * * @return the ICU default locale - * @system + * \xrefitem system "System" "System List" Do not use unless you know what you are doing. diff --git a/tools/icu4c_srcgen/doc_patches/patches/unicode/ulocdata.h.patch b/tools/icu4c_srcgen/doc_patches/patches/unicode/ulocdata.h.patch index 11f79b89c..08b925fca 100644 --- a/tools/icu4c_srcgen/doc_patches/patches/unicode/ulocdata.h.patch +++ b/tools/icu4c_srcgen/doc_patches/patches/unicode/ulocdata.h.patch @@ -1,63 +1,63 @@ ---- libicu/ndk_headers/unicode/ulocdata.h 2021-02-10 23:39:51.609654012 +0000 -+++ libicu/ndk_headers/unicode/ulocdata.h 2021-02-10 23:39:51.837655519 +0000 -@@ -21,87 +21,11 @@ +--- libicu/ndk_headers/unicode/ulocdata.h 2021-07-29 18:38:27.377303598 +0100 ++++ libicu/ndk_headers/unicode/ulocdata.h 2021-07-29 18:38:27.497304646 +0100 +@@ -21,16 +21,7 @@ #include "unicode/uloc.h" -#if U_SHOW_CPLUSPLUS_API -#include "unicode/localpointer.h" -#endif // U_SHOW_CPLUSPLUS_API -- + -/** +- * @addtogroup ICU4C +- * @{ - * \file - * \brief C API: Provides access to locale data. - */ -- --/** Forward declaration of the ULocaleData structure. @stable ICU 3.6 */ --struct ULocaleData; -- --/** A locale data object. @stable ICU 3.6 */ --typedef struct ULocaleData ULocaleData; -- -- -- + + /** Forward declaration of the ULocaleData structure. \xrefitem stable "Stable" "Stable List" ICU 3.6 */ + struct ULocaleData; +@@ -40,70 +31,15 @@ + + + -/** The possible types of exemplar character sets. -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ -typedef enum ULocaleDataExemplarSetType { -- /** Basic set @stable ICU 3.4 */ +- /** Basic set \xrefitem stable "Stable" "Stable List" ICU 3.4 */ - ULOCDATA_ES_STANDARD=0, -- /** Auxiliary set @stable ICU 3.4 */ +- /** Auxiliary set \xrefitem stable "Stable" "Stable List" ICU 3.4 */ - ULOCDATA_ES_AUXILIARY=1, -- /** Index Character set @stable ICU 4.8 */ +- /** Index Character set \xrefitem stable "Stable" "Stable List" ICU 4.8 */ - ULOCDATA_ES_INDEX=2, -- /** Punctuation set @stable ICU 51 */ +- /** Punctuation set \xrefitem stable "Stable" "Stable List" ICU 51 */ - ULOCDATA_ES_PUNCTUATION=3, -#ifndef U_HIDE_DEPRECATED_API - /** - * One more than the highest normal ULocaleDataExemplarSetType value. -- * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. +- * \xrefitem deprecated "Deprecated" "Deprecated List" ICU 58 The numeric value may change over time, see ICU ticket #12420. - */ - ULOCDATA_ES_COUNT=4 -#endif /* U_HIDE_DEPRECATED_API */ -} ULocaleDataExemplarSetType; - -/** The possible types of delimiters. -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ -typedef enum ULocaleDataDelimiterType { -- /** Quotation start @stable ICU 3.4 */ +- /** Quotation start \xrefitem stable "Stable" "Stable List" ICU 3.4 */ - ULOCDATA_QUOTATION_START = 0, -- /** Quotation end @stable ICU 3.4 */ +- /** Quotation end \xrefitem stable "Stable" "Stable List" ICU 3.4 */ - ULOCDATA_QUOTATION_END = 1, -- /** Alternate quotation start @stable ICU 3.4 */ +- /** Alternate quotation start \xrefitem stable "Stable" "Stable List" ICU 3.4 */ - ULOCDATA_ALT_QUOTATION_START = 2, -- /** Alternate quotation end @stable ICU 3.4 */ +- /** Alternate quotation end \xrefitem stable "Stable" "Stable List" ICU 3.4 */ - ULOCDATA_ALT_QUOTATION_END = 3, -#ifndef U_HIDE_DEPRECATED_API - /** - * One more than the highest normal ULocaleDataDelimiterType value. -- * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. +- * \xrefitem deprecated "Deprecated" "Deprecated List" ICU 58 The numeric value may change over time, see ICU ticket #12420. - */ - ULOCDATA_DELIMITER_COUNT = 4 -#endif /* U_HIDE_DEPRECATED_API */ @@ -68,9 +68,9 @@ -#if U_SHOW_CPLUSPLUS_API -- + -U_NAMESPACE_BEGIN -- + -/** - * \class LocalULocaleDataPointer - * "Smart pointer" class, closes a ULocaleData via ulocdata_close(). @@ -78,36 +78,45 @@ - * - * @see LocalPointerBase - * @see LocalPointer -- * @stable ICU 4.4 +- * \xrefitem stable "Stable" "Stable List" ICU 4.4 - */ -U_DEFINE_LOCAL_OPEN_POINTER(LocalULocaleDataPointer, ULocaleData, ulocdata_close); -- + -U_NAMESPACE_END -- + -#endif -@@ -111,22 +35,6 @@ +@@ -113,25 +49,6 @@ -/** - * Enumeration for representing the measurement systems. -- * @stable ICU 2.8 +- * \xrefitem stable "Stable" "Stable List" ICU 2.8 - */ -typedef enum UMeasurementSystem { -- UMS_SI, /**< Measurement system specified by SI otherwise known as Metric system. @stable ICU 2.8 */ -- UMS_US, /**< Measurement system followed in the United States of America. @stable ICU 2.8 */ -- UMS_UK, /**< Mix of metric and imperial units used in Great Britain. @stable ICU 55 */ +- UMS_SI, /**< Measurement system specified by SI otherwise known as Metric system. \xrefitem stable "Stable" "Stable List" ICU 2.8 */ +- UMS_US, /**< Measurement system followed in the United States of America. \xrefitem stable "Stable" "Stable List" ICU 2.8 */ +- UMS_UK, /**< Mix of metric and imperial units used in Great Britain. \xrefitem stable "Stable" "Stable List" ICU 55 */ -#ifndef U_HIDE_DEPRECATED_API - /** - * One more than the highest normal UMeasurementSystem value. -- * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420. +- * \xrefitem deprecated "Deprecated" "Deprecated List" ICU 58 The numeric value may change over time, see ICU ticket #12420. - */ - UMS_LIMIT -#endif /* U_HIDE_DEPRECATED_API */ -} UMeasurementSystem; +- +- +- + + /** +@@ -150,5 +67,3 @@ + #endif +- +-/** @} */ // addtogroup diff --git a/tools/icu4c_srcgen/doc_patches/patches/unicode/utext.h.patch b/tools/icu4c_srcgen/doc_patches/patches/unicode/utext.h.patch index d2f760fbc..978a75c5b 100644 --- a/tools/icu4c_srcgen/doc_patches/patches/unicode/utext.h.patch +++ b/tools/icu4c_srcgen/doc_patches/patches/unicode/utext.h.patch @@ -1,6 +1,6 @@ ---- libicu/ndk_headers/unicode/utext.h 2021-02-10 23:39:51.649654277 +0000 -+++ libicu/ndk_headers/unicode/utext.h 2021-02-10 23:39:51.865655704 +0000 -@@ -625,787 +625,6 @@ +--- libicu/ndk_headers/unicode/utext.h 2021-07-29 18:38:27.265302620 +0100 ++++ libicu/ndk_headers/unicode/utext.h 2021-07-29 18:38:27.533304961 +0100 +@@ -627,787 +627,6 @@ @@ -27,7 +27,7 @@ - * Returns U_SENTINEL (-1) if the position is at the end of the - * text. - * -- * @internal ICU 4.4 technology preview +- * \xrefitem internal "Internal" "Internal List" Do not use. This API is for internal use only. ICU 4.4 technology preview - */ -#define UTEXT_CURRENT32(ut) \ - ((ut)->chunkOffset < (ut)->chunkLength && ((ut)->chunkContents)[(ut)->chunkOffset]<0xd800 ? \ @@ -43,7 +43,7 @@ - * Returns U_SENTINEL (-1) if the position is at the end of the - * text. - * -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ -#define UTEXT_NEXT32(ut) \ - ((ut)->chunkOffset < (ut)->chunkLength && ((ut)->chunkContents)[(ut)->chunkOffset]<0xd800 ? \ @@ -57,7 +57,7 @@ - * This is a pre-decrement operation. - * Returns U_SENTINEL (-1) if the position is at the start of the text. - * -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ -#define UTEXT_PREVIOUS32(ut) \ - ((ut)->chunkOffset > 0 && \ @@ -74,7 +74,7 @@ - * the corresponding UChar (UTF-16) index. - * The returned position will always be aligned to a code point boundary. - * -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ -#define UTEXT_GETNATIVEINDEX(ut) \ - ((ut)->chunkOffset <= (ut)->nativeIndexingLimit? \ @@ -90,7 +90,7 @@ - * If the index is out of range, it will be pinned to be within - * the range of the input text. - * -- * @stable ICU 3.8 +- * \xrefitem stable "Stable" "Stable List" ICU 3.8 - */ -#define UTEXT_SETNATIVEINDEX(ut, ix) UPRV_BLOCK_MACRO_BEGIN { \ - int64_t __offset = (ix) - (ut)->chunkNativeStart; \ @@ -132,32 +132,32 @@ - * UText provider properties (bit field indexes). - * - * @see UText -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ -enum { - /** - * It is potentially time consuming for the provider to determine the length of the text. -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ - UTEXT_PROVIDER_LENGTH_IS_EXPENSIVE = 1, - /** - * Text chunks remain valid and usable until the text object is modified or - * deleted, not just until the next time the access() function is called - * (which is the default). -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ - UTEXT_PROVIDER_STABLE_CHUNKS = 2, - /** - * The provider supports modifying the text via the replace() and copy() - * functions. - * @see Replaceable -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ - UTEXT_PROVIDER_WRITABLE = 3, - /** - * There is meta data associated with the text. - * @see Replaceable::hasMetaData() -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ - UTEXT_PROVIDER_HAS_META_DATA = 4, - /** @@ -165,7 +165,7 @@ - * Generally occurs as the result of a deep clone of the UText. - * When closing the UText, the associated text must - * also be closed/deleted/freed/ whatever is appropriate. -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - UTEXT_PROVIDER_OWNS_TEXT = 5 -}; @@ -205,7 +205,7 @@ - * original text. - * @return The newly created clone, or NULL if the clone operation failed. - * -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ -typedef UText * U_CALLCONV -UTextClone(UText *dest, const UText *src, UBool deep, UErrorCode *status); @@ -217,7 +217,7 @@ - * @param ut the UText to get the length of. - * @return the length, in the native units of the original text string. - * @see UText -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ -typedef int64_t U_CALLCONV -UTextNativeLength(UText *ut); @@ -245,7 +245,7 @@ - * (the requested index is out of bounds). - * - * @see UText -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ -typedef UBool U_CALLCONV -UTextAccess(UText *ut, int64_t nativeIndex, UBool forward); @@ -275,7 +275,7 @@ - * preflighting. - * @return Number of UChars in the data. Does not include a trailing NUL. - * -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ -typedef int32_t U_CALLCONV -UTextExtract(UText *ut, @@ -310,7 +310,7 @@ - * @return The signed number of (native) storage units by which - * the length of the text expanded or contracted. - * -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ -typedef int32_t U_CALLCONV -UTextReplace(UText *ut, @@ -344,7 +344,7 @@ - * @param move If true, then the substring is moved, not copied/duplicated. - * @param status receives any error status. Possible errors include U_NO_WRITE_PERMISSION - * -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ -typedef void U_CALLCONV -UTextCopy(UText *ut, @@ -364,7 +364,7 @@ - * @return Absolute (native) index corresponding to chunkOffset in the current chunk. - * The returned native index should always be to a code point boundary. - * -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ -typedef int64_t U_CALLCONV -UTextMapOffsetToNative(const UText *ut); @@ -382,7 +382,7 @@ - * @return Chunk-relative UTF-16 offset corresponding to the specified native - * index. - * -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ -typedef int32_t U_CALLCONV -UTextMapNativeIndexToUTF16(const UText *ut, int64_t nativeIndex); @@ -403,7 +403,7 @@ - * - * @param ut A UText object to be closed. - * -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ -typedef void U_CALLCONV -UTextClose(UText *ut); @@ -416,7 +416,7 @@ - * Each text provider implementation must provide an - * actual table that is initialized with the appropriate functions - * for the type of text being handled. -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ -struct UTextFuncs { - /** @@ -431,23 +431,23 @@ - * 4 pointers, - * 2 64-bit fields - * in sequence. -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - int32_t tableSize; - - /** - * (private) Alignment padding. - * Do not use, reserved for use by the UText framework only. -- * @internal +- * \xrefitem internal "Internal" "Internal List" Do not use. This API is for internal use only. - */ -- int32_t reserved1, /** @internal */ reserved2, /** @internal */ reserved3; +- int32_t reserved1, /** \xrefitem internal "Internal" "Internal List" Do not use. This API is for internal use only. */ reserved2, /** \xrefitem internal "Internal" "Internal List" Do not use. This API is for internal use only. */ reserved3; - - - /** - * (public) Function pointer for UTextClone - * - * @see UTextClone -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - UTextClone *clone; - @@ -456,7 +456,7 @@ - * May be expensive to compute! - * - * @see UTextLength -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - UTextNativeLength *nativeLength; - @@ -464,7 +464,7 @@ - * (public) Function pointer for UTextAccess. - * - * @see UTextAccess -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - UTextAccess *access; - @@ -472,7 +472,7 @@ - * (public) Function pointer for UTextExtract. - * - * @see UTextExtract -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - UTextExtract *extract; - @@ -480,7 +480,7 @@ - * (public) Function pointer for UTextReplace. - * - * @see UTextReplace -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - UTextReplace *replace; - @@ -488,7 +488,7 @@ - * (public) Function pointer for UTextCopy. - * - * @see UTextCopy -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - UTextCopy *copy; - @@ -496,7 +496,7 @@ - * (public) Function pointer for UTextMapOffsetToNative. - * - * @see UTextMapOffsetToNative -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - UTextMapOffsetToNative *mapOffsetToNative; - @@ -504,7 +504,7 @@ - * (public) Function pointer for UTextMapNativeIndexToUTF16. - * - * @see UTextMapNativeIndexToUTF16 -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - UTextMapNativeIndexToUTF16 *mapNativeIndexToUTF16; - @@ -512,25 +512,25 @@ - * (public) Function pointer for UTextClose. - * - * @see UTextClose -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - UTextClose *close; - - /** - * (private) Spare function pointer -- * @internal +- * \xrefitem internal "Internal" "Internal List" Do not use. This API is for internal use only. - */ - UTextClose *spare1; - - /** - * (private) Spare function pointer -- * @internal +- * \xrefitem internal "Internal" "Internal List" Do not use. This API is for internal use only. - */ - UTextClose *spare2; - - /** - * (private) Spare function pointer -- * @internal +- * \xrefitem internal "Internal" "Internal List" Do not use. This API is for internal use only. - */ - UTextClose *spare3; - @@ -550,7 +550,7 @@ - * to pass text data to ICU services will have no need to view the - * internals of the UText structs that they open. - * -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ -struct UText { - /** @@ -563,7 +563,7 @@ - * Text provider close functions must NOT clear - * the magic field because that would prevent - * reuse of the UText struct. -- * @internal +- * \xrefitem internal "Internal" "Internal List" Do not use. This API is for internal use only. - */ - uint32_t magic; - @@ -571,7 +571,7 @@ - /** - * (private) Flags for managing the allocation and freeing of - * memory associated with this UText. -- * @internal +- * \xrefitem internal "Internal" "Internal List" Do not use. This API is for internal use only. - */ - int32_t flags; - @@ -579,7 +579,7 @@ - /** - * Text provider properties. This set of flags is maintained by the - * text provider implementation. -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ - int32_t providerProperties; - @@ -587,7 +587,7 @@ - * (public) sizeOfStruct=sizeof(UText) - * Allows possible backward compatible extension. - * -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ - int32_t sizeOfStruct; - @@ -597,13 +597,13 @@ - /** - * (protected) Native index of the first character position following - * the current chunk. -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - int64_t chunkNativeLimit; - - /** - * (protected) Size in bytes of the extra space (pExtra). -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ - int32_t extraSize; - @@ -612,7 +612,7 @@ - * chunk (UTF-16) indexing correspond. For UTF-16 sources, value - * will be equal to chunkLength. - * -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - int32_t nativeIndexingLimit; - @@ -620,20 +620,20 @@ - - /** - * (protected) Native index of the first character in the text chunk. -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - int64_t chunkNativeStart; - - /** - * (protected) Current iteration position within the text chunk (UTF-16 buffer). - * This is the index to the character that will be returned by utext_next32(). -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - int32_t chunkOffset; - - /** - * (protected) Length the text chunk (UTF-16 buffer), in UChars. -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - int32_t chunkLength; - @@ -644,20 +644,20 @@ - * (protected) pointer to a chunk of text in UTF-16 format. - * May refer either to original storage of the source of the text, or - * if conversion was required, to a buffer owned by the UText. -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - const UChar *chunkContents; - - /** - * (public) Pointer to Dispatch table for accessing functions for this UText. -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - const UTextFuncs *pFuncs; - - /** - * (protected) Pointer to additional space requested by the - * text provider during the utext_open operation. -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ - void *pExtra; - @@ -665,7 +665,7 @@ - * (protected) Pointer to string or text-containing object or similar. - * This is the source of the text that this UText is wrapping, in a format - * that is known to the text provider functions. -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ - const void *context; - @@ -674,26 +674,26 @@ - /** - * (protected) Pointer fields available for use by the text provider. - * Not used by UText common code. -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - const void *p; - /** - * (protected) Pointer fields available for use by the text provider. - * Not used by UText common code. -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - const void *q; - /** - * (protected) Pointer fields available for use by the text provider. - * Not used by UText common code. -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ - const void *r; - - /** - * Private field reserved for future use by the UText framework - * itself. This is not to be touched by the text providers. -- * @internal ICU 3.4 +- * \xrefitem internal "Internal" "Internal List" Do not use. This API is for internal use only. ICU 3.4 - */ - void *privP; - @@ -704,21 +704,21 @@ - /** - * (protected) Integer field reserved for use by the text provider. - * Not used by the UText framework, or by the client (user) of the UText. -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ - int64_t a; - - /** - * (protected) Integer field reserved for use by the text provider. - * Not used by the UText framework, or by the client (user) of the UText. -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ - int32_t b; - - /** - * (protected) Integer field reserved for use by the text provider. - * Not used by the UText framework, or by the client (user) of the UText. -- * @stable ICU 3.4 +- * \xrefitem stable "Stable" "Stable List" ICU 3.4 - */ - int32_t c; - @@ -728,19 +728,19 @@ - /** - * Private field reserved for future use by the UText framework - * itself. This is not to be touched by the text providers. -- * @internal ICU 3.4 +- * \xrefitem internal "Internal" "Internal List" Do not use. This API is for internal use only. ICU 3.4 - */ - int64_t privA; - /** - * Private field reserved for future use by the UText framework - * itself. This is not to be touched by the text providers. -- * @internal ICU 3.4 +- * \xrefitem internal "Internal" "Internal List" Do not use. This API is for internal use only. ICU 3.4 - */ - int32_t privB; - /** - * Private field reserved for future use by the UText framework - * itself. This is not to be touched by the text providers. -- * @internal ICU 3.4 +- * \xrefitem internal "Internal" "Internal List" Do not use. This API is for internal use only. ICU 3.4 - */ - int32_t privC; -}; @@ -750,7 +750,7 @@ - -// do not use #ifndef U_HIDE_INTERNAL_API around the following! -/** -- * @internal +- * \xrefitem internal "Internal" "Internal List" Do not use. This API is for internal use only. - * Value used to help identify correctly initialized UText structs. - * Note: must be publicly visible so that UTEXT_INITIALIZER can access it. - */ @@ -763,7 +763,7 @@ - * struct. UText structs must be initialized before passing - * them to one of the utext_open functions. - * -- * @stable ICU 3.6 +- * \xrefitem stable "Stable" "Stable List" ICU 3.6 - */ -#define UTEXT_INITIALIZER { \ - UTEXT_MAGIC, /* magic */ \ diff --git a/tools/icu4c_srcgen/generate_ndk.py b/tools/icu4c_srcgen/generate_ndk.py index 42e6808bf..aa49fb40b 100755 --- a/tools/icu4c_srcgen/generate_ndk.py +++ b/tools/icu4c_srcgen/generate_ndk.py @@ -195,6 +195,69 @@ IGNORED_INCLUDE_DEPENDENCY = { "ustring.h": ["uiter.h", ], } +IGNORED_HEADER_FOR_DOXYGEN_GROUPING = set([ + "uconfig.h", # pre-defined config that NDK users shouldn't change + "platform.h", # pre-defined variable not to be changed by the NDK users + "utf_old.h", # deprecated UTF macros + "uvernum.h", # ICU version information not useful for version-independent usage in NDK +]) + +""" +This map should mirror the mapping in external/icu/icu4c/source/Doxyfile.in. +This is needed because NDK doesn't allow per-module Doxyfile, +apart from the shared frameworks/native/docs/Doxyfile. +""" +DOXYGEN_ALIASES = { + "@memo": '\\par Note:\n', + "@draft": '\\xrefitem draft "Draft" "Draft List" This API may be changed in the future versions and was introduced in', + "@stable": '\\xrefitem stable "Stable" "Stable List"', + "@deprecated": '\\xrefitem deprecated "Deprecated" "Deprecated List"', + "@obsolete": '\\xrefitem obsolete "Obsolete" "Obsolete List"', + "@system": '\\xrefitem system "System" "System List" Do not use unless you know what you are doing.', + "@internal": '\\xrefitem internal "Internal" "Internal List" Do not use. This API is for internal use only.', +} + +def add_ndk_required_doxygen_grouping(): + """Add @addtogroup annotation to the header files for NDK API docs""" + path = android_path('external/icu/libicu/ndk_headers/unicode') + files = [os.path.join(path, f) for f in os.listdir(path) if f.endswith('.h')] + + for src_path in files: + with open(src_path, 'r') as file: + header_content = file.read() + + for old, new in DOXYGEN_ALIASES.items(): + header_content = header_content.replace(old, new) + + with open(src_path, 'w') as file: + file.write(header_content) + + + for src_path in files: + if os.path.basename(src_path) in IGNORED_HEADER_FOR_DOXYGEN_GROUPING: + continue + + cmd_add_addtogroup_annotation = ['sed', + '-i', + '0,/^\( *\)\(\* *\\\\file\)/s//\\1* @addtogroup ICU4C\\n\\1* @{\\n\\1\\2/', + src_path + ] + + subprocess.check_call(cmd_add_addtogroup_annotation) + + # Next iteration if the above sed regex doesn't add the text + if not has_string_in_file(src_path, 'addtogroup'): + continue + + # Add the closing bracket for @addtogroup + with open(src_path, 'a') as header_file: + header_file.write('\n/** @} */ // addtogroup\n') + +def has_string_in_file(path, str): + """Return True if the a string exists in the file""" + with open(path, 'r') as file: + return file.read().find(str) != -1 + def main(): """Parse the ICU4C headers and generate the shim libicu.""" logging.basicConfig(level=logging.DEBUG) @@ -239,6 +302,8 @@ def main(): generate_cts_headers(allowlisted_apis) + add_ndk_required_doxygen_grouping() + # Apply documentation patches by the following shell script subprocess.check_call( [android_path('external/icu/tools/icu4c_srcgen/doc_patches/apply_patches.sh')]) |