00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef lint
00041 static const char RCSstorage[] = "@(#)$Header: /cvsroot/brlcad/brlcad/src/librt/storage.c,v 14.11 2006/09/16 02:04:26 lbutler Exp $ (ARL)";
00042 #endif
00043
00044 #include "common.h"
00045
00046
00047
00048 #include <stdio.h>
00049 #ifdef HAVE_STRING_H
00050 # include <string.h>
00051 #else
00052 # include <strings.h>
00053 #endif
00054
00055 #include "machine.h"
00056 #include "vmath.h"
00057 #include "raytrace.h"
00058 #include "bu.h"
00059 #include "./debug.h"
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 void
00071 rt_get_seg(register struct resource *res)
00072 {
00073 register struct seg *sp;
00074 register int bytes;
00075
00076 RT_CK_RESOURCE(res);
00077
00078 if( BU_LIST_UNINITIALIZED( &res->re_seg ) ) {
00079 BU_LIST_INIT( &(res->re_seg) );
00080 bu_ptbl_init( &res->re_seg_blocks, 64, "re_seg_blocks ptbl" );
00081 }
00082 bytes = bu_malloc_len_roundup(64*sizeof(struct seg));
00083 sp = (struct seg *)bu_malloc(bytes, "rt_get_seg()");
00084 bu_ptbl_ins( &res->re_seg_blocks, (long *)sp );
00085 while( bytes >= sizeof(struct seg) ) {
00086 sp->l.magic = RT_SEG_MAGIC;
00087 BU_LIST_INSERT(&(res->re_seg), &(sp->l));
00088 res->re_seglen++;
00089 sp++;
00090 bytes -= sizeof(struct seg);
00091 }
00092 }
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102