Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
afw_value.h
Go to the documentation of this file.
1 // See the 'COPYING' file in the project root for licensing information.
2 /*
3  * Adaptive Framework Header for Adaptive Values
4  *
5  * Copyright (c) 2010-2023 Clemson University
6  *
7  */
8 
9 #ifndef __AFW_VALUE_H__
10 #define __AFW_VALUE_H__
11 
12 #include "afw_interface.h"
13 
47 
50  const afw_utf8_t *value_inf_id;
51  const afw_compile_value_contextual_t *contextual;
52  const afw_utf8_t *detail;
53 };
54 
55 
56 
61  const afw_value_inf_t *inf;
62  afw_octet_t internal; /* type specific value */
63 };
64 
65 
66 
69  afw_object_t meta;
70  const afw_data_type_t *data_type;
71  afw_utf8_t dataType;
72  afw_utf8_t dataTypeParameter;
73  afw_utf8_t name;
74  afw_utf8_t brief;
75  afw_utf8_t description;
76 
77  /*
78  * This is the minimum number of values that can be specified for this
79  * parameter. If -1, the parameter can be specified exactly once. This
80  * can only have a value other than -1 on last parameter where it can
81  * have a value of -1 to 127.
82  */
83  afw_integer_t minArgs;
84 
85  /* Indicates that parameter is optional and can be undefined (NULL). */
86  afw_boolean_t optional;
87 
88  /* Indicates that parameter can be undefined (NULL) even if not optional. */
89  afw_boolean_t canBeUndefined;
90 
91  /* Indicates that dataType is polymorphic. */
92  afw_boolean_t polymorphicDataType;
93 
94  /* Indicates that dataTypeParameter is polymorphic. */
95  afw_boolean_t polymorphicDataTypeParameter;
96 
97 };
98 
99 
100 
103  const afw_value_inf_t *inf;
104 
107 
110 
113 
119 
122 
125 
128 
131 
134 
137 
140 
143 
146 
149 
152 
155 
158 
161 
164 
167 
170 
173 
184  const afw_utf8_z_t * const *errorsThrown;
185 
188 
191 
194 
197 
200 
203 
209 
214 };
215 
216 
220 
221 
222 
226 
227 
228 
232 
233 
234 
238 
239 
240 
244 
245 
246 
250 
251 
252 
256 
257 
258 
262 
263 
264 
268 
269 
270 
274 
275 
276 
280 
281 
282 
286 
287 
288 
292 
293 
294 
298 
299 
300 
304 
305 
306 
310 
311 
312 
321 
322 
323 
330 #define afw_value_undefined NULL
331 
332 
333 
337 
338 
339 
343 
344 
345 
349 
350 
351 
355 
356 
357 
363 #define afw_value_for_boolean(variable) (variable) \
364  ? afw_value_true \
365  : afw_value_false
366 
367 
368 
375 #define AFW_VALUE_UNDECORATE(a_value) \
376 if (a_value) { \
377  if ((a_value)->inf == &afw_value_compiled_value_inf) { \
378  a_value = ((const afw_value_compiled_value_t *)a_value)->root_value; \
379  } \
380  if ((a_value)->inf == &afw_value_annotated_inf) { \
381  a_value = ((const afw_value_annotated_t *)a_value)->value; \
382  } \
383 }
384 
385 
386 
394 AFW_DECLARE(const afw_value_t *)
396  const afw_value_t *value);
397 
408  const afw_value_t *value,
409  const afw_value_inf_t *inf);
410 
411 
412 
422 #define afw_value_is_nullish(A_VALUE) \
423 ( \
424  (!A_VALUE) || \
425  (A_VALUE)->inf->fully_evaluated_data_type == afw_data_type_null \
426 )
427 
428 
429 
438 #define afw_value_is_undefined(A_VALUE) (!A_VALUE)
439 
440 
441 
449 afw_value_is_scalar(const afw_value_t *value, afw_xctx_t *xctx);
450 
451 
452 
458 #define AFW_VALUE_TYPE_ID(A_VALUE) \
459 &(A_VALUE)->inf->rti.implementation_id
460 
461 
462 
468 #define afw_value_is_annotated(A_VALUE) \
469 ( \
470  (A_VALUE) && \
471  (A_VALUE)->inf == &afw_value_annotated_inf \
472 )
473 
474 
475 
481 #define afw_value_is_defined_and_evaluated(A_VALUE) \
482 ( \
483  (A_VALUE) && \
484  (A_VALUE)->inf->fully_evaluated_data_type \
485 )
486 
487 
488 
494 #define afw_value_is_undefined_or_evaluated(A_VALUE) \
495 ( \
496  (!A_VALUE) || \
497  (A_VALUE)->inf->fully_evaluated_data_type \
498 )
499 
500 
501 
510  const afw_value_t *value,
511  afw_xctx_t *xctx);
512 
513 
514 
520 #define afw_value_is_assignment_target(A_VALUE) \
521 ( \
522  (A_VALUE) && \
523  (A_VALUE)->inf == &afw_value_assignment_target_inf \
524 )
525 
526 
527 
533 #define afw_value_is_block(A_VALUE) \
534 ( \
535  (A_VALUE) && \
536  (A_VALUE)->inf == &afw_value_block_inf \
537 )
538 
539 
540 
546 #define afw_value_is_call(A_VALUE) \
547 ( \
548  (A_VALUE) && \
549  (A_VALUE)->inf == &afw_value_call_inf \
550 )
551 
552 
553 
559 #define afw_value_is_call_built_in_function(A_VALUE) \
560 ( \
561  (A_VALUE) && \
562  (A_VALUE)->inf == &afw_value_call_built_in_function_inf \
563 )
564 
565 
566 
572 #define afw_value_is_any_call(A_VALUE) \
573 ( \
574  (A_VALUE) && \
575  ( \
576  (A_VALUE)->inf == &afw_value_call_inf || \
577  (A_VALUE)->inf == &afw_value_call_built_in_function_inf \
578  ) \
579 )
580 
581 
582 
588 #define afw_value_is_compiled_value(A_VALUE) \
589 ( \
590  (A_VALUE) && \
591  (A_VALUE)->inf == &afw_value_compiled_value_inf \
592 )
593 
594 
595 
601 #define afw_value_is_expression_definition(A_VALUE) \
602 ( \
603  (A_VALUE) && \
604  (A_VALUE)->inf == &afw_value_expression_definition_inf \
605 )
606 
607 
608 
614 #define afw_value_is_function_definition(A_VALUE) \
615 ( \
616  (A_VALUE) && \
617  (A_VALUE)->inf == &afw_value_function_definition_inf \
618 )
619 
620 
621 
627 #define afw_value_is_function_thunk(A_VALUE) \
628 ( \
629  (A_VALUE) && \
630  (A_VALUE)->inf == &afw_value_function_thunk_inf \
631 )
632 
633 
634 
640 #define afw_value_is_list_expression(A_VALUE) \
641 ( \
642  (A_VALUE) && \
643  (A_VALUE)->inf == &afw_value_list_expression_inf \
644 )
645 
646 
647 
653 #define afw_value_is_object_expression(A_VALUE) \
654 ( \
655  (A_VALUE) && \
656  (A_VALUE)->inf == &afw_value_object_expression_inf \
657 )
658 
659 
660 
666 #define afw_value_is_script_function(A_VALUE) \
667 ( \
668  (A_VALUE) && \
669  (A_VALUE)->inf == &afw_value_script_function_definition_inf \
670 )
671 
672 
673 
679 #define afw_value_is_qualified_variable_reference(A_VALUE) \
680 ( \
681  (A_VALUE) && \
682  (A_VALUE)->inf == &afw_value_qualified_variable_reference_inf \
683 )
684 
685 
686 
692 #define afw_value_is_reference_by_key(A_VALUE) \
693 ( \
694  (A_VALUE) && \
695  (A_VALUE)->inf == &afw_value_reference_by_key_inf \
696 )
697 
698 
699 
705 #define afw_value_is_template_definition(A_VALUE) \
706 ( \
707  (A_VALUE) && \
708  (A_VALUE)->inf == &afw_value_template_definition_inf \
709 )
710 
711 
712 
718 #define afw_value_is_variable_reference(A_VALUE) \
719 ( \
720  (A_VALUE) && \
721  (A_VALUE)->inf == &afw_value_variable_reference_inf \
722 )
723 
724 
726 #define AFW_VALUE_ASSERT_IS(A_VALUE, A_TYPE_ID, A_SCOPE) \
727 if (!A_VALUE || (A_VALUE)->inf != &afw_value_ ## A_TYPE_ID ## _inf) \
728  AFW_THROW_ERROR_Z(cast_error, "Expecting " #A_TYPE_ID, A_SCOPE)
729 
730 
739 #define afw_value_quick_data_type(A_VALUE) \
740 ((A_VALUE)->inf->data_type)
741 
742 
751 #define afw_value_get_quick_data_type_id(A_VALUE) \
752 (((A_VALUE) && (A_VALUE)->inf->data_type) \
753 ? &((A_VALUE)->inf->data_type->data_type_id) \
754 : &afw_s_unknown )
755 
756 
757 
759 #define AFW_VALUE_IS_DATA_TYPE(A_VALUE,A_DATA_TYPE) \
760 ( \
761  (A_VALUE) && (A_VALUE)->inf->fully_evaluated_data_type && \
762  (A_VALUE)->inf->fully_evaluated_data_type == afw_data_type_ ## A_DATA_TYPE \
763 )
764 
765 
766 
768 #define AFW_VALUE_ASSERT_IS_DATA_TYPE(A_VALUE, A_DATA_TYPE, A_SCOPE) \
769 do { \
770 if (!AFW_VALUE_IS_DATA_TYPE(A_VALUE, A_DATA_TYPE)) \
771  AFW_THROW_ERROR_Z(cast_error, "Type safe exception.", A_SCOPE); \
772 } while (0)
773 
774 
775 
777 #define AFW_VALUE_ASSERT_IS_ANYURI_OR_STRING(A_VALUE, A_SCOPE) \
778 do { \
779 if (!AFW_VALUE_IS_DATA_TYPE(A_VALUE, anyURI) && \
780  !AFW_VALUE_IS_DATA_TYPE(A_VALUE, string) ) \
781  AFW_THROW_ERROR_Z(cast_error, "Type safe exception.", A_SCOPE); \
782 } while (0)
783 
784 
785 
794 afw_value_equal(const afw_value_t *value1, const afw_value_t *value2,
795  afw_xctx_t *xctx);
796 
797 
798 
808 AFW_DECLARE(int)
810  const afw_value_t *value1, const afw_value_t *value2,
811  afw_xctx_t *xctx);
812 
813 
814 
826  const afw_value_t *value, const afw_value_t *substring,
827  afw_xctx_t *xctx);
828 
829 
830 
841 #define afw_value_evaluate(value, p, xctx) \
842 (((value) && (value)->inf->optional_evaluate) \
843  ? (value)->inf->optional_evaluate(value, p, xctx) \
844  : value)
845 
846 
847 
856 #define AFW_VALUE_INTERNAL(_VALUE_) \
857 ((void *)(&((afw_value_evaluated_t *)(_VALUE_))->internal))
858 
859 
860 
867 #define AFW_VALUE_DATA_TYPES_EQUAL(value1, value2, xctx) \
868 (afw_value_get_data_type(value1, xctx) != \
869  afw_value_get_data_type(value2, xctx))
870 
871 
872 
879 #define AFW_VALUE_ASSERT_DATA_TYPES_EQUAL(value1, value2, xctx) \
880 if (!AFW_VALUE_DATA_TYPES_EQUAL(value1, value2, xctx)) \
881 { \
882  AFW_THROW_ERROR_Z(cast_error, "Type safe exception.", xctx); \
883 }
884 
885 
886 
893 #define afw_value_is_true(A_VALUE) \
894 ( \
895  AFW_VALUE_IS_DATA_TYPE(A_VALUE, boolean) && \
896  ((const afw_value_boolean_t *)(A_VALUE))->internal \
897 )
898 
899 
900 
909 AFW_DECLARE(const afw_value_t *)
911  const afw_value_t *value,
912  const afw_utf8_t *source_location,
913  const afw_pool_t *p,
914  afw_xctx_t *xctx);
915 
916 
917 
927 AFW_DECLARE(const afw_value_t *)
929  const afw_value_t *value,
930  const afw_utf8_t *source_location,
931  afw_compile_type_t compile_type,
932  const afw_pool_t *p,
933  afw_xctx_t *xctx);
934 
935 
936 
946 AFW_DECLARE(const afw_value_t *)
948  const afw_value_t *value,
949  const afw_utf8_t *source_location,
950  const afw_pool_t *p,
951  afw_xctx_t *xctx);
952 
953 
954 
964 AFW_DECLARE(const afw_value_t *)
966  const afw_value_t *value,
967  const afw_utf8_t *source_location,
968  afw_compile_type_t compile_type,
969  const afw_pool_t *p,
970  afw_xctx_t *xctx);
971 
972 
973 
987 AFW_DECLARE(const afw_value_t *)
989  const afw_value_t *value,
990  const afw_value_t *untrusted_qualified_variables,
991  const afw_pool_t *p, afw_xctx_t *xctx);
992 
993 
994 
1006 AFW_DECLARE(const afw_value_t *)
1008  const afw_value_t *value,
1009  const afw_data_type_t *to_data_type,
1010  afw_boolean_t required,
1011  const afw_pool_t *p, afw_xctx_t *xctx);
1012 
1013 
1014 
1026 AFW_DECLARE(const afw_value_t *)
1028  const afw_value_t *value,
1029  afw_boolean_t allow_undefined,
1030  const afw_pool_t *p, afw_xctx_t *xctx);
1031 
1032 
1033 
1040 AFW_DECLARE(const afw_utf8_z_t *)
1041 afw_value_as_utf8_z(const afw_value_t *value,
1042  const afw_pool_t *p, afw_xctx_t *xctx);
1043 
1044 
1045 
1053 AFW_DECLARE(const afw_value_t *)
1055  const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx);
1056 
1057 
1058 
1066 AFW_DECLARE(const afw_utf8_t *)
1068  const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx);
1069 
1070 
1071 
1078 AFW_DECLARE(const afw_utf8_t *)
1080  const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx);
1081 
1082 
1083 
1100 AFW_DECLARE(const afw_utf8_t *)
1102  const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx);
1103 
1104 
1105 
1115 AFW_DECLARE(const afw_value_t *)
1117  const afw_value_t *value,
1118  const afw_pool_t *p,
1119  afw_xctx_t *xctx);
1120 
1121 
1122 
1131  const afw_pool_t *p,
1132  afw_xctx_t *xctx);
1133 
1134 
1135 
1145 AFW_DECLARE(const afw_value_t *)
1147  const afw_compile_value_contextual_t *contextual,
1148  const afw_value_t *value,
1149  const afw_object_t *annotation,
1150  const afw_pool_t *p,
1151  afw_xctx_t *xctx);
1152 
1153 
1154 
1163 AFW_DECLARE(const afw_value_t *)
1165  const afw_compile_value_contextual_t *contextual,
1166  const afw_compile_assignment_target_t *assignment_target,
1167  const afw_pool_t *p,
1168  afw_xctx_t *xctx);
1169 
1170 
1171 
1182  const afw_compile_value_contextual_t *contextual,
1183  afw_value_compiled_value_t *compiled_value,
1184  afw_size_t *block_count,
1185  const afw_pool_t *p,
1186  afw_xctx_t *xctx);
1187 
1188 
1189 
1190 
1199 AFW_DECLARE(const afw_value_t *)
1201  const afw_value_block_t *block,
1202  afw_size_t argc,
1203  const afw_value_t * const *argv,
1204  afw_xctx_t *xctx);
1205 
1206 
1207 
1208 
1218  const afw_data_type_t *data_type,
1219  const afw_pool_t *p,
1220  afw_xctx_t *xctx);
1221 
1222 
1223 
1232 AFW_DECLARE(const afw_value_t *)
1234  const void * value,
1235  const afw_data_type_t *data_type,
1236  const afw_pool_t *p,
1237  afw_xctx_t *xctx);
1238 
1239 
1240 
1254 AFW_DECLARE(const afw_value_t *)
1256  const afw_compile_value_contextual_t *contextual,
1257  afw_size_t argc,
1258  const afw_value_t * const *argv,
1259  const afw_pool_t *p,
1260  afw_xctx_t *xctx);
1261 
1262 
1263 
1277 AFW_DECLARE(const afw_value_t *)
1279  const afw_compile_value_contextual_t *contextual,
1280  afw_size_t argc,
1281  const afw_value_t * const *argv,
1282  const afw_pool_t *p,
1283  afw_xctx_t *xctx);
1284 
1285 
1286 
1296 AFW_DECLARE(const afw_value_t *)
1298  const afw_compile_value_contextual_t *contextual,
1299  const afw_value_assignment_t * const * assignments,
1300  const afw_value_t * value,
1301  const afw_pool_t *p,
1302  afw_xctx_t *xctx);
1303 
1304 
1316 AFW_DECLARE(const afw_value_t *)
1318  const afw_utf8_t *name,
1319  const afw_value_t *like_function_value,
1321  void *ctx,
1322  const afw_utf8_z_t *source_z,
1323  const afw_pool_t *p,
1324  afw_xctx_t *xctx);
1325 
1326 
1327 
1338 #define afw_value_function_thunk_create( \
1339  name, like_function_value, execute, ctx, p, xctx) \
1340 afw_value_function_thunk_create_impl( \
1341  name, like_function_value, execute, ctx, AFW__FILE_LINE__, p, xctx)
1342 
1343 
1344 
1356 AFW_DECLARE(const afw_value_t *)
1358  const afw_compile_value_contextual_t *contextual,
1359  const afw_value_type_t *returns,
1360  afw_size_t count,
1361  const afw_value_script_function_parameter_t **parameters,
1362  const afw_value_t *body,
1363  const afw_pool_t *p,
1364  afw_xctx_t *xctx);
1365 
1366 
1367 
1376 AFW_DEFINE(const afw_value_t *)
1378  const afw_compile_value_contextual_t *contextual,
1379  const afw_value_t *internal,
1380  const afw_pool_t *p, afw_xctx_t *xctx);
1381 
1382 
1383 
1392 AFW_DEFINE(const afw_value_t *)
1394  const afw_compile_value_contextual_t *contextual,
1395  const afw_object_t *internal,
1396  const afw_pool_t *p, afw_xctx_t *xctx);
1397 
1398 
1399 
1409 AFW_DECLARE(const afw_value_t *)
1411  const afw_compile_value_contextual_t *contextual,
1412  const afw_utf8_t *qualifier,
1413  const afw_utf8_t *name,
1414  const afw_pool_t *p,
1415  afw_xctx_t *xctx);
1416 
1417 
1418 
1428 AFW_DECLARE(const afw_value_t *)
1430  const afw_compile_value_contextual_t *contextual,
1431  const afw_value_t *aggregate_value,
1432  const afw_value_t *key,
1433  const afw_pool_t *p,
1434  afw_xctx_t *xctx);
1435 
1436 
1452 AFW_DECLARE(const afw_value_t *)
1454  const afw_compile_value_contextual_t *contextual,
1455  afw_size_t count,
1456  const afw_value_t * const *values,
1457  const afw_pool_t *p,
1458  afw_xctx_t *xctx);
1459 
1460 
1461 
1470 AFW_DECLARE(const afw_value_t *)
1472  const afw_compile_value_contextual_t *contextual,
1473  const afw_value_block_symbol_t *symbol,
1474  const afw_pool_t *p,
1475  afw_xctx_t *xctx);
1476 
1477 
1478 
1480 AFW_DECLARE(const afw_value_t *)
1482  const afw_utf8_octet_t *s,
1483  afw_size_t len,
1484  const afw_pool_t *p,
1485  afw_xctx_t *xctx);
1486 
1487 
1488 
1490 AFW_DECLARE(const afw_value_t *)
1492  const afw_utf8_octet_t *s,
1493  afw_size_t len,
1494  const afw_pool_t *p,
1495  afw_xctx_t *xctx);
1496 
1497 
1498 
1500 AFW_DECLARE(const afw_value_t *)
1502  const afw_utf8_z_t *string_z,
1503  const afw_pool_t *p,
1504  afw_xctx_t *xctx);
1505 
1506 
1507 
1509 AFW_DECLARE(const afw_value_t *)
1511  const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx);
1512 
1513 
1514 
1521 AFW_DECLARE(const afw_value_t *)
1523  const afw_pool_t *p, afw_xctx_t *xctx);
1524 
1525 
1526 
1533 AFW_DECLARE(const afw_value_t *)
1535  const afw_pool_t *p, afw_xctx_t *xctx);
1536 
1537 
1538 
1546 AFW_DECLARE(const afw_value_t * const *)
1548  const afw_value_t * value,
1549  const afw_pool_t *p, afw_xctx_t *xctx);
1550 
1551 
1552 
1560 AFW_DECLARE(const afw_utf8_t * const *)
1562  const afw_value_t * value,
1563  const afw_pool_t *p, afw_xctx_t *xctx);
1564 
1565 
1566 
1576 AFW_DEFINE(const afw_utf8_t *)
1578  const afw_value_t *value,
1579  const afw_utf8_t *tab,
1580  const afw_pool_t *p,
1581  afw_xctx_t *xctx);
1582 
1583 
1584 
1594 AFW_DECLARE(const afw_utf8_t *)
1596  const afw_value_t *value,
1597  const afw_utf8_t *tab,
1598  const afw_pool_t *p,
1599  afw_xctx_t *xctx);
1600 
1601 
1602 
1609 AFW_DEFINE(void)
1611  const afw_writer_t *writer,
1612  afw_size_t first_arg,
1613  const afw_value_call_args_t *args,
1614  afw_xctx_t *xctx);
1615 
1616 
1617 
1630 AFW_DEFINE(void)
1632  const afw_value_t *instance,
1633  const afw_writer_t *writer,
1634  afw_xctx_t *xctx);
1635 
1636 
1644 AFW_DECLARE(void)
1645 afw_value_register_core_value_infs(afw_xctx_t *xctx);
1646 
1647 AFW_END_DECLARES
1648 
1651 #endif /* __AFW_VALUE_H__ */
AFW_DEFINE(const afw_object_t *)
#define AFW_BEGIN_DECLARES
#define AFW_DECLARE(type)
Declare a public afw function.
Interfaceafw_interface header.
AFW_DECLARE_CONST_DATA(afw_utf8_t) afw_s_200
afw_utf8_t for string 200
const afw_utf8_t *(* afw_function_arg_check_t)(afw_function_execute_t *x, afw_size_t argc, const afw_value_t *argv[], const afw_pool_t *p, afw_xctx_t *xctx)
Typedef for function arg check functions.
Definition: afw_common.h:1289
_Bool afw_boolean_t
Definition: afw_common.h:373
const afw_value_t *(* afw_function_execute_cb_t)(afw_function_execute_t *x)
Typedef for function execute functions.
Definition: afw_common.h:1252
afw_utf8_octet_t afw_utf8_z_t
NFC normalized UTF-8 null terminated string.
Definition: afw_common.h:523
enum afw_compile_type_e afw_compile_type_t
Compile type enum.
char afw_utf8_octet_t
8 bits of utf-8 codepoint.
Definition: afw_common.h:236
apr_size_t afw_size_t
size_t.
Definition: afw_common.h:151
const afw_value_t *(* afw_function_thunk_execute_t)(const afw_value_function_thunk_t *function, afw_size_t argc, const afw_value_t *const *argv, const afw_pool_t *p, afw_xctx_t *xctx)
Typedef for function thunk execute functions.
Definition: afw_common.h:1266
unsigned char afw_octet_t
8 bits (unsigned).
Definition: afw_common.h:211
apr_int64_t afw_integer_t
typedef for big signed int.
Definition: afw_common.h:321
const afw_utf8_t *const * afw_value_as_array_of_utf8(const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Return a NULL terminated list of utf8 in a specified pool.
Definition: afw_value.c:827
const afw_value_t * afw_value_expression_definition_create(const afw_compile_value_contextual_t *contextual, const afw_value_assignment_t *const *assignments, const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for expression definition value.
const afw_value_t * afw_value_convert_to_string(const afw_value_t *value, afw_boolean_t allow_undefined, const afw_pool_t *p, afw_xctx_t *xctx)
Convert a value to a string value.
Definition: afw_value.c:688
afw_value_compiler_listing_to_string(const afw_value_t *value, const afw_utf8_t *tab, const afw_pool_t *p, afw_xctx_t *xctx)
Decompile a value to a compiler listing string.
const afw_value_t * afw_value_one_and_only(const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Return value from one entry list or single value.
Definition: afw_value.c:407
afw_value_assignment_target_inf
Value annotated inf.
Definition: afw_value.h:225
afw_value_function_thunk_inf
Value function thunk inf.
Definition: afw_value.h:267
const afw_value_t * afw_value_undecorate(const afw_value_t *value)
Return undecorated value.
Definition: afw_value.c:186
const afw_value_t * afw_value_compile_and_evaluate_as(const afw_value_t *value, 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 value using specified compile type.
Definition: afw_value.c:165
afw_boolean_t afw_value_equal(const afw_value_t *value1, const afw_value_t *value2, afw_xctx_t *xctx)
Test whether two values are equal.
Definition: afw_value.c:851
const afw_value_t * afw_value_compile_as(const afw_value_t *value, const afw_utf8_t *source_location, afw_compile_type_t compile_type, const afw_pool_t *p, afw_xctx_t *xctx)
Compile a value using specified compile type.
Definition: afw_value.c:104
const afw_utf8_t * afw_value_decompile_to_string(const afw_value_t *value, const afw_utf8_t *tab, const afw_pool_t *p, afw_xctx_t *xctx)
Decompile a value to a string.
const afw_value_t * afw_value_annotated_create(const afw_compile_value_contextual_t *contextual, const afw_value_t *value, const afw_object_t *annotation, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for annotated value.
const afw_value_t * afw_value_script_function_definition_create(const afw_compile_value_contextual_t *contextual, const afw_value_type_t *returns, afw_size_t count, const afw_value_script_function_parameter_t **parameters, const afw_value_t *body, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for lambda definition value.
afw_value_create_list_expression(const afw_compile_value_contextual_t *contextual, const afw_value_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for list expression value.
afw_value_decompile_call_args(const afw_writer_t *writer, afw_size_t first_arg, const afw_value_call_args_t *args, afw_xctx_t *xctx)
Decompile call args.
afw_value_undefined_as_string
Adaptive value containing <undefined> string.
Definition: afw_value.h:336
afw_value_reference_by_key_inf
Value evaluation_reference_by_key inf.
Definition: afw_value.h:297
const afw_value_t * afw_value_clone(const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Clone a value to specified pool.
Definition: afw_value.c:282
afw_value_annotated_inf
Value annotated inf.
Definition: afw_value.h:219
const afw_value_t * afw_value_compile_and_evaluate(const afw_value_t *value, const afw_utf8_t *source_location, const afw_pool_t *p, afw_xctx_t *xctx)
Compile and evaluate a value.
Definition: afw_value.c:145
const afw_value_t * afw_value_template_definition_create(const afw_compile_value_contextual_t *contextual, afw_size_t count, const afw_value_t *const *values, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for template definition value.
const afw_utf8_t * afw_value_as_utf8(const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Definition: afw_value.c:456
afw_value_evaluated_t * afw_value_evaluated_allocate(const afw_data_type_t *data_type, const afw_pool_t *p, afw_xctx_t *xctx)
Allocate function for an evaluated data type value.
const afw_value_t * afw_value_compile(const afw_value_t *value, const afw_utf8_t *source_location, const afw_pool_t *p, afw_xctx_t *xctx)
Compile a value.
Definition: afw_value.c:74
afw_value_block_inf
Value block inf.
Definition: afw_value.h:231
afw_value_call_built_in_function_inf
Value call inf.
Definition: afw_value.h:243
afw_value_expression_definition_inf
Value expression inf.
Definition: afw_value.h:255
afw_value_false
Adaptive value false.
Definition: afw_value.h:354
afw_value_object_expression_inf
Value object expression inf.
Definition: afw_value.h:285
const afw_utf8_z_t * afw_value_as_utf8_z(const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Definition: afw_value.c:315
afw_value_call_inf
Value call inf.
Definition: afw_value.h:237
const afw_utf8_t * afw_value_one_and_only_as_utf8(const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Return result of afw_value_one_and_only() as utf8.
Definition: afw_value.c:441
const afw_value_t * afw_value_evaluated_create(const void *value, const afw_data_type_t *data_type, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for an evaluated data type value.
const afw_value_t * afw_value_assignment_target_create(const afw_compile_value_contextual_t *contextual, const afw_compile_assignment_target_t *assignment_target, const afw_pool_t *p, afw_xctx_t *xctx)
Create assignment target value.
afw_value_function_definition_inf
Value function inf.
Definition: afw_value.h:261
const afw_value_t * afw_value_create_dateTime_now_local(const afw_pool_t *p, afw_xctx_t *xctx)
Create a dateTime value with current local time.
Definition: afw_value.c:749
afw_value_empty_string
Adaptive value empty string.
Definition: afw_value.h:342
const afw_value_t * afw_value_create_dateTime_now_utc(const afw_pool_t *p, afw_xctx_t *xctx)
Create a dateTime value with current time.
Definition: afw_value.c:736
const afw_value_t * afw_value_convert(const afw_value_t *value, const afw_data_type_t *to_data_type, afw_boolean_t required, const afw_pool_t *p, afw_xctx_t *xctx)
Convert a value to a value/data type.
Definition: afw_value.c:584
afw_boolean_t afw_value_undecorated_inf_is(const afw_value_t *value, const afw_value_inf_t *inf)
Determine if value's undecorated inf is the supplied one.
Definition: afw_value.c:197
const afw_value_t * afw_value_block_finalize(const afw_value_block_t *block, afw_size_t argc, const afw_value_t *const *argv, afw_xctx_t *xctx)
Create and link a new block.
afw_value_decompile_value(const afw_value_t *instance, const afw_writer_t *writer, afw_xctx_t *xctx)
Decompile Value::.
afw_boolean_t afw_value_contains(const afw_value_t *value, const afw_value_t *substring, afw_xctx_t *xctx)
Check to see if a value contains a substring.
Definition: afw_value.c:931
const afw_value_t * afw_value_function_thunk_create_impl(const afw_utf8_t *name, const afw_value_t *like_function_value, afw_function_thunk_execute_t execute, void *ctx, const afw_utf8_z_t *source_z, const afw_pool_t *p, afw_xctx_t *xctx)
Create a function thunk value.
const afw_value_t * afw_value_make_string_copy(const afw_utf8_octet_t *s, afw_size_t len, const afw_pool_t *p, afw_xctx_t *xctx)
Definition: afw_value.c:496
afw_value_variable_reference_inf
Value variable_reference inf.
Definition: afw_value.h:309
afw_value_script_function_definition_inf
Value lambda inf.
Definition: afw_value.h:273
const afw_value_t * afw_value_variable_reference_create(const afw_compile_value_contextual_t *contextual, const afw_value_block_symbol_t *symbol, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for variable reference value.
int afw_value_compare(const afw_value_t *value1, const afw_value_t *value2, afw_xctx_t *xctx)
Compare two evaluated values.
Definition: afw_value.c:893
const afw_value_t * afw_value_call_create(const afw_compile_value_contextual_t *contextual, afw_size_t argc, const afw_value_t *const *argv, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for call value.
const afw_utf8_t * afw_value_as_casted_utf8(const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Convert value to casted utf8 in specified pool.
Definition: afw_value.c:334
const afw_value_t * afw_value_evaluate_with_additional_untrusted_qualified_variables(const afw_value_t *value, const afw_value_t *untrusted_qualified_variables, const afw_pool_t *p, afw_xctx_t *xctx)
Evaluate a value with additional insecure context.
Definition: afw_value.c:534
afw_value_list_expression_inf
Value list expression inf.
Definition: afw_value.h:279
afw_boolean_t afw_value_is_scalar(const afw_value_t *value, afw_xctx_t *xctx)
Determine if value is scalar.
Definition: afw_value.c:271
const afw_value_t * afw_value_call_built_in_function_create(const afw_compile_value_contextual_t *contextual, afw_size_t argc, const afw_value_t *const *argv, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for call_built_in_function value.
afw_value_qualified_variable_reference_inf
Value qualified_variable_reference inf.
Definition: afw_value.h:291
const afw_value_block_t * afw_value_block_allocated_and_link(const afw_compile_value_contextual_t *contextual, afw_value_compiled_value_t *compiled_value, afw_size_t *block_count, const afw_pool_t *p, afw_xctx_t *xctx)
Create and link a new block.
afw_value_null
Adaptive value null.
Definition: afw_value.h:320
afw_value_template_definition_inf
Value template inf.
Definition: afw_value.h:303
const afw_value_t * afw_value_make_single_string(const afw_utf8_octet_t *s, afw_size_t len, const afw_pool_t *p, afw_xctx_t *xctx)
Definition: afw_value.c:478
const afw_value_t * afw_value_string_from_internal(const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Definition: afw_value.c:710
afw_value_compiled_value_inf
Value call inf.
Definition: afw_value.h:249
afw_boolean_t afw_value_is_fully_evaluated(const afw_value_t *value, afw_xctx_t *xctx)
Determine if value and all of it contained values are evaluated.
Definition: afw_value.c:218
afw_value_annotated_t * afw_value_annotation_allocate(const afw_pool_t *p, afw_xctx_t *xctx)
Allocate function for annotation value.
afw_value_create_object_expression(const afw_compile_value_contextual_t *contextual, const afw_object_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for object expression value.
afw_value_true
Adaptive value true.
Definition: afw_value.h:348
const afw_value_t * afw_value_create_string_from_u8z(const afw_utf8_z_t *string_z, const afw_pool_t *p, afw_xctx_t *xctx)
Definition: afw_value.c:519
const afw_value_t * afw_value_reference_by_key_create(const afw_compile_value_contextual_t *contextual, const afw_value_t *aggregate_value, const afw_value_t *key, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for reference_by_key value.
const afw_value_t * afw_value_qualified_variable_reference_create(const afw_compile_value_contextual_t *contextual, const afw_utf8_t *qualifier, const afw_utf8_t *name, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for variable reference value.
const afw_value_t *const * afw_value_as_array_of_values(const afw_value_t *value, const afw_pool_t *p, afw_xctx_t *xctx)
Return a NULL terminated list of values in a specified pool.
Definition: afw_value.c:817
Contextual information provided in some values.
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 annotated value.
Struct for value assignment.
struct for afw_value_block_t
struct for afw_value_block_symbol_t
Struct for contextual and args for call values.
Struct to access internal of all evaluated values.
Definition: afw_value.h:60
Struct for function value.
Definition: afw_value.h:102
const afw_value_function_parameter_t *const * parameters
Function parameters.
Definition: afw_value.h:157
afw_utf8_t functionSignature
Function signature.
Definition: afw_value.h:136
afw_utf8_t description
Description of function.
Definition: afw_value.h:133
afw_boolean_t polymorphicExecuteFunctionEvaluatesFirstParameter
True if polymorphic execute evaluates first parameter.
Definition: afw_value.h:199
afw_integer_t numberOfRequiredParameters
The number of required parameters.
Definition: afw_value.h:151
afw_utf8_t untypedFunctionId
Function id without <dataType>.
Definition: afw_value.h:118
afw_boolean_t deprecated
This function is deprecated.
Definition: afw_value.h:202
const afw_utf8_t * sideEffects
Side effects or NULL.
Definition: afw_value.h:187
const afw_object_t * object
Object representing function.
Definition: afw_value.h:106
afw_function_execute_cb_t execute
Function called to execute this Adaptive function.
Definition: afw_value.h:145
afw_utf8_t afwCamelCaseFunctionLabel
functionLabel prefixed with "afw" and converted to camel case.
Definition: afw_value.h:127
afw_utf8_t category
Category of function.
Definition: afw_value.h:109
afw_boolean_t polymorphic
True if this is a polymorphic function.
Definition: afw_value.h:196
afw_boolean_t signatureOnly
This is only a signature with an unimplemented execute function.
Definition: afw_value.h:213
afw_function_arg_check_t arg_check
Optional function called to check args.
Definition: afw_value.h:148
const afw_data_type_t * data_type
If this is a data type method, this is the data type.
Definition: afw_value.h:169
afw_utf8_t functionLabel
Label used internally for function.
Definition: afw_value.h:121
afw_integer_t dataTypeMethodNumber
Data type member number.
Definition: afw_value.h:190
afw_boolean_t pure
Given the same exact parameter values, this function will always return the same result an not cause ...
Definition: afw_value.h:208
afw_utf8_t op
Optional operator for function.
Definition: afw_value.h:142
const afw_utf8_t * polymorphicDataTypes
If this is polymorphic function, these are supported data types.
Definition: afw_value.h:166
const afw_value_function_parameter_t * returns
Function returns.
Definition: afw_value.h:163
afw_utf8_t functionId
Function id of function.
Definition: afw_value.h:112
afw_octet_t scriptSupportNumber
See AFW_VALUE_SCRIPT_SUPPORT_NUMBER_* #defines.
Definition: afw_value.h:193
afw_utf8_t dataType
If this is a data type method, this is the data type id.
Definition: afw_value.h:172
afw_utf8_t camelCaseFunctionLabel
functionLabel converted to camel case.
Definition: afw_value.h:124
afw_utf8_t brief
Brief description.
Definition: afw_value.h:130
const afw_size_t parameters_count
Parameters count.
Definition: afw_value.h:160
afw_utf8_t functionDeclaration
Function declaration.
Definition: afw_value.h:139
const afw_utf8_z_t *const * errorsThrown
Errors thrown or NULL.
Definition: afw_value.h:184
afw_integer_t maximumNumberOfParameters
The maximum number of required parameters or -1 is no max.
Definition: afw_value.h:154
Struct for adaptive function parameter.
Definition: afw_value.h:68
Interface afw_value_inf_s struct.
Filled in by afw_value get_info method.
Definition: afw_value.h:49
Struct for compiled value value.
Interface afw_value public struct.
Struct for script function parameter.
Type meta (data type, data type parameters, and value meta object.
Interface afw_writer public struct.
Interface afw_xctx public struct.