Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
afw_compile.h
Go to the documentation of this file.
1 // See the 'COPYING' file in the project root for licensing information.
2 /*
3  * Adaptive Framework AFW Compile AFW expressions/json/templates
4  *
5  * Copyright (c) 2010-2023 Clemson University
6  *
7  */
8 
9 #ifndef __AFW_COMPILE_H__
10 #define __AFW_COMPILE_H__
11 
12 #include "afw_interface.h"
13 
28 
31  afw_compile_type_t compile_type;
32  const afw_utf8_t *name;
33  const afw_value_t *name_value;
34  const afw_utf8_t *description;
35  const afw_value_t *description_value;
36  const afw_data_type_t *data_type;
37  const afw_value_function_definition_t *compile_function;
38 };
39 
40 
43  afw_compile_residual_check_none,
44  afw_compile_residual_check_to_newline,
45  afw_compile_residual_check_to_full
47 
48 
49 
57  const afw_utf8_t *pneumonic,
58  const afw_xctx_t *xctx);
59 
60 
68  afw_compile_type_t compile_type,
69  const afw_xctx_t *xctx);
70 
71 
72 
85  const afw_pool_t *p,
86  afw_xctx_t *xctx);
87 
88 
89 
99 AFW_DECLARE(const afw_value_t *)
101  const afw_utf8_t *string,
102  const afw_utf8_t *source_location,
103  afw_compile_type_t compile_type,
104  const afw_pool_t *p,
105  afw_xctx_t *xctx);
106 
107 
108 
118 #define afw_compile_and_evaluate_type( \
119  compile_type, string, source_location, p, xctx) \
120  afw_compile_and_evaluate(string, source_location, \
121  afw_compile_type_ ## compile_type, p, xctx)
122 
123 
124 
152 AFW_DECLARE(const afw_value_t *)
154  const afw_utf8_t *string,
155  afw_utf8_octet_get_cb_t callback,
156  void *callback_data,
157  const afw_utf8_t *source_location,
158  afw_compile_type_t compile_type,
159  afw_compile_residual_check_t residual_check,
160  const afw_value_compiled_value_t *parent,
161  const afw_compile_shared_t *shared,
162  const afw_pool_t *p,
163  afw_xctx_t *xctx);
164 
165 
166 
189 #define afw_compile_to_value(string, source_location, compile_type, \
190  parent, shared, p, xctx) \
191  afw_compile_to_value_with_callback(string, NULL, NULL, \
192  source_location, compile_type, afw_compile_residual_check_to_full, \
193  parent, shared, p, xctx)
194 
195 
196 
210 #define afw_compile_expression(string, source_location, parent, shared, \
211  p, xctx) \
212  afw_compile_to_value_with_callback(string, NULL, NULL, \
213  source_location, afw_compile_type_expression, \
214  afw_compile_residual_check_to_full, \
215  parent, shared, p, xctx)
216 
217 
218 
232 AFW_DECLARE(const afw_value_t *)
234  const afw_value_t *value,
235  const afw_utf8_t *source_location,
236  const afw_value_compiled_value_t *parent,
237  const afw_compile_shared_t *shared,
238  const afw_pool_t *p,
239  afw_xctx_t *xctx);
240 
241 
242 
256 #define afw_compile_hybrid_source(string, source_location, parent, shared, \
257  p, xctx) \
258  afw_compile_to_value_with_callback(string, NULL, NULL, \
259  source_location, afw_compile_type_hybrid, \
260  afw_compile_residual_check_to_full, \
261  parent, shared, p, xctx)
262 
263 
264 
278 #define afw_compile_template(string, source_location, parent, shared, \
279  p, xctx) \
280  afw_compile_to_value_with_callback(string, NULL, NULL, \
281  source_location, afw_compile_type_template, \
282  afw_compile_residual_check_to_full, \
283  parent, shared, p, xctx)
284 
285 
286 
306 AFW_DECLARE(const afw_object_t *)
308  const afw_utf8_t *string,
309  const afw_utf8_t *source_location,
310  const afw_utf8_t * adaptor_id,
311  const afw_utf8_t * object_type_id,
312  const afw_utf8_t * object_id,
313  afw_boolean_t cede_p,
314  const afw_pool_t * p,
315  afw_xctx_t *xctx);
316 
317 
318 
344 AFW_DECLARE(void)
346  const afw_object_t *object,
347  const afw_utf8_t *source_location,
348  afw_boolean_t recursive,
349  const afw_compile_shared_t *shared,
350  afw_xctx_t *xctx);
351 
352 
353 
368 AFW_DECLARE(const afw_object_t *)
370  const afw_object_t *object,
371  const afw_utf8_t *source_location,
372  const afw_compile_shared_t *shared,
373  const afw_pool_t *p,
374  afw_xctx_t *xctx);
375 
376 
377 
385 AFW_DECLARE(void)
387  const afw_utf8_t *qualified_name,
388  afw_utf8_t *qualifier,
389  afw_utf8_t *name,
390  afw_xctx_t *xctx);
391 
392 
393 
401 AFW_DECLARE(const afw_utf8_t *)
403  const afw_value_t *value,
404  const afw_pool_t *p,
405  afw_xctx_t *xctx);
406 
407 
408 AFW_END_DECLARES
409 
412 #endif /* __AFW_COMPILE_H__ */
#define AFW_BEGIN_DECLARES
#define AFW_DECLARE(type)
Declare a public afw function.
Interfaceafw_interface header.
_Bool afw_boolean_t
Definition: afw_common.h:373
int(* afw_utf8_octet_get_cb_t)(afw_utf8_octet_t *octet, void *data, afw_xctx_t *xctx)
Get an utf-8 octet (8 bits).
Definition: afw_common.h:255
enum afw_compile_type_e afw_compile_type_t
Compile type enum.
enum afw_compile_residual_check_e afw_compile_residual_check_t
Residual checking options.
void afw_compile_expressions_templates_and_hybrids(const afw_object_t *object, const afw_utf8_t *source_location, afw_boolean_t recursive, const afw_compile_shared_t *shared, afw_xctx_t *xctx)
Compile object's expressions, templates, and hybrids.
Definition: afw_compile.c:411
const afw_object_t * afw_compile_object_all_hybrid_properties(const afw_object_t *object, const afw_utf8_t *source_location, const afw_compile_shared_t *shared, const afw_pool_t *p, afw_xctx_t *xctx)
Compile an object with all hybrid properties.
Definition: afw_compile.c:499
const afw_compile_type_info_t * afw_compile_type_get_info(afw_compile_type_t compile_type, const afw_xctx_t *xctx)
Return info for a afw_compile_type_t.
Definition: afw_compile.c:120
const afw_compile_shared_t * afw_compile_shared_create(const afw_pool_t *p, afw_xctx_t *xctx)
Created a struct for sharing resources by multiple compiles.
const afw_value_t * afw_compile_to_value_with_callback(const afw_utf8_t *string, afw_utf8_octet_get_cb_t callback, void *callback_data, const afw_utf8_t *source_location, afw_compile_type_t compile_type, afw_compile_residual_check_t residual_check, const afw_value_compiled_value_t *parent, const afw_compile_shared_t *shared, const afw_pool_t *p, afw_xctx_t *xctx)
Compile string to adaptive value with callback.
Definition: afw_compile.c:140
const afw_value_t * afw_compile_and_evaluate(const afw_utf8_t *string, const afw_utf8_t *source_location, afw_compile_type_t compile_type, const afw_pool_t *p, afw_xctx_t *xctx)
Compile and evaluate a string.
Definition: afw_compile.c:66
const afw_utf8_t * afw_compile_source_location_of_value(const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Return the source location of a value.
Definition: afw_compile.c:578
const afw_compile_type_info_t * afw_compile_type_get_info_by_pneumonic(const afw_utf8_t *pneumonic, const afw_xctx_t *xctx)
Return compile type info for a pneumonic.
Definition: afw_compile.c:97
const afw_object_t * afw_compile_to_object(const afw_utf8_t *string, const afw_utf8_t *source_location, const afw_utf8_t *adaptor_id, const afw_utf8_t *object_type_id, const afw_utf8_t *object_id, afw_boolean_t cede_p, const afw_pool_t *p, afw_xctx_t *xctx)
Compile string to adaptive object.
Definition: afw_compile.c:313
afw_compile_residual_check_e
Residual checking options.
Definition: afw_compile.h:42
void afw_compile_split_qualified_name(const afw_utf8_t *qualified_name, afw_utf8_t *qualifier, afw_utf8_t *name, afw_xctx_t *xctx)
Split name with optional qualifier.
Definition: afw_compile.c:548
const afw_value_t * afw_compile_hybrid(const afw_value_t *value, const afw_utf8_t *source_location, const afw_value_compiled_value_t *parent, const afw_compile_shared_t *shared, const afw_pool_t *p, afw_xctx_t *xctx)
Compile hybrid.
Definition: afw_compile.c:385
Resources that can be shared by multiple compiles.
Struc for afw_compile_type_info_t.
Definition: afw_compile.h:30
Interface afw_data_type public struct.
Interface afw_object public struct.
Interface afw_pool public struct.
NFC normalized UTF-8 string.
Definition: afw_common.h:545
Struct for function value.
Definition: afw_value.h:102
Struct for compiled value value.
Interface afw_value public struct.
Interface afw_xctx public struct.