/usr/include/ino-0/ino/lib.h is in ino-headers 0.4.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 | /*
* NASPRO - The NASPRO Architecture for Sound Processing
* Common headers for all ino implementations
*
* Copyright (C) 2011, 2012 ino development team
*
* See the COPYING file for license conditions.
*/
/*
Title: ino
*Version*: 0.4.0, *API*: 0.0.0.
About:
<ino at http://naspro.atheme.org/libraries/ino/> is a minimalist C API to
execute JavaScript code and to expose native methods to JavaScript
execution contexts.
The code is released under an ISC-style license (see the COPYING file).
API conventions:
* It is not thread-safe to concurrently operate on the same <ino_context>,
unless otherwise specified;
* All strings are null-terminated, UTF-8 or UTF-16 encoded according to the
Unicode 6.0 standard and without BOM (byte-order-mark) characters, unless
otherwise specified;
* <ino_variant> objects are automatically garbage collected or otherwise
destroyed when <ino_context_free()> is called for the execution context
they belong to;
* No function does input validation, hence, in case the API is misused in
this sense, the results are undefined.
Build-time dependencies:
* An environment capable of running Autotools-based build systems;
* (optional) <GNU Autoconf at http://www.gnu.org/software/autoconf/> >=
2.68 and <GNU Automake at http://www.gnu.org/software/automake/> to
regenerate the build system;
* (optional) <Natural Docs at http://www.naturaldocs.org/> >= 1.5 to
regenerate the build system and/or the documentation.
Usage:
Both ino implementations and applications/libraries using them are meant to
be including <ino/lib.h> in their source files.
Furthermore, ino implementations also need to #define the
INO_IMPLEMENTATION flag before such inclusion and should provide suitable
<pkg-config at http://pkg-config.freedesktop.org/> files for the build
systems of applications/libraries to retrieve compiler and linker flags.
This package itself supplies a pkg-config file
(package name: ino-headers-0) specifying compiler flags for the inclusion
of headers.
*/
#ifndef _INO_LIB_H
#define _INO_LIB_H
#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
/*
Group: Global Declaration Macros
These macros are meant to be used to delimit declarations in public header
files.
Example:
myheader.h
> #ifndef MY_HEADER_H
> #define MY_HEADER_H
>
> INO_BEGIN_C_DECLS
>
> ... blah blah blah ...
>
> INO_END_C_DECLS
>
> #endif
*/
/*
Macro: INO_BEGIN_C_DECLS
Delimits the beginning of public declarations.
So that C++ compilers don't mangle their names.
*/
/*
Macro: INO_END_C_DECLS
Delimits the end of public declarations.
So that C++ compilers don't mangle their names.
*/
/*
Group: Symbol Declaration Macros
These macros are meant to be used for *SINGLE* symbol declarations (variables
or functions) by prepending them to such declarations.
They can be combined together, unless otherwise told.
Example:
myfunc.h
> INO_PUBLIC void myfunc();
myfunc.c
> INO_PUBLIC void
> myfunc()
> {
> ... blah blah blah ...
> }
*/
/*
Macro: INO_IMPORT
Specifies that a symbol is imported from a library.
Cannot be combined with <INO_EXPORT>.
*/
/*
Macro: INO_EXPORT
Specifies that a symbol is to be exported.
Cannot be combined with <INO_IMPORT>.
*/
/*
Macro: INO_PUBLIC
Specifies that a symbol is publicly visible.
Cannot be combined with <INO_PRIVATE>.
*/
/*
Macro: INO_PRIVATE
Specifies that a symbol has hidden visibility.
Cannot be combined with <INO_PUBLIC>.
*/
/*
Macro: INO_DEF
Equivalent to a combination of <INO_PUBLIC> and <INO_EXPORT> if the
INO_IMPLEMENTATION flag is defined or to a combination of <INO_PRIVATE> and
<INO_IMPORT> otherwise.
*/
#ifdef __cplusplus
# define INO_BEGIN_C_DECLS extern "C" {
# define INO_END_C_DECLS }
#else
# define INO_BEGIN_C_DECLS
# define INO_END_C_DECLS
#endif
#ifdef __GNUC__ /* assuming gcc >= 2.95 */
# ifdef _WIN32
# define INO_IMPORT __attribute__((dllimport))
# define INO_EXPORT __attribute__((dllexport))
# else
# define INO_IMPORT
# define INO_EXPORT
# endif
# if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) \
&& !defined(_WIN32)
# define INO_PUBLIC __attribute__((visibility("default")))
# define INO_PRIVATE __attribute__((visibility("hidden")))
# else
# define INO_PUBLIC
# define INO_PRIVATE
# endif
#else
# define INO_IMPORT
# define INO_EXPORT
# define INO_PUBLIC
# define INO_PRIVATE
#endif
#ifdef INO_IMPLEMENTATION
# define INO_DEF INO_PUBLIC INO_EXPORT
#else
# define INO_DEF INO_PUBLIC INO_IMPORT
#endif
INO_BEGIN_C_DECLS
/*
Group: Enumerations
*/
/*
Enum: ino_variant_type
Variant type.
INO_VARINAT_TYPE_UNDEFINED - undefined value.
INO_VARIANT_TYPE_NULL - null value.
INO_VARIANT_TYPE_BOOLEAN - Boolean value.
INO_VARIANT_TYPE_STRING - String.
INO_VARIANT_TYPE_NUMBER - Numeric value.
INO_VARIANT_TYPE_OBJECT - Object.
*/
typedef enum
{
INO_VARIANT_TYPE_UNDEFINED,
INO_VARIANT_TYPE_NULL,
INO_VARIANT_TYPE_BOOLEAN,
INO_VARIANT_TYPE_STRING,
INO_VARIANT_TYPE_NUMBER,
INO_VARIANT_TYPE_OBJECT
} ino_variant_type;
/*
Group: Types
*/
/*
Type: ino_context
Execution context.
*/
typedef void* ino_context;
/*
Type: ino_variant
Variant.
*/
typedef void* ino_variant;
/*
Type: ino_method_cb
Native method callback.
Parameters:
ctx - Execution context.
args - Array of arguments passed to the method.
n_args - Number of elements in args.
Returns:
New variant holding the result value.
*/
typedef ino_variant
(*ino_method_cb)(ino_context ctx, const ino_variant *args, size_t n_args);
/*
Group: Functions
*/
/*
Function: ino_context_new()
Creates a new execution context.
Returns:
New execution context.
*/
INO_DEF ino_context
ino_context_new();
/*
Function: ino_context_free()
Destroys an execution context.
*/
INO_DEF void
ino_context_free(ino_context ctx);
/*
Function: ino_context_get_global_object()
Gets the global object in ctx.
Parameters:
ctx - Execution context.
Returns:
Global object in ctx.
*/
INO_DEF ino_variant
ino_context_get_global_object(ino_context ctx);
/*
Function: ino_variant_new_undefined()
Creates a new variant holding undefined.
Paramters:
ctx - Execution context.
Returns:
Variant holding undefined.
*/
INO_DEF ino_variant
ino_variant_new_undefined(ino_context ctx);
/*
Function: ino_variant_new_null()
Creates a new variant holding null.
Paramters:
ctx - Execution context.
Returns:
Variant holding null.
*/
INO_DEF ino_variant
ino_variant_new_null(ino_context ctx);
/*
Function: ino_variant_new_boolean()
Creates a new variant holding the specified boolean value.
Paramters:
ctx - Execution context.
value - The value.
Returns:
Variant holding the specified boolean value.
*/
INO_DEF ino_variant
ino_variant_new_boolean(ino_context ctx, bool value);
/*
Function: ino_variant_new_string()
Creates a new variant holding the specified string.
Paramters:
ctx - Execution context.
value - UTF-16 encoded string.
Returns:
Variant holding the specified string.
*/
INO_DEF ino_variant
ino_variant_new_string(ino_context ctx, const uint16_t *value);
/*
Function: ino_variant_new_string_utf8()
Creates a new variant holding the specified string.
Paramters:
ctx - Execution context.
value - UTF-8 encoded string.
Returns:
Variant holding the specified string.
*/
INO_DEF ino_variant
ino_variant_new_string_utf8(ino_context ctx, const char *value);
/*
Function: ino_variant_new_number()
Creates a new variant holding the specified numeric value.
Paramters:
ctx - Execution context.
value - The numeric value.
Returns:
Variant holding the specified numeric value.
*/
INO_DEF ino_variant
ino_variant_new_number(ino_context ctx, double value);
/*
Function: ino_variant_new_object()
Creates a new variant holding a new object.
Paramters:
ctx - Execution context.
Returns:
Variant holding a new object.
*/
INO_DEF ino_variant
ino_variant_new_object(ino_context ctx);
/*
Function: ino_variant_get_type()
Gets the type of value held by a variant.
Parameters:
ctx - Execution context.
variant - Variant.
Returns:
Variant type.
*/
INO_DEF ino_variant_type
ino_variant_get_type(ino_context ctx, ino_variant variant);
/*
Function: ino_variant_to_boolean()
Converts a variant to boolean and returns its value.
Parameters:
ctx - Execution context.
variant - Variant.
Returns:
Boolean value.
*/
INO_DEF bool
ino_variant_to_boolean(ino_context ctx, ino_variant variant);
/*
Function: ino_variant_to_string()
Converts a variant to string and returns a UTF-16 encoding malloc()-allocated
copy.
The returned value should be free()d whe it is no longer needed.
Parameters:
ctx - Execution context.
variant - Variant.
Returns:
UTF-16 encoded malloc()-allocated string copy.
*/
INO_DEF uint16_t *
ino_variant_to_string(ino_context ctx, ino_variant variant);
/*
Function: ino_variant_to_string_utf8()
Converts a variant to string and returns a UTF-8 encoding malloc()-allocated
copy.
The returned value should be free()d whe it is no longer needed.
Parameters:
ctx - Execution context.
variant - Variant.
Returns:
UTF-8 encoded malloc()-allocated string copy.
*/
INO_DEF char *
ino_variant_to_string_utf8(ino_context ctx, ino_variant variant);
/*
Function: ino_variant_to_number()
Converts a variant to number and returns its value.
Parameters:
ctx - Execution context.
variant - Variant.
Returns:
Numeric value.
*/
INO_DEF double
ino_variant_to_number(ino_context ctx, ino_variant variant);
/*
Function: ino_variant_object_get_property()
Gets a property from an object.
Parameters:
ctx - Execution context.
object - Object variant.
name - UTF-16 encoded property name.
Returns:
Variant containing the property value or the undefined value if the object
does not have the specified property.
*/
INO_DEF ino_variant
ino_variant_object_get_property(ino_context ctx, ino_variant object,
const uint16_t *name);
/*
Function: ino_variant_object_get_property_utf8()
Gets a property from an object.
Parameters:
ctx - Execution context.
object - Object variant.
name - UTF-8 encoded property name.
Returns:
Variant containing the property value or the undefined value if the object
does not have the specified property.
*/
INO_DEF ino_variant
ino_variant_object_get_property_utf8(ino_context ctx, ino_variant object,
const char *name);
/*
Function: ino_variant_object_set_property()
Sets a property on an object.
Parameters:
ctx - Execution context.
object - Object variant.
name - UTF-16 encoded property name.
value - Variant containing the property value.
*/
INO_DEF void
ino_variant_object_set_property(ino_context ctx, ino_variant object,
const uint16_t *name, ino_variant value);
/*
Function: ino_variant_object_set_property_utf8()
Sets a property on an object.
Parameters:
ctx - Execution context.
object - Object variant.
name - UTF-8 encoded property name.
value - Variant containing the property value.
*/
INO_DEF void
ino_variant_object_set_property_utf8(ino_context ctx, ino_variant object,
const char *name, ino_variant value);
/*
Function: ino_variant_object_add_method()
Adds a natively implemented method to an object.
Parameters:
ctx - Execution context.
object - Object variant.
name - UTF-16 encoded method name.
cb - Callback implementing the method.
Returns:
Object variant representing the method.
*/
INO_DEF ino_variant
ino_variant_object_add_method(ino_context ctx, ino_variant object,
const uint16_t *name, ino_method_cb cb);
/*
Function: ino_variant_object_add_method_utf8()
Adds a natively implemented method to an object.
Parameters:
ctx - Execution context.
object - Object variant.
name - UTF-8 encoded method name.
cb - Callback implementing the method.
Returns:
Object variant representing the method.
*/
INO_DEF ino_variant
ino_variant_object_add_method_utf8(ino_context ctx, ino_variant object,
const char *name, ino_method_cb cb);
/*
Function: ino_variant_object_call()
Call an object as a function.
Parameters:
ctx - Execution context.
object - Object variant.
args - Array of arguments.
n_args - Number of elements in args.
Returns:
Variant holding the result value.
*/
INO_DEF ino_variant
ino_variant_object_call(ino_context ctx, ino_variant object,
const ino_variant *args, size_t n_args);
/*
Function: ino_variant_protect()
Protects a variant from garbage collection.
A variant may be protected multiple times and must be unprotected an equal
number of times before becoming eligible for garbage collection.
Parameters:
ctx - Execution context.
variant - Variant.
*/
INO_DEF void
ino_variant_protect(ino_context ctx, ino_variant variant);
/*
Function: ino_variant_unprotect()
Unprotects a variant from garbage collection.
Parameters:
ctx - Execution context.
variant - Variant.
*/
INO_DEF void
ino_variant_unprotect(ino_context ctx, ino_variant variant);
/*
Function: ino_eval()
Evaluates a string of JavaScript code.
Parameters:
ctx - Execution context.
script - UTF-16 encoded string of JavaScript code.
Returns:
Variant holding the result value.
*/
INO_DEF ino_variant
ino_eval(ino_context ctx, const uint16_t *script);
/*
Function: ino_eval_utf8()
Evaluates a string of JavaScript code.
Parameters:
ctx - Execution context.
script - UTF-8 encoded string of JavaScript code.
Returns:
Variant holding the result value.
*/
INO_DEF ino_variant
ino_eval_utf8(ino_context ctx, const char *script);
INO_END_C_DECLS
#endif
|