Lines Matching refs:buf

349 #define BBUF_INIT(buf,size)    onig_bbuf_init((BBuf* )(buf), (size))  argument
351 #define BBUF_SIZE_INC(buf,inc) do{\ argument
352 (buf)->alloc += (inc);\
353 (buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
354 if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
357 #define BBUF_EXPAND(buf,low) do{\ argument
358 do { (buf)->alloc *= 2; } while ((buf)->alloc < (unsigned int )low);\
359 (buf)->p = (UChar* )xrealloc((buf)->p, (buf)->alloc);\
360 if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
363 #define BBUF_ENSURE_SIZE(buf,size) do{\ argument
364 unsigned int new_alloc = (buf)->alloc;\
366 if ((buf)->alloc != new_alloc) {\
367 (buf)->p = (UChar* )xrealloc((buf)->p, new_alloc);\
368 if (IS_NULL((buf)->p)) return(ONIGERR_MEMORY);\
369 (buf)->alloc = new_alloc;\
373 #define BBUF_WRITE(buf,pos,bytes,n) do{\ argument
375 if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\
376 xmemcpy((buf)->p + (pos), (bytes), (n));\
377 if ((buf)->used < (unsigned int )used) (buf)->used = used;\
380 #define BBUF_WRITE1(buf,pos,byte) do{\ argument
382 if ((buf)->alloc < (unsigned int )used) BBUF_EXPAND((buf),used);\
383 (buf)->p[(pos)] = (byte);\
384 if ((buf)->used < (unsigned int )used) (buf)->used = used;\
387 #define BBUF_ADD(buf,bytes,n) BBUF_WRITE((buf),(buf)->used,(bytes),(n)) argument
388 #define BBUF_ADD1(buf,byte) BBUF_WRITE1((buf),(buf)->used,(byte)) argument
389 #define BBUF_GET_ADD_ADDRESS(buf) ((buf)->p + (buf)->used) argument
390 #define BBUF_GET_OFFSET_POS(buf) ((buf)->used) argument
393 #define BBUF_MOVE_RIGHT(buf,from,to,n) do {\ argument
394 if ((unsigned int )((to)+(n)) > (buf)->alloc) BBUF_EXPAND((buf),(to) + (n));\
395 xmemmove((buf)->p + (to), (buf)->p + (from), (n));\
396 if ((unsigned int )((to)+(n)) > (buf)->used) (buf)->used = (to) + (n);\
400 #define BBUF_MOVE_LEFT(buf,from,to,n) do {\ argument
401 xmemmove((buf)->p + (to), (buf)->p + (from), (n));\
405 #define BBUF_MOVE_LEFT_REDUCE(buf,from,to) do {\ argument
406 xmemmove((buf)->p + (to), (buf)->p + (from), (buf)->used - (from));\
407 (buf)->used -= (from - to);\
410 #define BBUF_INSERT(buf,pos,bytes,n) do {\ argument
411 if (pos >= (buf)->used) {\
412 BBUF_WRITE(buf,pos,bytes,n);\
415 BBUF_MOVE_RIGHT((buf),(pos),(pos) + (n),((buf)->used - (pos)));\
416 xmemcpy((buf)->p + (pos), (bytes), (n));\
420 #define BBUF_GET_BYTE(buf, pos) (buf)->p[(pos)] argument
772 extern void onig_snprintf_with_pattern PV_((UChar buf[], int bufsize, OnigEncoding enc, UChar* pat…
773 extern int onig_bbuf_init P_((BBuf* buf, int size));