Adaptive Framework  0.9.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
afw_function_stream.c
Go to the documentation of this file.
1 // See the 'COPYING' file in the project root for licensing information.
2 /*
3  * afw_function_execute_* functions for stream
4  *
5  * Copyright (c) 2010-2023 Clemson University
6  *
7  */
8 
14 #include "afw.h"
15 
16 
17 
18 /*
19  * Adaptive function: flush
20  *
21  * afw_function_execute_flush
22  *
23  * See afw_function_bindings.h for more information.
24  *
25  * Write the content of the stream's buffers to its destination.
26  *
27  * This function is not pure, so it may return a different result
28  * given exactly the same parameters and has side effects.
29  *
30  * Declaration:
31  *
32  * ```
33  * function flush(
34  * streamNumber: integer
35  * ): null;
36  * ```
37  *
38  * Parameters:
39  *
40  * streamNumber - (integer) The streamNumber for the stream to flush.
41  *
42  * Returns:
43  *
44  * (null)
45  */
46 const afw_value_t *
49 {
50  const afw_value_integer_t *streamNumber;
51  const afw_stream_t *stream;
52 
54  1, integer);
55 
56  stream = afw_stream_get_by_streamNumber(streamNumber->internal, x->xctx);
58  if (stream) {
59  afw_stream_flush(stream, x->xctx);
60  }
61  stream = NULL;
62 
63  return afw_value_null;
64 }
65 
66 
67 
68 /*
69  * Adaptive function: print
70  *
71  * afw_function_execute_print
72  *
73  * See afw_function_bindings.h for more information.
74  *
75  * Evaluate and convert 0 or more values to its string value, then write them
76  * to stdout. An undefined value is represented by `<undefined>`.
77  *
78  * This function is not pure, so it may return a different result
79  * given exactly the same parameters and has side effects.
80  *
81  * Declaration:
82  *
83  * ```
84  * function print(
85  * ...values: (list of any)
86  * ): null;
87  * ```
88  *
89  * Parameters:
90  *
91  * values - (0 or more any dataType) Values to print.
92  *
93  * Returns:
94  *
95  * (null)
96  */
97 const afw_value_t *
100 {
101  const afw_value_t *value;
102  const afw_stream_t *stream;
103  const afw_utf8_t *s;
104  afw_size_t i;
105 
106  stream = afw_stream_standard(stdout, x->xctx);
107  for (i = 1; i <= x->argc; i++) {
109  if (value) {
110  value = afw_value_convert_to_string(value, true, x->p, x->xctx);
111  s = AFW_VALUE_INTERNAL(value);
112  afw_stream_write(stream, s->s, s->len, x->xctx);
113  }
114  else {
115  afw_stream_write_utf8(stream,
116  &afw_s_a_undefined_as_string, x->xctx);
117  }
118  }
119  afw_stream_flush(stream, x->xctx);
120 
121  return afw_value_null;
122 }
123 
124 
125 
126 /*
127  * Adaptive function: println
128  *
129  * afw_function_execute_println
130  *
131  * See afw_function_bindings.h for more information.
132  *
133  * Evaluate and convert 0 or more values to their string value, then write them
134  * to stdout. A newline character ('\n') is written after the last value. An
135  * undefined value is represented by `<undefined>`.
136  *
137  * This function is not pure, so it may return a different result
138  * given exactly the same parameters and has side effects.
139  *
140  * Declaration:
141  *
142  * ```
143  * function println(
144  * ...value: (list of any)
145  * ): null;
146  * ```
147  *
148  * Parameters:
149  *
150  * value - (0 or more any dataType) Values to print.
151  *
152  * Returns:
153  *
154  * (null)
155  */
156 const afw_value_t *
159 {
160  const afw_stream_t *stream;
161  const afw_value_t *value;
162  const afw_utf8_t *s;
163  afw_size_t i;
164 
165  stream = afw_stream_standard(stdout, x->xctx);
166  for (i = 1; i <= x->argc; i++) {
168  if (value) {
169  value = afw_value_convert_to_string(value, true, x->p, x->xctx);
170  s = AFW_VALUE_INTERNAL(value);
171  afw_stream_write(stream, s->s, s->len, x->xctx);
172  }
173  else {
174  afw_stream_write_utf8(stream,
175  &afw_s_a_undefined_as_string, x->xctx);
176  }
177  }
178  afw_stream_write_eol(stream, x->xctx);
179  afw_stream_flush(stream, x->xctx);
180 
181  return afw_value_null;
182 }
183 
184 
185 
186 /*
187  * Adaptive function: write
188  *
189  * afw_function_execute_write
190  *
191  * See afw_function_bindings.h for more information.
192  *
193  * Evaluate and convert 0 or more values to its string value, then write them
194  * to stream. An value with an undefined value is represented by `<undefined>`.
195  *
196  * This function is not pure, so it may return a different result
197  * given exactly the same parameters and has side effects.
198  *
199  * Declaration:
200  *
201  * ```
202  * function write(
203  * streamNumber: integer,
204  * ...value: (list of any)
205  * ): null;
206  * ```
207  *
208  * Parameters:
209  *
210  * streamNumber - (integer) The streamNumber for the stream to write.
211  *
212  * value - (0 or more any) Values to write as their string value.
213  *
214  * Returns:
215  *
216  * (null)
217  */
218 const afw_value_t *
221 {
222  const afw_value_integer_t *streamNumber;
223  const afw_stream_t *stream;
224  const afw_value_t *value;
225  const afw_utf8_t *s;
226  afw_size_t i;
227 
229  1, integer);
230 
231  stream = afw_stream_get_by_streamNumber(streamNumber->internal, x->xctx);
233  if (!stream) {
234  return afw_value_null;
235  }
236 
237  for (i = 2; i <= x->argc; i++) {
239  if (value) {
240  value = afw_value_convert_to_string(value, true, x->p, x->xctx);
241  s = AFW_VALUE_INTERNAL(value);
242  afw_stream_write(stream, s->s, s->len, x->xctx);
243  }
244  else {
245  afw_stream_write_utf8(stream,
246  &afw_s_a_undefined_as_string, x->xctx);
247  }
248  }
249 
250  return afw_value_null;
251 }
252 
253 
254 
255 /*
256  * Adaptive function: writeln
257  *
258  * afw_function_execute_writeln
259  *
260  * See afw_function_bindings.h for more information.
261  *
262  * Evaluate and convert 0 or more values to its string value, then write them
263  * to stream. A newline character ('\n') is written after the last value. An
264  * undefined value is represented by `<undefined>`.
265  *
266  * This function is not pure, so it may return a different result
267  * given exactly the same parameters and has side effects.
268  *
269  * Declaration:
270  *
271  * ```
272  * function writeln(
273  * streamNumber: integer,
274  * ...value: (list of any)
275  * ): null;
276  * ```
277  *
278  * Parameters:
279  *
280  * streamNumber - (integer) The streamNumber for the stream to write.
281  *
282  * value - (0 or more any dataType) Values to write.
283  *
284  * Returns:
285  *
286  * (null)
287  */
288 const afw_value_t *
291 {
292  const afw_value_integer_t *streamNumber;
293  const afw_stream_t *stream;
294  const afw_value_t *value;
295  const afw_utf8_t *s;
296  afw_size_t i;
297 
299  1, integer);
300 
301  stream = afw_stream_get_by_streamNumber(streamNumber->internal, x->xctx);
303  if (!stream) {
304  return afw_value_null;
305  }
306 
307  for (i = 2; i <= x->argc; i++) {
309  if (value) {
310  value = afw_value_convert_to_string(value, true, x->p, x->xctx);
311  s = AFW_VALUE_INTERNAL(value);
312  afw_stream_write(stream, s->s, s->len, x->xctx);
313  }
314  else {
315  afw_stream_write_z(stream, "<undefined>", x->xctx);
316  }
317  }
318  afw_stream_write_eol(stream, x->xctx);
319 
320  return afw_value_null;
321 }
322 
323 
324 
325 /*
326  * Adaptive function: close
327  *
328  * afw_function_execute_close
329  *
330  * See afw_function_bindings.h for more information.
331  *
332  * This will close an open stream
333  *
334  * This function is not pure, so it may return a different result
335  * given exactly the same parameters and has side effects.
336  *
337  * Declaration:
338  *
339  * ```
340  * function close(
341  * streamNumber: integer
342  * ): null;
343  * ```
344  *
345  * Parameters:
346  *
347  * streamNumber - (integer) The streamNumber for the stream to close.
348  *
349  * Returns:
350  *
351  * (null)
352  */
353 const afw_value_t *
356 {
357  const afw_value_integer_t *streamNumber;
358  const afw_stream_t *stream;
359 
361  1, integer);
362 
363  stream = afw_stream_get_by_streamNumber(streamNumber->internal, x->xctx);
365  if (stream) {
366  afw_stream_release(stream, x->xctx);
367  }
368 
369  return afw_value_null;
370 }
371 
372 
373 
374 /*
375  * Adaptive function: get_stream_error
376  *
377  * afw_function_execute_get_stream_error
378  *
379  * See afw_function_bindings.h for more information.
380  *
381  * Get the most recent stream error.
382  *
383  * This function is not pure, so it may return a different result
384  * given exactly the same parameters.
385  *
386  * Declaration:
387  *
388  * ```
389  * function get_stream_error(
390  *
391  * ): string;
392  * ```
393  *
394  * Parameters:
395  *
396  * Returns:
397  *
398  * (string) The most recent stream error.
399  */
400 const afw_value_t *
403 {
404  if (x->xctx->stream_anchor && x->xctx->stream_anchor->last_stream_error)
405  {
407  x->xctx->stream_anchor->last_stream_error,
408  x->p, x->xctx);
409  }
410  return NULL;
411 }
412 
413 
414 
415 /*
416  * Adaptive function: open_file
417  *
418  * afw_function_execute_open_file
419  *
420  * See afw_function_bindings.h for more information.
421  *
422  * This will open a file stream.
423  *
424  * This function is not pure, so it may return a different result
425  * given exactly the same parameters and has side effects.
426  *
427  * Declaration:
428  *
429  * ```
430  * function open_file(
431  * streamId: string,
432  * path: string,
433  * mode: string,
434  * autoFlush?: boolean
435  * ): integer;
436  * ```
437  *
438  * Parameters:
439  *
440  * streamId - (string) This is the streamId that will be associated with this
441  * open file stream.
442  *
443  * path - (string) This is the path to the file to open. The rootDirectory of
444  * the path is defined in the application object.
445  *
446  * mode - (string) This is the access mode string. Values can be:
447  * r - Open an existing file text file for read.
448  * w - Open a text file for writing. If the file does not exist, it
449  * will be created.
450  * a - Open a text file for writing additional data to the end. If the
451  * file does not exist, it will be created.
452  * r+ - Open a text file for both reading and writing.
453  * w+ - Open a text file for both reading and writing. If the file
454  * exists, it will be overwritten. If the file does not exist, it will be
455  * created.
456  * a+ - Open a text file for both reading and writing. Reading will
457  * begin at the start of the file while writing will be appended to the
458  * end.
459  *
460  * All of these modes expect data type string. If you are using data type
461  * base64Binary or hexBinary you can use corresponding binary modes,
462  * "rb", "wb", "ab", "rb+", "r+b", "wb+", "w+b", "ab+", and "a+b".
463  *
464  * autoFlush - (optional boolean) If specified and true, this will
465  * automatically flush the stream's buffers after every write.
466  *
467  * Returns:
468  *
469  * (integer) The streamNumber for the streamId or -1 if there was an error.
470  * Use get_stream_error() for error information.
471  */
472 const afw_value_t *
475 {
476  const afw_value_string_t *streamId;
477  const afw_value_string_t *path;
478  const afw_value_string_t *mode;
479  const afw_value_boolean_t *autoFlush;
480  const afw_stream_t *stream;
481  afw_size_t number;
482 
484  1, string);
486  2, string);
488  3, string);
490  4, boolean);
491 
493  &streamId->internal, x->xctx);
494  if (number == -1) {
495  AFW_THROW_ERROR_FZ(general, x->xctx,
496  "streamId %" AFW_UTF8_FMT " is already open",
497  AFW_UTF8_FMT_ARG(&streamId->internal));
498  }
499 
501  &streamId->internal, &path->internal, &mode->internal,
502  autoFlush && autoFlush->internal, x->p, x->xctx);
503 
504  number = afw_stream_set(stream, x->xctx);
505  if (number == -1) {
506  AFW_THROW_ERROR_FZ(general, x->xctx,
507  "streamId %" AFW_UTF8_FMT " could not be set",
508  AFW_UTF8_FMT_ARG(&streamId->internal));
509  }
510 
511  return afw_value_create_integer((afw_integer_t)number, x->p, x->xctx);
512 }
513 
514 
515 
516 /*
517  * Adaptive function: open_response
518  *
519  * afw_function_execute_open_response
520  *
521  * See afw_function_bindings.h for more information.
522  *
523  * This will open a response text write-only stream that will be written to the
524  * http response.
525  *
526  * This function is not pure, so it may return a different result
527  * given exactly the same parameters and has side effects.
528  *
529  * Declaration:
530  *
531  * ```
532  * function open_response(
533  * streamId: string,
534  * autoFlush?: boolean
535  * ): integer;
536  * ```
537  *
538  * Parameters:
539  *
540  * streamId - (string) This is the streamId that will be associated with this
541  * open response stream.
542  *
543  * autoFlush - (optional boolean) If specified and true, this will
544  * automatically flush the stream's buffers after every write.
545  *
546  * Returns:
547  *
548  * (integer) The streamNumber for the streamId or -1 if there was an error.
549  * Use get_stream_error() for error information.
550  */
551 const afw_value_t *
554 {
555  const afw_value_string_t *streamId;
556  const afw_stream_t *stream;
557  afw_size_t number;
558 
560 
561  number = afw_stream_get_streamNumber_for_streamId(&streamId->internal,
562  x->xctx);
563  if (number == -1) {
564  AFW_THROW_ERROR_FZ(general, x->xctx,
565  "streamId %" AFW_UTF8_FMT " is already open",
566  AFW_UTF8_FMT_ARG(&streamId->internal));
567  }
568 
569  stream = afw_utf8_stream_create(&streamId->internal, x->p, x->xctx);
570  number = afw_stream_set(stream, x->xctx);
571  if (number == -1) {
572  AFW_THROW_ERROR_FZ(general, x->xctx,
573  "streamId %" AFW_UTF8_FMT " could not be set",
574  AFW_UTF8_FMT_ARG(&streamId->internal));
575  }
576 
577  return afw_value_create_integer((afw_integer_t)number, x->p, x->xctx);
578 }
579 
580 
581 
582 /*
583  * Adaptive function: open_uri
584  *
585  * afw_function_execute_open_uri
586  *
587  * See afw_function_bindings.h for more information.
588  *
589  * This will open a read or write stream for a URI.
590  *
591  * This function is not pure, so it may return a different result
592  * given exactly the same parameters and has side effects.
593  *
594  * Declaration:
595  *
596  * ```
597  * function open_uri(
598  * streamId: string,
599  * uri: string,
600  * mode: string,
601  * autoFlush?: boolean
602  * ): integer;
603  * ```
604  *
605  * Parameters:
606  *
607  * streamId - (string) This is the streamId that will be associated with this
608  * open URI stream.
609  *
610  * uri - (string) This is the URI of the stream to open.
611  *
612  * mode - (string) This is the access mode string. Values can be "r" for read
613  * or "w" for write.
614  *
615  * autoFlush - (optional boolean) If specified and true, this will
616  * automatically flush the stream's buffers after every write.
617  *
618  * Returns:
619  *
620  * (integer) The streamNumber for the streamId or -1 if there was an error.
621  * Use get_stream_error() for error information.
622  */
623 const afw_value_t *
626 {
628  AFW_THROW_ERROR_Z(general, "Not implemented", x->xctx);
629 }
630 
631 
632 
633 /*
634  * Adaptive function: read
635  *
636  * afw_function_execute_read
637  *
638  * See afw_function_bindings.h for more information.
639  *
640  * Read a UTF-8 text stream up to a specified number of octets. The stream must
641  * contain valid UTF-8 or an error is thrown.
642  *
643  * This function is not pure, so it may return a different result
644  * given exactly the same parameters and has side effects.
645  *
646  * Declaration:
647  *
648  * ```
649  * function read(
650  * streamNumber: integer,
651  * n: any
652  * ): string;
653  * ```
654  *
655  * Parameters:
656  *
657  * streamNumber - (integer) Stream number.
658  *
659  * n - (any dataType) The maximum number of octets to read.
660  *
661  * Returns:
662  *
663  * (string) The UTF-8 string read. Check the size of this value to determine
664  * the actual number of octets read.
665  */
666 const afw_value_t *
669 {
671  AFW_THROW_ERROR_Z(general, "Not implemented", x->xctx);
672 }
673 
674 
675 
676 /*
677  * Adaptive function: read_to_base64Binary
678  *
679  * afw_function_execute_read_to_base64Binary
680  *
681  * See afw_function_bindings.h for more information.
682  *
683  * Read a stream up to a specified number of octets. The result will be the
684  * internal memory of a base64Binary value.
685  *
686  * This function is not pure, so it may return a different result
687  * given exactly the same parameters and has side effects.
688  *
689  * Declaration:
690  *
691  * ```
692  * function read_to_base64Binary(
693  * streamNumber: integer,
694  * n: any
695  * ): base64Binary;
696  * ```
697  *
698  * Parameters:
699  *
700  * streamNumber - (integer) Stream number.
701  *
702  * n - (any dataType) The maximum number of octets to read.
703  *
704  * Returns:
705  *
706  * (base64Binary) The base64Binary value read. Check the size of this value
707  * to determine the actual number of octets read.
708  */
709 const afw_value_t *
712 {
714  AFW_THROW_ERROR_Z(general, "Not implemented", x->xctx);
715 }
716 
717 
718 
719 /*
720  * Adaptive function: read_to_hexBinary
721  *
722  * afw_function_execute_read_to_hexBinary
723  *
724  * See afw_function_bindings.h for more information.
725  *
726  * Read a stream up to a specified number of octets. The result will be the
727  * internal memory of a hexBinary value.
728  *
729  * This function is not pure, so it may return a different result
730  * given exactly the same parameters and has side effects.
731  *
732  * Declaration:
733  *
734  * ```
735  * function read_to_hexBinary(
736  * streamNumber: integer,
737  * n: any
738  * ): hexBinary;
739  * ```
740  *
741  * Parameters:
742  *
743  * streamNumber - (integer) Stream number.
744  *
745  * n - (any dataType) The maximum number of octets to read.
746  *
747  * Returns:
748  *
749  * (hexBinary) The hexBinary value read. Check the size of this value to
750  * determine the actual number of octets read.
751  */
752 const afw_value_t *
755 {
757  AFW_THROW_ERROR_Z(general, "Not implemented", x->xctx);
758 }
759 
760 
761 
762 /*
763  * Adaptive function: readln
764  *
765  * afw_function_execute_readln
766  *
767  * See afw_function_bindings.h for more information.
768  *
769  * Read a UTF-8 text stream line. The stream must contain valid UTF-8 or an
770  * error is thrown.
771  *
772  * This function is not pure, so it may return a different result
773  * given exactly the same parameters and has side effects.
774  *
775  * Declaration:
776  *
777  * ```
778  * function readln(
779  * streamNumber: integer
780  * ): string;
781  * ```
782  *
783  * Parameters:
784  *
785  * streamNumber - (integer) Stream number.
786  *
787  * Returns:
788  *
789  * (string) The UTF-8 string read.
790  */
791 const afw_value_t *
794 {
796  AFW_THROW_ERROR_Z(general, "Not implemented", x->xctx);
797 }
798 
799 
800 
801 /*
802  * Adaptive function: stream
803  *
804  * afw_function_execute_stream
805  *
806  * See afw_function_bindings.h for more information.
807  *
808  * This will return the streamNumber for a streamId. This function useful to
809  * obtain the number of the automatically opened standard streams "console",
810  * "stderr" and "stdout" as well and any other open stream.
811  *
812  * This function is not pure, so it may return a different result
813  * given exactly the same parameters.
814  *
815  * Declaration:
816  *
817  * ```
818  * function stream(
819  * streamId: string
820  * ): integer;
821  * ```
822  *
823  * Parameters:
824  *
825  * streamId - (string) The id of a stream.
826  *
827  * Returns:
828  *
829  * (integer) The streamNumber for the streamId or -1 if there was an error.
830  * Use get_stream_error() for error information.
831  */
832 const afw_value_t *
835 {
836  const afw_value_string_t *streamId;
837  afw_size_t number;
838  afw_integer_t integer;
839 
841 
842  number = afw_stream_get_streamNumber_for_streamId(&streamId->internal,
843  x->xctx);
844  if (number == -1) {
845  integer = -1;
846  }
847  else {
848  integer = (afw_integer_t)number;
849  }
850 
851  return afw_value_create_integer(integer, x->p, x->xctx);
852 }
853 
854 
855 
856 /*
857  * Adaptive function: write_internal
858  *
859  * afw_function_execute_write_internal
860  *
861  * See afw_function_bindings.h for more information.
862  *
863  * Write a value's internal memory. This is especially useful for writing data
864  * type base64Binary and hexBinary.
865  *
866  * This function is not pure, so it may return a different result
867  * given exactly the same parameters and has side effects.
868  *
869  * Declaration:
870  *
871  * ```
872  * function write_internal(
873  * streamNumber: integer,
874  * value: any
875  * ): null;
876  * ```
877  *
878  * Parameters:
879  *
880  * streamNumber - (integer) The streamNumber for the stream to write.
881  *
882  * value - (any) The internal memory of this value is written.
883  *
884  * Returns:
885  *
886  * (null)
887  */
888 const afw_value_t *
891 {
893  AFW_THROW_ERROR_Z(general, "Not implemented", x->xctx);
894 }
Adaptive Framework Core API.
afw_value_create_integer(afw_integer_t internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type integer value.
afw_value_create_string(const afw_utf8_t *internal, const afw_pool_t *p, afw_xctx_t *xctx)
Create function for unmanaged data type string value.
#define AFW_UTF8_FMT_ARG(A_STRING)
Convenience Macro for use with AFW_UTF8_FMT to specify arg.
Definition: afw_common.h:605
#define AFW_UTF8_FMT
Format string specifier used for afw_utf8_t.
Definition: afw_common.h:588
apr_size_t afw_size_t
size_t.
Definition: afw_common.h:151
apr_int64_t afw_integer_t
typedef for big signed int.
Definition: afw_common.h:321
#define AFW_THROW_ERROR_FZ(code, xctx, format_z,...)
Macro used to set error and 0 rv in xctx and throw it.
Definition: afw_error.h:319
#define AFW_THROW_ERROR_Z(code, message_z, xctx)
Macro used to set error and 0 rv in xctx and throw it.
Definition: afw_error.h:283
#define AFW_FUNCTION_EVALUATE_DATA_TYPE_PARAMETER(A_RESULT, A_N, A_TYPE)
Evaluate an arg for a particular data type.
Definition: afw_function.h:261
#define AFW_FUNCTION_EVALUATE_REQUIRED_DATA_TYPE_PARAMETER(A_RESULT, A_N, A_TYPE)
Evaluate an arg for a particular data type.
Definition: afw_function.h:328
#define AFW_FUNCTION_EVALUATE_PARAMETER(A_RESULT, A_N)
Evaluate a parameter.
Definition: afw_function.h:279
const afw_value_t * afw_function_execute_read(afw_function_execute_t *x)
Adaptive Function read
const afw_value_t * afw_function_execute_flush(afw_function_execute_t *x)
Adaptive Function flush
const afw_value_t * afw_function_execute_close(afw_function_execute_t *x)
Adaptive Function close
const afw_value_t * afw_function_execute_readln(afw_function_execute_t *x)
Adaptive Function readln
const afw_value_t * afw_function_execute_open_response(afw_function_execute_t *x)
Adaptive Function open_response
const afw_value_t * afw_function_execute_write(afw_function_execute_t *x)
Adaptive Function write
const afw_value_t * afw_function_execute_read_to_base64Binary(afw_function_execute_t *x)
Adaptive Function read_to_base64Binary
const afw_value_t * afw_function_execute_open_uri(afw_function_execute_t *x)
Adaptive Function open_uri
const afw_value_t * afw_function_execute_get_stream_error(afw_function_execute_t *x)
Adaptive Function get_stream_error
const afw_value_t * afw_function_execute_print(afw_function_execute_t *x)
Adaptive Function print
const afw_value_t * afw_function_execute_writeln(afw_function_execute_t *x)
Adaptive Function writeln
const afw_value_t * afw_function_execute_stream(afw_function_execute_t *x)
Adaptive Function stream
const afw_value_t * afw_function_execute_write_internal(afw_function_execute_t *x)
Adaptive Function write_internal
const afw_value_t * afw_function_execute_read_to_hexBinary(afw_function_execute_t *x)
Adaptive Function read_to_hexBinary
const afw_value_t * afw_function_execute_println(afw_function_execute_t *x)
Adaptive Function println
const afw_value_t * afw_function_execute_open_file(afw_function_execute_t *x)
Adaptive Function open_file
#define afw_stream_write(instance, buffer, size, xctx)
Call method write of interface afw_stream.
#define afw_stream_flush(instance, xctx)
Call method flush of interface afw_stream.
#define afw_stream_release(instance, xctx)
Call method release of interface afw_stream.
afw_stream_get_by_streamNumber(const afw_integer_t streamNumber, afw_xctx_t *xctx)
Get stream by streamNumber.
Definition: afw_stream.c:68
#define afw_stream_write_eol(writer, xctx)
Write eol char to stream.
Definition: afw_stream.h:188
afw_stream_set(const afw_stream_t *stream, afw_xctx_t *xctx)
Set an opening stream and get its streamNumber.
Definition: afw_stream.c:114
#define afw_stream_write_z(writer, s_z, xctx)
Call afw_stream_write() with zero terminated string.
Definition: afw_stream.h:178
afw_stream_get_streamNumber_for_streamId(const afw_utf8_t *streamId, afw_xctx_t *xctx)
Get streamNumber for streamId.
Definition: afw_stream.c:97
#define afw_stream_write_utf8(writer, S, xctx)
Call afw_stream_write() with a afw_utf8_t string.
Definition: afw_stream.h:199
#define afw_stream_standard(enum_suffix, xctx)
Get xctx stream instance.
Definition: afw_stream.h:122
const afw_stream_t * afw_stream_fd_open_and_create(const afw_utf8_t *streamId, const afw_utf8_t *path, const afw_utf8_t *mode, afw_boolean_t auto_flush, const afw_pool_t *p, afw_xctx_t *xctx)
Open a file and create a stream for it.
const afw_stream_t * afw_utf8_stream_create(const afw_utf8_t *streamId, const afw_pool_t *p, afw_xctx_t *xctx)
Create UTF-8 stream.
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
#define AFW_VALUE_INTERNAL(_VALUE_)
Macro to get const void * of the internal of a value.
Definition: afw_value.h:856
afw_value_null
Adaptive value null.
Definition: afw_value.h:320
Function execute parameter.
Definition: afw_function.h:53
afw_xctx_t * xctx
The execution context (xctx) of caller.
Definition: afw_function.h:62
const afw_pool_t * p
Pool for result.
Definition: afw_function.h:59
afw_size_t argc
This is the argv count not counting argv[0].
Definition: afw_function.h:89
Interface afw_stream public struct.
NFC normalized UTF-8 string.
Definition: afw_common.h:545
struct for data type boolean values.
struct for data type integer values.
Interface afw_value public struct.
struct for data type string values.