odin-blend2d

Odin bindings to Blend2D
Log | Files | Refs | README | LICENSE

Documentation.odin (17258B)


      1 /*==-- clang-c/Documentation.h - Utilities for comment processing -*- C -*-===*\
      2 |*                                                                            *|
      3 |* Part of the LLVM Project, under the Apache License v2.0 with LLVM          *|
      4 |* Exceptions.                                                                *|
      5 |* See https://llvm.org/LICENSE.txt for license information.                  *|
      6 |* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception                    *|
      7 |*                                                                            *|
      8 |*===----------------------------------------------------------------------===*|
      9 |*                                                                            *|
     10 |* This header provides a supplementary interface for inspecting              *|
     11 |* documentation comments.                                                    *|
     12 |*                                                                            *|
     13 \*===----------------------------------------------------------------------===*/
     14 package libclang
     15 
     16 import "core:c"
     17 
     18 _ :: c
     19 
     20 when ODIN_OS == .Windows {
     21     @(extra_linker_flags="/NODEFAULTLIB:libcmt")
     22     foreign import lib {
     23         "system:ntdll.lib",
     24         "system:ucrt.lib",
     25         "system:msvcrt.lib",
     26         "system:legacy_stdio_definitions.lib",
     27         "system:kernel32.lib",
     28         "system:user32.lib",
     29         "system:advapi32.lib",
     30         "system:shell32.lib",
     31         "system:ole32.lib",
     32         "system:oleaut32.lib",
     33         "system:uuid.lib",
     34         "system:ws2_32.lib",
     35         "system:version.lib",
     36         "system:oldnames.lib",
     37         "libclang.lib",
     38 	}
     39 } else {
     40     foreign import lib "system:clang"
     41 }
     42 
     43 // LLVM_CLANG_C_DOCUMENTATION_H :: 
     44 
     45 /**
     46 * A parsed comment.
     47 */
     48 CXComment :: struct {
     49 	ASTNode:         rawptr,
     50 	TranslationUnit: Translation_Unit,
     51 }
     52 
     53 /**
     54 * Describes the type of the comment AST node (\c CXComment).  A comment
     55 * node can be considered block content (e. g., paragraph), inline content
     56 * (plain text) or neither (the root AST node).
     57 */
     58 Comment_Kind :: enum c.int {
     59 	/**
     60 	* Null comment.  No AST node is constructed at the requested location
     61 	* because there is no text or a syntax error.
     62 	*/
     63 	Null,
     64 
     65 	/**
     66 	* Plain text.  Inline content.
     67 	*/
     68 	Text,
     69 
     70 	/**
     71 	* A command with word-like arguments that is considered inline content.
     72 	*
     73 	* For example: \\c command.
     74 	*/
     75 	InlineCommand,
     76 
     77 	/**
     78 	* HTML start tag with attributes (name-value pairs).  Considered
     79 	* inline content.
     80 	*
     81 	* For example:
     82 	* \verbatim
     83 	* <br> <br /> <a href="http://example.org/">
     84 	* \endverbatim
     85 	*/
     86 	HTMLStartTag,
     87 
     88 	/**
     89 	* HTML end tag.  Considered inline content.
     90 	*
     91 	* For example:
     92 	* \verbatim
     93 	* </a>
     94 	* \endverbatim
     95 	*/
     96 	HTMLEndTag,
     97 
     98 	/**
     99 	* A paragraph, contains inline comment.  The paragraph itself is
    100 	* block content.
    101 	*/
    102 	Paragraph,
    103 
    104 	/**
    105 	* A command that has zero or more word-like arguments (number of
    106 	* word-like arguments depends on command name) and a paragraph as an
    107 	* argument.  Block command is block content.
    108 	*
    109 	* Paragraph argument is also a child of the block command.
    110 	*
    111 	* For example: \has 0 word-like arguments and a paragraph argument.
    112 	*
    113 	* AST nodes of special kinds that parser knows about (e. g., \\param
    114 	* command) have their own node kinds.
    115 	*/
    116 	BlockCommand,
    117 
    118 	/**
    119 	* A \\param or \\arg command that describes the function parameter
    120 	* (name, passing direction, description).
    121 	*
    122 	* For example: \\param [in] ParamName description.
    123 	*/
    124 	ParamCommand,
    125 
    126 	/**
    127 	* A \\tparam command that describes a template parameter (name and
    128 	* description).
    129 	*
    130 	* For example: \\tparam T description.
    131 	*/
    132 	TParamCommand,
    133 
    134 	/**
    135 	* A verbatim block command (e. g., preformatted code).  Verbatim
    136 	* block has an opening and a closing command and contains multiple lines of
    137 	* text (\c CXComment_VerbatimBlockLine child nodes).
    138 	*
    139 	* For example:
    140 	* \\verbatim
    141 	* aaa
    142 	* \\endverbatim
    143 	*/
    144 	VerbatimBlockCommand,
    145 
    146 	/**
    147 	* A line of text that is contained within a
    148 	* CXComment_VerbatimBlockCommand node.
    149 	*/
    150 	VerbatimBlockLine,
    151 
    152 	/**
    153 	* A verbatim line command.  Verbatim line has an opening command,
    154 	* a single line of text (up to the newline after the opening command) and
    155 	* has no closing command.
    156 	*/
    157 	VerbatimLine,
    158 
    159 	/**
    160 	* A full comment attached to a declaration, contains block content.
    161 	*/
    162 	FullComment,
    163 }
    164 
    165 /**
    166 * The most appropriate rendering mode for an inline command, chosen on
    167 * command semantics in Doxygen.
    168 */
    169 Comment_Inline_Command_Render_Kind :: enum c.int {
    170 	/**
    171 	* Command argument should be rendered in a normal font.
    172 	*/
    173 	Normal,
    174 
    175 	/**
    176 	* Command argument should be rendered in a bold font.
    177 	*/
    178 	Bold,
    179 
    180 	/**
    181 	* Command argument should be rendered in a monospaced font.
    182 	*/
    183 	Monospaced,
    184 
    185 	/**
    186 	* Command argument should be rendered emphasized (typically italic
    187 	* font).
    188 	*/
    189 	Emphasized,
    190 
    191 	/**
    192 	* Command argument should not be rendered (since it only defines an anchor).
    193 	*/
    194 	Anchor,
    195 }
    196 
    197 /**
    198 * Describes parameter passing direction for \\param or \\arg command.
    199 */
    200 Comment_Param_Pass_Direction :: enum c.int {
    201 	/**
    202 	* The parameter is an input parameter.
    203 	*/
    204 	In,
    205 
    206 	/**
    207 	* The parameter is an output parameter.
    208 	*/
    209 	Out,
    210 
    211 	/**
    212 	* The parameter is an input and output parameter.
    213 	*/
    214 	InOut,
    215 }
    216 
    217 /**
    218 * CXAPISet is an opaque type that represents a data structure containing all
    219 * the API information for a given translation unit. This can be used for a
    220 * single symbol symbol graph for a given symbol.
    221 */
    222 Apiset :: struct {}
    223 
    224 @(default_calling_convention="c", link_prefix="clang_")
    225 foreign lib {
    226 	/**
    227 	* Given a cursor that represents a documentable entity (e.g.,
    228 	* declaration), return the associated parsed comment as a
    229 	* \c CXComment_FullComment AST node.
    230 	*/
    231 	Cursor_getParsedComment :: proc(C: Cursor) -> CXComment ---
    232 
    233 	/**
    234 	* \param Comment AST node of any kind.
    235 	*
    236 	* \returns the type of the AST node.
    237 	*/
    238 	Comment_getKind :: proc(Comment: CXComment) -> Comment_Kind ---
    239 
    240 	/**
    241 	* \param Comment AST node of any kind.
    242 	*
    243 	* \returns number of children of the AST node.
    244 	*/
    245 	Comment_getNumChildren :: proc(Comment: CXComment) -> c.uint ---
    246 
    247 	/**
    248 	* \param Comment AST node of any kind.
    249 	*
    250 	* \param ChildIdx child index (zero-based).
    251 	*
    252 	* \returns the specified child of the AST node.
    253 	*/
    254 	Comment_getChild :: proc(Comment: CXComment, ChildIdx: c.uint) -> CXComment ---
    255 
    256 	/**
    257 	* A \c CXComment_Paragraph node is considered whitespace if it contains
    258 	* only \c CXComment_Text nodes that are empty or whitespace.
    259 	*
    260 	* Other AST nodes (except \c CXComment_Paragraph and \c CXComment_Text) are
    261 	* never considered whitespace.
    262 	*
    263 	* \returns non-zero if \c Comment is whitespace.
    264 	*/
    265 	Comment_isWhitespace :: proc(Comment: CXComment) -> c.uint ---
    266 
    267 	/**
    268 	* \returns non-zero if \c Comment is inline content and has a newline
    269 	* immediately following it in the comment text.  Newlines between paragraphs
    270 	* do not count.
    271 	*/
    272 	InlineContentComment_hasTrailingNewline :: proc(Comment: CXComment) -> c.uint ---
    273 
    274 	/**
    275 	* \param Comment a \c CXComment_Text AST node.
    276 	*
    277 	* \returns text contained in the AST node.
    278 	*/
    279 	TextComment_getText :: proc(Comment: CXComment) -> String ---
    280 
    281 	/**
    282 	* \param Comment a \c CXComment_InlineCommand AST node.
    283 	*
    284 	* \returns name of the inline command.
    285 	*/
    286 	InlineCommandComment_getCommandName :: proc(Comment: CXComment) -> String ---
    287 
    288 	/**
    289 	* \param Comment a \c CXComment_InlineCommand AST node.
    290 	*
    291 	* \returns the most appropriate rendering mode, chosen on command
    292 	* semantics in Doxygen.
    293 	*/
    294 	InlineCommandComment_getRenderKind :: proc(Comment: CXComment) -> Comment_Inline_Command_Render_Kind ---
    295 
    296 	/**
    297 	* \param Comment a \c CXComment_InlineCommand AST node.
    298 	*
    299 	* \returns number of command arguments.
    300 	*/
    301 	InlineCommandComment_getNumArgs :: proc(Comment: CXComment) -> c.uint ---
    302 
    303 	/**
    304 	* \param Comment a \c CXComment_InlineCommand AST node.
    305 	*
    306 	* \param ArgIdx argument index (zero-based).
    307 	*
    308 	* \returns text of the specified argument.
    309 	*/
    310 	InlineCommandComment_getArgText :: proc(Comment: CXComment, ArgIdx: c.uint) -> String ---
    311 
    312 	/**
    313 	* \param Comment a \c CXComment_HTMLStartTag or \c CXComment_HTMLEndTag AST
    314 	* node.
    315 	*
    316 	* \returns HTML tag name.
    317 	*/
    318 	HTMLTagComment_getTagName :: proc(Comment: CXComment) -> String ---
    319 
    320 	/**
    321 	* \param Comment a \c CXComment_HTMLStartTag AST node.
    322 	*
    323 	* \returns non-zero if tag is self-closing (for example, &lt;br /&gt;).
    324 	*/
    325 	HTMLStartTagComment_isSelfClosing :: proc(Comment: CXComment) -> c.uint ---
    326 
    327 	/**
    328 	* \param Comment a \c CXComment_HTMLStartTag AST node.
    329 	*
    330 	* \returns number of attributes (name-value pairs) attached to the start tag.
    331 	*/
    332 	HTMLStartTag_getNumAttrs :: proc(Comment: CXComment) -> c.uint ---
    333 
    334 	/**
    335 	* \param Comment a \c CXComment_HTMLStartTag AST node.
    336 	*
    337 	* \param AttrIdx attribute index (zero-based).
    338 	*
    339 	* \returns name of the specified attribute.
    340 	*/
    341 	HTMLStartTag_getAttrName :: proc(Comment: CXComment, AttrIdx: c.uint) -> String ---
    342 
    343 	/**
    344 	* \param Comment a \c CXComment_HTMLStartTag AST node.
    345 	*
    346 	* \param AttrIdx attribute index (zero-based).
    347 	*
    348 	* \returns value of the specified attribute.
    349 	*/
    350 	HTMLStartTag_getAttrValue :: proc(Comment: CXComment, AttrIdx: c.uint) -> String ---
    351 
    352 	/**
    353 	* \param Comment a \c CXComment_BlockCommand AST node.
    354 	*
    355 	* \returns name of the block command.
    356 	*/
    357 	BlockCommandComment_getCommandName :: proc(Comment: CXComment) -> String ---
    358 
    359 	/**
    360 	* \param Comment a \c CXComment_BlockCommand AST node.
    361 	*
    362 	* \returns number of word-like arguments.
    363 	*/
    364 	BlockCommandComment_getNumArgs :: proc(Comment: CXComment) -> c.uint ---
    365 
    366 	/**
    367 	* \param Comment a \c CXComment_BlockCommand AST node.
    368 	*
    369 	* \param ArgIdx argument index (zero-based).
    370 	*
    371 	* \returns text of the specified word-like argument.
    372 	*/
    373 	BlockCommandComment_getArgText :: proc(Comment: CXComment, ArgIdx: c.uint) -> String ---
    374 
    375 	/**
    376 	* \param Comment a \c CXComment_BlockCommand or
    377 	* \c CXComment_VerbatimBlockCommand AST node.
    378 	*
    379 	* \returns paragraph argument of the block command.
    380 	*/
    381 	BlockCommandComment_getParagraph :: proc(Comment: CXComment) -> CXComment ---
    382 
    383 	/**
    384 	* \param Comment a \c CXComment_ParamCommand AST node.
    385 	*
    386 	* \returns parameter name.
    387 	*/
    388 	ParamCommandComment_getParamName :: proc(Comment: CXComment) -> String ---
    389 
    390 	/**
    391 	* \param Comment a \c CXComment_ParamCommand AST node.
    392 	*
    393 	* \returns non-zero if the parameter that this AST node represents was found
    394 	* in the function prototype and \c clang_ParamCommandComment_getParamIndex
    395 	* function will return a meaningful value.
    396 	*/
    397 	ParamCommandComment_isParamIndexValid :: proc(Comment: CXComment) -> c.uint ---
    398 
    399 	/**
    400 	* \param Comment a \c CXComment_ParamCommand AST node.
    401 	*
    402 	* \returns zero-based parameter index in function prototype.
    403 	*/
    404 	ParamCommandComment_getParamIndex :: proc(Comment: CXComment) -> c.uint ---
    405 
    406 	/**
    407 	* \param Comment a \c CXComment_ParamCommand AST node.
    408 	*
    409 	* \returns non-zero if parameter passing direction was specified explicitly in
    410 	* the comment.
    411 	*/
    412 	ParamCommandComment_isDirectionExplicit :: proc(Comment: CXComment) -> c.uint ---
    413 
    414 	/**
    415 	* \param Comment a \c CXComment_ParamCommand AST node.
    416 	*
    417 	* \returns parameter passing direction.
    418 	*/
    419 	ParamCommandComment_getDirection :: proc(Comment: CXComment) -> Comment_Param_Pass_Direction ---
    420 
    421 	/**
    422 	* \param Comment a \c CXComment_TParamCommand AST node.
    423 	*
    424 	* \returns template parameter name.
    425 	*/
    426 	TParamCommandComment_getParamName :: proc(Comment: CXComment) -> String ---
    427 
    428 	/**
    429 	* \param Comment a \c CXComment_TParamCommand AST node.
    430 	*
    431 	* \returns non-zero if the parameter that this AST node represents was found
    432 	* in the template parameter list and
    433 	* \c clang_TParamCommandComment_getDepth and
    434 	* \c clang_TParamCommandComment_getIndex functions will return a meaningful
    435 	* value.
    436 	*/
    437 	TParamCommandComment_isParamPositionValid :: proc(Comment: CXComment) -> c.uint ---
    438 
    439 	/**
    440 	* \param Comment a \c CXComment_TParamCommand AST node.
    441 	*
    442 	* \returns zero-based nesting depth of this parameter in the template parameter list.
    443 	*
    444 	* For example,
    445 	* \verbatim
    446 	*     template<typename C, template<typename T> class TT>
    447 	*     void test(TT<int> aaa);
    448 	* \endverbatim
    449 	* for C and TT nesting depth is 0,
    450 	* for T nesting depth is 1.
    451 	*/
    452 	TParamCommandComment_getDepth :: proc(Comment: CXComment) -> c.uint ---
    453 
    454 	/**
    455 	* \param Comment a \c CXComment_TParamCommand AST node.
    456 	*
    457 	* \returns zero-based parameter index in the template parameter list at a
    458 	* given nesting depth.
    459 	*
    460 	* For example,
    461 	* \verbatim
    462 	*     template<typename C, template<typename T> class TT>
    463 	*     void test(TT<int> aaa);
    464 	* \endverbatim
    465 	* for C and TT nesting depth is 0, so we can ask for index at depth 0:
    466 	* at depth 0 C's index is 0, TT's index is 1.
    467 	*
    468 	* For T nesting depth is 1, so we can ask for index at depth 0 and 1:
    469 	* at depth 0 T's index is 1 (same as TT's),
    470 	* at depth 1 T's index is 0.
    471 	*/
    472 	TParamCommandComment_getIndex :: proc(Comment: CXComment, Depth: c.uint) -> c.uint ---
    473 
    474 	/**
    475 	* \param Comment a \c CXComment_VerbatimBlockLine AST node.
    476 	*
    477 	* \returns text contained in the AST node.
    478 	*/
    479 	VerbatimBlockLineComment_getText :: proc(Comment: CXComment) -> String ---
    480 
    481 	/**
    482 	* \param Comment a \c CXComment_VerbatimLine AST node.
    483 	*
    484 	* \returns text contained in the AST node.
    485 	*/
    486 	VerbatimLineComment_getText :: proc(Comment: CXComment) -> String ---
    487 
    488 	/**
    489 	* Convert an HTML tag AST node to string.
    490 	*
    491 	* \param Comment a \c CXComment_HTMLStartTag or \c CXComment_HTMLEndTag AST
    492 	* node.
    493 	*
    494 	* \returns string containing an HTML tag.
    495 	*/
    496 	HTMLTagComment_getAsString :: proc(Comment: CXComment) -> String ---
    497 
    498 	/**
    499 	* Convert a given full parsed comment to an HTML fragment.
    500 	*
    501 	* Specific details of HTML layout are subject to change.  Don't try to parse
    502 	* this HTML back into an AST, use other APIs instead.
    503 	*
    504 	* Currently the following CSS classes are used:
    505 	* \li "para-brief" for \paragraph and equivalent commands;
    506 	* \li "para-returns" for \\returns paragraph and equivalent commands;
    507 	* \li "word-returns" for the "Returns" word in \\returns paragraph.
    508 	*
    509 	* Function argument documentation is rendered as a \<dl\> list with arguments
    510 	* sorted in function prototype order.  CSS classes used:
    511 	* \li "param-name-index-NUMBER" for parameter name (\<dt\>);
    512 	* \li "param-descr-index-NUMBER" for parameter description (\<dd\>);
    513 	* \li "param-name-index-invalid" and "param-descr-index-invalid" are used if
    514 	* parameter index is invalid.
    515 	*
    516 	* Template parameter documentation is rendered as a \<dl\> list with
    517 	* parameters sorted in template parameter list order.  CSS classes used:
    518 	* \li "tparam-name-index-NUMBER" for parameter name (\<dt\>);
    519 	* \li "tparam-descr-index-NUMBER" for parameter description (\<dd\>);
    520 	* \li "tparam-name-index-other" and "tparam-descr-index-other" are used for
    521 	* names inside template template parameters;
    522 	* \li "tparam-name-index-invalid" and "tparam-descr-index-invalid" are used if
    523 	* parameter position is invalid.
    524 	*
    525 	* \param Comment a \c CXComment_FullComment AST node.
    526 	*
    527 	* \returns string containing an HTML fragment.
    528 	*/
    529 	FullComment_getAsHTML :: proc(Comment: CXComment) -> String ---
    530 
    531 	/**
    532 	* Convert a given full parsed comment to an XML document.
    533 	*
    534 	* A Relax NG schema for the XML can be found in comment-xml-schema.rng file
    535 	* inside clang source tree.
    536 	*
    537 	* \param Comment a \c CXComment_FullComment AST node.
    538 	*
    539 	* \returns string containing an XML document.
    540 	*/
    541 	FullComment_getAsXML :: proc(Comment: CXComment) -> String ---
    542 
    543 	/**
    544 	* Traverses the translation unit to create a \c CXAPISet.
    545 	*
    546 	* \param tu is the \c CXTranslationUnit to build the \c CXAPISet for.
    547 	*
    548 	* \param out_api is a pointer to the output of this function. It is needs to be
    549 	* disposed of by calling clang_disposeAPISet.
    550 	*
    551 	* \returns Error code indicating success or failure of the APISet creation.
    552 	*/
    553 	createAPISet :: proc(tu: Translation_Unit, out_api: ^Apiset) -> Error_Code ---
    554 
    555 	/**
    556 	* Dispose of an APISet.
    557 	*
    558 	* The provided \c CXAPISet can not be used after this function is called.
    559 	*/
    560 	disposeAPISet :: proc(api: Apiset) ---
    561 
    562 	/**
    563 	* Generate a single symbol symbol graph for the given USR. Returns a null
    564 	* string if the associated symbol can not be found in the provided \c CXAPISet.
    565 	*
    566 	* The output contains the symbol graph as well as some additional information
    567 	* about related symbols.
    568 	*
    569 	* \param usr is a string containing the USR of the symbol to generate the
    570 	* symbol graph for.
    571 	*
    572 	* \param api the \c CXAPISet to look for the symbol in.
    573 	*
    574 	* \returns a string containing the serialized symbol graph representation for
    575 	* the symbol being queried or a null string if it can not be found in the
    576 	* APISet.
    577 	*/
    578 	getSymbolGraphForUSR :: proc(usr: cstring, api: Apiset) -> String ---
    579 
    580 	/**
    581 	* Generate a single symbol symbol graph for the declaration at the given
    582 	* cursor. Returns a null string if the AST node for the cursor isn't a
    583 	* declaration.
    584 	*
    585 	* The output contains the symbol graph as well as some additional information
    586 	* about related symbols.
    587 	*
    588 	* \param cursor the declaration for which to generate the single symbol symbol
    589 	* graph.
    590 	*
    591 	* \returns a string containing the serialized symbol graph representation for
    592 	* the symbol being queried or a null string if it can not be found in the
    593 	* APISet.
    594 	*/
    595 	getSymbolGraphForCursor :: proc(cursor: Cursor) -> String ---
    596 }