### Setup and Annotation Functions in DasLang Source: https://daslang.io/doc/genindex Facilitates the setup of various program constructs like call lists, macros, and annotations. Includes functions for setting up annotations such as `SetupAnyAnnotation`, `SetupBlockAnnotation`, and others, along with their `apply` and specific setup methods. ```DasLang setup_call_list(name: string, at: LineInfo, isInit: bool = false, isPrivate: bool = true, isLateInit: bool = false) : ExprBlock?() setup_call_list(name: string, at: LineInfo, subblock: block<(var fn:FunctionPtr):void>) : ExprBlock?() setup_macro(name: string, at: LineInfo) : ExprBlock?() setup_tag_annotation(name: string, tag: string, classPtr: auto) : auto() SetupAnyAnnotation.apply(st: StructurePtr, group: ModuleGroup, args: AnnotationArgumentList, errors: das_string) : bool() SetupAnyAnnotation.setup_call() SetupBlockAnnotation : SetupAnyAnnotation SetupCallMacro : SetupAnyAnnotation SetupCaptureMacro : SetupAnyAnnotation SetupCommentReader : SetupAnyAnnotation SetupContractAnnotation : SetupAnyAnnotation SetupDirtyInferMacro : SetupAnyAnnotation SetupEnumerationAnnotation : SetupAnyAnnotation SetupForLoopMacro : SetupAnyAnnotation SetupFunctionAnnotation : SetupAnyAnnotation SetupGlobalLintMacro : SetupAnyAnnotation SetupInferMacro : SetupAnyAnnotation SetupLintMacro : SetupAnyAnnotation SetupOptimizationMacro : SetupAnyAnnotation SetupReaderMacro : SetupAnyAnnotation SetupSimulateMacro : SetupAnyAnnotation SetupStructureAnnotation : SetupAnyAnnotation SetupTypeInfoMacro : SetupAnyAnnotation SetupTypeMacro : SetupAnyAnnotation SetupVariantMacro : SetupAnyAnnotation ``` -------------------------------- ### SetupSimulateMacro: Simulate Macro Setup Source: https://daslang.io/doc/stdlib/ast_boost Handles setup for simulate macros, specified by '[simulate_macro]'. This class inherits from SetupAnyAnnotation. ```DasLang SetupSimulateMacro : SetupAnyAnnotation Fields * **annotation_function_call** : string = “add_new_simulate_macro” - This is base class for a simulate macro. ``` -------------------------------- ### SetupInferMacro: Infer Macro Setup Source: https://daslang.io/doc/stdlib/ast_boost Handles setup for infer macros ('[infer_macro]'). It inherits from SetupAnyAnnotation. ```DasLang SetupInferMacro : SetupAnyAnnotation Fields * **annotation_function_call** : string = “add_new_infer_macro” - [infer_macro] implementation. ``` -------------------------------- ### SetupCaptureMacro: Capture Macro Setup Source: https://daslang.io/doc/stdlib/ast_boost Provides setup functionality for capture macros ('[capture_macro]'). It inherits from SetupAnyAnnotation. ```DasLang SetupCaptureMacro : SetupAnyAnnotation Fields * **annotation_function_call** : string = “add_new_capture_macro” - [capture_macro] implementation. ``` -------------------------------- ### SetupForLoopMacro: For Loop Macro Setup Source: https://daslang.io/doc/stdlib/ast_boost Handles the setup for for loop macros, identified by '[for_loop_macro]'. This class inherits from SetupAnyAnnotation. ```DasLang SetupForLoopMacro : SetupAnyAnnotation Fields * **annotation_function_call** : string = “add_new_for_loop_macro” - [for_loop_macro] implementation. ``` -------------------------------- ### SetupCallMacro: Call Macro Setup Source: https://daslang.io/doc/stdlib/ast_boost Provides setup for call macros ('[call_macro]') in DasLang. It inherits from SetupAnyAnnotation. ```DasLang SetupCallMacro : SetupAnyAnnotation Fields * **annotation_function_call** : string = “add_new_call_macro” - [call_macro] implementation. ``` -------------------------------- ### SetupReaderMacro: Reader Macro Setup Source: https://daslang.io/doc/stdlib/ast_boost Handles the setup for reader macros, identified by the '[reader_macro]' tag. It inherits from SetupAnyAnnotation with a specific function call. ```DasLang SetupReaderMacro : SetupAnyAnnotation Fields * **annotation_function_call** : string = “add_new_reader_macro” - [reader_macro] implementation. ``` -------------------------------- ### SetupCommentReader: Comment Reader Setup Source: https://daslang.io/doc/stdlib/ast_boost Provides setup for comment readers, corresponding to '[comment_reader]'. This class inherits from SetupAnyAnnotation. ```DasLang SetupCommentReader : SetupAnyAnnotation Fields * **annotation_function_call** : string = “add_new_comment_reader” - [comment_reader] implementation. ``` -------------------------------- ### Using lpipe Macro for Block Piping Source: https://daslang.io/doc/_sources/stdlib/lpipe.rst This example showcases the 'lpipe' macro's functionality in piping a code block to the 'take2' function. The second block, starting with 'lpipe <|', is executed within the context of 'take2', demonstrating how to pass blocks to functions using the lpipe pattern. ```daslang def take2(a,b:block) invoke(a) invoke(b) ... take2 <| print("block1\n") lpipe <| // this block will pipe into take2 print("block2\n") ``` -------------------------------- ### Daslang Struct Initialization Examples Source: https://daslang.io/doc/reference/language/structs Illustrates struct initialization. 'fZero' gets default zero values, while 'fInited' calls the default initializer. 'fExplicit' initializes only specified fields. ```daslang let fZero : Foo // no initializer is called, x, y = 0 let fInited = Foo() // initializer is called, x = 1, y = 2 let fExplicit = Foo(uninitialized x=13) // x = 13, y = 0 ``` -------------------------------- ### SetupEnumerationAnnotation: Enumeration Annotation Setup Source: https://daslang.io/doc/stdlib/ast_boost Handles setup for enumeration annotations, including the '[enumration_macro]' implementation. It inherits from SetupAnyAnnotation. ```DasLang SetupEnumerationAnnotation : SetupAnyAnnotation Fields * **annotation_function_call** : string = “add_new_enumeration_annotation” - [enumration_macro] implementation. ``` -------------------------------- ### SetupDirtyInferMacro: Dirty Infer Macro Setup Source: https://daslang.io/doc/stdlib/ast_boost Provides setup for dirty infer macros, indicated by '[dirty_infer_macro]'. This class inherits from SetupAnyAnnotation. ```DasLang SetupDirtyInferMacro : SetupAnyAnnotation Fields * **annotation_function_call** : string = “add_new_dirty_infer_macro” - [dirty_infer_macro] implementation. ``` -------------------------------- ### SetupContractAnnotation: Contract Annotation Setup Source: https://daslang.io/doc/stdlib/ast_boost Provides setup for contract annotations, inheriting from SetupAnyAnnotation. The function call is set to 'add_new_contract_annotation'. ```DasLang SetupContractAnnotation : SetupAnyAnnotation Fields * **annotation_function_call** : string = “add_new_contract_annotation” - This is base class for contract annotation setup. ``` -------------------------------- ### SetupBlockAnnotation: Block Annotation Setup Source: https://daslang.io/doc/stdlib/ast_boost A setup class for block annotations, inheriting from SetupAnyAnnotation. It defaults the annotation function call to 'add_new_block_annotation'. ```DasLang SetupBlockAnnotation : SetupAnyAnnotation Fields * **annotation_function_call** : string = “add_new_block_annotation” - This is base class for block annotation setup. ``` -------------------------------- ### Daslang Reification: qmacro Example Source: https://daslang.io/doc/reference/language Shows a basic example of using qmacro for compile-time code generation in Daslang. qmacro allows macros to manipulate abstract syntax trees. ```daslang qmacro my_macro(ast_node) { // process and transform ast_node return transformed_ast_node; } ``` -------------------------------- ### SetupFunctionAnnotation: Function Annotation Setup Source: https://daslang.io/doc/stdlib/ast_boost A specialized setup class for function annotations. It inherits from SetupAnyAnnotation and sets the default annotation function call to 'add_new_function_annotation'. ```DasLang SetupFunctionAnnotation : SetupAnyAnnotation Fields * **annotation_function_call** : string = “add_new_function_annotation” - This is base class for function annotation setup. ``` -------------------------------- ### DasLang Block Function Signature Examples Source: https://daslang.io/doc/_sources/reference/language/blocks.rst Illustrates how to declare function parameters that accept block types in DasLang. Shows examples with and without explicit block type signatures. ```DasLang def goo ( b : block ) ... def foo ( b : block < (arg1:int, arg2:float&) : bool > ... ``` -------------------------------- ### Example of _take_while Shorthand Macro Source: https://daslang.io/doc/_sources/stdlib/linq_boost.rst Shows an example of the `_take_while` shorthand macro, which is used to take elements from the beginning of an iterator as long as a condition is met. This simplifies conditional element selection. ```das each(foo)._take_while(_ < 5) ``` -------------------------------- ### Generate C++ bindings example - Daslang Source: https://daslang.io/doc/stdlib/cpp_bind Example demonstrating the generation of C++ bindings for Daslang interfaces. It uses `get_das_root`, `fopen`, and `log_cpp_class_adapter` to create an include file with class adapter code. ```daslang require fio require ast require daslib/cpp_bind [init] def generate_cpp_bindings let root = get_das_root() + "/examples/tutorial/" fopen(root + "tutorial04_gen.inc","wb") <| $ ( cpp_file ) log_cpp_class_adapter(cpp_file, "TutorialBaseClass", typeinfo(ast_typedecl type)) ``` -------------------------------- ### Daslang Comprehension Syntax Examples Source: https://daslang.io/doc/_sources/reference/language/comprehensions.rst Demonstrates the various forms of Daslang comprehensions, including array, iterator, and table comprehensions, with examples of single and multiple variable iteration, and filtering using a 'where' clause. ```Daslang var a1 <- [iterator for(x in range(0,10)); x] // iterator var a2 <- [for(x in range(0,10)); x] // array var at1 <- {for(x in range(0,10)); x} // table var at2 <- {for(x in range(0,10)); x=>"{x}"} // table var a3 <- [for(x in range(0,10)); x; where (x & 1) == 1] // only odd numbers var a4 <- [for(x,y in range(0,10),a1); x + y; where x==y] // multiple variables var a = [1,2,3,4] var b <- [iterator for(x in a); a] // iterator and will point to captured copy of the elements of a ``` -------------------------------- ### Daslang Function Declaration Examples Source: https://daslang.io/doc/_sources/reference/language/functions.rst Demonstrates basic function declaration in Daslang, including functions with parameters, return types, and empty functions. It also shows an example of a compilation error due to returning a different type than declared. ```daslang def twice(a: int): int { return a+a } def foo { print("foo") } //same as above def foo() { print("foo") } def foo(a:bool) { if ( a ) { return 1 } else { return 2.0 // error, expecting int } } ``` -------------------------------- ### Get Dimension of Vector Type Source: https://daslang.io/doc/stdlib/ast Returns the dimension of a vector type. For example, for `vector4`, it returns `4`. ```das TypeDecl implicit.vectorDim() : int() ``` -------------------------------- ### Get Base Type of Vector Source: https://daslang.io/doc/stdlib/ast Returns the base type of a vector type. For example, for `vector4`, it returns `float` if the type is `float4`. ```das TypeDecl implicit.vectorBaseType() : Type() ``` -------------------------------- ### Setup Functions Source: https://daslang.io/doc/stdlib/ast_boost Functions related to setting up various components within the daslang_io_doc project. These include setting up call lists, macros, and tag annotations. ```APIDOC ## setup_call_list (name: string; at: LineInfo; subblock: block<(var fn:FunctionPtr):void>) : ExprBlock? ### Description Create new function which will contain collection of calls. Returns body block to where the call is to be appended. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` ```APIDOC ## setup_call_list (name: string; at: LineInfo; isInit: bool = false; isPrivate: bool = true; isLateInit: bool = false) : ExprBlock? ### Description Create new function which will contain collection of calls. Returns body block to where the call is to be appended. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` ```APIDOC ## setup_macro (name: string; at: LineInfo) : ExprBlock? ### Description Setup macro initialization function, which will only be called during compilation of this module. Returns body block to where the macro initialization is to be appended. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` ```APIDOC ## setup_tag_annotation (name: string; tag: string; var classPtr: auto) : auto ### Description Creates annotation and applies it to all tagged functions given tag. ### Method N/A (Function Signature) ### Endpoint N/A (Function Signature) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### SetupTypeInfoMacro: Type Info Macro Setup Source: https://daslang.io/doc/stdlib/ast_boost Sets up type information macros, corresponding to '[typeinfo_macro]'. This class inherits from SetupAnyAnnotation. ```DasLang SetupTypeInfoMacro : SetupAnyAnnotation Fields * **annotation_function_call** : string = “add_new_typeinfo_macro” - [typeinfo_macro] implementation. ``` -------------------------------- ### Using [apply_in_context] Annotation for Cross-Context Function Calls Source: https://daslang.io/doc/stdlib/apply_in_context This example shows the usage of the [apply_in_context] function annotation in Daslang. It modifies a function to be called within a specific debug agent context (e.g., 'opengl_cache'). If the specified context is not installed, a panic will occur. The example illustrates calling a 'cache_font' function within the 'opengl_cache' context. ```daslang [apply_in_context(opengl_cache)] def public cache_font(name:string implicit) : Font? // ... let font = cache_font("Arial") // call invoked in the "opengl_cache" debug agent context ``` -------------------------------- ### Daslang Modifying Table Value Safely Source: https://daslang.io/doc/reference/language/tables Demonstrates a non-constant version of 'get' that allows modification of the retrieved value within a block. The example shows updating the value associated with the key 'one' and then retrieving the modified value. ```daslang var tab <- { "one"=>1, "two"=>2 } let found = get(tab,"one") <| $(var val) { val = 123 } let t = tab |> get_value("one") assert(t==123) ``` -------------------------------- ### Apply_in_context function annotation example Source: https://daslang.io/doc/_sources/stdlib/apply_in_context.rst Demonstrates the usage of the [apply_in_context] function annotation in daslang. This annotation modifies a function to be called within a specified debug agent context. If the context is not installed, a panic occurs. ```daslang [apply_in_context(opengl_cache)] def public cache_font(name:string implicit) : Font? ... ... let font = cache_font("Arial") // call invoked in the "opengl_cache" debug agent context ``` -------------------------------- ### SetupAnyAnnotation.setup_call Source: https://daslang.io/doc/_sources/stdlib/ast_boost.rst Implementation details for how a call is set up for any annotation. It takes a structure pointer and an expression call. ```APIDOC ## SetupAnyAnnotation.setup_call ### Description Implementation details for how the call is set up for any annotation. ### Method N/A (This is a method of an annotation type) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (void) - No specific return value documented. #### Response Example N/A ``` -------------------------------- ### Invoking Macros with [_macro] Annotation in Daslang Source: https://daslang.io/doc/_sources/reference/language/macros.rst This snippet demonstrates how to use the [_macro] annotation to define functions that are evaluated at compile time. The example shows a `setup` function that conditionally adds a new function annotation based on the currently compiling module. It utilizes the `is_compiling_macros_in_module` function to check the module name. ```daslang [_macro,private] def setup { if ( is_compiling_macros_in_module("ast_boost") ) { add_new_function_annotation("macro", new MacroMacro()) } } ``` -------------------------------- ### Generate New GUID (Python) Source: https://daslang.io/doc/_sources/stdlib/uriparser.rst Generates a new Globally Unique Identifier (GUID). ```python def make_new_guid() -> string: """Generates new GUID.""" ... ``` -------------------------------- ### setup_tag_annotation Source: https://daslang.io/doc/_sources/stdlib/ast_boost.rst Creates an annotation and applies it to all functions tagged with the specified tag. ```APIDOC ## setup_tag_annotation ### Description Creates annotation and applies it to all tagged functions given tag. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) auto representing the created annotation. #### Response Example None ``` -------------------------------- ### Make Group and GUID Source: https://daslang.io/doc/genindex Functions for creating string groups and generating unique GUIDs. ```APIDOC ## make_group ### Description Creates a string group, optionally with a custom plus operator. ### Method Not Applicable (Built-in Function) ### Endpoint Not Applicable ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **string()** - The created group string. #### Response Example None ## make_new_guid ### Description Generates a new unique GUID (Globally Unique Identifier). ### Method Not Applicable (Built-in Function) ### Endpoint Not Applicable ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **string()** - The newly generated GUID string. #### Response Example None ``` -------------------------------- ### Annotation Setup Functions Source: https://daslang.io/doc/stdlib/ast_boost APIs for configuring and setting up various annotation types, including lint macros, optimization macros, and tag functions. ```APIDOC ## SetupAnnotation Function ### Description Base class for annotation setup functions. ### Method N/A (Conceptual Base Class) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **annotation_function_call** (string) - Required - The implementation of the lint macro. ### Request Example ```json { "annotation_function_call": "add_new_lint_macro" } ``` ### Response #### Success Response (200) N/A (Conceptual Base Class) #### Response Example N/A ``` ```APIDOC ## SetupGlobalLintMacro ### Description Sets up a global lint macro. ### Method N/A ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **annotation_function_call** (string) - Required - The implementation of the global lint macro. ### Request Example ```json { "annotation_function_call": "add_new_global_lint_macro" } ``` ### Response #### Success Response (200) N/A #### Response Example N/A ``` ```APIDOC ## SetupOptimizationMacro ### Description Sets up an optimization macro. ### Method N/A ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **annotation_function_call** (string) - Required - The implementation of the optimization macro. ### Request Example ```json { "annotation_function_call": "add_new_optimization_macro" } ``` ### Response #### Success Response (200) N/A #### Response Example N/A ``` ```APIDOC ## TagFunctionMacro ### Description Sets up a tag function macro for annotations. ### Method N/A ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **annotation_function_call** (string) - Required - The name of the function call that sets up the annotation. * **tag** (string) - Required - The name of the tag. ### Request Example ```json { "annotation_function_call": "setup_tag_annotation", "tag": "my_tag" } ``` ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Daslang Initialization Order Example Source: https://daslang.io/doc/reference/language/contexts Demonstrates the order of function execution during context initialization using 'init' annotations like 'tag', 'before', and 'after'. Functions are executed based on these tags and topological sorting. ```daslang [init(before="middle")] def a { order |> push("a") } [init(tag="middle")] def b { order |> push("b") } [init(tag="middle")] def c { order |> push("c") } [init(after="middle")] def d { order |> push("d") } ``` -------------------------------- ### Unroll Macro Example - Daslang Source: https://daslang.io/doc/_sources/stdlib/unroll.rst This example shows the usage of the UnrollMacro, which implements loop unrolling. The macro expects a block containing a single for loop with a fixed range. The provided example unrolls a loop to load image data into a float4 array. ```daslang var n : float4[9] unroll <| // contents of the loop will be replaced with 9 image load instructions. for i in range(9) n[i] = imageLoad(c_bloom_htex, xy + int2(0,i-4)) ``` -------------------------------- ### SetupTypeMacro: Type Macro Setup Source: https://daslang.io/doc/stdlib/ast_boost Base class for setting up type macros in DasLang. It inherits from SetupAnyAnnotation. ```DasLang SetupTypeMacro : SetupAnyAnnotation Fields * **annotation_function_call** : string = “add_new_type_macro” - This is base class for type macro setup. ``` -------------------------------- ### GET /table/value Source: https://daslang.io/doc/_sources/stdlib/builtin.rst Gets the specific value associated with a key in the table. Handles different value types including smart pointers and arrays. ```APIDOC ## GET /table/value ### Description Gets the specific value associated with a key in the table. Handles different value types including smart pointers and arrays. ### Method GET ### Endpoint /table/value ### Parameters #### Query Parameters - **Tab** (table | table> | table ) - Required - The table to retrieve from. - **at** (keyT|keyT#) - Required - The key to look up. ### Response #### Success Response (200) - **valT** | **smart_ptr** | **valT[-2]** - The value associated with the key. #### Response Example { "example": "value" } ``` -------------------------------- ### String Starts With Check Source: https://daslang.io/doc/stdlib/strings Checks if a string starts with a specified substring, with options for offset and comparison length. ```APIDOC ## Function: starts_with ### Description Returns true if the beginning of the string `str` matches the string `cmp`; otherwise returns false. ### Supported Overloads - `starts_with(str: string implicit; cmp: string implicit) : bool` - `starts_with(str: string implicit; cmp: string implicit; cmpLen: uint) : bool` - `starts_with(str: string implicit; offset: int; cmp: string implicit) : bool` - `starts_with(str: string implicit; offset: int; cmp: string implicit; cmpLen: uint) : bool` ### Parameters #### For `starts_with(str: string implicit; cmp: string implicit)`: - **str** (string implicit) - The string to check. - **cmp** (string implicit) - The substring to compare against the beginning of `str`. #### For `starts_with(str: string implicit; cmp: string implicit; cmpLen: uint)`: - **str** (string implicit) - The string to check. - **cmp** (string implicit) - The substring to compare against the beginning of `str`. - **cmpLen** (uint) - The number of characters to compare. #### For `starts_with(str: string implicit; offset: int; cmp: string implicit)`: - **str** (string implicit) - The string to check. - **offset** (int) - The starting position within `str` for comparison. - **cmp** (string implicit) - The substring to compare against the beginning of `str` from the specified offset. #### For `starts_with(str: string implicit; offset: int; cmp: string implicit; cmpLen: uint)`: - **str** (string implicit) - The string to check. - **offset** (int) - The starting position within `str` for comparison. - **cmp** (string implicit) - The substring to compare against the beginning of `str` from the specified offset. - **cmpLen** (uint) - The number of characters to compare. ### Returns - bool - `true` if the string starts with the substring (considering offset and length), `false` otherwise. ### Example Usage ``` // Assuming 'my_string' is a string variable let starts_with_test = starts_with(my_string, "prefix"); let starts_with_offset_len = starts_with(my_string, 5, "another_prefix", 10); ``` ``` -------------------------------- ### SetupCommentReader Source: https://daslang.io/doc/_sources/stdlib/ast_boost.rst Represents the setup for a comment reader annotation within the Ast Boost module. It inherits from SetupAnyAnnotation. ```APIDOC ## SetupCommentReader ### Description This represents the setup for a comment reader annotation. ### Method N/A (This is a type definition) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### GUID Generation Source: https://daslang.io/doc/stdlib/uriparser Provides a function to generate new Globally Unique Identifiers (GUIDs). ```APIDOC ## make_new_guid ### Description Generates a new GUID. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **string** - A newly generated GUID. #### Response Example N/A ``` -------------------------------- ### SetupAnyAnnotation: Base for Annotation Setup Source: https://daslang.io/doc/stdlib/ast_boost The base class for setting up any annotation or macro in DasLang's AST. It includes fields for the annotation function call name and the annotation name. ```DasLang SetupAnyAnnotation : AstStructureAnnotation This is base class for any annotation or macro setup. Fields * **annotation_function_call** : string = “” - Function call name, which is used to setup any annotation. * **name** : string - Name of the annotation to setup. SetupAnyAnnotation.apply(st: StructurePtr; group: ModuleGroup; args: AnnotationArgumentList; errors: das_string) : bool() Implementation details for setting up any type of annotation in the ast_boost module. Arguments * **st** : StructurePtr * **group** : ModuleGroup * **args** : AnnotationArgumentList * **errors** : das_string SetupAnyAnnotation.setup_call(_st: StructurePtr; cll: smart_ptr_) Implementation details for how the call is set up for any annotation. Arguments * **st** : StructurePtr * **cll** : smart_ptr< ExprCall > ``` -------------------------------- ### LINQ Module Initialization Source: https://daslang.io/doc/_sources/stdlib/linq.rst To use the LINQ module, you need to require it using the 'require' keyword. ```APIDOC ## LINQ Module Initialization ### Description The LINQ module provides Language Integrated Query capabilities. To access its functions and symbols, you must first require the module. ### Method `require` ### Endpoint `daslib/linq` ### Usage Example ``` require daslib/linq ``` ``` -------------------------------- ### Tuple Construction Source: https://daslang.io/doc/_sources/reference/language/tuples.rst Provides examples of constructing tuples using the literal syntax `()` or the `tuple()` constructor. It also shows how to specify element names during construction and how to construct arrays of tuples. ```daslang var a = (1,2.0,"3") var b = tuple(1, 2.0, "3") var a = tuple(a=1, b=2.0, c="3") let H : array <- array tuple((a = 1, b = 2., c = "3"), (a = 4, b = 5., c = "6")) ``` -------------------------------- ### Algorithms: Count Integers Source: https://daslang.io/doc/_sources/stdlib/builtin.rst Generates an iterator for a sequence of integers. It allows specifying a start value and a step increment, with default values of 0 for start and 1 for step. ```das count(start: int = 0; step: int = 1) : iterator ``` -------------------------------- ### setup_call_list Source: https://daslang.io/doc/_sources/stdlib/ast_boost.rst Sets up a new function to contain a collection of calls. It returns the body block to which calls can be appended. Overloaded versions exist for different parameter sets. ```APIDOC ## setup_call_list ### Description Create new function which will contain collection of calls. Returns body block to where the call is to be appended. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) ExprBlock? representing the body block. #### Response Example None ``` -------------------------------- ### SetupAnyAnnotation.apply Source: https://daslang.io/doc/_sources/stdlib/ast_boost.rst Implementation details for setting up any type of annotation in the ast_boost module. It takes a structure pointer, module group, argument list, and error string. ```APIDOC ## SetupAnyAnnotation.apply ### Description Implementation details for setting up any type of annotation in the ast_boost module. ### Method N/A (This is a method of an annotation type) ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (bool) - **bool** (bool) - Indicates success or failure of the annotation setup. #### Response Example ```json { "success": true } ``` ``` -------------------------------- ### setup_macro Source: https://daslang.io/doc/_sources/stdlib/ast_boost.rst Sets up a macro initialization function that is called during module compilation. It returns the body block for appending macro initialization code. ```APIDOC ## setup_macro ### Description Setup macro initialization function, which will only be called during compilation of this module. Returns body block to where the macro initialization is to be appended. ### Method Not applicable (function signature) ### Endpoint Not applicable (function signature) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) ExprBlock? representing the body block. #### Response Example None ``` -------------------------------- ### Custom Type Serialization Example Source: https://daslang.io/doc/_sources/stdlib/archive.rst Example demonstrating how to implement the `serialize` method for custom types to support serialization with the archive module. ```APIDOC ## Custom Type Serialization ### Description This example shows how to define a `serialize` method for a custom type (e.g., `Component`) to integrate it with the `archive` module's serialization infrastructure. ### Method `serialize` (custom method for a type) ### Endpoint N/A (Code implementation) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```das def public serialize ( var arch:Archive; var src:Component ) arch |> serialize(src.name) arch |> serialize(src.hash) arch |> serialize(src.stride) arch |> serialize(src.info) invoke(src.info.serializer, arch, src.data) ``` ### Response #### Success Response (200) N/A (This is a code implementation example, not an API endpoint response) #### Response Example None ``` -------------------------------- ### SetupAnyAnnotation Source: https://daslang.io/doc/_sources/stdlib/ast_boost.rst Base class for setting up any annotation or macro within the Ast Boost module. It includes fields for the annotation function call and the annotation name. ```APIDOC ## SetupAnyAnnotation ### Description This is the base class for any annotation or macro setup. ### Fields - **annotation_function_call** (string) - Function call name, which is used to setup any annotation. - **name** (string) - Name of the annotation to setup. ### Method N/A (This is a type definition) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Daslang Initialization Order Example Source: https://daslang.io/doc/_sources/reference/language/contexts.rst Demonstrates the order of execution for functions tagged with init annotations (tag, before, after) during context initialization. This ordering is crucial for managing dependencies between initialization functions. ```daslang [init(before="middle")] def a { order |> push("a") } [init(tag="middle")] def b { order |> push("b") } [init(tag="middle")] def c { order |> push("c") } [init(after="middle")] def d { order |> push("d") } ``` -------------------------------- ### Algorithms: Count Unsigned Integers Source: https://daslang.io/doc/_sources/stdlib/builtin.rst Generates an iterator for a sequence of unsigned integers. It allows specifying a start value and a step increment, with default values of 0x0 for start and 0x1 for step. ```das ucount(start: uint = 0x0; step: uint = 0x1) : iterator ``` -------------------------------- ### Daslang String Builder Example Source: https://daslang.io/doc/_sources/reference/language/string_builder.rst Demonstrates the basic usage of Daslang's String Builder, showing how to embed variables and expressions within strings. It highlights compile-time evaluation for computable expressions. ```daslang let str1 = "String Literal" let str2 = "str1={str1}" // str2 will be "str1=String Literal" ``` -------------------------------- ### SetupReaderMacro Source: https://daslang.io/doc/_sources/stdlib/ast_boost.rst Base class for reader macro setup. It inherits from SetupAnyAnnotation and sets the default annotation function call to 'add_new_reader_macro'. ```APIDOC ## SetupReaderMacro ### Description This is the base class for reader macro setup. It handles the [reader_macro] implementation. ### Fields - **annotation_function_call** (string) - Defaults to "add_new_reader_macro". ### Method N/A (This is a type definition) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Example Usage of MAKE_TYPE_FACTORY Source: https://daslang.io/doc/reference/embedding/cast A simple example demonstrating the usage of the MAKE_TYPE_FACTORY macro to expose the C++ type 'das::Time' to Daslang under the name 'clock'. ```cpp MAKE_TYPE_FACTORY(clock, das::Time) ``` -------------------------------- ### Daslang Block Type Declaration Example Source: https://daslang.io/doc/reference/language/blocks Illustrates a specific declaration of a block type in Daslang, specifying argument names, types, and the return type. This shows a practical application of the block type syntax. ```Daslang block < (arg1:int;arg2:float&):bool > ``` -------------------------------- ### Example of _order_by_to_array Shorthand Macro Source: https://daslang.io/doc/_sources/stdlib/linq_boost.rst Shows an example of the `_order_by_to_array` shorthand macro, which sorts elements of an iterator by a key and returns the result as an array. This simplifies sorted collection creation. ```das each(foo)._order_by_to_array(_.id) ``` -------------------------------- ### General Setting Functions in DasLang Source: https://daslang.io/doc/genindex Offers various functions to set configurations and properties. This includes setting elements, file sources, duplicate key policies, and verification flags for arrays, contexts, and tables. ```DasLang set() : auto() set(box: LockBox?, data: auto(TT)) : auto() set(box: LockBox?, data: auto?) : auto() set(cmp: ComponentMap, name: string, value: auto(TT)) : auto() set(cv: ComponentValue, val: auto) : auto() set_allow_duplicate_keys(value: bool) : bool() set_aot() : auto() set_element(Character: int, Charset: uint const[8] implicit) : int() set_file_source(access: smart_ptr implicit, fileName: string implicit, text: string implicit) : bool() set_no_empty_arrays(value: bool) : bool() set_no_trailing_zeros(value: bool) : bool() set_total(Charset: uint const[8] implicit) : uint() set_variant_index() : auto() set_verify_array_locks(array: array, check: bool) : bool() set_verify_context_locks(check: bool) : bool() set_verify_table_locks(table: table, check: bool) : bool() ``` -------------------------------- ### DasLang Nested Block Example Source: https://daslang.io/doc/_sources/reference/language/blocks.rst Shows an example of nested blocks in DasLang, where blocks are defined within other blocks. This demonstrates how context can be captured across multiple nested levels. ```DasLang def passthroughFoo(a:Foo; blk:block<(b:Foo):void>) { invoke(blk,a) } passthrough(1) <| $ ( a ) { assert(a==1) passthrough(2) <| $ ( b ) { assert(a==1 && b==2) passthrough(3) <| $ ( c ) { assert(a==1 && b==2 && c==3) } } } ``` -------------------------------- ### SetupVariantMacro: Variant Macro Setup Source: https://daslang.io/doc/stdlib/ast_boost Class for setting up variant macros, associated with '[variant_macro]'. It inherits from SetupAnyAnnotation. ```DasLang SetupVariantMacro : SetupAnyAnnotation Fields * **annotation_function_call** : string = “add_new_variant_macro” - [variant_macro] implementation. ``` -------------------------------- ### SetupBlockAnnotation Source: https://daslang.io/doc/_sources/stdlib/ast_boost.rst Base class for block annotation setup. It inherits from SetupAnyAnnotation and sets the default annotation function call to 'add_new_block_annotation'. ```APIDOC ## SetupBlockAnnotation ### Description This is the base class for block annotation setup. ### Fields - **annotation_function_call** (string) - Defaults to "add_new_block_annotation". ### Method N/A (This is a type definition) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Daslang Basic Generator Example Source: https://daslang.io/doc/reference/language/generators An example of a simple Daslang generator that yields integers from 0 to 9. It demonstrates the 'yield' keyword and the return value 'false' to stop iteration. ```daslang let gen <- generator() <| $ { // gen is iterator for ( t in range(0,10) ) { yield t } return false // returning false stops iteration } ``` -------------------------------- ### Q Macro Functions Source: https://daslang.io/doc/genindex Documentation for various qmacro related functions. ```APIDOC ## Q Macro Functions ### Description Provides functions related to qmacro operations. ### Functions * `qmacro` (None attribute) * `qmacro_block` (None attribute) * `qmacro_block_to_array` (None attribute) * `qmacro_expr` (None attribute) * `qmacro_function` (None attribute) * `qmacro_method` (None attribute) * `qmacro_template_class` (None attribute) * `qmacro_type` (None attribute) * `qmacro_variable` (None attribute) ``` -------------------------------- ### Daslang Null-Propagation Operator ?. Example Source: https://daslang.io/doc/_sources/reference/language/expressions.rst Provides a comprehensive example demonstrating the usage of the null-propagation operator '?.' with nested optional types. It shows how to safely access nested fields and use the null-coalescing operator. ```daslang struct TestObjectFooNative { fooData : int } struct TestObjectBarNative { fooPtr: TestObjectFooNative? barData: float } def test { var a: TestObjectFooNative? var b: TestObjectBarNative? var idummy: int var fdummy: float a?.fooData ?? idummy = 1 assert(idummy == 1) a = new TestObjectFooNative a?.fooData ?? idummy = 2 assert(a.fooData == 2 & idummy == 1) b = new TestObjectBarNative b?.fooPtr?.fooData ?? idummy = 3 assert(idummy == 3) b.fooPtr <- a b?.fooPtr?.fooData ?? idummy = 4 assert(b.fooPtr.fooData == 4 & idummy == 3) } ```