00001 /* A "buffer" utility type. 00002 Copyright (C) 1998, 2000 Free Software Foundation, Inc. 00003 00004 This file is part of GNU CC. 00005 00006 GNU CC is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2, or (at your option) 00009 any later version. 00010 00011 GNU CC is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with GNU CC; see the file COPYING. If not, write to 00018 the Free Software Foundation, 59 Temple Place - Suite 330, 00019 Boston, MA 02111-1307, USA. */ 00020 00021 /* Written by Per Bothner <bothner@cygnus.com>, July 1998. */ 00022 00023 /* A simple data structure for an expandable buffer. */ 00024 00025 struct buffer 00026 { 00027 /* The start of the actual data buffer. */ 00028 unsigned char *data; 00029 00030 /* Where to write next in the buffer. */ 00031 unsigned char *ptr; 00032 00033 /* The end of the allocated data buffer. */ 00034 unsigned char *limit; 00035 }; 00036 00037 #define NULL_BUFFER { (void*) 0, (void*) 0, (void*) 0 } 00038 00039 #define BUFFER_INIT(BUFP) \ 00040 ((BUFP)->data = NULL, (BUFP)->ptr = NULL, (BUFP)->limit = NULL) 00041 00042 #define BUFFER_LENGTH(BUFP) ((BUFP)->ptr - (BUFP)->data) 00043 00044 #define BUFFER_RESET(BUFP) ((BUFP)->ptr = (BUFP)->data) 00045 00046 extern void buffer_grow PARAMS ((struct buffer*, int));
1.5.6