BARfly Help - BAR Implementation File Reference - Expressions

  Built-in functions

BAR provides built-in functions for general use in scripts.  These functions provide low-level data processing capabilities, such as string copying and searching.

char *strstr(char *string, char *strcharset);

This function is used to find the first instance of substring strcharset in string.  A pointer to the first instance of the substring is returned on success; a null pointer is returned on failure.

char *strcpy(char *dest, char *source);

This function is used to copy the string, including null byte, from source to dest.  The value of dest is returned.  Overlapping buffers result in undefined copying output.

void *memmove(void *dest, void *source, long count);

This function is used to copy count bytes from source to dest.  The value of dest is returned.  Overlapping buffers are always copied correctly.

void *memcpy(void *dest, void *source, long count);

This function is used to copy count bytes from source to dest.  The value of dest is returned.  Overlapping buffers result in undefined copying output.

void *memset(void *dest, char c, long count);

This function is used to set count bytes in dest to the value of c.  The value of dest is returned.

char *strchr(char *string, char c);

This function is used to find the first instance of c in string.  A pointer to the first instance of c is returned on success; a null pointer is returned on failure.

void *memchr(void *buf, char c, long count);

This function is used to find the first instance of c in buf, searching as many as count characters.  A pointer to the first instance of c is returned on success; a null pointer is returned on failure.

long strcmp(char *string1, char *string2);

This function is used to compare two strings.  If string1 is less than string2, the number returned is less than 0.  If string1 is greater than string2, the number returned is greater than 0.  If the strings are identical, the number returned equals 0.

long memcmp(void *buf1, void *buf2, long count);

This function is used to compare count bytes of two buffers.  If buf1 is less than buf2, the number returned is less than 0.  If buf1 is greater than buf2, the number returned is greater than 0.  If the buffers are identical, the number returned equals 0.

char *strupr(char *string);

This function is used to convert, in-place, a string to uppercase.  The value of string is returned.

char *strlwr(char *string);

This function is used to convert, in-place, a string to lowercase.  The value of string is returned.

long strlen(char *string);

This function is used to return the length of a null-terminated string.

Built-in functions have their own compliance conditions.  The following items explain how these conditions work, on a per-parameter basis:

  • A pointer-to-void parameter is always accompanied by a length parameter.  If any part of the region of bytes occupied by the start of the pointed-to location through the last byte of the buffer is out of bounds of the pointer, the pointer and length violate the memory bounds check condition.
  • A pointer-to-char parameter must point to a null-terminated string.  If the null byte, which effectively sizes the string, is beyond the upper bounds of the pointer, the pointer violates the memory bounds check condition.


  See also:  [Expression characteristics] [Identifier interpretations] [Built-in functions] [Special load considerations]
[Additional rules for expressions] [Final expression type result] [L-value status gain and loss]
[Overly complex expressions] [Limitations on pointer usage] [Structure member dereference:  bit scan blocks]


BARfly Help Copyright © 2009 Christopher Allen