[brlcad-commits] SF.net SVN: brlcad:[70127] brlcad/trunk
Revision: 70127 http://sourceforge.net/p/brlcad/code/70127 Author: starseeker Date: 2017-08-24 22:11:50 + (Thu, 24 Aug 2017) Log Message: --- Stub in a dsp command for down-and-dirty work with dsp objects. Modified Paths: -- brlcad/trunk/include/ged/objects.h brlcad/trunk/src/libged/CMakeLists.txt brlcad/trunk/src/mged/setup.c brlcad/trunk/src/tclscripts/archer/ArcherCore.tcl brlcad/trunk/src/tclscripts/lib/Ged.tcl brlcad/trunk/src/tclscripts/mged/help.tcl Added Paths: --- brlcad/trunk/src/libged/dsp.c Modified: brlcad/trunk/include/ged/objects.h === --- brlcad/trunk/include/ged/objects.h 2017-08-24 21:13:53 UTC (rev 70126) +++ brlcad/trunk/include/ged/objects.h 2017-08-24 22:11:50 UTC (rev 70127) @@ -481,6 +481,11 @@ GED_EXPORT extern int ged_delete_pipept(struct ged *gedp, int argc, const char *argv[]); /** + * DSP utility command + */ +GED_EXPORT extern int ged_dsp(struct ged *gedp, int argc, const char *argv[]); + +/** * Arb specific edits. */ GED_EXPORT extern int ged_edarb(struct ged *gedp, int argc, const char *argv[]); Modified: brlcad/trunk/src/libged/CMakeLists.txt === --- brlcad/trunk/src/libged/CMakeLists.txt 2017-08-24 21:13:53 UTC (rev 70126) +++ brlcad/trunk/src/libged/CMakeLists.txt 2017-08-24 22:11:50 UTC (rev 70127) @@ -79,6 +79,7 @@ display_list.c draw.c draw_calc.cpp + dsp.c dump.c dup.c eac.c Added: brlcad/trunk/src/libged/dsp.c === --- brlcad/trunk/src/libged/dsp.c (rev 0) +++ brlcad/trunk/src/libged/dsp.c 2017-08-24 22:11:50 UTC (rev 70127) @@ -0,0 +1,162 @@ +/* D S P . C + * BRL-CAD + * + * Copyright (c) 2017 United States Government as represented by + * the U.S. Army Research Laboratory. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this file; see the file named COPYING for more + * information. + */ +/** @file libged/dsp.c + * + * DSP command for displacement map operations. + * + */ + +#include "common.h" + +#include +#include +#include + +#include "bu/opt.h" +#include "rt/geom.h" +#include "wdb.h" +#include "./ged_private.h" + +/* FIXME - we want the DSP macro for convenience here - should this be in include/rt/dsp.h ? */ +#include "../librt/primitives/dsp/dsp.h" + +int +ged_dsp(struct ged *gedp, int argc, const char *argv[]) +{ +struct directory *dsp_dp; +struct rt_db_internal intern; +struct rt_dsp_internal *dsp; +const char *cmd = argv[0]; +size_t len; +const char *sub = NULL; +const char *primitive = NULL; +static const char *usage = " [command]\n"; + +GED_CHECK_DATABASE_OPEN(gedp, GED_ERROR); +GED_CHECK_READ_ONLY(gedp, GED_ERROR); +GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR); + +/* initialize result */ +bu_vls_trunc(gedp->ged_result_str, 0); + +/* must be wanting help */ +if (argc < 3) { + bu_vls_printf(gedp->ged_result_str, "Usage: %s %s", cmd, usage); + bu_vls_printf(gedp->ged_result_str, "commands:\n"); + bu_vls_printf(gedp->ged_result_str, "\txy x y - report the height value at (x,y)\n"); + bu_vls_printf(gedp->ged_result_str, "\tdiff obj [min_diff_val] - report height differences at x,y coordinates between two dsp objects\n"); + return GED_ERROR; +} + +/* get dsp */ +primitive = argv[1]; +GED_DB_LOOKUP(gedp, dsp_dp, primitive, LOOKUP_NOISY, GED_ERROR & GED_QUIET); +GED_DB_GET_INTERNAL(gedp, , dsp_dp, bn_mat_identity, _uniresource, GED_ERROR); + +if (intern.idb_major_type != DB5_MAJORTYPE_BRLCAD || intern.idb_minor_type != DB5_MINORTYPE_BRLCAD_DSP) { + bu_vls_printf(gedp->ged_result_str, "%s: %s is not a DSP solid!", cmd, primitive); + rt_db_free_internal(); + return GED_ERROR; +} + +dsp = (struct rt_dsp_internal *)intern.idb_ptr; +RT_DSP_CK_MAGIC(dsp); + +/* execute subcommand */ +sub = argv[2]; +len = strlen(sub); +if (BU_STR_EQUAL(sub, "xy")) { + unsigned short elev; + unsigned int gx = 0; + unsigned int gy = 0; + (void)bu_opt_int(NULL, 1, [3], ); + (void)bu_opt_int(NULL, 1, [4], ); + if (gx > dsp->dsp_xcnt || gy > dsp->dsp_ycnt) { +
[brlcad-commits] SF.net SVN: brlcad:[70126] brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp
Revision: 70126 http://sourceforge.net/p/brlcad/code/70126 Author: starseeker Date: 2017-08-24 21:13:53 + (Thu, 24 Aug 2017) Log Message: --- need to do some testing with pre-transform I/O... probably multiple errors in here... Modified Paths: -- brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp Modified: brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp === --- brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp 2017-08-24 19:36:23 UTC (rev 70125) +++ brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp 2017-08-24 21:13:53 UTC (rev 70126) @@ -306,20 +306,20 @@ (void)get_dataset_info(pjdata); /* Read the data into something a DSP can process */ -unsigned int xsize = GDALGetRasterXSize(pjdata); -unsigned int ysize = GDALGetRasterYSize(pjdata); +//GDALDatasetH indata = pjdata; +GDALDatasetH indata = state->hDataset; +unsigned int xsize = GDALGetRasterXSize(indata); +unsigned int ysize = GDALGetRasterYSize(indata); unsigned short *uint16_array = (unsigned short *)bu_calloc(xsize*ysize, sizeof(unsigned short), "unsigned short array"); -GDALRasterBandH band = GDALGetRasterBand(pjdata, 1); +GDALRasterBandH band = GDALGetRasterBand(indata, 1); -/* - int bmin, bmax; - double adfMinMax[2]; - adfMinMax[0] = GDALGetRasterMinimum(band, ); - adfMinMax[1] = GDALGetRasterMaximum(band, ); - if (!(bmin && bmax)) GDALComputeRasterMinMax(band, TRUE, adfMinMax); - bu_log("Min/Max: %f, %f\n", adfMinMax[0], adfMinMax[1]); - */ +int bmin, bmax; +double adfMinMax[2]; +adfMinMax[0] = GDALGetRasterMinimum(band, ); +adfMinMax[1] = GDALGetRasterMaximum(band, ); +if (!(bmin && bmax)) GDALComputeRasterMinMax(band, TRUE, adfMinMax); +bu_log("Min/Max: %f, %f\n", adfMinMax[0], adfMinMax[1]); /* If we're going to DSP we need the unsigned short read. */ uint16_t *scanline = (uint16_t *)CPLMalloc(sizeof(uint16_t)*GDALGetRasterBandXSize(band)); @@ -328,7 +328,7 @@ for (int j = 0; j < GDALGetRasterBandXSize(band); ++j) { /* This is the critical assignment point - if we get this * indexing wrong, data will not look right in dsp */ - uint16_array[i*ysize+j] = scanline[j]; + uint16_array[(ysize-i-1)*ysize+j] = scanline[j]; //bu_log("%d, %d: %d\n", i, j, scanline[j]); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits
[brlcad-commits] SF.net SVN: brlcad:[70123] brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp
Revision: 70123 http://sourceforge.net/p/brlcad/code/70123 Author: starseeker Date: 2017-08-24 16:11:49 + (Thu, 24 Aug 2017) Log Message: --- We'll need to be able to project data... start working on figuring out how to do that. Modified Paths: -- brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp Modified: brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp === --- brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp 2017-08-24 14:18:25 UTC (rev 70122) +++ brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp 2017-08-24 16:11:49 UTC (rev 70123) @@ -43,6 +43,7 @@ /* GDAL headers */ #include +#include #include #include #include @@ -131,7 +132,111 @@ return 1; } +/* Pull the latitude and longitude out of the dataset. Based on gdalinfo code, so + * this function (gdal_ll) is: + * + * Copyright (c) 1998, Frank Warmerdam + * Copyright (c) 2007-2015, Even Rouault + * Copyright (c) 2015, Faza Mahamood + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ HIDDEN int +gdal_ll(GDALDatasetH hDataset, double *lat_center, double *long_center) +{ +double longitude, latitude; +double adfGeoTransform[6]; +const char *pzp = NULL; +OGRCoordinateTransformationH htfm = NULL; +double gx = GDALGetRasterXSize(hDataset)/2.0; +double gy = GDALGetRasterYSize(hDataset)/2.0; +if(GDALGetGeoTransform(hDataset, adfGeoTransform) == CE_None ) { + longitude = adfGeoTransform[0] + adfGeoTransform[1] * gx + adfGeoTransform[2] * gy; + latitude = adfGeoTransform[3] + adfGeoTransform[4] * gx + adfGeoTransform[5] * gy; + pzp = GDALGetProjectionRef(hDataset); +} else { + return 0; +} + +if(pzp != NULL && strlen(pzp) > 0) { + OGRSpatialReferenceH hpj, hll = NULL; + hpj = OSRNewSpatialReference( pzp ); + if(hpj != NULL) hll = OSRCloneGeogCS(hpj); + if(hll != NULL) { + CPLPushErrorHandler(CPLQuietErrorHandler); + /* The bit we need... */ + htfm = OCTNewCoordinateTransformation(hpj, hll); + CPLPopErrorHandler(); + OSRDestroySpatialReference(hll); + } + if(hpj != NULL) OSRDestroySpatialReference(hpj); +} + +if(htfm != NULL) { + if (OCTTransform(htfm,1,,,NULL)) { + if (lat_center) (*lat_center) = latitude; + if (long_center) (*long_center) = longitude; + } else { + return 0; + } +} else { + if (lat_center) (*lat_center) = latitude; + if (long_center) (*long_center) = longitude; +} +bu_log("lat: %f, long: %f\n", latitude, longitude); + +return 1; +} + + +/* Get the UTM zone and corresponding EPSG number - see + * https://gis.stackexchange.com/questions/241696/how-to-convert-from-lat-lon-to-utm-with-gdaltransform + * and the linked posts in the answers for more info. */ +HIDDEN int +gdal_utm_zone(struct conversion_state *state) +{ +int zone = INT_MAX; +double longitude = 0.0; +if (gdal_ll(state->hDataset, NULL, )) { + zone = floor((longitude + 180) / 6) + 1; +} +bu_log("zone: %d\n", zone); +return zone; +} + + +/* Get corresponding EPSG number of the UTM zone - see + * https://gis.stackexchange.com/questions/241696/how-to-convert-from-lat-lon-to-utm-with-gdaltransform + * and the linked posts in the answers for more info. */ +HIDDEN int +gdal_utm_epsg(struct conversion_state *state, int zone) +{ +int epsg = INT_MAX; +double latitude = 0.0; +if (gdal_ll(state->hDataset, , NULL)) { + epsg = (latitude > 0) ? 32600 + zone : 32700 + zone; +} +bu_log("epsg: %d\n", epsg); +return epsg; +} + +HIDDEN int gdal_read(struct gcv_context *context, const struct gcv_opts *gcv_options, const void *options_data, const char *source_path) { @@ -154,7 +259,51 @@ (void)get_dataset_info(state); -/* Read in the
[brlcad-commits] SF.net SVN: brlcad:[70122] brlcad/trunk/include/bu/bitv.h
Revision: 70122 http://sourceforge.net/p/brlcad/code/70122 Author: brlcad Date: 2017-08-24 14:18:25 + (Thu, 24 Aug 2017) Log Message: --- we do want to make sure we have CHAR_BIT for the bu_bitv_shift optimization Modified Paths: -- brlcad/trunk/include/bu/bitv.h Modified: brlcad/trunk/include/bu/bitv.h === --- brlcad/trunk/include/bu/bitv.h 2017-08-24 14:17:51 UTC (rev 70121) +++ brlcad/trunk/include/bu/bitv.h 2017-08-24 14:18:25 UTC (rev 70122) @@ -23,6 +23,8 @@ #include "common.h" +#include /* for CHAR_BIT */ + #include "bu/defines.h" #include "bu/magic.h" #include "bu/list.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits
[brlcad-commits] SF.net SVN: brlcad:[70121] brlcad/trunk
Revision: 70121 http://sourceforge.net/p/brlcad/code/70121 Author: brlcad Date: 2017-08-24 14:17:51 + (Thu, 24 Aug 2017) Log Message: --- the cv header doesn't actually use CHAR_MAX, but the implementation does need limits.h Modified Paths: -- brlcad/trunk/include/bu/cv.h brlcad/trunk/src/libbu/convert.c brlcad/trunk/src/libbu/parse.c Modified: brlcad/trunk/include/bu/cv.h === --- brlcad/trunk/include/bu/cv.h2017-08-24 13:25:50 UTC (rev 70120) +++ brlcad/trunk/include/bu/cv.h2017-08-24 14:17:51 UTC (rev 70121) @@ -24,7 +24,6 @@ #include "common.h" #include /* for size_t */ -#include /* for CHAR_MAX */ #include "bu/defines.h" Modified: brlcad/trunk/src/libbu/convert.c === --- brlcad/trunk/src/libbu/convert.c2017-08-24 13:25:50 UTC (rev 70120) +++ brlcad/trunk/src/libbu/convert.c2017-08-24 14:17:51 UTC (rev 70121) @@ -23,6 +23,7 @@ #include #include #include +#include #include "bu/cv.h" #include "bu/endian.h" Modified: brlcad/trunk/src/libbu/parse.c === --- brlcad/trunk/src/libbu/parse.c 2017-08-24 13:25:50 UTC (rev 70120) +++ brlcad/trunk/src/libbu/parse.c 2017-08-24 14:17:51 UTC (rev 70121) @@ -26,6 +26,7 @@ #include #include #include +#include #include "bu/cv.h" #include "bu/log.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits
[brlcad-commits] SF.net SVN: brlcad:[70120] brlcad/trunk/src
Revision: 70120 http://sourceforge.net/p/brlcad/code/70120 Author: brlcad Date: 2017-08-24 13:25:50 + (Thu, 24 Aug 2017) Log Message: --- slew of changes in support of link-time optimization. uninitialized data access, dead code, aliasing due to incorrect types, and a big reworking of the rtuif applications. they should now be back to defining the right modes (RTSRV and RT_MULTISPECTRAL) and linking the right objects in rttherm, remrt/rtsrv, and all the other rt apps. Modified Paths: -- brlcad/trunk/src/conv/comgeom/region.c brlcad/trunk/src/conv/comgeom/solid.c brlcad/trunk/src/conv/iges/add_face.c brlcad/trunk/src/conv/iges/add_inner_shell.c brlcad/trunk/src/conv/iges/brep.c brlcad/trunk/src/conv/iges/check_names.c brlcad/trunk/src/conv/iges/conv_drawings.c brlcad/trunk/src/conv/iges/convassem.c brlcad/trunk/src/conv/iges/convinst.c brlcad/trunk/src/conv/iges/convtree.c brlcad/trunk/src/conv/iges/extrudcirc.c brlcad/trunk/src/conv/iges/extrude.c brlcad/trunk/src/conv/iges/g-iges.c brlcad/trunk/src/conv/iges/get_att.c brlcad/trunk/src/conv/iges/get_cnurb_curve.c brlcad/trunk/src/conv/iges/get_outer_shell.c brlcad/trunk/src/conv/iges/iges.c brlcad/trunk/src/conv/iges/main.c brlcad/trunk/src/conv/iges/make_face.c brlcad/trunk/src/conv/iges/make_nurb_face.c brlcad/trunk/src/conv/iges/read_att.c brlcad/trunk/src/conv/iges/read_edge_list.c brlcad/trunk/src/conv/iges/read_vertex_list.c brlcad/trunk/src/conv/iges/readmatrix.c brlcad/trunk/src/conv/iges/readtree.c brlcad/trunk/src/conv/iges/spline.c brlcad/trunk/src/conv/iges/trimsurf.c brlcad/trunk/src/conv/obj-g.c brlcad/trunk/src/halftone/tone_floyd.c brlcad/trunk/src/libged/ged_private.h brlcad/trunk/src/liboptical/sh_light.c brlcad/trunk/src/librt/binunif/db5_bin.c brlcad/trunk/src/librt/constraint.c brlcad/trunk/src/mged/attach.c brlcad/trunk/src/mged/fbserv.c brlcad/trunk/src/mged/mged.h brlcad/trunk/src/mged/predictor.c brlcad/trunk/src/mged/set.c brlcad/trunk/src/proc-db/naca/nacax.c brlcad/trunk/src/remrt/CMakeLists.txt brlcad/trunk/src/remrt/remrt.c brlcad/trunk/src/rt/CMakeLists.txt brlcad/trunk/src/rt/main.c brlcad/trunk/src/rt/view.c brlcad/trunk/src/rt/viewpp.c brlcad/trunk/src/rt/viewrad.c brlcad/trunk/src/rt/viewsil.c brlcad/trunk/src/rttherm/CMakeLists.txt brlcad/trunk/src/rttherm/viewtherm.c Removed Paths: - brlcad/trunk/src/rt/sh_tcl.c Modified: brlcad/trunk/src/conv/comgeom/region.c === --- brlcad/trunk/src/conv/comgeom/region.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/comgeom/region.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -32,7 +32,7 @@ /* defined in read.c */ extern int get_line(char *cp, int buflen, char *title); -extern int getint(char *cp, int start, int len); +extern int getint(char *cp, int start, size_t len); extern void namecvt(int n, char **cp, int c); /* defined in cvt.c */ Modified: brlcad/trunk/src/conv/comgeom/solid.c === --- brlcad/trunk/src/conv/comgeom/solid.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/comgeom/solid.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -44,8 +44,9 @@ /* defined in read.c */ extern int get_line(char *cp, int buflen, char *title); -extern int getint(char *cp, int start, int len); extern void namecvt(int n, char **cp, int c); +extern int getint(char *cp, int start, size_t len); +extern double getdouble(char *cp, int start, size_t len); /* defined in cvt.c */ extern void col_pr(char *str); @@ -57,7 +58,6 @@ extern int version; extern int verbose; -extern double getdouble(char *cp, int start, int len); extern int sol_total, sol_work; char scard[132]; /* Solid card buffer area */ Modified: brlcad/trunk/src/conv/iges/add_face.c === --- brlcad/trunk/src/conv/iges/add_face.c 2017-08-24 11:56:08 UTC (rev 70119) +++ brlcad/trunk/src/conv/iges/add_face.c 2017-08-24 13:25:50 UTC (rev 70120) @@ -25,10 +25,10 @@ Add_face_to_shell(struct shell *s, int entityno, int face_orient) { -int sol_num; /* IGES solid type number */ -int surf_de; /* Directory sequence number for underlying surface */ -int no_of_loops; /* Number of loops in face */ -int outer_loop_flag; /* Indicates if first loop is an the outer loop */ +int sol_num = 0; /* IGES solid type number */ +int surf_de = 0; /* Directory sequence number for underlying surface */ +int no_of_loops = 0; /* Number of loops in face */ +int outer_loop_flag = 0; /* Indicates if first loop is
[brlcad-commits] SF.net SVN: brlcad:[70119] brlcad/trunk/src/librt/CMakeLists.txt
Revision: 70119 http://sourceforge.net/p/brlcad/code/70119 Author: brlcad Date: 2017-08-24 11:56:08 + (Thu, 24 Aug 2017) Log Message: --- renamed table.c to table.cpp Modified Paths: -- brlcad/trunk/src/librt/CMakeLists.txt Modified: brlcad/trunk/src/librt/CMakeLists.txt === --- brlcad/trunk/src/librt/CMakeLists.txt 2017-08-24 11:54:46 UTC (rev 70118) +++ brlcad/trunk/src/librt/CMakeLists.txt 2017-08-24 11:56:08 UTC (rev 70119) @@ -208,7 +208,7 @@ primitives/superell/superell.c primitives/superell/superell_brep.cpp primitives/superell/superell_mirror.c - primitives/table.c + primitives/table.cpp primitives/tgc/tgc.c primitives/tgc/tgc_brep.cpp primitives/tgc/tgc_mirror.c This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits
[brlcad-commits] SF.net SVN: brlcad:[70118] brlcad/trunk/src/nirt/if.c
Revision: 70118 http://sourceforge.net/p/brlcad/code/70118 Author: brlcad Date: 2017-08-24 11:54:46 + (Thu, 24 Aug 2017) Log Message: --- fill out the incomplete sig Modified Paths: -- brlcad/trunk/src/nirt/if.c Modified: brlcad/trunk/src/nirt/if.c === --- brlcad/trunk/src/nirt/if.c 2017-08-24 11:53:38 UTC (rev 70117) +++ brlcad/trunk/src/nirt/if.c 2017-08-24 11:54:46 UTC (rev 70118) @@ -264,7 +264,7 @@ int -if_miss(void) +if_miss(struct application *UNUSED(ap)) { report(FMT_RAY); report(FMT_MISS); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits
[brlcad-commits] SF.net SVN: brlcad:[70117] brlcad/trunk
Revision: 70117 http://sourceforge.net/p/brlcad/code/70117 Author: brlcad Date: 2017-08-24 11:53:38 + (Thu, 24 Aug 2017) Log Message: --- probably short-lived, but track free calls too. also semaphore-protect the counter incrementing. Modified Paths: -- brlcad/trunk/include/bu/malloc.h brlcad/trunk/src/libbu/globals.c brlcad/trunk/src/libbu/malloc.c Modified: brlcad/trunk/include/bu/malloc.h === --- brlcad/trunk/include/bu/malloc.h2017-08-24 05:36:47 UTC (rev 70116) +++ brlcad/trunk/include/bu/malloc.h2017-08-24 11:53:38 UTC (rev 70117) @@ -45,8 +45,9 @@ /** @{ */ /** @file bu/malloc.h */ -BU_EXPORT extern long bu_n_malloc; -BU_EXPORT extern long bu_n_realloc; +BU_EXPORT extern size_t bu_n_malloc; +BU_EXPORT extern size_t bu_n_realloc; +BU_EXPORT extern size_t bu_n_free; /** * This routine only returns on successful allocation. We promise Modified: brlcad/trunk/src/libbu/globals.c === --- brlcad/trunk/src/libbu/globals.c2017-08-24 05:36:47 UTC (rev 70116) +++ brlcad/trunk/src/libbu/globals.c2017-08-24 11:53:38 UTC (rev 70117) @@ -37,19 +37,27 @@ * number of calls to bu_malloc()/bu_calloc()/bu_alloc(). * * used by rt. - * not semaphore-protected and is thus only an estimate. + * not necessarily thread-safe and is thus only an estimate. */ -long bu_n_malloc = 0; +size_t bu_n_malloc = 0; /** * number of calls to bu_realloc(). * * used by rt. - * not semaphore-protected and is thus only an estimate. + * not necessarily thread-safe and is thus only an estimate. */ -long bu_n_realloc = 0; +size_t bu_n_realloc = 0; /** + * number of calls to bu_free(). + * + * used by rt. + * not necessarily thread-safe and is thus only an estimate. + */ +size_t bu_n_free = 0; + +/** * used by malloc and vls as the bu_malloc/bu_free debug string. * * NOT published in a public header. Modified: brlcad/trunk/src/libbu/malloc.c === --- brlcad/trunk/src/libbu/malloc.c 2017-08-24 05:36:47 UTC (rev 70116) +++ brlcad/trunk/src/libbu/malloc.c 2017-08-24 11:53:38 UTC (rev 70117) @@ -275,6 +275,7 @@ if (UNLIKELY(ptr==NULL || bu_debug_DEBUG_MEM_LOG)) { fprintf(stderr, "NULL malloc(%llu) %s\n", (unsigned long long)(cnt*size), str); } +bu_n_malloc++; #if defined(MALLOC_NOT_MP_SAFE) bu_semaphore_release(BU_SEM_MALLOC); @@ -307,7 +308,7 @@ BU_LIST_MAGIC_SET(&(mp->q), MDB_MAGIC); bu_semaphore_release(BU_SEM_MALLOC); } -bu_n_malloc++; + return ptr; } @@ -375,6 +376,8 @@ *((uint32_t *)ptr) = 0x; /* zappo! */ free(ptr); +bu_n_free++; + #if defined(MALLOC_NOT_MP_SAFE) bu_semaphore_release(BU_SEM_MALLOC); #endif @@ -460,7 +463,10 @@ #if defined(MALLOC_NOT_MP_SAFE) bu_semaphore_acquire(BU_SEM_MALLOC); #endif + ptr = realloc(ptr, siz); +bu_n_realloc++; + #if defined(MALLOC_NOT_MP_SAFE) bu_semaphore_release(BU_SEM_MALLOC); #endif @@ -519,7 +525,7 @@ BU_LIST_MAGIC_SET(&(mqp->q), MDB_MAGIC); bu_semaphore_release(BU_SEM_MALLOC); } -bu_n_realloc++; + return ptr; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits