Open64 (mfef90, whirl2f, and IR tools)  TAG: version-openad; SVN changeset: 916
array_alloc.h
Go to the documentation of this file.
00001 /*
00002 
00003   Copyright (C) 2000, 2001 Silicon Graphics, Inc.  All Rights Reserved.
00004 
00005   This program is free software; you can redistribute it and/or modify it
00006   under the terms of version 2 of the GNU General Public License as
00007   published by the Free Software Foundation.
00008 
00009   This program is distributed in the hope that it would be useful, but
00010   WITHOUT ANY WARRANTY; without even the implied warranty of
00011   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
00012 
00013   Further, this software is distributed without any warranty that it is
00014   free of the rightful claim of any third person regarding infringement 
00015   or the like.  Any license provided herein, whether implied or 
00016   otherwise, applies only to this software file.  Patent licenses, if 
00017   any, provided herein do not apply to combinations of this program with 
00018   other software, or any other product whatsoever.  
00019 
00020   You should have received a copy of the GNU General Public License along
00021   with this program; if not, write the Free Software Foundation, Inc., 59
00022   Temple Place - Suite 330, Boston MA 02111-1307, USA.
00023 
00024   Contact information:  Silicon Graphics, Inc., 1600 Amphitheatre Pky,
00025   Mountain View, CA 94043, or:
00026 
00027   http://www.sgi.com
00028 
00029   For further information regarding this notice, see:
00030 
00031   http://oss.sgi.com/projects/GenInfo/NoticeExplan
00032 
00033 */
00034 
00035 
00036 /*
00037 
00038 The following is to allow dynamic arrays.
00039 It calls your error function (or prints to stderr if you don't give
00040 one) and abort()s on error.
00041 
00042 You must set up the  base pointer and the element next and ''to use''
00043 and the package updates them: thus these are local to you for your
00044 easy reference.
00045 
00046 The rest is held in the struct pointed to by aa_handle.
00047 For each array:
00048         call aa_initialize once, setting things up.
00049                 remember the handle passed back.
00050         Call aa_alloc as needed.
00051                 It allocates space if necessary and returns
00052                 a pointer to the next available array element.
00053                 Note that the next call to aa_alloc may move
00054                 the array, so
00055 
00056                        *use pointers only for short periods*.
00057 
00058                 The only *safe* way to access these arrays is via
00059                 indexes from the base pointer.
00060         
00061 
00062 aa_discard() is probably completely unnecessary.
00063 It frees up all memory allocated by aa_initialize() and aa_alloc() for the
00064 given handle.
00065 
00066 All three names are reserved for this package. And only those
00067 3 (beyond ANSI C guaranteed functions).
00068 
00069 */
00070 typedef struct aa_data_st *aa_handle;
00071 aa_handle aa_initialize( char ** /* base */,
00072                         long * /* next to use */,
00073                         long * /* max allocated */,
00074                         int    /* initial allocation */,
00075                         int   /* element size */,
00076                         int  /* change factor numerator */,
00077                         int  /* change factor denominator */,
00078                         void (* /* err func */)(int /* user array number */,
00079                                   
00080                                 char * /* user string*/,
00081                                 int    /* aa error number */,
00082                                 char *  /* aa error string */),
00083                         int   /* user aa array number */,
00084                         char * /* user string */
00085                         );
00086 
00087 void *aa_alloc(aa_handle , long /* elements_to_allocate */ );
00088 
00089 void aa_discard( aa_handle);
00090 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines