Lines Matching refs:buf

353 #define BBUF_INIT(buf,size)    onig_bbuf_init((BBuf* )(buf), (size))  argument
355 #define BBUF_SIZE_INC(buf,inc) do{\ argument
356 (buf)->alloc += (inc);\
357 (buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
358 if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
361 #define BBUF_EXPAND(buf,low) do{\ argument
362 do { (buf)->alloc *= 2; } while ((buf)->alloc < (unsigned int )low);\
363 (buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
364 if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
367 #define BBUF_ENSURE_SIZE(buf,size) do{\ argument
368 unsigned int new_alloc = (buf)->alloc;\
370 if ((buf)->alloc != new_alloc) {\
371 (buf)->p = (UChar* )xrealloc((buf)->p, new_alloc);\
372 if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
373 (buf)->alloc = new_alloc;\
377 #define BBUF_WRITE(buf,pos,bytes,n) do{\ argument
379 if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\
380 xmemcpy((buf)->p + (pos), (bytes), (n));\
381 if ((buf)->used < (unsigned int )used) (buf)->used = used;\
384 #define BBUF_WRITE1(buf,pos,byte) do{\ argument
386 if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\
387 (buf)->p[(pos)] = (byte);\
388 if ((buf)->used < (unsigned int )used) (buf)->used = used;\
391 #define BBUF_ADD(buf,bytes,n) BBUF_WRITE((buf),(buf)->used,(bytes),(n)) argument
392 #define BBUF_ADD1(buf,byte) BBUF_WRITE1((buf),(buf)->used,(byte)) argument
393 #define BBUF_GET_ADD_ADDRESS(buf) ((buf)->p + (buf)->used) argument
394 #define BBUF_GET_OFFSET_POS(buf) ((buf)->used) argument
397 #define BBUF_MOVE_RIGHT(buf,from,to,n) do {\ argument
398 if ((unsigned int )((to)+(n)) > (buf)->alloc) BBUF_EXPAND((buf),(to) + (n));\
399 xmemmove((buf)->p + (to), (buf)->p + (from), (n));\
400 if ((unsigned int )((to)+(n)) > (buf)->used) (buf)->used = (to) + (n);\
404 #define BBUF_MOVE_LEFT(buf,from,to,n) do {\ argument
405 xmemmove((buf)->p + (to), (buf)->p + (from), (n));\
409 #define BBUF_MOVE_LEFT_REDUCE(buf,from,to) do {\ argument
410 xmemmove((buf)->p + (to), (buf)->p + (from), (buf)->used - (from));\
411 (buf)->used -= (from - to);\
414 #define BBUF_INSERT(buf,pos,bytes,n) do {\ argument
415 if (pos >= (buf)->used) {\
416 BBUF_WRITE(buf,pos,bytes,n);\
419 BBUF_MOVE_RIGHT((buf),(pos),(pos) + (n),((buf)->used - (pos)));\
420 xmemcpy((buf)->p + (pos), (bytes), (n));\
424 #define BBUF_GET_BYTE(buf, pos) (buf)->p[(pos)] argument
789 extern void onig_snprintf_with_pattern PV_((UChar buf[], int bufsize, OnigEncoding enc, UChar* pat…
790 extern int onig_bbuf_init P_((BBuf* buf, int size));