.TH ": Program Space Utilities" 3avr "Wed Jun 4 2014" "Version 1.8.0svn" "avr-libc" \" -*- nroff -*- .ad l .nh .SH NAME : Program Space Utilities \- .SS "Macros" .in +1c .ti -1c .RI "#define \fBPROGMEM\fP __ATTR_PROGMEM__" .br .ti -1c .RI "#define \fBPGM_P\fP const char *" .br .ti -1c .RI "#define \fBPGM_VOID_P\fP const void *" .br .ti -1c .RI "#define \fBPSTR\fP(s) ((const \fBPROGMEM\fP char *)(s))" .br .ti -1c .RI "#define \fBpgm_read_byte_near\fP(address_short) __LPM((\fBuint16_t\fP)(address_short))" .br .ti -1c .RI "#define \fBpgm_read_word_near\fP(address_short) __LPM_word((\fBuint16_t\fP)(address_short))" .br .ti -1c .RI "#define \fBpgm_read_dword_near\fP(address_short) __LPM_dword((\fBuint16_t\fP)(address_short))" .br .ti -1c .RI "#define \fBpgm_read_float_near\fP(address_short) __LPM_float((\fBuint16_t\fP)(address_short))" .br .ti -1c .RI "#define \fBpgm_read_ptr_near\fP(address_short) (void*)__LPM_word((\fBuint16_t\fP)(address_short))" .br .ti -1c .RI "#define \fBpgm_read_byte_far\fP(address_long) __ELPM((\fBuint32_t\fP)(address_long))" .br .ti -1c .RI "#define \fBpgm_read_word_far\fP(address_long) __ELPM_word((\fBuint32_t\fP)(address_long))" .br .ti -1c .RI "#define \fBpgm_read_dword_far\fP(address_long) __ELPM_dword((\fBuint32_t\fP)(address_long))" .br .ti -1c .RI "#define \fBpgm_read_float_far\fP(address_long) __ELPM_float((\fBuint32_t\fP)(address_long))" .br .ti -1c .RI "#define \fBpgm_read_ptr_far\fP(address_long) (void*)__ELPM_word((\fBuint32_t\fP)(address_long))" .br .ti -1c .RI "#define \fBpgm_read_byte\fP(address_short) \fBpgm_read_byte_near\fP(address_short)" .br .ti -1c .RI "#define \fBpgm_read_word\fP(address_short) \fBpgm_read_word_near\fP(address_short)" .br .ti -1c .RI "#define \fBpgm_read_dword\fP(address_short) \fBpgm_read_dword_near\fP(address_short)" .br .ti -1c .RI "#define \fBpgm_read_float\fP(address_short) \fBpgm_read_float_near\fP(address_short)" .br .ti -1c .RI "#define \fBpgm_read_ptr\fP(address_short) \fBpgm_read_ptr_near\fP(address_short)" .br .in -1c .SS "Typedefs" .in +1c .ti -1c .RI "typedef void \fBPROGMEM\fP \fBprog_void\fP" .br .ti -1c .RI "typedef char \fBPROGMEM\fP \fBprog_char\fP" .br .ti -1c .RI "typedef unsigned char \fBPROGMEM\fP \fBprog_uchar\fP" .br .ti -1c .RI "typedef \fBint8_t\fP \fBPROGMEM\fP \fBprog_int8_t\fP" .br .ti -1c .RI "typedef \fBuint8_t\fP \fBPROGMEM\fP \fBprog_uint8_t\fP" .br .ti -1c .RI "typedef \fBint16_t\fP \fBPROGMEM\fP \fBprog_int16_t\fP" .br .ti -1c .RI "typedef \fBuint16_t\fP \fBPROGMEM\fP \fBprog_uint16_t\fP" .br .ti -1c .RI "typedef \fBint32_t\fP \fBPROGMEM\fP \fBprog_int32_t\fP" .br .ti -1c .RI "typedef \fBuint32_t\fP \fBPROGMEM\fP \fBprog_uint32_t\fP" .br .ti -1c .RI "typedef \fBint64_t\fP \fBPROGMEM\fP \fBprog_int64_t\fP" .br .ti -1c .RI "typedef \fBuint64_t\fP \fBPROGMEM\fP \fBprog_uint64_t\fP" .br .in -1c .SS "Functions" .in +1c .ti -1c .RI "char * \fBstrtok_P\fP (char *s, \fBPGM_P\fP delim)" .br .ti -1c .RI "int \fBmemcmp_PF\fP (const void *, \fBuint_farptr_t\fP, size_t) __ATTR_PURE__" .br .ti -1c .RI "void * \fBmemcpy_PF\fP (void *dest, \fBuint_farptr_t\fP src, size_t len)" .br .ti -1c .RI "int \fBstrcasecmp_PF\fP (const char *s1, \fBuint_farptr_t\fP s2) __ATTR_PURE__" .br .ti -1c .RI "char * \fBstrcat_PF\fP (char *dest, \fBuint_farptr_t\fP src)" .br .ti -1c .RI "int \fBstrcmp_PF\fP (const char *s1, \fBuint_farptr_t\fP s2) __ATTR_PURE__" .br .ti -1c .RI "char * \fBstrcpy_PF\fP (char *dest, \fBuint_farptr_t\fP src)" .br .ti -1c .RI "size_t \fBstrlcat_PF\fP (char *dst, \fBuint_farptr_t\fP src, size_t siz)" .br .ti -1c .RI "size_t \fBstrlcpy_PF\fP (char *dst, \fBuint_farptr_t\fP src, size_t siz)" .br .ti -1c .RI "size_t \fBstrlen_PF\fP (\fBuint_farptr_t\fP src)" .br .ti -1c .RI "int \fBstrncasecmp_PF\fP (const char *s1, \fBuint_farptr_t\fP s2, size_t n) __ATTR_PURE__" .br .ti -1c .RI "char * \fBstrncat_PF\fP (char *dest, \fBuint_farptr_t\fP src, size_t len)" .br .ti -1c .RI "int \fBstrncmp_PF\fP (const char *s1, \fBuint_farptr_t\fP s2, size_t n) __ATTR_PURE__" .br .ti -1c .RI "char * \fBstrncpy_PF\fP (char *dest, \fBuint_farptr_t\fP src, size_t len)" .br .ti -1c .RI "size_t \fBstrnlen_PF\fP (\fBuint_farptr_t\fP src, size_t len)" .br .ti -1c .RI "char * \fBstrstr_PF\fP (const char *s1, \fBuint_farptr_t\fP s2)" .br .in -1c .SH "Detailed Description" .PP .PP .nf #include #include .fi .PP .PP The functions in this module provide interfaces for a program to access data stored in program space (flash memory) of the device\&. In order to use these functions, the target device must support either the \fCLPM\fP or \fCELPM\fP instructions\&. .PP \fBNote:\fP .RS 4 These functions are an attempt to provide some compatibility with header files that come with IAR C, to make porting applications between different compilers easier\&. This is not 100% compatibility though (GCC does not have full support for multiple address spaces yet)\&. .PP If you are working with strings which are completely based in ram, use the standard string functions described in \fB: Strings\fP\&. .PP If possible, put your constant tables in the lower 64 KB and use \fBpgm_read_byte_near()\fP or \fBpgm_read_word_near()\fP instead of \fBpgm_read_byte_far()\fP or \fBpgm_read_word_far()\fP since it is more efficient that way, and you can still use the upper 64K for executable code\&. All functions that are suffixed with a \fC_P\fP \fIrequire\fP their arguments to be in the lower 64 KB of the flash ROM, as they do not use ELPM instructions\&. This is normally not a big concern as the linker setup arranges any program space constants declared using the macros from this header file so they are placed right after the interrupt vectors, and in front of any executable code\&. However, it can become a problem if there are too many of these constants, or for bootloaders on devices with more than 64 KB of ROM\&. \fIAll these functions will not work in that situation\&.\fP .PP For \fBXmega\fP devices, make sure the NVM controller command register (\fCNVM\&.CMD\fP or \fCNVM_CMD\fP) is set to 0x00 (NOP) before using any of these functions\&. .RE .PP .SH "Macro Definition Documentation" .PP .SS "#define PGM_P const char *" Used to declare a variable that is a pointer to a string in program space\&. .SS "#define pgm_read_byte(address_short) \fBpgm_read_byte_near\fP(address_short)" Read a byte from the program space with a 16-bit (near) address\&. .PP \fBNote:\fP .RS 4 The address is a byte address\&. The address is in the program space\&. .RE .PP .SS "#define pgm_read_byte_far(address_long) __ELPM((\fBuint32_t\fP)(address_long))" Read a byte from the program space with a 32-bit (far) address\&. .PP \fBNote:\fP .RS 4 The address is a byte address\&. The address is in the program space\&. .RE .PP .SS "#define pgm_read_byte_near(address_short) __LPM((\fBuint16_t\fP)(address_short))" Read a byte from the program space with a 16-bit (near) address\&. .PP \fBNote:\fP .RS 4 The address is a byte address\&. The address is in the program space\&. .RE .PP .SS "#define pgm_read_dword(address_short) \fBpgm_read_dword_near\fP(address_short)" Read a double word from the program space with a 16-bit (near) address\&. .PP \fBNote:\fP .RS 4 The address is a byte address\&. The address is in the program space\&. .RE .PP .SS "#define pgm_read_dword_far(address_long) __ELPM_dword((\fBuint32_t\fP)(address_long))" Read a double word from the program space with a 32-bit (far) address\&. .PP \fBNote:\fP .RS 4 The address is a byte address\&. The address is in the program space\&. .RE .PP .SS "#define pgm_read_dword_near(address_short) __LPM_dword((\fBuint16_t\fP)(address_short))" Read a double word from the program space with a 16-bit (near) address\&. .PP \fBNote:\fP .RS 4 The address is a byte address\&. The address is in the program space\&. .RE .PP .SS "#define pgm_read_float(address_short) \fBpgm_read_float_near\fP(address_short)" Read a float from the program space with a 16-bit (near) address\&. .PP \fBNote:\fP .RS 4 The address is a byte address\&. The address is in the program space\&. .RE .PP .SS "#define pgm_read_float_far(address_long) __ELPM_float((\fBuint32_t\fP)(address_long))" Read a float from the program space with a 32-bit (far) address\&. .PP \fBNote:\fP .RS 4 The address is a byte address\&. The address is in the program space\&. .RE .PP .SS "#define pgm_read_float_near(address_short) __LPM_float((\fBuint16_t\fP)(address_short))" Read a float from the program space with a 16-bit (near) address\&. .PP \fBNote:\fP .RS 4 The address is a byte address\&. The address is in the program space\&. .RE .PP .SS "#define pgm_read_ptr(address_short) \fBpgm_read_ptr_near\fP(address_short)" Read a pointer from the program space with a 16-bit (near) address\&. .PP \fBNote:\fP .RS 4 The address is a byte address\&. The address is in the program space\&. .RE .PP .SS "#define pgm_read_ptr_far(address_long) (void*)__ELPM_word((\fBuint32_t\fP)(address_long))" Read a pointer from the program space with a 32-bit (far) address\&. .PP \fBNote:\fP .RS 4 The address is a byte address\&. The address is in the program space\&. .RE .PP .SS "#define pgm_read_ptr_near(address_short) (void*)__LPM_word((\fBuint16_t\fP)(address_short))" Read a pointer from the program space with a 16-bit (near) address\&. .PP \fBNote:\fP .RS 4 The address is a byte address\&. The address is in the program space\&. .RE .PP .SS "#define pgm_read_word(address_short) \fBpgm_read_word_near\fP(address_short)" Read a word from the program space with a 16-bit (near) address\&. .PP \fBNote:\fP .RS 4 The address is a byte address\&. The address is in the program space\&. .RE .PP .SS "#define pgm_read_word_far(address_long) __ELPM_word((\fBuint32_t\fP)(address_long))" Read a word from the program space with a 32-bit (far) address\&. .PP \fBNote:\fP .RS 4 The address is a byte address\&. The address is in the program space\&. .RE .PP .SS "#define pgm_read_word_near(address_short) __LPM_word((\fBuint16_t\fP)(address_short))" Read a word from the program space with a 16-bit (near) address\&. .PP \fBNote:\fP .RS 4 The address is a byte address\&. The address is in the program space\&. .RE .PP .SS "#define PGM_VOID_P const void *" Used to declare a generic pointer to an object in program space\&. .SS "#define PROGMEM __ATTR_PROGMEM__" Attribute to use in order to declare an object being located in flash ROM\&. .SS "#define PSTR(s) ((const \fBPROGMEM\fP char *)(s))" Used to declare a static pointer to a string in program space\&. .SH "Typedef Documentation" .PP .SS "\fBprog_char\fP" .PP \fBNote:\fP .RS 4 DEPRECATED .RE .PP This typedef is now deprecated because the usage of the \fBprogmem\fP attribute on a type is not supported in GCC\&. However, the use of the \fBprogmem\fP attribute on a variable declaration is supported, and this is now the recommended usage\&. .PP The typedef is only visible if the macro \fBPROG_TYPES_COMPAT\fP has been defined before including <\fBavr/pgmspace\&.h\fP> (either by a #define directive, or by a -D compiler option\&.) .PP Type of a 'char' object located in flash ROM\&. .SS "\fBprog_int16_t\fP" .PP \fBNote:\fP .RS 4 DEPRECATED .RE .PP This typedef is now deprecated because the usage of the \fBprogmem\fP attribute on a type is not supported in GCC\&. However, the use of the \fBprogmem\fP attribute on a variable declaration is supported, and this is now the recommended usage\&. .PP The typedef is only visible if the macro \fBPROG_TYPES_COMPAT\fP has been defined before including <\fBavr/pgmspace\&.h\fP> (either by a #define directive, or by a -D compiler option\&.) .PP Type of an 'int16_t' object located in flash ROM\&. .SS "\fBprog_int32_t\fP" .PP \fBNote:\fP .RS 4 DEPRECATED .RE .PP This typedef is now deprecated because the usage of the \fBprogmem\fP attribute on a type is not supported in GCC\&. However, the use of the \fBprogmem\fP attribute on a variable declaration is supported, and this is now the recommended usage\&. .PP The typedef is only visible if the macro \fBPROG_TYPES_COMPAT\fP has been defined before including <\fBavr/pgmspace\&.h\fP> (either by a #define directive, or by a -D compiler option\&.) .PP Type of an 'int32_t' object located in flash ROM\&. .SS "\fBprog_int64_t\fP" .PP \fBNote:\fP .RS 4 DEPRECATED .RE .PP This typedef is now deprecated because the usage of the \fBprogmem\fP attribute on a type is not supported in GCC\&. However, the use of the \fBprogmem\fP attribute on a variable declaration is supported, and this is now the recommended usage\&. .PP The typedef is only visible if the macro \fBPROG_TYPES_COMPAT\fP has been defined before including <\fBavr/pgmspace\&.h\fP> (either by a #define directive, or by a -D compiler option\&.) .PP Type of an 'int64_t' object located in flash ROM\&. .PP \fBNote:\fP .RS 4 This type is not available when the compiler option -mint8 is in effect\&. .RE .PP .SS "\fBprog_int8_t\fP" .PP \fBNote:\fP .RS 4 DEPRECATED .RE .PP This typedef is now deprecated because the usage of the \fBprogmem\fP attribute on a type is not supported in GCC\&. However, the use of the \fBprogmem\fP attribute on a variable declaration is supported, and this is now the recommended usage\&. .PP The typedef is only visible if the macro \fBPROG_TYPES_COMPAT\fP has been defined before including <\fBavr/pgmspace\&.h\fP> (either by a #define directive, or by a -D compiler option\&.) .PP Type of an 'int8_t' object located in flash ROM\&. .SS "\fBprog_uchar\fP" .PP \fBNote:\fP .RS 4 DEPRECATED .RE .PP This typedef is now deprecated because the usage of the \fBprogmem\fP attribute on a type is not supported in GCC\&. However, the use of the \fBprogmem\fP attribute on a variable declaration is supported, and this is now the recommended usage\&. .PP The typedef is only visible if the macro \fBPROG_TYPES_COMPAT\fP has been defined before including <\fBavr/pgmspace\&.h\fP> (either by a #define directive, or by a -D compiler option\&.) .PP Type of an 'unsigned char' object located in flash ROM\&. .SS "\fBprog_uint16_t\fP" .PP \fBNote:\fP .RS 4 DEPRECATED .RE .PP This typedef is now deprecated because the usage of the \fBprogmem\fP attribute on a type is not supported in GCC\&. However, the use of the \fBprogmem\fP attribute on a variable declaration is supported, and this is now the recommended usage\&. .PP The typedef is only visible if the macro \fBPROG_TYPES_COMPAT\fP has been defined before including <\fBavr/pgmspace\&.h\fP> (either by a #define directive, or by a -D compiler option\&.) .PP Type of an 'uint16_t' object located in flash ROM\&. .SS "\fBprog_uint32_t\fP" .PP \fBNote:\fP .RS 4 DEPRECATED .RE .PP This typedef is now deprecated because the usage of the \fBprogmem\fP attribute on a type is not supported in GCC\&. However, the use of the \fBprogmem\fP attribute on a variable declaration is supported, and this is now the recommended usage\&. .PP The typedef is only visible if the macro \fBPROG_TYPES_COMPAT\fP has been defined before including <\fBavr/pgmspace\&.h\fP> (either by a #define directive, or by a -D compiler option\&.) .PP Type of an 'uint32_t' object located in flash ROM\&. .SS "\fBprog_uint64_t\fP" .PP \fBNote:\fP .RS 4 DEPRECATED .RE .PP This typedef is now deprecated because the usage of the \fBprogmem\fP attribute on a type is not supported in GCC\&. However, the use of the \fBprogmem\fP attribute on a variable declaration is supported, and this is now the recommended usage\&. .PP The typedef is only visible if the macro \fBPROG_TYPES_COMPAT\fP has been defined before including <\fBavr/pgmspace\&.h\fP> (either by a #define directive, or by a -D compiler option\&.) .PP Type of an 'uint64_t' object located in flash ROM\&. .PP \fBNote:\fP .RS 4 This type is not available when the compiler option -mint8 is in effect\&. .RE .PP .SS "\fBprog_uint8_t\fP" .PP \fBNote:\fP .RS 4 DEPRECATED .RE .PP This typedef is now deprecated because the usage of the \fBprogmem\fP attribute on a type is not supported in GCC\&. However, the use of the \fBprogmem\fP attribute on a variable declaration is supported, and this is now the recommended usage\&. .PP The typedef is only visible if the macro \fBPROG_TYPES_COMPAT\fP has been defined before including <\fBavr/pgmspace\&.h\fP> (either by a #define directive, or by a -D compiler option\&.) .PP Type of an 'uint8_t' object located in flash ROM\&. .SS "\fBprog_void\fP" .PP \fBNote:\fP .RS 4 DEPRECATED .RE .PP This typedef is now deprecated because the usage of the \fBprogmem\fP attribute on a type is not supported in GCC\&. However, the use of the \fBprogmem\fP attribute on a variable declaration is supported, and this is now the recommended usage\&. .PP The typedef is only visible if the macro \fBPROG_TYPES_COMPAT\fP has been defined before including <\fBavr/pgmspace\&.h\fP> (either by a #define directive, or by a -D compiler option\&.) .PP Type of a 'void' object located in flash ROM\&. Does not make much sense by itself, but can be used to declare a 'void *' object in flash ROM\&. .SH "Function Documentation" .PP .SS "int memcmp_PF (const void *s1, \fBuint_farptr_t\fPs2, size_tlen)" .PP Compare memory areas\&. The \fBmemcmp_PF()\fP function compares the first \fClen\fP bytes of the memory areas \fCs1\fP and flash \fCs2\fP\&. The comparision is performed using unsigned char operations\&. It is an equivalent of memcmp_P() function, except that it is capable working on all FLASH including the exteded area above 64kB\&. .PP \fBReturns:\fP .RS 4 The \fBmemcmp_PF()\fP function returns an integer less than, equal to, or greater than zero if the first \fClen\fP bytes of \fCs1\fP is found, respectively, to be less than, to match, or be greater than the first \fClen\fP bytes of \fCs2\fP\&. .RE .PP .SS "void * memcpy_PF (void *dest, \fBuint_farptr_t\fPsrc, size_tn)" .PP Copy a memory block from flash to SRAM\&. The \fBmemcpy_PF()\fP function is similar to \fBmemcpy()\fP, except the data is copied from the program space and is addressed using a far pointer .PP .nf \param dst A pointer to the destination buffer \param src A far pointer to the origin of data in flash memory \param n The number of bytes to be copied .fi .PP .PP \fBReturns:\fP .RS 4 The \fBmemcpy_PF()\fP function returns a pointer to \fIdst\fP\&. The contents of RAMPZ SFR are undefined when the function returns .RE .PP .SS "int strcasecmp_PF (const char *s1, \fBuint_farptr_t\fPs2)" .PP Compare two strings ignoring case\&. The \fBstrcasecmp_PF()\fP function compares the two strings \fIs1\fP and \fIs2\fP, ignoring the case of the characters .PP \fBParameters:\fP .RS 4 \fIs1\fP A pointer to the first string in SRAM .br \fIs2\fP A far pointer to the second string in Flash .RE .PP \fBReturns:\fP .RS 4 The \fBstrcasecmp_PF()\fP function returns an integer less than, equal to, or greater than zero if \fIs1\fP is found, respectively, to be less than, to match, or be greater than \fIs2\fP\&. The contents of RAMPZ SFR are undefined when the function returns .RE .PP .SS "char * strcat_PF (char *dst, \fBuint_farptr_t\fPsrc)" .PP Concatenates two strings\&. The \fBstrcat_PF()\fP function is similar to \fBstrcat()\fP except that the \fIsrc\fP string must be located in program space (flash) and is addressed using a far pointer .PP \fBParameters:\fP .RS 4 \fIdst\fP A pointer to the destination string in SRAM .br \fIsrc\fP A far pointer to the string to be appended in Flash .RE .PP \fBReturns:\fP .RS 4 The \fBstrcat_PF()\fP function returns a pointer to the resulting string \fIdst\fP\&. The contents of RAMPZ SFR are undefined when the function returns .RE .PP .SS "int strcmp_PF (const char *s1, \fBuint_farptr_t\fPs2)" .PP Compares two strings\&. The \fBstrcmp_PF()\fP function is similar to \fBstrcmp()\fP except that \fIs2\fP is a far pointer to a string in program space .PP \fBParameters:\fP .RS 4 \fIs1\fP A pointer to the first string in SRAM .br \fIs2\fP A far pointer to the second string in Flash .RE .PP \fBReturns:\fP .RS 4 The \fBstrcmp_PF()\fP function returns an integer less than, equal to, or greater than zero if \fIs1\fP is found, respectively, to be less than, to match, or be greater than \fIs2\fP\&. The contents of RAMPZ SFR are undefined when the function returns .RE .PP .SS "char * strcpy_PF (char *dst, \fBuint_farptr_t\fPsrc)" .PP Duplicate a string\&. The \fBstrcpy_PF()\fP function is similar to \fBstrcpy()\fP except that \fIsrc\fP is a far pointer to a string in program space .PP \fBParameters:\fP .RS 4 \fIdst\fP A pointer to the destination string in SRAM .br \fIsrc\fP A far pointer to the source string in Flash .RE .PP \fBReturns:\fP .RS 4 The \fBstrcpy_PF()\fP function returns a pointer to the destination string \fIdst\fP\&. The contents of RAMPZ SFR are undefined when the funcion returns .RE .PP .SS "size_t strlcat_PF (char *dst, \fBuint_farptr_t\fPsrc, size_tn)" .PP Concatenate two strings\&. The \fBstrlcat_PF()\fP function is similar to \fBstrlcat()\fP, except that the \fIsrc\fP string must be located in program space (flash) and is addressed using a far pointer .PP Appends src to string dst of size \fIn\fP (unlike \fBstrncat()\fP, \fIn\fP is the full size of \fIdst\fP, not space left)\&. At most \fIn-1\fP characters will be copied\&. Always NULL terminates (unless \fIn\fP <= strlen(\fIdst\fP)) .PP \fBParameters:\fP .RS 4 \fIdst\fP A pointer to the destination string in SRAM .br \fIsrc\fP A far pointer to the source string in Flash .br \fIn\fP The total number of bytes allocated to the destination string .RE .PP \fBReturns:\fP .RS 4 The \fBstrlcat_PF()\fP function returns strlen(\fIsrc\fP) + MIN(\fIn\fP, strlen(initial \fIdst\fP))\&. If retval >= \fIn\fP, truncation occurred\&. The contents of RAMPZ SFR are undefined when the funcion returns .RE .PP .SS "size_t strlcpy_PF (char *dst, \fBuint_farptr_t\fPsrc, size_tsiz)" .PP Copy a string from progmem to RAM\&. Copy src to string dst of size siz\&. At most siz-1 characters will be copied\&. Always NULL terminates (unless siz == 0)\&. .PP \fBReturns:\fP .RS 4 The \fBstrlcpy_PF()\fP function returns strlen(src)\&. If retval >= siz, truncation occurred\&. The contents of RAMPZ SFR are undefined when the function returns .RE .PP .SS "size_t strlen_PF (\fBuint_farptr_t\fPs)" .PP Obtain the length of a string\&. The \fBstrlen_PF()\fP function is similar to \fBstrlen()\fP, except that \fIs\fP is a far pointer to a string in program space .PP \fBParameters:\fP .RS 4 \fIs\fP A far pointer to the string in flash .RE .PP \fBReturns:\fP .RS 4 The \fBstrlen_PF()\fP function returns the number of characters in \fIs\fP\&. The contents of RAMPZ SFR are undefined when the function returns .RE .PP .SS "int strncasecmp_PF (const char *s1, \fBuint_farptr_t\fPs2, size_tn)" .PP Compare two strings ignoring case\&. The \fBstrncasecmp_PF()\fP function is similar to \fBstrcasecmp_PF()\fP, except it only compares the first \fIn\fP characters of \fIs1\fP and the string in flash is addressed using a far pointer .PP \fBParameters:\fP .RS 4 \fIs1\fP A pointer to a string in SRAM .br \fIs2\fP A far pointer to a string in Flash .br \fIn\fP The maximum number of bytes to compare .RE .PP \fBReturns:\fP .RS 4 The \fBstrncasecmp_PF()\fP function returns an integer less than, equal to, or greater than zero if \fIs1\fP (or the first \fIn\fP bytes thereof) is found, respectively, to be less than, to match, or be greater than \fIs2\fP\&. The contents of RAMPZ SFR are undefined when the function returns .RE .PP .SS "char * strncat_PF (char *dst, \fBuint_farptr_t\fPsrc, size_tn)" .PP Concatenate two strings\&. The \fBstrncat_PF()\fP function is similar to \fBstrncat()\fP, except that the \fIsrc\fP string must be located in program space (flash) and is addressed using a far pointer .PP \fBParameters:\fP .RS 4 \fIdst\fP A pointer to the destination string in SRAM .br \fIsrc\fP A far pointer to the source string in Flash .br \fIn\fP The maximum number of bytes to append .RE .PP \fBReturns:\fP .RS 4 The \fBstrncat_PF()\fP function returns a pointer to the resulting string \fIdst\fP\&. The contents of RAMPZ SFR are undefined when the function returns .RE .PP .SS "int strncmp_PF (const char *s1, \fBuint_farptr_t\fPs2, size_tn)" .PP Compare two strings with limited length\&. The \fBstrncmp_PF()\fP function is similar to \fBstrcmp_PF()\fP except it only compares the first (at most) \fIn\fP characters of \fIs1\fP and \fIs2\fP .PP \fBParameters:\fP .RS 4 \fIs1\fP A pointer to the first string in SRAM .br \fIs2\fP A far pointer to the second string in Flash .br \fIn\fP The maximum number of bytes to compare .RE .PP \fBReturns:\fP .RS 4 The \fBstrncmp_PF()\fP function returns an integer less than, equal to, or greater than zero if \fIs1\fP (or the first \fIn\fP bytes thereof) is found, respectively, to be less than, to match, or be greater than \fIs2\fP\&. The contents of RAMPZ SFR are undefined when the function returns .RE .PP .SS "char * strncpy_PF (char *dst, \fBuint_farptr_t\fPsrc, size_tn)" .PP Duplicate a string until a limited length\&. The \fBstrncpy_PF()\fP function is similar to \fBstrcpy_PF()\fP except that not more than \fIn\fP bytes of \fIsrc\fP are copied\&. Thus, if there is no null byte among the first \fIn\fP bytes of \fIsrc\fP, the result will not be null-terminated .PP In the case where the length of \fIsrc\fP is less than that of \fIn\fP, the remainder of \fIdst\fP will be padded with nulls .PP \fBParameters:\fP .RS 4 \fIdst\fP A pointer to the destination string in SRAM .br \fIsrc\fP A far pointer to the source string in Flash .br \fIn\fP The maximum number of bytes to copy .RE .PP \fBReturns:\fP .RS 4 The \fBstrncpy_PF()\fP function returns a pointer to the destination string \fIdst\fP\&. The contents of RAMPZ SFR are undefined when the function returns .RE .PP .SS "size_t strnlen_PF (\fBuint_farptr_t\fPs, size_tlen)" .PP Determine the length of a fixed-size string\&. The \fBstrnlen_PF()\fP function is similar to \fBstrnlen()\fP, except that \fIs\fP is a far pointer to a string in program space .PP \fBParameters:\fP .RS 4 \fIs\fP A far pointer to the string in Flash .br \fIlen\fP The maximum number of length to return .RE .PP \fBReturns:\fP .RS 4 The strnlen_PF function returns strlen_P(\fIs\fP), if that is less than \fIlen\fP, or \fIlen\fP if there is no '\\0' character among the first \fIlen\fP characters pointed to by \fIs\fP\&. The contents of RAMPZ SFR are undefined when the function returns .RE .PP .SS "char * strstr_PF (const char *s1, \fBuint_farptr_t\fPs2)" .PP Locate a substring\&. The \fBstrstr_PF()\fP function finds the first occurrence of the substring \fCs2\fP in the string \fCs1\fP\&. The terminating '\\0' characters are not compared\&. The \fBstrstr_PF()\fP function is similar to \fBstrstr()\fP except that \fCs2\fP is a far pointer to a string in program space\&. .PP \fBReturns:\fP .RS 4 The \fBstrstr_PF()\fP function returns a pointer to the beginning of the substring, or NULL if the substring is not found\&. If \fCs2\fP points to a string of zero length, the function returns \fCs1\fP\&. The contents of RAMPZ SFR are undefined when the function returns .RE .PP .SS "char* strtok_P (char *s, \fBPGM_P\fPdelim)" .PP Parses the string into tokens\&. \fBstrtok_P()\fP parses the string \fCs\fP into tokens\&. The first call to \fBstrtok_P()\fP should have \fCs\fP as its first argument\&. Subsequent calls should have the first argument set to NULL\&. If a token ends with a delimiter, this delimiting character is overwritten with a '\\0' and a pointer to the next character is saved for the next call to \fBstrtok_P()\fP\&. The delimiter string \fCdelim\fP may be different for each call\&. .PP The \fBstrtok_P()\fP function is similar to \fBstrtok()\fP except that \fCdelim\fP is pointer to a string in program space\&. .PP \fBReturns:\fP .RS 4 The \fBstrtok_P()\fP function returns a pointer to the next token or NULL when no more tokens are found\&. .RE .PP \fBNote:\fP .RS 4 \fBstrtok_P()\fP is NOT reentrant\&. For a reentrant version of this function see strtok_rP()\&. .RE .PP .SH "Author" .PP Generated automatically by Doxygen for avr-libc from the source code\&.