1 /* 2 * Copyright (c) 2024-2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef LIBABCKIT_METADATA_ARKTS_H 17 #define LIBABCKIT_METADATA_ARKTS_H 18 19 #ifndef __cplusplus 20 #include <stdbool.h> 21 #include <stddef.h> 22 #include <stdint.h> 23 #else 24 #include <cstddef> 25 #include <cstdint> 26 #endif /* __cplusplus */ 27 28 #include "../../declarations.h" 29 #include "../../api_version.h" 30 31 #ifdef __cplusplus 32 extern "C" { 33 #endif /* __cplusplus */ 34 35 /** 36 * @brief Struct that holds the pointers to the non-modifying API for Arkts-specific Abckit types. 37 */ 38 struct CAPI_EXPORT AbckitArktsInspectApi { 39 /* ======================================== 40 * Language-independent abstractions 41 * ======================================== */ 42 43 /* ======================================== 44 * File 45 * ======================================== */ 46 47 /* ======================================== 48 * String 49 * ======================================== */ 50 51 /* ======================================== 52 * Type 53 * ======================================== */ 54 55 /* ======================================== 56 * Value 57 * ======================================== */ 58 59 /* ======================================== 60 * Literal 61 * ======================================== */ 62 63 /* ======================================== 64 * LiteralArray 65 * ======================================== */ 66 67 /* ======================================== 68 * Language-dependent abstractions 69 * ======================================== */ 70 71 /* ======================================== 72 * Module 73 * ======================================== */ 74 75 /** 76 * @brief Convert an instance of type `AbckitArktsModule` to the instance of type `AbckitCoreModule`, which can be 77 * used to invoke the corresponding APIs. 78 * @return Pointer to the language-independent representation of the `m`. 79 * @param [ in ] m - Module to convert. 80 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `m` is NULL. 81 */ 82 AbckitCoreModule *(*arktsModuleToCoreModule)(AbckitArktsModule *m); 83 84 /** 85 * @brief Convert an instance of type `AbckitCoreModule` to the instance of type `AbckitArktsModule`, which can be 86 * used to invoke the corresponding APIs. 87 * @return Pointer to the language-dependent representation of the `m`. 88 * @param [ in ] m - Module to convert. 89 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `m` is NULL. 90 * @note Set `ABCKIT_STATUS_WRONG_TARGET` error if `m` is does not have `ABCKIT_TARGET_ARK_TS_V1` or 91 * `ABCKIT_TARGET_ARK_TS_V2` target. 92 */ 93 AbckitArktsModule *(*coreModuleToArktsModule)(AbckitCoreModule *m); 94 95 /* ======================================== 96 * Namespace 97 * ======================================== */ 98 99 /** 100 * @brief Convert an instance of type `AbckitArktsNamespace` to the instance of type `AbckitCoreNamespace`, which 101 * can be used to invoke the corresponding APIs. 102 * @return Pointer to the language-independent representation of the `ns`. 103 * @param [ in ] ns - Namespace to convert. 104 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `ns` is NULL. 105 */ 106 AbckitCoreNamespace *(*arktsNamespaceToCoreNamespace)(AbckitArktsNamespace *ns); 107 108 /** 109 * @brief Convert an instance of type `AbckitCoreNamespace` to the instance of type `AbckitArktsNamespace`, which 110 * can be used to invoke the corresponding APIs. 111 * @return Pointer to the language-dependent representation of the `ns`. 112 * @param [ in ] ns - Namespace to convert. 113 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `ns` is NULL. 114 * @note Set `ABCKIT_STATUS_WRONG_TARGET` error if `ns` is does not have `ABCKIT_TARGET_ARK_TS_V1` or 115 * `ABCKIT_TARGET_ARK_TS_V2` target. 116 */ 117 AbckitArktsNamespace *(*coreNamespaceToArktsNamespace)(AbckitCoreNamespace *ns); 118 119 /** 120 * @brief Returns constructor function for namespace. 121 * @return Function that is invoked upon namespace `ns` construction. 122 * @param [ in ] ns - Namespace to get the constructor function for. 123 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `ns` is NULL. 124 * @note Set `ABCKIT_STATUS_WRONG_TARGET` error if `ns` is does not have `ABCKIT_TARGET_ARK_TS_V1` target. 125 */ 126 AbckitArktsFunction *(*arktsV1NamespaceGetConstructor)(AbckitArktsNamespace *ns); 127 128 /* ======================================== 129 * ImportDescriptor 130 * ======================================== */ 131 132 /** 133 * @brief Convert an instance of type `AbckitArktsImportDescriptorToCoreImportDescrip` to the instance of type `r`, 134 * which can be used to invoke the corresponding APIs. 135 * @return Pointer to the language-independent representation of the `id`. 136 * @param [ in ] id - Import descriptor to convert. 137 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `id` is NULL. 138 */ 139 AbckitCoreImportDescriptor *(*arktsImportDescriptorToCoreImportDescriptor)(AbckitArktsImportDescriptor *id); 140 141 /** 142 * @brief Convert an instance of type `AbckitCoreImportDescriptorToArktsImportDescrip` to the instance of type `r`, 143 * which can be used to invoke the corresponding APIs. 144 * @return Pointer to the language-dependent representation of the `id`. 145 * @param [ in ] id - Import descriptor to convert. 146 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `id` is NULL. 147 * @note Set `ABCKIT_STATUS_WRONG_TARGET` error if `id` is does not have `ABCKIT_TARGET_ARK_TS_V1` or 148 * `ABCKIT_TARGET_ARK_TS_V2` target. 149 */ 150 AbckitArktsImportDescriptor *(*coreImportDescriptorToArktsImportDescriptor)(AbckitCoreImportDescriptor *id); 151 152 /* ======================================== 153 * ExportDescriptor 154 * ======================================== */ 155 156 /** 157 * @brief Convert an instance of type `AbckitArktsExportDescriptorToCoreExportDescrip` to the instance of type `r`, 158 * which can be used to invoke the corresponding APIs. 159 * @return Pointer to the language-independent representation of the `ed`. 160 * @param [ in ] ed - Export descriptor to convert. 161 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `ed` is NULL. 162 */ 163 AbckitCoreExportDescriptor *(*arktsExportDescriptorToCoreExportDescriptor)(AbckitArktsExportDescriptor *ed); 164 165 /** 166 * @brief Convert an instance of type `AbckitCoreExportDescriptorToArktsExportDescrip` to the instance of type `r`, 167 * which can be used to invoke the corresponding APIs. 168 * @return Pointer to the language-dependent representation of the `ed`. 169 * @param [ in ] ed - Export descriptor to convert. 170 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `ed` is NULL. 171 * @note Set `ABCKIT_STATUS_WRONG_TARGET` error if `ed` is does not have `ABCKIT_TARGET_ARK_TS_V1` or 172 * `ABCKIT_TARGET_ARK_TS_V2` target. 173 */ 174 AbckitArktsExportDescriptor *(*coreExportDescriptorToArktsExportDescriptor)(AbckitCoreExportDescriptor *ed); 175 176 /* ======================================== 177 * Class 178 * ======================================== */ 179 180 /** 181 * @brief Convert an instance of type `AbckitArktsClass` to the instance of type `AbckitCoreClass`, which can be 182 * used to invoke the corresponding APIs. 183 * @return Pointer to the language-independent representation of the `klass`. 184 * @param [ in ] klass - Class to convert. 185 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `klass` is NULL. 186 */ 187 AbckitCoreClass *(*arktsClassToCoreClass)(AbckitArktsClass *klass); 188 189 /** 190 * @brief Convert an instance of type `AbckitCoreClass` to the instance of type `AbckitArktsClass`, which can be 191 * used to invoke the corresponding APIs. 192 * @return Pointer to the language-dependent representation of the `klass`. 193 * @param [ in ] klass - Class to convert. 194 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `klass` is NULL. 195 * @note Set `ABCKIT_STATUS_WRONG_TARGET` error if `klass` is does not have `ABCKIT_TARGET_ARK_TS_V1` or 196 * `ABCKIT_TARGET_ARK_TS_V2` target. 197 */ 198 AbckitArktsClass *(*coreClassToArktsClass)(AbckitCoreClass *klass); 199 200 /* ======================================== 201 * Function 202 * ======================================== */ 203 204 /** 205 * @brief Convert an instance of type `AbckitArktsFunction` to the instance of type `AbckitCoreFunction`, which can 206 * be used to invoke the corresponding APIs. 207 * @return Pointer to the language-independent representation of the `function`. 208 * @param [ in ] function - Function to convert. 209 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `function` is NULL. 210 */ 211 AbckitCoreFunction *(*arktsFunctionToCoreFunction)(AbckitArktsFunction *function); 212 213 /** 214 * @brief Convert an instance of type `AbckitCoreFunction` to the instance of type `AbckitArktsFunction`, which can 215 * be used to invoke the corresponding APIs. 216 * @return Pointer to the language-dependent representation of the `function`. 217 * @param [ in ] function - Function to convert. 218 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `function` is NULL. 219 * @note Set `ABCKIT_STATUS_WRONG_TARGET` error if `function` is does not have `ABCKIT_TARGET_ARK_TS_V1` or 220 * `ABCKIT_TARGET_ARK_TS_V2` target. 221 */ 222 AbckitArktsFunction *(*coreFunctionToArktsFunction)(AbckitCoreFunction *function); 223 224 /** 225 * @brief Check whether the `function` is native. 226 * @return `true` if `function` is native, `false` otherwise. 227 * @param [ in ] function - Function to inspect. 228 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `function` is NULL. 229 */ 230 bool (*functionIsNative)(AbckitArktsFunction *function); 231 232 /* ======================================== 233 * Annotation 234 * ======================================== */ 235 236 /** 237 * @brief Convert an instance of type `AbckitArktsAnnotation` to the instance of type `AbckitCoreAnnotation`, which 238 * can be used to invoke the corresponding APIs. 239 * @return Pointer to the language-independent representation of the `anno`. 240 * @param [ in ] anno - Annotation to convert. 241 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `anno` is NULL. 242 */ 243 AbckitCoreAnnotation *(*arktsAnnotationToCoreAnnotation)(AbckitArktsAnnotation *anno); 244 245 /** 246 * @brief Convert an instance of type `AbckitCoreAnnotation` to the instance of type `AbckitArktsAnnotation`, which 247 * can be used to invoke the corresponding APIs. 248 * @return Pointer to the language-dependent representation of the `anno`. 249 * @param [ in ] anno - Annotation to convert. 250 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `anno` is NULL. 251 * @note Set `ABCKIT_STATUS_WRONG_TARGET` error if `anno` is does not have `ABCKIT_TARGET_ARK_TS_V1` or 252 * `ABCKIT_TARGET_ARK_TS_V2` target. 253 */ 254 AbckitArktsAnnotation *(*coreAnnotationToArktsAnnotation)(AbckitCoreAnnotation *anno); 255 256 /* ======================================== 257 * AnnotationElement 258 * ======================================== */ 259 260 /** 261 * @brief Convert an instance of type `AbckitArktsAnnotationElement` to the instance of type 262 * `AbckitCoreAnnotationElement`, which can be used to invoke the corresponding APIs. 263 * @return Pointer to the language-independent representation of the `annoElem`. 264 * @param [ in ] annoElem - Annotation element to convert. 265 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `annoElem` is NULL. 266 */ 267 AbckitCoreAnnotationElement *(*arktsAnnotationElementToCoreAnnotationElement)( 268 AbckitArktsAnnotationElement *annoElem); 269 270 /** 271 * @brief Convert an instance of type `AbckitCoreAnnotationElement` to the instance of type 272 * `AbckitArktsAnnotationElement`, which can be used to invoke the corresponding APIs. 273 * @return Pointer to the language-dependent representation of the `annoElem`. 274 * @param [ in ] annoElem - Annotation element to convert. 275 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `annoElem` is NULL. 276 * @note Set `ABCKIT_STATUS_WRONG_TARGET` error if `annoElem` is does not have `ABCKIT_TARGET_ARK_TS_V1` or 277 * `ABCKIT_TARGET_ARK_TS_V2` target. 278 */ 279 AbckitArktsAnnotationElement *(*coreAnnotationElementToArktsAnnotationElement)( 280 AbckitCoreAnnotationElement *annoElem); 281 282 /* ======================================== 283 * AnnotationInterface 284 * ======================================== */ 285 286 /** 287 * @brief Convert an instance of type `AbckitArktsAnnotationInterface` to the instance of type 288 * `AbckitCoreAnnotationInterface`, which can be used to invoke the corresponding APIs. 289 * @return Pointer to the language-independent representation of the `annoInterface`. 290 * @param [ in ] annoInterface - Annotataion interface to convert. 291 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `annoInterface` is NULL. 292 */ 293 AbckitCoreAnnotationInterface *(*arktsAnnotationInterfaceToCoreAnnotationInterface)( 294 AbckitArktsAnnotationInterface *annoInterface); 295 296 /** 297 * @brief Convert an instance of type `AbckitCoreAnnotationInterface` to the instance of type 298 * `AbckitArktsAnnotationInterface`, which can be used to invoke the corresponding APIs. 299 * @return Pointer to the language-dependent representation of the `annoInterface`. 300 * @param [ in ] annoInterface - Annotataion interface to convert. 301 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `annoInterface` is NULL. 302 * @note Set `ABCKIT_STATUS_WRONG_TARGET` error if `annoInterface` is does not have `ABCKIT_TARGET_ARK_TS_V1` or 303 * `ABCKIT_TARGET_ARK_TS_V2` target. 304 */ 305 AbckitArktsAnnotationInterface *(*coreAnnotationInterfaceToArktsAnnotationInterface)( 306 AbckitCoreAnnotationInterface *annoInterface); 307 308 /* ======================================== 309 * AnnotationInterfaceField 310 * ======================================== */ 311 312 /** 313 * @brief Convert an instance of type `AbckitArktsAnnotationInterfaceField` to the instance of type 314 * `AbckitCoreAnnotationInterfaceField`, which can be used to invoke the corresponding APIs. 315 * @return Pointer to the language-independent representation of the `annoInterfaceField`. 316 * @param [ in ] annoInterfaceField - Annotation inteface field to convert. 317 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `annoInterfaceField` is NULL. 318 */ 319 AbckitCoreAnnotationInterfaceField *(*arktsAnnotationInterfaceFieldToCoreAnnotationInterfaceField)( 320 AbckitArktsAnnotationInterfaceField *annoInterfaceField); 321 322 /** 323 * @brief Convert an instance of type `AbckitCoreAnnotationInterfaceField` to the instance of type 324 * `AbckitArktsAnnotationInterfaceField`, which can be used to invoke the corresponding APIs. 325 * @return Pointer to the language-dependent representation of the `annoInterfaceField`. 326 * @param [ in ] annoInterfaceField - Annotation inteface field to convert. 327 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `annoInterfaceField` is NULL. 328 * @note Set `ABCKIT_STATUS_WRONG_TARGET` error if `annoInterfaceField` is does not have `ABCKIT_TARGET_ARK_TS_V1` 329 * or `ABCKIT_TARGET_ARK_TS_V2` target. 330 */ 331 AbckitArktsAnnotationInterfaceField *(*coreAnnotationInterfaceFieldToArktsAnnotationInterfaceField)( 332 AbckitCoreAnnotationInterfaceField *annoInterfaceField); 333 }; 334 335 /** 336 * @brief Struct that is used to create new annotation interfaces. 337 */ 338 struct AbckitArktsAnnotationInterfaceCreateParams { 339 /** 340 * @brief Name of the created annotation interface. 341 */ 342 const char *name; 343 }; 344 345 /** 346 * @brief Struct that is used to create new annotation interface fields. 347 */ 348 struct AbckitArktsAnnotationInterfaceFieldCreateParams { 349 /** 350 * @brief Name of the created annotation interface field. 351 */ 352 const char *name; 353 /** 354 * @brief Type of the created annotation interface field. 355 */ 356 AbckitType *type; 357 /** 358 * @brief Default value of the created annotation interface field. Leave as NULL for no default value. 359 */ 360 AbckitValue *defaultValue; 361 }; 362 363 /** 364 * @brief Struct that is used to create new annotations. 365 */ 366 struct AbckitArktsAnnotationCreateParams { 367 /** 368 * @brief Annotation interface that created annotation instantiates. 369 */ 370 AbckitArktsAnnotationInterface *ai; 371 }; 372 373 /** 374 * @brief Struct that is used to create new annotation elements. 375 */ 376 struct AbckitArktsAnnotationElementCreateParams { 377 /** 378 * @brief Name of the created annotation element. Must be equal to one of the fields of the corresponding annotation 379 * interface. 380 */ 381 const char *name; 382 /** 383 * @brief Value that should be assigned to the annotation element. 384 */ 385 AbckitValue *value; 386 }; 387 388 /** 389 * @brief Struct that is used to create new imports. 390 */ 391 struct AbckitArktsImportFromDynamicModuleCreateParams { 392 /** 393 * @brief Import name. For namespace imports equals to "*". For default imports equals to "default". For regular 394 * imports is the same as in user code. 395 */ 396 const char *name; 397 /** 398 * @brief Alias name for the import. For namespace imports is the same as in user code. For delault import is the 399 * same as the default import name in user code. For regular imports is the same as in user code. 400 */ 401 const char *alias; 402 }; 403 404 /** 405 * @brief Struct that is used to create new exports. 406 */ 407 struct AbckitArktsDynamicModuleExportCreateParams { 408 /** 409 * @brief Name of the entity that should be exported. For star exports equals to "*". For indirect exports is the 410 * same as in user code. For local exports is the same as in user code. 411 */ 412 const char *name; 413 /** 414 * @brief Alias under which entity should be exported. For star exports equals nullptr. For indirect exports is the 415 * same as in user code. For local exports is the same as in user code. 416 */ 417 const char *alias; 418 }; 419 420 /** 421 * @brief Struct that is used to create new external modules. 422 */ 423 struct AbckitArktsV1ExternalModuleCreateParams { 424 /** 425 * @brief Name of the created external module 426 */ 427 const char *name; 428 }; 429 430 /** 431 * @brief Struct that holds the pointers to the modifying API for Arkts-specific Abckit types. 432 */ 433 struct CAPI_EXPORT AbckitArktsModifyApi { 434 /* ======================================== 435 * File 436 * ======================================== */ 437 438 /** 439 * @brief Creates an external Arkts module with target `ABCKIT_TARGET_ARK_TS_V1` and adds it to the file `file`. 440 * @return Pointer to the newly created module. 441 * @param [ in ] file - Binary file to . 442 * @param [ in ] params - Data that is used to create the external module. 443 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `file` is NULL. 444 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `params` is NULL. 445 * @note Allocates 446 */ 447 AbckitArktsModule *(*fileAddExternalModuleArktsV1)(AbckitFile *file, 448 const struct AbckitArktsV1ExternalModuleCreateParams *params); 449 450 /* ======================================== 451 * Module 452 * ======================================== */ 453 454 /** 455 * @brief Adds import from one Arkts module to another Arkts module. 456 * @return Pointer to the newly created import descriptor. 457 * @param [ in ] importing - Importing module. 458 * @param [ in ] imported - The module the `importing` module imports from. 459 * @param [ in ] params - Data that is used to create the import. 460 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `importing` is NULL. 461 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `imported` is NULL. 462 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `params` is NULL. 463 * @note Allocates 464 */ 465 AbckitArktsImportDescriptor *(*moduleAddImportFromArktsV1ToArktsV1)( 466 AbckitArktsModule *importing, AbckitArktsModule *imported, 467 const struct AbckitArktsImportFromDynamicModuleCreateParams *params); 468 469 /** 470 * @brief Removes import `id` from module `m`. 471 * @return None. 472 * @param [ in ] m - Module to remove the import `id` from. 473 * @param [ in ] id - Import to remove from the module `m`. 474 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `m` is NULL. 475 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `id` is NULL. 476 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if module `m` does not have the import descriptor `id`. 477 * @note Set `ABCKIT_STATUS_UNSUPPORTED` error if module `m` doesn;t have `ABCKIT_TARGET_ARK_TS_V1` target. 478 */ 479 void (*moduleRemoveImport)(AbckitArktsModule *m, AbckitArktsImportDescriptor *id); 480 481 /** 482 * @brief Adds export from one Arkts module to another Arkts module. 483 * @return Pointer to the newly created export descriptor. 484 * @param [ in ] exporting - The module to add export to. 485 * @param [ in ] exported - The module the entity is exported from. In case of local export is the same as 486 * `exporting`. 487 * @param [ in ] params - Data that is used to create the export. 488 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `exporting` is NULL. 489 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `exported` is NULL. 490 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `params` is NULL. 491 * @note Set `ABCKIT_STATUS_UNSUPPORTED` error if module `m` doesn't have `ABCKIT_TARGET_ARK_TS_V1` target. 492 * @note Allocates 493 */ 494 AbckitArktsExportDescriptor *(*moduleAddExportFromArktsV1ToArktsV1)( 495 AbckitArktsModule *exporting, AbckitArktsModule *exported, 496 const struct AbckitArktsDynamicModuleExportCreateParams *params); 497 498 /** 499 * @brief Removes export `ed` from module `m`. 500 * @return None. 501 * @param [ in ] m - Module to remove the export `e` from. 502 * @param [ in ] ed - Export to remove from the module `m`. 503 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `m` is NULL. 504 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `ed` is NULL. 505 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if module `m` does not have the export descriptor `ed`. 506 * @note Set `ABCKIT_STATUS_UNSUPPORTED` error if module `m` doesn't have `ABCKIT_TARGET_ARK_TS_V1` target. 507 */ 508 void (*moduleRemoveExport)(AbckitArktsModule *m, AbckitArktsExportDescriptor *ed); 509 510 /** 511 * @brief Adds new annotation interface to the module `m`. 512 * @return Pointer to the newly constructed annotation interface. 513 * @param [ in ] m - Module to add annotation interface to. 514 * @param [ in ] params - Data that is used to create the annotation interface. 515 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `m` is NULL. 516 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `params` is NULL. 517 * @note Set `ABCKIT_STATUS_UNSUPPORTED` error if module `m` doesn't have `ABCKIT_TARGET_ARK_TS_V1` target. 518 * @note Allocates 519 */ 520 AbckitArktsAnnotationInterface *(*moduleAddAnnotationInterface)( 521 AbckitArktsModule *m, const struct AbckitArktsAnnotationInterfaceCreateParams *params); 522 523 /* ======================================== 524 * Class 525 * ======================================== */ 526 527 /** 528 * @brief Add annotation to the class declaration. 529 * @return Pointer to the newly created annotation. 530 * @param [ in ] klass - Class to add annotation to. 531 * @param [ in ] params - Data that is used to create the annotation. 532 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `klass` is NULL. 533 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `params` is NULL. 534 * @note Set `ABCKIT_STATUS_UNSUPPORTED` error if class `klass` doesn't have `ABCKIT_TARGET_ARK_TS_V1` target. 535 * @note Allocates 536 */ 537 AbckitArktsAnnotation *(*classAddAnnotation)(AbckitArktsClass *klass, 538 const struct AbckitArktsAnnotationCreateParams *params); 539 540 /** 541 * @brief Remove annotation from the class declaration. 542 * @return None. 543 * @param [ in ] klass - Class to remove annotation from. 544 * @param [ in ] anno - Annotation to remove. 545 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `klass` is NULL. 546 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `anno` is NULL. 547 * @note Set `ABCKIT_STATUS_UNSUPPORTED` error if class `klass` doesn't have `ABCKIT_TARGET_ARK_TS_V1` target. 548 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if class `klass` doesn't have the annotation `anno`. 549 */ 550 void (*classRemoveAnnotation)(AbckitArktsClass *klass, AbckitArktsAnnotation *anno); 551 552 /* ======================================== 553 * AnnotationInterface 554 * ======================================== */ 555 556 /** 557 * @brief Add new field to the annotation interface. 558 * @return Pointer to the newly created annotation field. 559 * @param [ in ] ai - Annotation interface to add new field to. 560 * @param [ in ] params - Data that is used to create the field of the annotation interface `ai`. 561 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `ai` is NULL. 562 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `params` is NULL. 563 * @note Set `ABCKIT_STATUS_UNSUPPORTED` error if annotation interface `ai` doesn't have `ABCKIT_TARGET_ARK_TS_V1` 564 * target. 565 * @note Allocates 566 */ 567 AbckitArktsAnnotationInterfaceField *(*annotationInterfaceAddField)( 568 AbckitArktsAnnotationInterface *ai, const struct AbckitArktsAnnotationInterfaceFieldCreateParams *params); 569 570 /** 571 * @brief Remove field from the annotation interface. 572 * @return None. 573 * @param [ in ] ai - Annotation interface to remove the field `field` from. 574 * @param [ in ] field - Field to remove from the annotation interface `ai`. 575 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `ai` is NULL. 576 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `field` is NULL. 577 * @note Set `ABCKIT_STATUS_UNSUPPORTED` error if annotation interface `ai` doesn't have `ABCKIT_TARGET_ARK_TS_V1` 578 * target. 579 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if annotation interface `ai` does not have the field `field`. 580 */ 581 void (*annotationInterfaceRemoveField)(AbckitArktsAnnotationInterface *ai, 582 AbckitArktsAnnotationInterfaceField *field); 583 584 /* ======================================== 585 * Function 586 * ======================================== */ 587 588 /** 589 * @brief Function to add annotation to. 590 * @return Pointer to the newly created annotation. 591 * @param [ in ] function - Function to add annotation to. 592 * @param [ in ] params - Data that is used to create the annotation. 593 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `function` is NULL. 594 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `params` is NULL. 595 * @note Set `ABCKIT_STATUS_UNSUPPORTED` error if function `function` doesn't have `ABCKIT_TARGET_ARK_TS_V1` target. 596 * @note Allocates 597 */ 598 AbckitArktsAnnotation *(*functionAddAnnotation)(AbckitArktsFunction *function, 599 const struct AbckitArktsAnnotationCreateParams *params); 600 601 /** 602 * @brief Remove annotation from the function. 603 * @return None. 604 * @param [ in ] function - Function to remove annotation `anno` from. 605 * @param [ in ] anno - Annotation to remove from the function `function`. 606 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `function` is NULL. 607 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `anno` is NULL. 608 * @note Set `ABCKIT_STATUS_UNSUPPORTED` error if function `function` doesn't have `ABCKIT_TARGET_ARK_TS_V1` target. 609 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if function `function` doesn't have the annotation `anno`. 610 */ 611 void (*functionRemoveAnnotation)(AbckitArktsFunction *function, AbckitArktsAnnotation *anno); 612 613 /* ======================================== 614 * Annotation 615 * ======================================== */ 616 617 /** 618 * @brief Add annotation element to the existing annotation. 619 * @return Pointer to the newly created annotation element. 620 * @param [ in ] anno - Annotation to add new element to. 621 * @param [ in ] params - Data that is used to create the annotation element. 622 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `anno` is NULL. 623 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `params` is NULL. 624 * @note Set `ABCKIT_STATUS_UNSUPPORTED` error if annotation `anno` doesn't have `ABCKIT_TARGET_ARK_TS_V1` target. 625 * @note Allocates 626 */ 627 AbckitArktsAnnotationElement *(*annotationAddAnnotationElement)( 628 AbckitArktsAnnotation *anno, struct AbckitArktsAnnotationElementCreateParams *params); 629 630 /** 631 * @brief Remove annotation element `elem` from the annotation `anno`. 632 * @return None. 633 * @param [ in ] anno - Annotation to remove the annotataion element `elem` from. 634 * @param [ in ] elem - Annotation element to remove from the annotation `anno`. 635 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `anno` is NULL. 636 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if `elem` is NULL. 637 * @note Set `ABCKIT_STATUS_UNSUPPORTED` error if annotation `anno` doesn't have `ABCKIT_TARGET_ARK_TS_V1` target. 638 * @note Set `ABCKIT_STATUS_BAD_ARGUMENT` error if annotation `anno` doesn't have the annotation element `elem`. 639 */ 640 void (*annotationRemoveAnnotationElement)(AbckitArktsAnnotation *anno, AbckitArktsAnnotationElement *elem); 641 642 /* ======================================== 643 * Type 644 * ======================================== */ 645 646 /* ======================================== 647 * Value 648 * ======================================== */ 649 650 /* ======================================== 651 * String 652 * ======================================== */ 653 654 /* ======================================== 655 * LiteralArray 656 * ======================================== */ 657 658 /* ======================================== 659 * Literal 660 * ======================================== */ 661 }; 662 663 /** 664 * @brief Instantiates non-modifying API for Arkts-specific Abckit types. 665 * @return Instance of the `AbckitApi` struct with valid function pointers. 666 * @param [ in ] version - Version of the API to instantiate. 667 * @note Set `ABCKIT_STATUS_UNKNOWN_API_VERSION` error if `version` value is not in the `AbckitApiVersion` enum. 668 */ 669 CAPI_EXPORT struct AbckitArktsInspectApi const *AbckitGetArktsInspectApiImpl(enum AbckitApiVersion version); 670 671 /** 672 * @brief Instantiates modifying API for Arkts-specific Abckit types. 673 * @return Instance of the `AbckitApi` struct with valid function pointers. 674 * @param [ in ] version - Version of the API to instantiate. 675 * @note Set `ABCKIT_STATUS_UNKNOWN_API_VERSION` error if `version` value is not in the `AbckitApiVersion` enum. 676 */ 677 CAPI_EXPORT struct AbckitArktsModifyApi const *AbckitGetArktsModifyApiImpl(enum AbckitApiVersion version); 678 679 #ifdef __cplusplus 680 } 681 #endif /* __cplusplus */ 682 683 #endif /* !LIBABCKIT_METADATA_ARKTS_H */ 684