strobj.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __STRING_H__
00017 #define __STRING_H__
00018
00019
00029 #define USE_STRING_CACHE 1
00030
00031
00038 #define string_loadFromImg(ms, paddr, r_pstring) \
00039 string_create((ms), (paddr), (int16_t)-1, (int16_t)1, (r_pstring))
00040
00047 #define string_new(paddr, r_pstring) \
00048 string_create(MEMSPACE_RAM, (uint8_t const **)(paddr), 0, (int16_t)1, (r_pstring))
00049
00058 #define string_newWithLen(paddr, len, r_pstring) \
00059 string_create(MEMSPACE_RAM, (uint8_t const **)(paddr), (len), (int16_t)1, \
00060 (r_pstring))
00061
00069 #define string_replicate(paddr, n, r_pstring) \
00070 string_create(MEMSPACE_RAM, (paddr), (uint8_t)0, (n), (r_pstring))
00071
00072
00073
00074
00075
00081 typedef struct PmString_s
00082 {
00084 PmObjDesc_t od;
00085
00087 uint16_t length;
00088
00089 #if USE_STRING_CACHE
00090
00091 struct PmString_s *next;
00092 #endif
00093
00100 uint8_t val[1];
00101 } PmString_t,
00102 *pPmString_t;
00103
00104
00105
00106
00107
00108
00136 PmReturn_t string_create(PmMemSpace_t memspace, uint8_t const **paddr,
00137 int16_t len, int16_t n, pPmObj_t *r_pstring);
00138 ;
00139
00147 PmReturn_t string_newFromChar(uint8_t const c, pPmObj_t *r_pstring);
00148
00156 int8_t string_compare(pPmString_t, pPmString_t);
00157
00158 #ifdef HAVE_PRINT
00159
00168 PmReturn_t string_print(pPmObj_t pstr, uint8_t marshall);
00169 #endif
00170
00177 PmReturn_t string_cacheInit(void);
00178
00179
00181 PmReturn_t string_getCache(pPmString_t **r_ppstrcache);
00182
00192 PmReturn_t
00193 string_concat(pPmString_t pstr1, pPmString_t pstr2, pPmObj_t *r_pstring);
00194
00195 #ifdef HAVE_STRING_FORMAT
00196
00205 PmReturn_t string_format(pPmString_t pstr, pPmObj_t parg, pPmObj_t *r_pstring);
00206 #endif
00207
00208 #endif