SuperH-based fx calculators
fx legacy: MultiByte

The calc will in some cases use multibyte strings, for instance to access the extended character glyph tables. Some functions exist specifically for this kind of string.

0x531: int MB_IsLead(char character)

Returns 1 if character is 0x7F, 0xE5..0xE7, 0xF7 or 0xF9 (lead characters). Ret 0 otherwise.

0x533: int MB_ElementCount(char *str)

Returns the number of _elements_ (not bytes) in string at str.
Eg string: [0xF7 0x44] [0x36] [0x55] [0xE8 0x32] (0x00) consists of 4 elements, excluding terminating 0.

0x534: int MB_ByteCount(char *str)

Returns number of _bytes_ in string at str. This includes lead characters, and will in the example above, return 6.

0x536: char * MB_strcat(char *dest, char *src)

Works like a usual strcat. Locates end of dest, and appends string at src to it. Returns dest.

 

0x537: char * MB_strncat(char *dest, char *src, int bytes)

Works like expected. The bytes parameter does not respect multibyte chars, and may split a 'multibyte char'. Returns src.

 

0x538: char * MB_strcpy(char *dest, char *src)

Works like expected. Returns dest.

 

0x53C: char * MB_GetSecondElemPtr(char *str) - poorly named function?

Returns a pointer to the second element at str. That means increasing str by 1 or 2 depending on the data.

0x53D: short int MB_GetElement(char *str)

Returns first element of string at str. E.g: 0x0041 or 0xF761

0x53E: char * MB_CopyToHeap(char *src) - never used by OS

malloc()'s bytes needed for src string, and copies the string to the newly allocated memory. Returns pointer there.

(09.03.2011 09:52:51)