NAME ^

languages/tcl/src/binary.c

DESCRIPTION ^

RT#48162

Functions ^

static int extract_int(char *str, int *pos, int length)

Extract an integer from the string at the position given. Return the integer and update the position. Returns 1 if no digit is found or if the int is zero.

static PMC *binary_scan_number_field(PARROT_INTERP, char field, char *binstr, int *_pos, int length)

Scan and remove a number from a binary string. Return a PMC representing that value.

static PMC *binary_scan_number_slurpy(PARROT_INTERP, char field, char *binstr, int *_pos, int length)

Scan the binary string for all remaining occurences of a number of the type of the field. Returns a TclList PMC of the number PMCs.

static PMC *binary_scan_number(PARROT_INTERP, char field, char *format, int *formatpos, int formatlen, char *binstr, int *binstrpos, int binstrlen)

Scan the binary string for a number field. There may be a width following the field specifier.

static STRING *binary_scan_string_field(PARROT_INTERP, char field, char *binstr, int *_binstrpos, int binstrlen, STRING *value, int length)

Scan the binary string for a string field. Returns the value of the extracted string (concatenated to its previous value).

static STRING *binary_scan_string_slurpy(PARROT_INTERP, char field, char *binstr, int *_binstrpos, int binstrlen, STRING *value)

Scan the binary string for all remaining matches of the field. Returns the new value of the STRING value passed in.

static PMC *binary_scan_string(PARROT_INTERP, char field, char *format, int *formatpos, int formatlen, char *binstr, int *binstrpos, int binstrlen)

Scan the binary string for a string field. Returns a TclString PMC with the value(s) extracted.

PMC *ParTcl_binary_scan(PARROT_INTERP, STRING *BINSTR, STRING *FORMAT)

Scan a binary string according to a format string and return a TclList of the extracted values.

Assumes, in order to prevent entering another PIR runloop, that the format has been checked to contain valid fields.

String and number field code has been separated in an effort to reduce code.

static STRING *binary_format_number_field(PARROT_INTERP, char field, STRING *binstr, PMC *value)

RT#48164: Not yet documented!!!

static STRING *binary_format_number(PARROT_INTERP, char field, STRING *binstr, PMC *value, char *format, int *formatpos, int formatlen)

RT#48164: Not yet documented!!!

static STRING *binary_format_string_field(PARROT_INTERP, char field, STRING *binstr, STRING *strval, int length)

RT#48164: Not yet documented!!!

static STRING *binary_format_string(PARROT_INTERP, char field, STRING *binstr, PMC *value, char *format, int *formatpos, int formatlen)

RT#48164: Not yet documented!!!

STRING *ParTcl_binary_format(PARROT_INTERP, STRING *FORMAT, PMC *values)

RT#48164: Not yet documented!!!


parrot