Changeset 39457
- Timestamp:
- Mar 11, 2016, 10:23:42 PM (10 years ago)
- Location:
- trunk/Ohana
- Files:
-
- 271 edited
- 12 copied
-
. (modified) (1 prop)
-
Makefile.Common (modified) (1 diff)
-
configure.tcsh (modified) (6 diffs)
-
src/addstar/src/ConfigInit.c (modified) (1 diff)
-
src/addstar/src/LoadDataSDSS.c (modified) (1 diff)
-
src/addstar/src/ReadImageHeader.c (modified) (2 diffs)
-
src/addstar/src/ReadStarsFITS.c (modified) (1 diff)
-
src/addstar/src/SkyRegionUtils.c (modified) (1 diff)
-
src/addstar/src/build_links.c (modified) (3 diffs)
-
src/addstar/src/calibrate.c (modified) (1 diff)
-
src/addstar/src/greference.c (modified) (1 diff)
-
src/addstar/src/loadgalphot_table.c (modified) (1 diff)
-
src/addstar/src/loadsupercos_rawdata.c (modified) (1 diff)
-
src/addstar/src/mkcmf.c (modified) (5 diffs)
-
src/addstar/src/sky_tessalation.c (modified) (4 diffs)
-
src/delstar/src/delete_duplicate_images.c (modified) (1 diff)
-
src/delstar/src/delete_fix_LAP.c (modified) (1 diff)
-
src/delstar/src/find_image_db.c (modified) (1 diff)
-
src/delstar/src/gimages.c (modified) (1 diff)
-
src/dvomerge/src/build_links.c (modified) (1 diff)
-
src/dvomerge/src/dvomergeCreate.c (modified) (1 diff)
-
src/dvomerge/src/dvorepairDeleteImagesByExternID.c (modified) (2 diffs)
-
src/dvomerge/src/dvorepairFixImages.c (modified) (1 diff)
-
src/dvomerge/src/replace_match.c (modified) (1 diff)
-
src/dvomerge/src/replace_tycho.c (modified) (1 diff)
-
src/fakeastro/src/Shutdown.c (modified) (1 diff)
-
src/fakeastro/src/airmass.c (modified) (1 diff)
-
src/getstar/src/WriteImages.c (modified) (1 diff)
-
src/kapa2/include/buttons.h (modified) (12 diffs)
-
src/kapa2/include/hms_buttons.h (modified) (2 diffs)
-
src/kapa2/include/prototypes.h (modified) (1 diff)
-
src/kapa2/include/structures.h (modified) (1 diff)
-
src/kapa2/src/ButtonFunctions.c (modified) (7 diffs)
-
src/kapa2/src/DrawBitmap.c (modified) (1 diff)
-
src/kapa2/src/Image.c (modified) (1 diff)
-
src/kapa2/src/PNGit.c (modified) (2 diffs)
-
src/kapa2/src/PaintOverlay.c (modified) (1 diff)
-
src/kapa2/src/Resize.c (modified) (2 diffs)
-
src/kapa2/src/bDrawOverlay.c (modified) (1 diff)
-
src/libdvo/include/dvo_util.h (modified) (2 diffs)
-
src/libdvo/include/dvodb.h (modified) (1 diff)
-
src/libdvo/include/libdvo_astro.h (modified) (1 diff)
-
src/libdvo/src/AstromOffsetMapIO.c (modified) (7 diffs)
-
src/libdvo/src/AstromOffsetMapUtils.c (modified) (2 diffs)
-
src/libdvo/src/HostTable.c (modified) (2 diffs)
-
src/libdvo/src/ImageOps.c (modified) (1 diff)
-
src/libdvo/src/RegionHostTable.c (modified) (3 diffs)
-
src/libdvo/src/dbExtractImages.c (modified) (1 diff)
-
src/libdvo/src/db_utils.c (modified) (1 diff)
-
src/libdvo/src/dvo_catalog_chipcoords.c (modified) (1 diff)
-
src/libdvo/src/dvo_catalog_mef.c (modified) (1 diff)
-
src/libdvo/src/dvo_catalog_raw.c (modified) (1 diff)
-
src/libdvo/src/dvo_convert.c (modified) (6 diffs)
-
src/libdvo/src/dvo_convert_PS1_DEV_1.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_DEV_2.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_REF.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_SIM.c (modified) (4 diffs)
-
src/libdvo/src/dvo_convert_PS1_V1.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_V2.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_V3.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_V4.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_PS1_V5.c (modified) (5 diffs)
-
src/libdvo/src/dvo_convert_panstarrs_DEV_0.c (modified) (2 diffs)
-
src/libdvo/src/dvo_convert_panstarrs_DEV_1.c (modified) (2 diffs)
-
src/libdvo/src/dvo_photcode_ops.c (modified) (22 diffs)
-
src/libdvo/src/dvo_tiny_values.c (modified) (1 diff)
-
src/libdvo/src/dvo_util.c (modified) (2 diffs)
-
src/libdvo/src/dvosorts.c (modified) (1 diff)
-
src/libdvo/src/match_image.c (modified) (2 diffs)
-
src/libdvo/src/mosaic_astrom.c (modified) (1 diff)
-
src/libfits/extern/gzip.c (modified) (6 diffs)
-
src/libfits/header/F_write_H.c (modified) (1 diff)
-
src/libfits/include/gfits_compress.h (copied) (copied from branches/eam_branches/ohana.20160226/src/libfits/include/gfits_compress.h )
-
src/libfits/include/gfitsio.h (modified) (2 diffs)
-
src/libfits/matrix/F_compress_M.c (modified) (22 diffs)
-
src/libfits/matrix/F_compress_data.c (modified) (7 diffs)
-
src/libfits/matrix/F_compress_utils.c (modified) (7 diffs)
-
src/libfits/matrix/F_convert_format.c (modified) (3 diffs)
-
src/libfits/matrix/F_uncompress_M.c (modified) (27 diffs)
-
src/libfits/matrix/F_uncompress_data.c (modified) (6 diffs)
-
src/libfits/table/F_compress_T.c (modified) (28 diffs)
-
src/libfits/table/F_set_column.c (modified) (4 diffs)
-
src/libfits/table/F_table_varlength.c (modified) (1 diff)
-
src/libfits/table/F_uncompress_T.c (modified) (20 diffs)
-
src/libfits/table/F_write_T.c (modified) (1 diff)
-
src/libfits/table/F_write_TH.c (modified) (1 diff)
-
src/libfits/test/imagecomp.c (modified) (2 diffs)
-
src/libfits/test/keywords.c (modified) (6 diffs)
-
src/libfits/test/ricetest.c (modified) (5 diffs)
-
src/libfits/test/tablecomp.c (modified) (12 diffs)
-
src/libfits/test/zlib.c (modified) (5 diffs)
-
src/libkapa/rotfont/courier12.h (modified) (1 diff)
-
src/libkapa/rotfont/courier24.h (modified) (1 diff)
-
src/libkapa/rotfont/courier8.h (modified) (1 diff)
-
src/libkapa/rotfont/fixed.h (modified) (1 diff)
-
src/libkapa/src/DrawRotString.c (modified) (6 diffs)
-
src/libkapa/src/KapaOpen.c (modified) (2 diffs)
-
src/libkapa/src/PSRotFont.c (modified) (4 diffs)
-
src/libkapa/src/RotFont.c (modified) (2 diffs)
-
src/libkapa/src/bDrawRotFont.c (modified) (3 diffs)
-
src/libohana/include/ohana.h (modified) (2 diffs)
-
src/libohana/include/ohana_allocate.h (modified) (1 diff)
-
src/libohana/src/Fread.c (modified) (2 diffs)
-
src/libohana/src/config.c (modified) (1 diff)
-
src/libohana/src/findexec.c (modified) (1 diff)
-
src/libohana/src/gaussj.c (modified) (1 diff)
-
src/libohana/src/isolate_elements.c (modified) (3 diffs)
-
src/libohana/src/ohana_allocate.c (modified) (8 diffs)
-
src/libohana/src/sprintf_floats.c (modified) (2 diffs)
-
src/libohana/test/sprintf_floats.c (modified) (3 diffs)
-
src/libtap/include/tap_ohana.h (modified) (2 diffs)
-
src/opihi/cmd.astro/flux.c (modified) (3 diffs)
-
src/opihi/cmd.astro/imfit-fgauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-pgauss-psf.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-pgauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-qfgauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-qgauss-psf.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-qgauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-qrgauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-rgauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-serbulge.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-sersic.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-sgauss-psf.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-sgauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-tgauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/imfit-vgauss.c (modified) (1 diff)
-
src/opihi/cmd.astro/spexseq.c (modified) (1 diff)
-
src/opihi/cmd.basic/continue.c (modified) (2 diffs)
-
src/opihi/cmd.basic/list_help.c (modified) (1 diff)
-
src/opihi/cmd.basic/list_vars.c (modified) (1 diff)
-
src/opihi/cmd.basic/nop.c (modified) (1 diff)
-
src/opihi/cmd.basic/run_for.c (modified) (1 diff)
-
src/opihi/cmd.basic/run_foreach.c (modified) (1 diff)
-
src/opihi/cmd.basic/shell.c (modified) (6 diffs)
-
src/opihi/cmd.data/book_commands.c (modified) (1 diff)
-
src/opihi/cmd.data/cursor.c (modified) (3 diffs)
-
src/opihi/cmd.data/gaussdeviate.c (modified) (1 diff)
-
src/opihi/cmd.data/list_buffers.c (modified) (1 diff)
-
src/opihi/cmd.data/list_vectors.c (modified) (1 diff)
-
src/opihi/cmd.data/medimage.c (modified) (1 diff)
-
src/opihi/cmd.data/medimage_commands.c (modified) (1 diff)
-
src/opihi/cmd.data/queuelist.c (modified) (1 diff)
-
src/opihi/cmd.data/spline.c (modified) (1 diff)
-
src/opihi/cmd.data/spline_commands.c (modified) (1 diff)
-
src/opihi/cmd.data/uniq.c (modified) (4 diffs)
-
src/opihi/cmd.data/vellipse.c (modified) (1 diff)
-
src/opihi/cmd.data/vgauss.c (modified) (1 diff)
-
src/opihi/cmd.data/vmaxwell.c (modified) (1 diff)
-
src/opihi/dvo/avextract.c (modified) (3 diffs)
-
src/opihi/dvo/avmatch.c (modified) (3 diffs)
-
src/opihi/dvo/catname.c (modified) (2 diffs)
-
src/opihi/dvo/ccd.c (modified) (2 diffs)
-
src/opihi/dvo/cmd.c (modified) (4 diffs)
-
src/opihi/dvo/dmt.c (modified) (1 diff)
-
src/opihi/dvo/dvo.c.in (modified) (1 diff)
-
src/opihi/dvo/dvo_host_utils.c (modified) (2 diffs)
-
src/opihi/dvo/fitcolors.c (modified) (5 diffs)
-
src/opihi/dvo/fitsed.c (modified) (5 diffs)
-
src/opihi/dvo/gcat.c (modified) (2 diffs)
-
src/opihi/dvo/gstar.c (modified) (1 diff)
-
src/opihi/dvo/imdata.c (modified) (2 diffs)
-
src/opihi/dvo/imextract.c (modified) (4 diffs)
-
src/opihi/dvo/mextract.c (modified) (4 diffs)
-
src/opihi/dvo/mmatch.c (modified) (3 diffs)
-
src/opihi/dvo/mmextract.c (modified) (4 diffs)
-
src/opihi/dvo/objectcoverage.c (modified) (2 diffs)
-
src/opihi/dvo/paverage.c (modified) (2 diffs)
-
src/opihi/dvo/pmeasure.c (modified) (2 diffs)
-
src/opihi/dvo/procks.c (modified) (1 diff)
-
src/opihi/dvo/showtile.c (modified) (1 diff)
-
src/opihi/dvo/skycat.c (modified) (2 diffs)
-
src/opihi/dvo/version.c (modified) (1 diff)
-
src/opihi/include/dvoshell.h (modified) (1 diff)
-
src/opihi/include/shell.h (modified) (1 diff)
-
src/opihi/lib.data/hermitian.c (modified) (1 diff)
-
src/opihi/lib.shell/CommandOps.c (modified) (1 diff)
-
src/opihi/lib.shell/VectorIO.c (modified) (2 diffs)
-
src/opihi/lib.shell/dvomath.c (modified) (2 diffs)
-
src/opihi/lib.shell/exec_loop.c (modified) (3 diffs)
-
src/opihi/lib.shell/interrupt.c (modified) (5 diffs)
-
src/opihi/lib.shell/macro_edit.c (modified) (1 diff)
-
src/opihi/lib.shell/macro_read.c (modified) (1 diff)
-
src/opihi/lib.shell/macro_write.c (modified) (1 diff)
-
src/opihi/lib.shell/multicommand.c (modified) (1 diff)
-
src/opihi/mana/mana.c.in (modified) (1 diff)
-
src/opihi/mana/version.c (modified) (1 diff)
-
src/opihi/pantasks/ListenClients.c (modified) (1 diff)
-
src/opihi/pantasks/controller_machines.c (modified) (1 diff)
-
src/opihi/pantasks/controller_threads.c (modified) (1 diff)
-
src/opihi/pantasks/controller_version.c (modified) (1 diff)
-
src/opihi/pantasks/invalid.c (modified) (1 diff)
-
src/opihi/pantasks/jobs_and_tasks_thread.c (modified) (1 diff)
-
src/opihi/pantasks/pantasks.c.in (modified) (1 diff)
-
src/opihi/pantasks/pantasks_client.c.in (modified) (1 diff)
-
src/opihi/pantasks/pantasks_server.c.in (modified) (1 diff)
-
src/opihi/pantasks/run.c (modified) (1 diff)
-
src/opihi/pantasks/server_connect.c (modified) (1 diff)
-
src/opihi/pantasks/server_disconnect.c (modified) (1 diff)
-
src/opihi/pantasks/server_run.c (modified) (3 diffs)
-
src/opihi/pantasks/stop.c (modified) (2 diffs)
-
src/opihi/pantasks/thread_locks.c (modified) (2 diffs)
-
src/opihi/pantasks/version.c (modified) (1 diff)
-
src/opihi/pclient/check.c (modified) (1 diff)
-
src/opihi/pclient/pclient.c.in (modified) (2 diffs)
-
src/opihi/pclient/reset.c (modified) (1 diff)
-
src/opihi/pclient/status.c (modified) (1 diff)
-
src/opihi/pclient/stdout.c (modified) (2 diffs)
-
src/opihi/pclient/version.c (modified) (1 diff)
-
src/opihi/pcontrol/CheckSystem.c (modified) (1 diff)
-
src/opihi/pcontrol/JobOps.c (modified) (2 diffs)
-
src/opihi/pcontrol/MachineOps.c (modified) (1 diff)
-
src/opihi/pcontrol/StackOps.c (modified) (1 diff)
-
src/opihi/pcontrol/machines.c (modified) (1 diff)
-
src/opihi/pcontrol/pcontrol.c.in (modified) (1 diff)
-
src/opihi/pcontrol/version.c (modified) (1 diff)
-
src/photdbc/include/photdbc.h (modified) (1 diff)
-
src/photdbc/src/UseBackupForHost.c (modified) (1 diff)
-
src/relastro/Makefile (modified) (6 diffs)
-
src/relastro/include/relastro.h (modified) (9 diffs)
-
src/relastro/src (modified) (1 prop)
-
src/relastro/src/BootstrapOps.c (modified) (1 diff)
-
src/relastro/src/BrightCatalog.c (modified) (11 diffs)
-
src/relastro/src/FitAstromOps.c (modified) (1 diff)
-
src/relastro/src/FitChip.c (modified) (2 diffs)
-
src/relastro/src/GetAstromError.c (modified) (1 diff)
-
src/relastro/src/ImageOps.c (modified) (13 diffs)
-
src/relastro/src/ImageTable.c (modified) (2 diffs)
-
src/relastro/src/MeasFilterTest.c (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/src/MeasFilterTest.c )
-
src/relastro/src/MosaicOps.c (modified) (4 diffs)
-
src/relastro/src/SetSignals.c (modified) (1 diff)
-
src/relastro/src/StarMaps.c (modified) (2 diffs)
-
src/relastro/src/UpdateChips.c (modified) (4 diffs)
-
src/relastro/src/UpdateMeasures.c (modified) (1 diff)
-
src/relastro/src/UpdateObjectOffsets.c (modified) (6 diffs)
-
src/relastro/src/UpdateObjects.c (modified) (4 diffs)
-
src/relastro/src/UpdateStacks.c (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/src/UpdateStacks.c )
-
src/relastro/src/args.c (modified) (6 diffs)
-
src/relastro/src/assign_images.c (modified) (2 diffs)
-
src/relastro/src/bcatalog.c (modified) (1 diff)
-
src/relastro/src/dvo_astrom_ops.c (modified) (8 diffs)
-
src/relastro/src/fitobj.c (modified) (2 diffs)
-
src/relastro/src/fitobj2.c (modified) (2 diffs)
-
src/relastro/src/fitstk.c (modified) (1 diff)
-
src/relastro/src/high_speed_utils.c (modified) (2 diffs)
-
src/relastro/src/indexCatalogs.c (modified) (4 diffs)
-
src/relastro/src/initialize.c (modified) (1 diff)
-
src/relastro/src/launch_region_hosts.c (modified) (2 diffs)
-
src/relastro/src/load_catalogs.c (modified) (4 diffs)
-
src/relastro/src/load_images.c (modified) (4 diffs)
-
src/relastro/src/plot_scatter.c (modified) (1 diff)
-
src/relastro/src/plotstuff.c (modified) (3 diffs)
-
src/relastro/src/relastro.c (modified) (4 diffs)
-
src/relastro/src/relastro_client.c (modified) (4 diffs)
-
src/relastro/src/relastro_images.c (modified) (7 diffs)
-
src/relastro/src/relastro_merge_source.c (modified) (1 diff)
-
src/relastro/src/relastro_objects.c (modified) (3 diffs)
-
src/relastro/src/relastro_parallel_images.c (modified) (3 diffs)
-
src/relastro/src/relastro_parallel_regions.c (modified) (1 diff)
-
src/relastro/src/share_icrf_obj.c (modified) (1 diff)
-
src/relastro/src/share_images_pos.c (modified) (1 diff)
-
src/relastro/src/share_mean_pos.c (modified) (1 diff)
-
src/relastro/src/share_meas_pos.c (modified) (2 diffs)
-
src/relastro/test/HostTable.dat.in (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/test/HostTable.dat.in )
-
src/relastro/test/RegionHosts.dat.in (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/test/RegionHosts.dat.in )
-
src/relastro/test/gdb.sh (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/test/gdb.sh )
-
src/relastro/test/run.fakeastro.par (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/test/run.fakeastro.par )
-
src/relastro/test/run.fakeastro.ser (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/test/run.fakeastro.ser )
-
src/relastro/test/run.relastro.par (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/test/run.relastro.par )
-
src/relastro/test/run.relastro.par.reg (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/test/run.relastro.par.reg )
-
src/relastro/test/run.relastro.ser (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/test/run.relastro.ser )
-
src/relastro/test/template.dat (copied) (copied from branches/eam_branches/ohana.20160226/src/relastro/test/template.dat )
-
src/relphot/src/GridOps.c (modified) (1 diff)
-
src/relphot/src/ImageOps.c (modified) (7 diffs)
-
src/relphot/src/MosaicOps.c (modified) (5 diffs)
-
src/relphot/src/StarOps.c (modified) (1 diff)
-
src/relphot/src/plotstuff.c (modified) (3 diffs)
-
src/relphot/src/setMrelCatalog.c (modified) (1 diff)
-
src/relphot/src/share_mean_mags.c (modified) (1 diff)
-
src/relphot/src/synthetic_mags.c (modified) (1 diff)
-
src/skycalc/src/astro.c (modified) (3 diffs)
-
src/tools/src/list_astro.c (modified) (1 diff)
-
src/uniphot/src/update_catalog_setphot.c (modified) (1 diff)
-
src/uniphot/src/update_catalog_setposangle.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana
-
Property svn:mergeinfo
set to
/branches/eam_branches/ohana.20160226 merged eligible
-
Property svn:mergeinfo
set to
-
trunk/Ohana/Makefile.Common
r39400 r39457 129 129 for i in $(TESTPROG); do rm -f $(TESTBIN)/$$i; done 130 130 for i in $(TESTPROG); do rm -f $(TESTDIR)/$$i.$(ARCH); done 131 for i in $(TESTPROG); do rm -f $(TESTDIR)/$$i.$(ARCH).o; done 131 132 132 133 dist: clean -
trunk/Ohana/configure.tcsh
r39406 r39457 14 14 set memcheck = 0 15 15 set use_tcmalloc = 0 16 set use_gnu 99 = 016 set use_gnu89 = 0 17 17 set no_largefiles = 0 18 18 set extra_safety_checks = 0 … … 90 90 set use_tcmalloc = 1 91 91 breaksw; 92 case --use-gnu99 93 set use_gnu99 = 1 92 case --use-gnu89 93 set use_gnu89 = 1 94 echo "---- warning : gnu89 is now deprecated" 94 95 breaksw; 95 96 case --no-largefiles … … 211 212 if ($sanitize_address) set CFLAGS = "$CFLAGS -fsanitize=address" 212 213 214 # gnu c99 fails due to missing flockfile prototype 215 # we are forced to used gnu99 216 # -std=gnu89 fails with -pedantic tests because we use VA_ARGS in macros (allowed by gnu but not C89) 217 213 218 # use_gnu99 214 if ($use_gnu99) then 219 if ($use_gnu89 && ($extra_safety_checks == 0)) then 220 set CFLAGS = "$CFLAGS -std=gnu89" 221 else 215 222 set CFLAGS = "$CFLAGS -std=gnu99" 216 else217 set CFLAGS = "$CFLAGS -std=gnu89"218 223 endif 219 224 … … 232 237 # other temp flags 233 238 if ($extra_safety_checks) then 234 set CPPFLAGS = "$CPPFLAGS -fstack-check -fstack-protector-all -D_FORTIFY_SOURCE=2 -Wstrict-aliasing=2 -fno-strict-aliasing -Wextra -pedantic" 239 set CPPFLAGS = "$CPPFLAGS -fstack-check -fstack-protector-all -D_FORTIFY_SOURCE=2 -Wstrict-aliasing=2 -fno-strict-aliasing -pedantic" 240 set CPPFLAGS = "$CPPFLAGS -Wclobbered -Wempty-body -Wignored-qualifiers -Wmissing-field-initializers -Wmissing-parameter-type -Wold-style-declaration -Woverride-init -Wtype-limits -Wuninitialized -Wunused-parameter -Wunused-but-set-parameter" 241 set CPPFLAGS = "$CPPFLAGS -Wsign-compare" 235 242 endif 236 243 … … 717 724 --enable-profile enable 718 725 --enable-sanitize-address enable 726 --extra-safety-checks enable extra gcc safety checks 719 727 --enable-memcheck enable ohana memory tests 728 --enable-debug-build enable debug build 720 729 --pedantic include -Wall -Werror on compilation 721 730 --use-tcmalloc use the alternate tcmalloc from Google 722 --use-gnu 99 use gnu99 flags to ensure C99 compatibility731 --use-gnu89 use gnu89 for possible backwards compatibility (probably will not work) 723 732 --no-largefiles skip large file compatibility 733 --enable-no-as-needed pass --no-as-needed flag to linker 724 734 725 735 Installation directories: … … 745 755 --no-create 746 756 --no-recursion 757 --disable-shared 758 --enable-shared 759 --disable-static 760 --enable-static 747 761 --sbindir 748 762 --libexecdir -
trunk/Ohana/src/addstar/src/ConfigInit.c
r39041 r39457 224 224 225 225 /* get detection filtering mask */ 226 if (!ScanConfig (config, "DETECTIONFILTER", "% d", 0, &options.detectionFilter)) {226 if (!ScanConfig (config, "DETECTIONFILTER", "%u", 0, &options.detectionFilter)) { 227 227 options.detectionFilter = 0; 228 228 } -
trunk/Ohana/src/addstar/src/LoadDataSDSS.c
r38553 r39457 5 5 // each SDSS data set corresponds to 5 images (ugriz) 6 6 Catalog *LoadDataSDSS (FILE *f, char *imagename, Image **images, off_t *nvalid, Header **headers, off_t *extsize, HeaderSet *headerSets, off_t Nimages) { 7 OHANA_UNUSED_PARAM(Nimages); 7 8 8 9 off_t Nskip, Nvalid, NVALID; -
trunk/Ohana/src/addstar/src/ReadImageHeader.c
r39041 r39457 209 209 } 210 210 211 if (!gfits_scan (header, ImageIDKeyword, "% d", 1, &image[0].externID)) {211 if (!gfits_scan (header, ImageIDKeyword, "%u", 1, &image[0].externID)) { 212 212 image[0].externID = 0; 213 213 } … … 272 272 273 273 /* find expected number of stars */ 274 if (!gfits_scan (header, "NSTARS", "% d", 1, &image[0].nstar) && !NO_STARS) {274 if (!gfits_scan (header, "NSTARS", "%u", 1, &image[0].nstar) && !NO_STARS) { 275 275 fprintf (stderr, "WARNING: can't get NSTARS from header (TEXT mode will be invalid)\n"); 276 276 } -
trunk/Ohana/src/addstar/src/ReadStarsFITS.c
r38553 r39457 43 43 // corresponding image header, load the stars from the table 44 44 Catalog *ReadStarsFITS (FILE *f, Header *header, Header *in_theader) { 45 OHANA_UNUSED_PARAM(header); 45 46 46 47 off_t Nskip; -
trunk/Ohana/src/addstar/src/SkyRegionUtils.c
r24977 r39457 2 2 3 3 SkyList *SkyListExistingSubset (SkyList *input, char *path) { 4 OHANA_UNUSED_PARAM(path); 4 5 5 6 int i, status, Nsubset, NSUBSET; -
trunk/Ohana/src/addstar/src/build_links.c
r39346 r39457 27 27 not partial, and has a correct set of average[].measureOffset,Nmeasure values */ 28 28 off_t *init_measure_links (Average *average, off_t Naverage, Measure *measure, off_t Nmeasure) { 29 OHANA_UNUSED_PARAM(measure); 29 30 30 31 off_t i, j, N; … … 161 162 /* build the initial links assuming the table is sorted */ 162 163 off_t *init_missing_links (Average *average, off_t Naverage, Missing *missing, off_t Nmissing) { 164 OHANA_UNUSED_PARAM(missing); 163 165 164 166 off_t i, j, N; … … 229 231 not partial, and has a correct set of average[].lensingOffset,Nlensing values */ 230 232 off_t *init_lensing_links (Average *average, off_t Naverage, Lensing *lensing, off_t Nlensing) { 233 OHANA_UNUSED_PARAM(lensing); 231 234 232 235 off_t i, j, N; -
trunk/Ohana/src/addstar/src/calibrate.c
r30613 r39457 157 157 /* create a hash array from Nstar[] entries */ 158 158 ALLOCATE (Nlist, int, MaxN + 1); 159 memset (Nlist, 0, MAX (0, MaxN*sizeof(int))); 159 if (MaxN >= 0) { 160 memset (Nlist, 0, sizeof(int)); 161 } 160 162 for (i = 0; i < Ncal; i++) { 161 163 Nlist[Nstar[i]] ++; -
trunk/Ohana/src/addstar/src/greference.c
r38986 r39457 4 4 5 5 Catalog *greference (char *Refcat, SkyRegion *region, int photcode) { 6 OHANA_UNUSED_PARAM(photcode); 6 7 7 8 Catalog *catalog = NULL; -
trunk/Ohana/src/addstar/src/loadgalphot_table.c
r39282 r39457 3 3 4 4 int loadgalphot_table (SkyList *skylistInput, HostTable *hosts, char *filename, AddstarClientOptions *options) { 5 OHANA_UNUSED_PARAM(hosts); 5 6 6 7 int i, Nstars; -
trunk/Ohana/src/addstar/src/loadsupercos_rawdata.c
r38986 r39457 7 7 8 8 int loadsupercos_rawdata (Image *image, int *imlist, int Nimage, SkyTable *skytable, char *filename, AddstarClientOptions options) { 9 OHANA_UNUSED_PARAM(Nimage); 9 10 10 11 int i; -
trunk/Ohana/src/addstar/src/mkcmf.c
r39248 r39457 1368 1368 1369 1369 int WriteXSRCtable (FILE *fits, char *extroot, double *X, double *Y, double *M, unsigned int *Flag, int Nstars, float zeroPt, float exptime) { 1370 OHANA_UNUSED_PARAM(Flag); 1370 1371 1371 1372 int i, j; … … 1527 1528 1528 1529 int WriteXFITtable (FILE *fits, char *extroot, double *X, double *Y, double *M, unsigned int *Flag, int Nstars) { 1530 OHANA_UNUSED_PARAM(Flag); 1529 1531 1530 1532 int i; … … 1688 1690 1689 1691 int WriteXGALtable (FILE *fits, char *extroot, double *X, double *Y, double *M, unsigned int *Flag, int Nstars) { 1692 OHANA_UNUSED_PARAM(Flag); 1690 1693 1691 1694 int i; … … 1804 1807 1805 1808 int WriteXRADtable (FILE *fits, char *extroot, double *X, double *Y, double *M, unsigned int *Flag, int Nstars, int Nrad) { 1809 OHANA_UNUSED_PARAM(Flag); 1806 1810 1807 1811 int i, j, k; … … 1881 1885 1882 1886 int WriteDETFtable (FILE *fits, char *extroot, double *X, double *Y, double *M, unsigned int *Flag, int Nstars) { 1887 OHANA_UNUSED_PARAM(X); 1888 OHANA_UNUSED_PARAM(Y); 1889 OHANA_UNUSED_PARAM(M); 1890 OHANA_UNUSED_PARAM(Flag); 1891 OHANA_UNUSED_PARAM(Nstars); 1883 1892 1884 1893 int i; -
trunk/Ohana/src/addstar/src/sky_tessalation.c
r37807 r39457 202 202 // for local projects such as the PS1 Medium Deep fields 203 203 int sky_tessellation_local (FITS_DB *db, int level, int Nmax) { 204 OHANA_UNUSED_PARAM(level); 205 OHANA_UNUSED_PARAM(Nmax); 204 206 205 207 int Nimage; … … 239 241 // we generate projects on uniform rings of constant dec height 240 242 int sky_tessellation_rings (FITS_DB *db, int level, int Nmax) { 243 OHANA_UNUSED_PARAM(level); 244 OHANA_UNUSED_PARAM(Nmax); 241 245 242 246 int j, nDEC, Nimage, Nring, Ntotal, Ndigit; … … 294 298 // based on code supplied by Tamas 2012.07.23 295 299 int sky_tessellation_tamas (FITS_DB *db, int level, int Nmax) { 300 OHANA_UNUSED_PARAM(level); 301 OHANA_UNUSED_PARAM(Nmax); 296 302 297 303 int j, nDEC, Nimage, Nring, Ntotal, Ndigit; … … 740 746 // format : guide to generate the filenames (c-type string format) 741 747 SkyRectangle *sky_rectangle_tamas (double *Dec, double dm, double halfa, double halftheta, int *nring, char *format) { 748 OHANA_UNUSED_PARAM(halfa); 742 749 743 750 static int Nname = 0; -
trunk/Ohana/src/delstar/src/delete_duplicate_images.c
r39313 r39457 630 630 631 631 off_t find_obstime_range (Image *image, off_t Nimage, off_t firstEntry) { 632 OHANA_UNUSED_PARAM(image); 632 633 633 634 Nsubset = 0; -
trunk/Ohana/src/delstar/src/delete_fix_LAP.c
r38986 r39457 465 465 466 466 int delete_fix_LAP_measures (off_t *measureDrop, Catalog *catalog, ImageSubset *image, off_t Nimage) { 467 OHANA_UNUSED_PARAM(Nimage); 467 468 468 469 /* internal counters */ -
trunk/Ohana/src/delstar/src/find_image_db.c
r38441 r39457 83 83 84 84 for (i = 0; i < Nimage; i++) { 85 if (image[i].tzero < START) continue;86 if (image[i].tzero > END) continue;85 if (image[i].tzero < start) continue; 86 if (image[i].tzero > end) continue; 87 87 if (code != NULL) { 88 88 if (image[i].photcode != code[0].code) continue; -
trunk/Ohana/src/delstar/src/gimages.c
r27435 r39457 46 46 47 47 /* get other header info */ 48 haveNx = gfits_scan (&header, "NAXIS1", "%h d", 1, &image[0].NX);49 haveNy = gfits_scan (&header, "NAXIS2", "%h d", 1, &image[0].NY);48 haveNx = gfits_scan (&header, "NAXIS1", "%hu", 1, &image[0].NX); 49 haveNy = gfits_scan (&header, "NAXIS2", "%hu", 1, &image[0].NY); 50 50 if (!haveNx && !haveNy) { 51 haveNx = gfits_scan (&header, "IMNAXIS1", "%h d", 1, &image[0].NX);52 haveNy = gfits_scan (&header, "IMNAXIS2", "%h d", 1, &image[0].NY);51 haveNx = gfits_scan (&header, "IMNAXIS1", "%hu", 1, &image[0].NX); 52 haveNy = gfits_scan (&header, "IMNAXIS2", "%hu", 1, &image[0].NY); 53 53 } 54 54 if (!haveNx && !haveNy) { 55 haveNx = gfits_scan (&header, "ZNAXIS1", "%h d", 1, &image[0].NX);56 haveNy = gfits_scan (&header, "ZNAXIS2", "%h d", 1, &image[0].NY);55 haveNx = gfits_scan (&header, "ZNAXIS1", "%hu", 1, &image[0].NX); 56 haveNy = gfits_scan (&header, "ZNAXIS2", "%hu", 1, &image[0].NY); 57 57 } 58 58 if (!haveNx || !haveNy) { -
trunk/Ohana/src/dvomerge/src/build_links.c
r39334 r39457 180 180 /* build the initial links assuming the table is sorted */ 181 181 off_t *init_missing_links (Average *average, off_t Naverage, Missing *missing, off_t Nmissing) { 182 OHANA_UNUSED_PARAM(missing); 182 183 183 184 off_t i, j, N; -
trunk/Ohana/src/dvomerge/src/dvomergeCreate.c
r38986 r39457 4 4 // the output db may have a different SKY_DEPTH from the input dbs 5 5 int dvomergeCreate (int argc, char **argv) { 6 OHANA_UNUSED_PARAM(argc); 6 7 7 8 int depth1, depth2; -
trunk/Ohana/src/dvomerge/src/dvorepairDeleteImagesByExternID.c
r39323 r39457 32 32 33 33 int dvorepairDeleteImagesByExternID (int argc, char **argv) { 34 OHANA_UNUSED_PARAM(argc); 34 35 35 36 FITS_DB db; // database handle pointing to input image table … … 306 307 307 308 int RepairTableCPT_V1(char *cptFilenameSrc, char *cptFilenameTgt, char *cpsFilenameSrc, char *cpsFilenameTgt, Measure *measure, off_t Nmeasure, Image *image, off_t Nimage, myIndexType *imageIDindex, char catformat) { 309 OHANA_UNUSED_PARAM(Nimage); 308 310 309 311 off_t *averefMatch; -
trunk/Ohana/src/dvomerge/src/dvorepairFixImages.c
r39323 r39457 126 126 127 127 int MarkMosaicsToDelete(Image *image, off_t Nimage, int *deleteIndex) { 128 OHANA_UNUSED_PARAM(image); 129 OHANA_UNUSED_PARAM(Nimage); 130 OHANA_UNUSED_PARAM(deleteIndex); 128 131 129 132 myAbort ("this function needs to be redone with a concept to match the old BuildChipMatch"); -
trunk/Ohana/src/dvomerge/src/replace_match.c
r38986 r39457 7 7 // average and measure pointers to the objects of interest and their first / current measurement 8 8 int replace_match (Average *average_out, Measure *measure_out, off_t *next_meas, Average *average_in, Measure *measure_in) { 9 OHANA_UNUSED_PARAM(average_in); 9 10 10 11 int Nout; -
trunk/Ohana/src/dvomerge/src/replace_tycho.c
r38986 r39457 11 11 12 12 int replace_tycho (Average *averageOut, Measure *measureOut, off_t *next_meas, Average *averageInp, Measure *measureInp) { 13 OHANA_UNUSED_PARAM(averageInp); 13 14 14 15 int i; -
trunk/Ohana/src/fakeastro/src/Shutdown.c
r37807 r39457 22 22 23 23 SetProtect (TRUE); 24 gfits_db_close (db);24 if (db) gfits_db_close (db); 25 25 fprintf (stderr, "ERROR: relastro halted\n"); 26 26 exit (1); -
trunk/Ohana/src/fakeastro/src/airmass.c
r37807 r39457 4 4 5 5 float airmass (float secz_image, double ra, double dec, double st, double latitude) { 6 OHANA_UNUSED_PARAM(secz_image); 6 7 7 8 double hour, cosz, secz; -
trunk/Ohana/src/getstar/src/WriteImages.c
r37807 r39457 3 3 /* given image, find catalog images which overlap it */ 4 4 int WriteImages (char *filename, Image *images, off_t Nimages, off_t *matches, off_t Nmatches) { 5 OHANA_UNUSED_PARAM(Nimages); 5 6 6 7 int i, N; -
trunk/Ohana/src/kapa2/include/buttons.h
r29539 r39457 1 1 #define PS_width 25 2 2 #define PS_height 25 3 static char PS_bits[] = {3 static unsigned char PS_bits[] = { 4 4 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x81, 0x3f, 0x00, 5 5 0x82, 0x67, 0x60, 0x00, 0x02, 0x26, 0x40, 0x00, 0x02, 0x24, 0x40, 0x00, … … 13 13 #define grey_width 25 14 14 #define grey_height 25 15 static char grey_bits[] = {15 static unsigned char grey_bits[] = { 16 16 0x90, 0x40, 0xf7, 0x01, 0x04, 0xaa, 0xad, 0x01, 0x68, 0xd5, 0xfe, 0x01, 17 17 0x82, 0x28, 0xdb, 0x01, 0x10, 0xd2, 0x75, 0x01, 0x40, 0xad, 0xee, 0x01, … … 25 25 #define rainbow_width 25 26 26 #define rainbow_height 25 27 static char rainbow_bits[] = {27 static unsigned char rainbow_bits[] = { 28 28 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 29 29 0x00, 0x80, 0xff, 0x00, 0x00, 0x70, 0x00, 0x01, 0x00, 0x0c, 0x7f, 0x00, … … 37 37 #define recenter_width 25 38 38 #define recenter_height 25 39 static char recenter_bits[] = {39 static unsigned char recenter_bits[] = { 40 40 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 41 41 0x80, 0xef, 0x03, 0x00, 0xe0, 0x00, 0x0e, 0x00, 0x30, 0x00, 0x18, 0x00, … … 49 49 #define heat_width 25 50 50 #define heat_height 25 51 static char heat_bits[] = {51 static unsigned char heat_bits[] = { 52 52 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0xd8, 0x01, 53 53 0x00, 0x0c, 0x37, 0x00, 0xf8, 0xc9, 0x6f, 0x00, 0x0c, 0xde, 0xf0, 0x00, … … 61 61 #define red_width 25 62 62 #define red_height 25 63 static char red_bits[] = {63 static unsigned char red_bits[] = { 64 64 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xfc, 0x03, 0x00, 65 65 0x20, 0x07, 0x06, 0x00, 0xe0, 0x00, 0x0c, 0x00, 0x20, 0x00, 0x08, 0x00, … … 73 73 #define green_width 25 74 74 #define green_height 25 75 static char green_bits[] = {75 static unsigned char green_bits[] = { 76 76 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x07, 0x00, 77 77 0x00, 0x06, 0x04, 0x00, 0x80, 0x03, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, … … 85 85 #define blue_width 25 86 86 #define blue_height 25 87 static char blue_bits[] = {87 static unsigned char blue_bits[] = { 88 88 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xfe, 0x00, 0x00, 89 89 0xc0, 0x83, 0x07, 0x00, 0xc0, 0x00, 0x0c, 0x00, 0x40, 0x00, 0x08, 0x00, … … 97 97 #define yellow_width 25 98 98 #define yellow_height 25 99 static char yellow_bits[] = {99 static unsigned char yellow_bits[] = { 100 100 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x18, 0x00, 101 101 0x80, 0x01, 0x0c, 0x00, 0x00, 0x03, 0x06, 0x00, 0x00, 0x02, 0x02, 0x00, … … 109 109 #define flipx_width 25 110 110 #define flipx_height 25 111 static char flipx_bits[] = {111 static unsigned char flipx_bits[] = { 112 112 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 113 113 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x01, 0x00, 0x80, 0x10, 0x02, 0x00, … … 121 121 #define flipy_width 25 122 122 #define flipy_height 25 123 static char flipy_bits[] = {123 static unsigned char flipy_bits[] = { 124 124 0x00, 0x10, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 125 125 0x00, 0x82, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x80, 0x00, 0x02, 0x00, … … 133 133 #define hex_width 25 134 134 #define hex_height 12 135 static char hex_bits[] = {135 static unsigned char hex_bits[] = { 136 136 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 137 137 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0xf0, 0x00, 0x1e, 0x00, 0x88, 0x00, -
trunk/Ohana/src/kapa2/include/hms_buttons.h
r29539 r39457 1 1 #define hms_width 25 2 2 #define hms_height 12 3 static char hms_bits[] = {3 static unsigned char hms_bits[] = { 4 4 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 5 5 0x02, 0x00, 0x00, 0x00, 0x02, 0x01, 0xf0, 0x00, 0x1e, 0xef, 0x89, 0x00, … … 8 8 #define ddd_width 25 9 9 #define ddd_height 12 10 static char ddd_bits[] = {10 static unsigned char ddd_bits[] = { 11 11 0x40, 0x80, 0x80, 0x00, 0x40, 0x80, 0x80, 0x00, 0x40, 0x80, 0x80, 0x00, 12 12 0x40, 0x80, 0x80, 0x00, 0x40, 0x80, 0x80, 0x00, 0x5c, 0xb8, 0xb8, 0x00, -
trunk/Ohana/src/kapa2/include/prototypes.h
r38986 r39457 172 172 void SetImageSize PROTO((Section *section)); 173 173 174 void InitButtonSize PROTO((Button *button, int width, int height, char *bitmap));174 void InitButtonSize PROTO((Button *button, int width, int height, unsigned char *bitmap)); 175 175 void InitButtonFunc PROTO((Button *button, int (*function)(Graphic *graphic, KapaImageWidget *image))); 176 176 void DrawImage PROTO((KapaImageWidget *image)); 177 177 void DrawButton PROTO((Graphic *graphic, Button *button)); 178 void DrawBitmap PROTO((Graphic *graphic, int x, int y, int dx, int dy, char *bitmap, int mode));178 void DrawBitmap PROTO((Graphic *graphic, int x, int y, int dx, int dy, unsigned char *bitmap, int mode)); 179 179 void CrossHairs PROTO((Graphic *graphic, Picture *image)); 180 180 void hh_hms PROTO((char *line, double ra, double dec, char sep, int Nchar)); -
trunk/Ohana/src/kapa2/include/structures.h
r38986 r39457 55 55 int x, y, dx, dy; /* position and size */ 56 56 int width, height; /* size of the bitmap */ 57 char*bitmap; /* picture on button */57 unsigned char *bitmap; /* picture on button */ 58 58 int (*function_1) (); /* mouse_button 1 function */ 59 59 int (*function_2) (); /* mouse_button 2 function */ -
trunk/Ohana/src/kapa2/src/ButtonFunctions.c
r29938 r39457 3 3 4 4 int PSfunction (Graphic *graphic, KapaImageWidget *image) { 5 OHANA_UNUSED_PARAM(graphic); 6 OHANA_UNUSED_PARAM(image); 5 7 6 8 int status; … … 11 13 12 14 int PNGfunction (Graphic *graphic, KapaImageWidget *image) { 15 OHANA_UNUSED_PARAM(graphic); 16 OHANA_UNUSED_PARAM(image); 13 17 14 18 int status; … … 19 23 20 24 int JPEGfunction (Graphic *graphic, KapaImageWidget *image) { 25 OHANA_UNUSED_PARAM(graphic); 26 OHANA_UNUSED_PARAM(image); 21 27 22 28 int status; … … 137 143 /*********** overlay_button functions ************/ 138 144 int Overlay0 (Graphic *graphic, KapaImageWidget *image) { 145 OHANA_UNUSED_PARAM(graphic); 139 146 140 147 image[0].overlay[0].active = image[0].overlay[0].active ^ TRUE; … … 145 152 146 153 int Overlay1 (Graphic *graphic, KapaImageWidget *image) { 154 OHANA_UNUSED_PARAM(graphic); 147 155 148 156 image[0].overlay[1].active = image[0].overlay[1].active ^ TRUE; … … 153 161 154 162 int Overlay2 (Graphic *graphic, KapaImageWidget *image) { 163 OHANA_UNUSED_PARAM(graphic); 155 164 156 165 image[0].overlay[2].active = image[0].overlay[2].active ^ TRUE; … … 161 170 162 171 int Overlay3 (Graphic *graphic, KapaImageWidget *image) { 172 OHANA_UNUSED_PARAM(graphic); 163 173 164 174 image[0].overlay[3].active = image[0].overlay[3].active ^ TRUE; -
trunk/Ohana/src/kapa2/src/DrawBitmap.c
r13320 r39457 1 1 # include "Ximage.h" 2 2 3 void DrawBitmap (Graphic *graphic, int x, int y, int dx, int dy, char *bitmap, int mode) {3 void DrawBitmap (Graphic *graphic, int x, int y, int dx, int dy, unsigned char *bitmap, int mode) { 4 4 5 5 int i, j, byte_line, byte, bit, flag; -
trunk/Ohana/src/kapa2/src/Image.c
r37807 r39457 132 132 } 133 133 134 void InitButtonSize (Button *button, int width, int height, char *bitmap) {134 void InitButtonSize (Button *button, int width, int height, unsigned char *bitmap) { 135 135 button->dx = width + 2; 136 136 button->dy = height + 2; -
trunk/Ohana/src/kapa2/src/PNGit.c
r33650 r39457 32 32 } 33 33 34 png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, (png_voidp) NULL, (png_voidp) NULL, (png_voidp)NULL);34 png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 35 35 if (!png_ptr) { 36 36 fprintf (stderr, "can't get png structure\n"); … … 42 42 if (!info_ptr) { 43 43 fprintf (stderr, "can't get png info structure\n"); 44 png_destroy_write_struct (&png_ptr, (png_infopp)NULL);44 png_destroy_write_struct (&png_ptr, NULL); 45 45 fclose (f); 46 46 return (TRUE); -
trunk/Ohana/src/kapa2/src/PaintOverlay.c
r34088 r39457 34 34 if (X - dX > Xmax) continue; 35 35 if (Y + dY < Ymin) continue; 36 if (Y - dY > Ymax) ;36 if (Y - dY > Ymax) continue; 37 37 38 38 pX = (image[0].picture.flipx) ? -1.0 : +1.0; -
trunk/Ohana/src/kapa2/src/Resize.c
r29938 r39457 12 12 13 13 // must scan the message before possible return 14 KiiScanMessage (sock, "% d %d", &NX, &NY);14 KiiScanMessage (sock, "%u %u", &NX, &NY); 15 15 16 16 // XXX keep this min limit (or modify for !USE_XWINDOW)? … … 42 42 // resise the window so the image in the currently active window fills its section 43 43 int ResizeByImage (int sock) { 44 OHANA_UNUSED_PARAM(sock); 44 45 45 46 int i, Nsection; -
trunk/Ohana/src/kapa2/src/bDrawOverlay.c
r34088 r39457 44 44 if (X - dX > Xmax) continue; 45 45 if (Y + dY < Ymin) continue; 46 if (Y - dY > Ymax) ;46 if (Y - dY > Ymax) continue; 47 47 48 48 pX = (image[0].picture.flipx) ? -1.0 : +1.0; -
trunk/Ohana/src/libdvo/include/dvo_util.h
r27435 r39457 61 61 // There is no need to release memory pointed to by return value. 62 62 // It will be freed when dvoConfigFree() is invoked. 63 Image *dvoImageByExternID(dvoConfig *dvoConfig, int sourceID,int externID);63 Image *dvoImageByExternID(dvoConfig *dvoConfig, unsigned short sourceID, unsigned int externID); 64 64 65 65 // Loads the sky table for the database. … … 72 72 // return a list of detections from a particular image id 73 73 // Use dvoFree() to free the memory pointed to by results 74 off_t dvoGetDetections(SkyList *skylist, int imageID, dvoDetection **results,int *pMaxDetID);74 off_t dvoGetDetections(SkyList *skylist, unsigned int imageID, dvoDetection **results, unsigned int *pMaxDetID); 75 75 76 76 // free memory returned by various dvo util functions -
trunk/Ohana/src/libdvo/include/dvodb.h
r39308 r39457 490 490 double TimeValue (time_t time, time_t TimeReference, int TimeFormat); 491 491 492 void image_subset PROTO((Image *image, off_t Nimage, off_t **Subset, off_t *Nsubset, SkyRegionSelection *selection, unsigned long inttzero, double trange, int TimeSelect));493 off_t match_image_subset PROTO((Image *image, off_t *subset, off_t Nsubset, unsigned intT, short int S));492 void image_subset PROTO((Image *image, off_t Nimage, off_t **Subset, off_t *Nsubset, SkyRegionSelection *selection, e_time tzero, double trange, int TimeSelect)); 493 off_t match_image_subset PROTO((Image *image, off_t *subset, off_t Nsubset, e_time T, short int S)); 494 494 495 495 // dvo DB field functions -
trunk/Ohana/src/libdvo/include/libdvo_astro.h
r39245 r39457 67 67 int NMAP; 68 68 AstromOffsetMap **map; 69 int *imageIDtoTableSeq;70 int MaxImageID;71 int MaxTableID;69 int *imageIDtoTableSeq; 70 unsigned int MaxImageID; 71 unsigned int MaxTableID; 72 72 } AstromOffsetTable; 73 73 -
trunk/Ohana/src/libdvo/src/AstromOffsetMapIO.c
r38986 r39457 77 77 } 78 78 AstromOffsetTableSetIDs (table); 79 gfits_free_header (ftable.header); 79 80 gfits_free_header (&theader); 80 81 gfits_free_table (&ftable); 81 82 } else { … … 98 99 // Convert the disk array of maps to then internal format in a rich structure: 99 100 table = AstromOffsetMapToTable (map_disk, Nmap); 101 102 gfits_free_header (&theader); 100 103 gfits_free_table (&ftable); 101 104 } 102 105 103 gfits_free_header (& theader);106 gfits_free_header (&header); 104 107 gfits_free_matrix (&matrix); 108 fclose (f); 105 109 106 110 return (table); … … 130 134 ftable.header = &theader; 131 135 gfits_table_set_AstromOffsetMap_Disk_6x6 (&ftable, map_disk, Nmap, TRUE); 136 FREE (map_disk); 132 137 133 138 f = fopen (filename, "w"); … … 143 148 fclose (f); 144 149 150 gfits_free_header (&header); 151 gfits_free_matrix (&matrix); 152 gfits_free_header (&theader); 153 gfits_free_table (&ftable); 154 145 155 return (TRUE); 146 156 } … … 148 158 AstromOffsetTable *AstromOffsetMapToTable(AstromOffsetMap_Disk_6x6 *map_disk, off_t Nmap) { 149 159 150 int i, j, k; 160 unsigned int i; 161 int j, k; 151 162 152 163 AstromOffsetTable *table = NULL; … … 157 168 158 169 // find the max value of imageID 159 int MaxTableID = 0;160 int MaxImageID = 0;170 unsigned int MaxTableID = 0; 171 unsigned int MaxImageID = 0; 161 172 for (i = 0; i < Nmap; i++) { 162 MaxTableID = MAX( map_disk[i].tableID, MaxTableID);163 MaxImageID = MAX( map_disk[i].imageID, MaxImageID);173 MaxTableID = MAX(MaxTableID, map_disk[i].tableID); 174 MaxImageID = MAX(MaxImageID, map_disk[i].imageID); 164 175 } 165 176 table->MaxTableID = MaxTableID; … … 312 323 int AstromOffsetTableSetIDs (AstromOffsetTable *table) { 313 324 314 int i;315 316 325 // find the max value of imageID 317 int MaxTableID = 0; 318 int MaxImageID = 0; 319 for (i = 0; i < table->Nmap; i++) { 320 MaxTableID = MAX(table->map[i][0].tableID, MaxTableID); 321 MaxImageID = MAX(table->map[i][0].imageID, MaxImageID); 322 } 323 table->MaxTableID = MaxTableID; 324 table->MaxImageID = MaxImageID; 326 unsigned int MaxTableID = 0; 327 unsigned int MaxImageID = 0; 328 { 329 int j; 330 for (j = 0; j < table->Nmap; j++) { 331 MaxTableID = MAX(MaxTableID, table->map[j][0].tableID); 332 MaxImageID = MAX(MaxImageID, table->map[j][0].imageID); 333 } 334 table->MaxTableID = MaxTableID; 335 table->MaxImageID = MaxImageID; 336 } 325 337 326 338 // generate the index and init values to -1 327 ALLOCATE (table->imageIDtoTableSeq, int, MaxImageID + 1); 328 for (i = 0; i <= MaxImageID; i++) { 329 table->imageIDtoTableSeq[i] = -1; 339 { 340 unsigned int i; 341 ALLOCATE (table->imageIDtoTableSeq, int, MaxImageID + 1); 342 for (i = 0; i <= MaxImageID; i++) { 343 table->imageIDtoTableSeq[i] = -1; 344 } 330 345 } 331 346 332 347 // assign the ID values 333 for (i = 0; i < table->Nmap; i++) { 334 int ImageID = table->map[i][0].imageID; 335 myAssert (table->imageIDtoTableSeq[ImageID] == -1, "oops, duplicate image IDs"); 336 table->imageIDtoTableSeq[ImageID] = i; 348 { 349 int j; 350 for (j = 0; j < table->Nmap; j++) { 351 int ImageID = table->map[j][0].imageID; 352 myAssert (table->imageIDtoTableSeq[ImageID] == -1, "oops, duplicate image IDs"); 353 table->imageIDtoTableSeq[ImageID] = j; 354 } 337 355 } 338 356 return TRUE; -
trunk/Ohana/src/libdvo/src/AstromOffsetMapUtils.c
r38986 r39457 11 11 off_t i; 12 12 for (i = 0; i < Nimages; i++) { 13 int imageID = images[i].imageID; 14 if (imageID < 0) continue; 13 // if (images[i].imageID < 0) continue; 14 15 unsigned int imageID = images[i].imageID; 15 16 if (imageID > table->MaxImageID) continue; 16 17 … … 126 127 tgt->keep = src->keep; 127 128 128 int Nx = src-> dX;129 int Ny = src-> dY;129 int Nx = src->Nx; 130 int Ny = src->Ny; 130 131 131 132 int j, k; -
trunk/Ohana/src/libdvo/src/HostTable.c
r39395 r39457 27 27 int i; 28 28 for (i = 0; i < Nhosts; i++) { 29 free (hosts[i].hostname); 30 free (hosts[i].pathname); 29 FREE (hosts[i].hostname); 30 FREE (hosts[i].pathname); 31 FREE (hosts[i].results); 31 32 FreeIOBuffer (&hosts[i].stdout); 32 33 FreeIOBuffer (&hosts[i].stderr); … … 43 44 } 44 45 if (table->index) free (table->index); 46 45 47 free (table); 46 48 return; -
trunk/Ohana/src/libdvo/src/ImageOps.c
r39347 r39457 5 5 void image_subset (Image *image, off_t Nimage, off_t **Subset, off_t *Nsubset, 6 6 SkyRegionSelection *selection, 7 unsigned long inttzero, double trange, int TimeSelect)7 e_time tzero, double trange, int TimeSelect) 8 8 { 9 9 -
trunk/Ohana/src/libdvo/src/RegionHostTable.c
r39395 r39457 42 42 for (i = 0; i < Nhosts; i++) { 43 43 free (hosts[i].hostname); 44 FreeIOBuffer (&hosts[i].stdout); 45 FreeIOBuffer (&hosts[i].stderr); 46 FREE (hosts[i].image); 47 FREE (hosts[i].imseq); 48 FREE (hosts[i].neighbors); 49 if (hosts[i].astromTable) { 50 FREE (hosts[i].astromTable->map); 51 FREE (hosts[i].astromTable->imageIDtoTableSeq); 52 FREE (hosts[i].astromTable); 53 } 54 // do NOT use AstromOffsetTableFree : an astromTable is 55 // only set here by relastro:assign_images, and it uses 56 // AstromOffsetTableAddMapFromImage to assign pointers, not copies 57 // AstromOffsetTableFree(hosts[i].astromTable); 44 58 } 45 59 free (hosts); … … 55 69 if (table->index) free (table->index); 56 70 free (table); 71 57 72 return; 58 73 } … … 83 98 RegionHostInfo *hosts = NULL; 84 99 ALLOCATE (hosts, RegionHostInfo, NHOSTS); 85 InitRegionHosts (hosts, Nhosts, NHOSTS);100 InitRegionHosts (hosts, 0, NHOSTS); 86 101 87 102 int maxID = 0; -
trunk/Ohana/src/libdvo/src/dbExtractImages.c
r39308 r39457 55 55 /* return image.field based on the selection */ 56 56 dbValue dbExtractImages (Image *image, off_t Nimage, off_t N, dbField *field) { 57 OHANA_UNUSED_PARAM(Nimage); // XXX: not sure why this is supplied 57 58 58 59 double x, y; -
trunk/Ohana/src/libdvo/src/db_utils.c
r31636 r39457 10 10 // by default, no graphdata 11 11 int GetGraphdata(Graphdata *graph, int *kapa, char *name) { 12 OHANA_UNUSED_PARAM(graph); 13 OHANA_UNUSED_PARAM(kapa); 14 OHANA_UNUSED_PARAM(name); 12 15 return FALSE; 13 16 } -
trunk/Ohana/src/libdvo/src/dvo_catalog_chipcoords.c
r37035 r39457 1 1 # include <dvo.h> 2 2 3 int dvo_match_image (Image *image, int Nimage, unsignedint T, short int S) {3 int dvo_match_image (Image *image, int Nimage, int T, short int S) { 4 4 5 5 int N, Nlo, Nhi, N1, N2; -
trunk/Ohana/src/libdvo/src/dvo_catalog_mef.c
r38441 r39457 17 17 it is not defined for a legacy database, we can generate them using the existing index values. 18 18 If it is missing, give a warning and recommend the user upgrade the DB */ 19 if (!gfits_scan (&catalog[0].header, "OBJID", "% d", 1, &catalog[0].objID)) {19 if (!gfits_scan (&catalog[0].header, "OBJID", "%u", 1, &catalog[0].objID)) { 20 20 if (VERBOSE) fprintf (stderr, "WARNING: OBJID is not set for %s: upgrade for full feature set\n", catalog[0].filename); 21 21 catalog[0].objID = 0; 22 22 } 23 if (!gfits_scan (&catalog[0].header, "CATID", "% d", 1, &catalog[0].catID)) {23 if (!gfits_scan (&catalog[0].header, "CATID", "%u", 1, &catalog[0].catID)) { 24 24 if (VERBOSE) fprintf (stderr, "WARNING: CATID is not set for %s: upgrade for full feature set\n", catalog[0].filename); 25 25 catalog[0].catID = 0; -
trunk/Ohana/src/libdvo/src/dvo_catalog_raw.c
r38441 r39457 29 29 it is not defined for a legacy database, we can generate them using the existing index values. 30 30 If it is missing, give a warning and recommend the user upgrade the DB */ 31 if (!gfits_scan (&catalog[0].header, "OBJID", "% d", 1, &catalog[0].objID)) {31 if (!gfits_scan (&catalog[0].header, "OBJID", "%u", 1, &catalog[0].objID)) { 32 32 if (VERBOSE) fprintf (stderr, "WARNING: OBJID is not set for this database: upgrade for full feature set\n"); 33 33 catalog[0].objID = 0; 34 34 } 35 if (!gfits_scan (&catalog[0].header, "CATID", "% d", 1, &catalog[0].catID)) {35 if (!gfits_scan (&catalog[0].header, "CATID", "%u", 1, &catalog[0].catID)) { 36 36 if (VERBOSE) fprintf (stderr, "WARNING: CATID is not set for this database: upgrade for full feature set\n"); 37 37 catalog[0].catID = 0; -
trunk/Ohana/src/libdvo/src/dvo_convert.c
r38986 r39457 320 320 321 321 Missing *FtableToMissing (FTable *ftable, Average *average, off_t *Nmissing, DVOCatFormat *format, char nativeBytes) { 322 OHANA_UNUSED_PARAM(average); 322 323 323 324 Missing *missing; … … 397 398 398 399 SecFilt *FtableToSecFilt (FTable *ftable, Average *average, off_t *Nsecfilt, DVOCatFormat *format, char nativeBytes) { 400 OHANA_UNUSED_PARAM(average); 399 401 400 402 SecFilt *secfilt; … … 509 511 510 512 Lensing *FtableToLensing (FTable *ftable, Average *average, off_t *Nlensing, DVOCatFormat *format, char nativeBytes) { 513 OHANA_UNUSED_PARAM(average); 511 514 512 515 Lensing *lensing; … … 652 655 653 656 Lensobj *FtableToLensobj (FTable *ftable, Average *average, off_t *Nlensobj, DVOCatFormat *format, char nativeBytes) { 657 OHANA_UNUSED_PARAM(average); 654 658 655 659 Lensobj *lensobj; … … 769 773 770 774 StarPar *FtableToStarPar (FTable *ftable, Average *average, off_t *Nstarpar, DVOCatFormat *format, char nativeBytes) { 775 OHANA_UNUSED_PARAM(average); 771 776 772 777 StarPar *starpar; … … 874 879 875 880 GalPhot *FtableToGalPhot (FTable *ftable, Average *average, off_t *Ngalphot, DVOCatFormat *format, char nativeBytes) { 881 OHANA_UNUSED_PARAM(average); 876 882 877 883 GalPhot *galphot; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_1.c
r38462 r39457 100 100 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 101 101 Average *Average_PS1_DEV_1_ToInternal (Average_PS1_DEV_1 *in, off_t Nvalues, SecFilt **primary) { 102 OHANA_UNUSED_PARAM(primary); 102 103 103 104 off_t i; … … 138 139 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 139 140 Average_PS1_DEV_1 *AverageInternalTo_PS1_DEV_1 (Average *in, off_t Nvalues, SecFilt *primary) { 141 OHANA_UNUSED_PARAM(primary); 140 142 141 143 off_t i; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_DEV_2.c
r38462 r39457 97 97 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 98 98 Average *Average_PS1_DEV_2_ToInternal (Average_PS1_DEV_2 *in, off_t Nvalues, SecFilt **primary) { 99 OHANA_UNUSED_PARAM(primary); 99 100 100 101 off_t i; … … 133 134 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 134 135 Average_PS1_DEV_2 *AverageInternalTo_PS1_DEV_2 (Average *in, off_t Nvalues, SecFilt *primary) { 136 OHANA_UNUSED_PARAM(primary); 135 137 136 138 off_t i; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_REF.c
r38462 r39457 55 55 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 56 56 Average *Average_PS1_REF_ToInternal (Average_PS1_REF *in, off_t Nvalues, SecFilt **primary) { 57 OHANA_UNUSED_PARAM(primary); 57 58 58 59 off_t i; … … 80 81 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 81 82 Average_PS1_REF *AverageInternalTo_PS1_REF (Average *in, off_t Nvalues, SecFilt *primary) { 83 OHANA_UNUSED_PARAM(primary); 82 84 83 85 off_t i; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_SIM.c
r39262 r39457 4 4 5 5 Measure *Measure_PS1_SIM_ToInternal (Average *ave, Measure_PS1_SIM *in, off_t Nvalues) { 6 OHANA_UNUSED_PARAM(ave); 6 7 7 8 off_t i; … … 51 52 52 53 Measure_PS1_SIM *MeasureInternalTo_PS1_SIM (Average *ave, Measure *in, off_t Nvalues) { 54 OHANA_UNUSED_PARAM(ave); 53 55 54 56 off_t i; … … 97 99 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 98 100 Average *Average_PS1_SIM_ToInternal (Average_PS1_SIM *in, off_t Nvalues, SecFilt **primary) { 101 OHANA_UNUSED_PARAM(primary); 99 102 100 103 off_t i; … … 143 146 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 144 147 Average_PS1_SIM *AverageInternalTo_PS1_SIM (Average *in, off_t Nvalues, SecFilt *primary) { 148 OHANA_UNUSED_PARAM(primary); 145 149 146 150 off_t i; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V1.c
r38462 r39457 115 115 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 116 116 Average *Average_PS1_V1_ToInternal (Average_PS1_V1 *in, off_t Nvalues, SecFilt **primary) { 117 OHANA_UNUSED_PARAM(primary); 117 118 118 119 off_t i; … … 152 153 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 153 154 Average_PS1_V1 *AverageInternalTo_PS1_V1 (Average *in, off_t Nvalues, SecFilt *primary) { 155 OHANA_UNUSED_PARAM(primary); 154 156 155 157 off_t i; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V2.c
r38462 r39457 116 116 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 117 117 Average *Average_PS1_V2_ToInternal (Average_PS1_V2 *in, off_t Nvalues, SecFilt **primary) { 118 OHANA_UNUSED_PARAM(primary); 118 119 119 120 off_t i; … … 157 158 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 158 159 Average_PS1_V2 *AverageInternalTo_PS1_V2 (Average *in, off_t Nvalues, SecFilt *primary) { 160 OHANA_UNUSED_PARAM(primary); 159 161 160 162 off_t i; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V3.c
r38462 r39457 116 116 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 117 117 Average *Average_PS1_V3_ToInternal (Average_PS1_V3 *in, off_t Nvalues, SecFilt **primary) { 118 OHANA_UNUSED_PARAM(primary); 118 119 119 120 off_t i; … … 159 160 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 160 161 Average_PS1_V3 *AverageInternalTo_PS1_V3 (Average *in, off_t Nvalues, SecFilt *primary) { 162 OHANA_UNUSED_PARAM(primary); 161 163 162 164 off_t i; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V4.c
r38462 r39457 134 134 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 135 135 Average *Average_PS1_V4_ToInternal (Average_PS1_V4 *in, off_t Nvalues, SecFilt **primary) { 136 OHANA_UNUSED_PARAM(primary); 136 137 137 138 off_t i; … … 180 181 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 181 182 Average_PS1_V4 *AverageInternalTo_PS1_V4 (Average *in, off_t Nvalues, SecFilt *primary) { 183 OHANA_UNUSED_PARAM(primary); 182 184 183 185 off_t i; -
trunk/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c
r39262 r39457 4 4 5 5 Measure *Measure_PS1_V5_ToInternal (Average *ave, Measure_PS1_V5 *in, off_t Nvalues) { 6 OHANA_UNUSED_PARAM(ave); 6 7 7 8 off_t i; … … 79 80 80 81 Measure_PS1_V5 *MeasureInternalTo_PS1_V5 (Average *ave, Measure *in, off_t Nvalues) { 82 OHANA_UNUSED_PARAM(ave); 81 83 82 84 off_t i; … … 153 155 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 154 156 Average *Average_PS1_V5_ToInternal (Average_PS1_V5 *in, off_t Nvalues, SecFilt **primary) { 157 OHANA_UNUSED_PARAM(primary); 155 158 156 159 off_t i; … … 225 228 // 'primary' is needed to conform with the API for Loneos and Elixir, but is not used 226 229 Average_PS1_V5 *AverageInternalTo_PS1_V5 (Average *in, off_t Nvalues, SecFilt *primary) { 230 OHANA_UNUSED_PARAM(primary); 227 231 228 232 off_t i; … … 1640 1644 1641 1645 Measure *Measure_PS1_V5alt_ToInternal (Average *ave, Measure_PS1_V5alt *in, off_t Nvalues) { 1646 OHANA_UNUSED_PARAM(ave); 1642 1647 1643 1648 off_t i; -
trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_0.c
r38462 r39457 106 106 // 'primary is needed to conform with the API for Loneos and Elixir, but is not used 107 107 Average *Average_Panstarrs_DEV_0_ToInternal (Average_Panstarrs_DEV_0 *in, off_t Nvalues, SecFilt **primary) { 108 OHANA_UNUSED_PARAM(primary); 108 109 109 110 off_t i; … … 143 144 // 'primary is needed to conform with the API for Loneos and Elixir, but is not used 144 145 Average_Panstarrs_DEV_0 *AverageInternalTo_Panstarrs_DEV_0 (Average *in, off_t Nvalues, SecFilt *primary) { 146 OHANA_UNUSED_PARAM(primary); 145 147 146 148 off_t i; -
trunk/Ohana/src/libdvo/src/dvo_convert_panstarrs_DEV_1.c
r38462 r39457 106 106 // 'primary is needed to conform with the API for Loneos and Elixir, but is not used 107 107 Average *Average_Panstarrs_DEV_1_ToInternal (Average_Panstarrs_DEV_1 *in, off_t Nvalues, SecFilt **primary) { 108 OHANA_UNUSED_PARAM(primary); 108 109 109 110 off_t i; … … 143 144 // 'primary is needed to conform with the API for Loneos and Elixir, but is not used 144 145 Average_Panstarrs_DEV_1 *AverageInternalTo_Panstarrs_DEV_1 (Average *in, off_t Nvalues, SecFilt *primary) { 146 OHANA_UNUSED_PARAM(primary); 145 147 146 148 off_t i; -
trunk/Ohana/src/libdvo/src/dvo_photcode_ops.c
r39277 r39457 467 467 /***/ 468 468 float PhotAve (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) { 469 OHANA_UNUSED_PARAM(average); 469 470 470 471 if (code == NULL) return NAN; … … 572 573 573 574 float PhotCalErr (Measure *measure, dvoMagClassType class) { 575 OHANA_UNUSED_PARAM(class); 574 576 575 577 float dMcal = measure[0].dMcal; … … 578 580 579 581 float PhotAveErr (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) { 582 OHANA_UNUSED_PARAM(average); 580 583 581 584 if (code == NULL) return NAN; … … 640 643 641 644 float PhotZeroPoint (Measure *measure, Average *average, SecFilt *secfilt) { 645 OHANA_UNUSED_PARAM(average); 646 OHANA_UNUSED_PARAM(secfilt); 642 647 643 648 int Np; … … 710 715 711 716 float PhotMstdev (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) { 717 OHANA_UNUSED_PARAM(average); 712 718 713 719 if (code == NULL) return NAN; … … 757 763 // return the number of detections in this filter (gpc1) 758 764 int PhotNcode (PhotCode *code, Average *average, SecFilt *secfilt) { 765 OHANA_UNUSED_PARAM(average); 759 766 760 767 if (code == NULL) return 0; … … 768 775 // return the number of detections in this filter (gpc1) 769 776 int PhotSecfiltFlags (PhotCode *code, Average *average, SecFilt *secfilt) { 777 OHANA_UNUSED_PARAM(average); 770 778 771 779 if (code == NULL) return 0; … … 778 786 779 787 int PhotNphot (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) { 788 OHANA_UNUSED_PARAM(average); 780 789 781 790 if (code == NULL) return 0; … … 824 833 825 834 float PhotAveFluxPSF (PhotCode *code, Average *average, SecFilt *secfilt) { 835 OHANA_UNUSED_PARAM(average); 826 836 827 837 int Ns; … … 836 846 837 847 float PhotAvedFluxPSF (PhotCode *code, Average *average, SecFilt *secfilt) { 848 OHANA_UNUSED_PARAM(average); 838 849 839 850 int Ns; … … 848 859 849 860 float PhotAveFluxKron (PhotCode *code, Average *average, SecFilt *secfilt) { 861 OHANA_UNUSED_PARAM(average); 850 862 851 863 int Ns; … … 860 872 861 873 float PhotAvedFluxKron (PhotCode *code, Average *average, SecFilt *secfilt) { 874 OHANA_UNUSED_PARAM(average); 862 875 863 876 int Ns; … … 872 885 873 886 float PhotMmin (PhotCode *code, Average *average, SecFilt *secfilt) { 887 OHANA_UNUSED_PARAM(average); 874 888 875 889 int Ns; … … 884 898 885 899 float PhotMmax (PhotCode *code, Average *average, SecFilt *secfilt) { 900 OHANA_UNUSED_PARAM(average); 886 901 887 902 int Ns; … … 896 911 897 912 float PhotUCdist (PhotCode *code, Average *average, SecFilt *secfilt) { 913 OHANA_UNUSED_PARAM(average); 898 914 899 915 int Ns; … … 921 937 // Xm is now (2014.07.03) stored as the chisq except in dvo formats which use as short 922 938 float PhotXm (PhotCode *code, Average *average, SecFilt *secfilt) { 939 OHANA_UNUSED_PARAM(average); 923 940 924 941 int Ns; … … 1188 1205 /***/ 1189 1206 float PhotFluxAve (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) { 1207 OHANA_UNUSED_PARAM(average); 1190 1208 1191 1209 if (code == NULL) return NAN; … … 1248 1266 1249 1267 float PhotFluxAveErr (PhotCode *code, Average *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) { 1268 OHANA_UNUSED_PARAM(average); 1250 1269 1251 1270 if (code == NULL) return NAN; … … 1610 1629 /***/ 1611 1630 float PhotAveTiny (PhotCode *code, AverageTiny *average, SecFilt *secfilt, dvoMagClassType class, dvoMagSourceType source) { 1631 OHANA_UNUSED_PARAM(average); 1612 1632 1613 1633 if (code == NULL) return NAN; … … 1746 1766 1747 1767 float PhotdMTiny (PhotCode *code, AverageTiny *average, SecFilt *secfilt) { 1768 OHANA_UNUSED_PARAM(average); 1748 1769 1749 1770 int Ns; … … 1759 1780 // Xm is now (2014.07.03) stored as the chisq except in dvo formats which use as short 1760 1781 float PhotXmTiny (PhotCode *code, AverageTiny *average, SecFilt *secfilt) { 1782 OHANA_UNUSED_PARAM(average); 1761 1783 1762 1784 int Ns; … … 1853 1875 } 1854 1876 1855 LENSFIELD(X11_sm_obj) ;1856 LENSFIELD(X12_sm_obj) ;1857 LENSFIELD(X22_sm_obj) ;1858 LENSFIELD(E1_sm_obj) ;1859 LENSFIELD(E2_sm_obj) ;1860 1861 LENSFIELD(X11_sh_obj) ;1862 LENSFIELD(X12_sh_obj) ;1863 LENSFIELD(X22_sh_obj) ;1864 LENSFIELD(E1_sh_obj) ;1865 LENSFIELD(E2_sh_obj) ;1866 1867 LENSFIELD(X11_sm_psf) ;1868 LENSFIELD(X12_sm_psf) ;1869 LENSFIELD(X22_sm_psf) ;1870 LENSFIELD(E1_sm_psf) ;1871 LENSFIELD(E2_sm_psf) ;1872 1873 LENSFIELD(X11_sh_psf) ;1874 LENSFIELD(X12_sh_psf) ;1875 LENSFIELD(X22_sh_psf) ;1876 LENSFIELD(E1_sh_psf) ;1877 LENSFIELD(E2_sh_psf) ;1878 1879 LENSFIELD( F_ApR5) ;1880 LENSFIELD(dF_ApR5) ;1881 LENSFIELD(sF_ApR5) ;1882 LENSFIELD(fF_ApR5) ;1883 1884 LENSFIELD( F_ApR6) ;1885 LENSFIELD(dF_ApR6) ;1886 LENSFIELD(sF_ApR6) ;1887 LENSFIELD(fF_ApR6) ;1888 1889 LENSFIELD( F_ApR7) ;1890 LENSFIELD(dF_ApR7) ;1891 LENSFIELD(sF_ApR7) ;1892 LENSFIELD(fF_ApR7) ;1893 1894 LENSFIELD(E1) ;1895 LENSFIELD(E2) ;1877 LENSFIELD(X11_sm_obj) 1878 LENSFIELD(X12_sm_obj) 1879 LENSFIELD(X22_sm_obj) 1880 LENSFIELD(E1_sm_obj) 1881 LENSFIELD(E2_sm_obj) 1882 1883 LENSFIELD(X11_sh_obj) 1884 LENSFIELD(X12_sh_obj) 1885 LENSFIELD(X22_sh_obj) 1886 LENSFIELD(E1_sh_obj) 1887 LENSFIELD(E2_sh_obj) 1888 1889 LENSFIELD(X11_sm_psf) 1890 LENSFIELD(X12_sm_psf) 1891 LENSFIELD(X22_sm_psf) 1892 LENSFIELD(E1_sm_psf) 1893 LENSFIELD(E2_sm_psf) 1894 1895 LENSFIELD(X11_sh_psf) 1896 LENSFIELD(X12_sh_psf) 1897 LENSFIELD(X22_sh_psf) 1898 LENSFIELD(E1_sh_psf) 1899 LENSFIELD(E2_sh_psf) 1900 1901 LENSFIELD( F_ApR5) 1902 LENSFIELD(dF_ApR5) 1903 LENSFIELD(sF_ApR5) 1904 LENSFIELD(fF_ApR5) 1905 1906 LENSFIELD( F_ApR6) 1907 LENSFIELD(dF_ApR6) 1908 LENSFIELD(sF_ApR6) 1909 LENSFIELD(fF_ApR6) 1910 1911 LENSFIELD( F_ApR7) 1912 LENSFIELD(dF_ApR7) 1913 LENSFIELD(sF_ApR7) 1914 LENSFIELD(fF_ApR7) 1915 1916 LENSFIELD(E1) 1917 LENSFIELD(E2) 1896 1918 1897 1919 # if (1) -
trunk/Ohana/src/libdvo/src/dvo_tiny_values.c
r39380 r39457 78 78 int free_tiny_values (Catalog *catalog) { 79 79 80 if (catalog[0].averageT) free (catalog[0].averageT); 81 if (catalog[0].measureT) free (catalog[0].measureT); 80 if (catalog[0].averageT) { 81 free (catalog[0].averageT); 82 catalog[0].averageT = NULL; 83 } 84 if (catalog[0].measureT) { 85 free (catalog[0].measureT); 86 catalog[0].measureT = NULL; 87 } 82 88 return (TRUE); 83 89 } -
trunk/Ohana/src/libdvo/src/dvo_util.c
r38553 r39457 1 #include <dvo_util.h> 2 1 3 // dvo_util.c 2 4 // This file contains a set of functions that provide simple read-only access to a dvo database 3 5 // 4 #include <dvo_util.h> 5 6 void dvoFree(void *ptr) 7 { 8 if (ptr) { 9 FREE(ptr); 10 } 11 } 12 13 dvoConfig * dvoConfigAlloc() 14 { 15 dvoConfig *config; 16 17 ALLOCATE(config, dvoConfig, 1); 18 19 memset(config, 0, sizeof(dvoConfig)); 20 return config; 21 } 22 23 void dvoConfigFree(dvoConfig *dvoConfig) 24 { 25 if (dvoConfig) { 26 if (dvoConfig->skyTable) { 27 SkyTableFree(dvoConfig->skyTable); 28 } 29 if (dvoConfig->images) { 30 gfits_db_free(&dvoConfig->imageDB); 31 } 32 FREE(dvoConfig); 33 } 34 } 35 36 dvoConfig *dvoConfigRead(int *argc, char **argv) 37 { 38 dvoConfig *dvoConfig = dvoConfigAlloc(); 39 char MasterPhotcodeFile[256]; 40 41 char *file = SelectConfigFile(argc, argv, "ptolemy"); 42 char *configData = LoadConfigFile(file); 43 if (!configData) { 44 fprintf(stderr, "ERROR: can't find configuration file %s\n", file); 45 if (file) { 46 FREE(file); 47 } 48 exit(3); 49 } 50 FREE (file); 51 file = NULL; 52 53 ScanConfig (configData, "GSCFILE", "%s", 0, dvoConfig->gscfile); 54 ScanConfig (configData, "CATDIR", "%s", 0, dvoConfig->catdir); 55 ScanConfig (configData, "CATMODE", "%s", 0, dvoConfig->catmode); 56 ScanConfig (configData, "CATFORMAT", "%s", 0, dvoConfig->catformat); 57 ScanConfig (configData, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 58 if (!ScanConfig (configData, "SKY_DEPTH", "%d", 0, &dvoConfig->skyDepth)) { 59 dvoConfig->skyDepth = 2; 60 } 61 if (!ScanConfig (configData, "SKY_TABLE", "%s", 0, dvoConfig->skyTableFile)) { 62 dvoConfig->skyTableFile[0] = 0; 63 } 64 65 snprintf (dvoConfig->photcodeFile, 256, "%s/Photcodes.dat", dvoConfig->catdir); 66 if (!LoadPhotcodes (dvoConfig->photcodeFile, MasterPhotcodeFile, FALSE)) { 67 fprintf (stderr, "error loading photcode table %s or master file %s\n", 68 dvoConfig->photcodeFile, MasterPhotcodeFile); 69 exit (1); 70 } 71 72 double zero_point; 73 ScanConfig (configData, "ZERO_PT", "%lf", 0, &zero_point); 74 SetZeroPoint (zero_point); 6 7 void dvoFree(void *ptr) { 8 if (ptr) { 9 FREE(ptr); 10 } 11 } 12 13 dvoConfig *dvoConfigAlloc() { 14 dvoConfig *config; 15 16 ALLOCATE(config, dvoConfig, 1); 17 18 memset(config, 0, sizeof(dvoConfig)); 19 return config; 20 } 21 22 void dvoConfigFree(dvoConfig *dvoConfig) { 23 if (dvoConfig) { 24 if (dvoConfig->skyTable) { 25 SkyTableFree(dvoConfig->skyTable); 26 } 27 if (dvoConfig->images) { 28 gfits_db_free(&dvoConfig->imageDB); 29 } 30 FREE(dvoConfig); 31 } 32 } 33 34 dvoConfig *dvoConfigRead(int *argc, char **argv) { 35 dvoConfig *dvoConfig = dvoConfigAlloc(); 36 char MasterPhotcodeFile[256]; 37 38 char *file = SelectConfigFile(argc, argv, "ptolemy"); 39 char *configData = LoadConfigFile(file); 40 if (!configData) { 41 fprintf(stderr, "ERROR: can't find configuration file %s\n", file); 42 if (file) { 43 FREE(file); 44 } 45 exit(3); 46 } 47 FREE (file); 48 file = NULL; 49 50 ScanConfig (configData, "GSCFILE", "%s", 0, dvoConfig->gscfile); 51 ScanConfig (configData, "CATDIR", "%s", 0, dvoConfig->catdir); 52 ScanConfig (configData, "CATMODE", "%s", 0, dvoConfig->catmode); 53 ScanConfig (configData, "CATFORMAT", "%s", 0, dvoConfig->catformat); 54 ScanConfig (configData, "PHOTCODE_FILE", "%s", 0, MasterPhotcodeFile); 55 if (!ScanConfig (configData, "SKY_DEPTH", "%d", 0, &dvoConfig->skyDepth)) { 56 dvoConfig->skyDepth = 2; 57 } 58 if (!ScanConfig (configData, "SKY_TABLE", "%s", 0, dvoConfig->skyTableFile)) { 59 dvoConfig->skyTableFile[0] = 0; 60 } 61 62 snprintf (dvoConfig->photcodeFile, 256, "%s/Photcodes.dat", dvoConfig->catdir); 63 if (!LoadPhotcodes (dvoConfig->photcodeFile, MasterPhotcodeFile, FALSE)) { 64 fprintf (stderr, "error loading photcode table %s or master file %s\n", 65 dvoConfig->photcodeFile, MasterPhotcodeFile); 66 exit (1); 67 } 68 69 double zero_point; 70 ScanConfig (configData, "ZERO_PT", "%lf", 0, &zero_point); 71 SetZeroPoint (zero_point); 75 72 76 73 #if (DVO_UTIL_READ_CAMERA_CONFIG) 77 // at one point I thought reading the camera configuration might be useful78 // but we didn't need it79 if (!ScanConfig (configData, "CAMERA_CONFIG", "%s", 0, dvoConfig->cameraConfig)) {80 fprintf (stderr, "can't find CAMERA_CONFIG in configuration\n");81 exit (3);82 }83 char * cameraConfigData = LoadConfigFile(dvoConfig->cameraConfig);84 if (!cameraConfigData) {85 fprintf (stderr, "failed to load %s\n", dvoConfig->cameraConfig);86 exit (3);87 }88 89 ScanConfig (cameraConfigData, "NCCD", "%d", 1, &dvoConfig->nCCD);74 // at one point I thought reading the camera configuration might be useful 75 // but we didn't need it 76 if (!ScanConfig (configData, "CAMERA_CONFIG", "%s", 0, dvoConfig->cameraConfig)) { 77 fprintf (stderr, "can't find CAMERA_CONFIG in configuration\n"); 78 exit (3); 79 } 80 char * cameraConfigData = LoadConfigFile(dvoConfig->cameraConfig); 81 if (!cameraConfigData) { 82 fprintf (stderr, "failed to load %s\n", dvoConfig->cameraConfig); 83 exit (3); 84 } 85 86 ScanConfig (cameraConfigData, "NCCD", "%d", 1, &dvoConfig->nCCD); 90 87 #endif 91 88 92 return (dvoConfig); 93 } 94 95 int dvoLoadImages(dvoConfig *dvoConfig) 96 { 97 if (dvoConfig->images) { 98 return TRUE; 99 } 100 101 char filename[256]; 89 return (dvoConfig); 90 } 91 92 int dvoLoadImages(dvoConfig *dvoConfig) { 93 if (dvoConfig->images) { 94 return TRUE; 95 } 96 97 char filename[256]; 102 98 103 snprintf (filename, 256, "%s/Images.dat", dvoConfig->catdir); 104 105 gfits_db_init (&dvoConfig->imageDB); 106 dvoConfig->imageDB.lockstate = LCK_SOFT; 107 dvoConfig->imageDB.timeout = 120.0; 108 109 if (!gfits_db_lock (&dvoConfig->imageDB, filename)) { 110 fprintf (stderr, "error opening image catalog %s (1)\n", filename); 111 return (FALSE); 112 } 113 114 if (dvoConfig->imageDB.dbstate == LCK_EMPTY) { 115 fprintf (stderr, "note: image catalog is empty\n"); 116 ALLOCATE (dvoConfig->images, Image, 1); 117 dvoConfig->nImages = 1; 118 return (TRUE); 119 } 120 121 int status = dvo_image_load (&dvoConfig->imageDB, TRUE, FALSE); 122 gfits_db_close (&dvoConfig->imageDB); 123 124 if (!status) { 125 fprintf (stderr, "problem loading image database table\n"); 126 return (FALSE); 127 } 128 129 dvoConfig->images = gfits_table_get_Image (&dvoConfig->imageDB.ftable, &dvoConfig->nImages, &dvoConfig->imageDB.scaledValue, &dvoConfig->imageDB.nativeOrder); 130 if (!dvoConfig->images) { 131 fprintf (stderr, "problem loading images\n"); 132 return (FALSE); 133 } 134 99 snprintf (filename, 256, "%s/Images.dat", dvoConfig->catdir); 100 101 gfits_db_init (&dvoConfig->imageDB); 102 dvoConfig->imageDB.lockstate = LCK_SOFT; 103 dvoConfig->imageDB.timeout = 120.0; 104 105 if (!gfits_db_lock (&dvoConfig->imageDB, filename)) { 106 fprintf (stderr, "error opening image catalog %s (1)\n", filename); 107 return (FALSE); 108 } 109 110 if (dvoConfig->imageDB.dbstate == LCK_EMPTY) { 111 fprintf (stderr, "note: image catalog is empty\n"); 112 ALLOCATE (dvoConfig->images, Image, 1); 113 dvoConfig->nImages = 1; 135 114 return (TRUE); 136 } 137 Image *dvoImageByExternID(dvoConfig *dvoConfig, int sourceID, int externID) 138 { 139 int i; 115 } 116 117 int status = dvo_image_load (&dvoConfig->imageDB, TRUE, FALSE); 118 gfits_db_close (&dvoConfig->imageDB); 119 120 if (!status) { 121 fprintf (stderr, "problem loading image database table\n"); 122 return (FALSE); 123 } 124 125 dvoConfig->images = gfits_table_get_Image (&dvoConfig->imageDB.ftable, &dvoConfig->nImages, &dvoConfig->imageDB.scaledValue, &dvoConfig->imageDB.nativeOrder); 126 if (!dvoConfig->images) { 127 fprintf (stderr, "problem loading images\n"); 128 return (FALSE); 129 } 130 131 return (TRUE); 132 } 133 134 Image *dvoImageByExternID(dvoConfig *dvoConfig, unsigned short sourceID, unsigned int externID) { 135 136 unsigned int i; 140 137 141 if (!dvoLoadImages(dvoConfig)) return NULL; 142 143 for (i=0; i<dvoConfig->nImages; i++) { 144 Image *image = dvoConfig->images + i; 145 if ((image->externID == externID) && (image->sourceID == sourceID)) { 146 BuildChipMatch(dvoConfig->images, dvoConfig->nImages); 147 return image; 148 } 149 } 150 fprintf(stderr, "can't find image for %d %d\n", sourceID, externID); 151 return NULL; 152 } 153 154 SkyTable *dvoLoadSkyTable(dvoConfig *dvoConfig) 155 { 156 if (!dvoConfig->skyTable) { 157 char *skyfile = ""; 158 dvoConfig->skyTable = SkyTableLoadOptimal(dvoConfig->catdir, skyfile, dvoConfig->gscfile, 159 FALSE, dvoConfig->skyDepth, 0); 160 } 161 162 if (dvoConfig->skyTable == NULL) { 163 fprintf(stderr, "failed to load SkyTable\n"); 164 return NULL; 165 } 166 167 SkyTableSetFilenames(dvoConfig->skyTable, dvoConfig->catdir, "cpt"); 168 169 return dvoConfig->skyTable; 170 } 171 172 SkyList *dvoSkyListByExternID(dvoConfig *dvoConfig, int sourceID, int externID, Image **ppImage) 173 { 174 Image *image = dvoImageByExternID(dvoConfig, sourceID, externID); 175 if (image == NULL) { 176 // fprintf(stderr, "can't find image for %d %d\n", sourceID, externID); 177 return NULL; 178 } 179 180 if (dvoLoadSkyTable(dvoConfig) == NULL) { 181 fprintf(stderr, "failed to load Sky table\n"); 182 return NULL; 183 } 184 SkyList *skylist = SkyListByImage(dvoConfig->skyTable, -1, image); 185 if (!skylist->Nregions) { 186 fprintf(stderr, "failed to find SkyList for image %d %d\n", sourceID, externID); 187 return NULL; 188 } 189 190 *ppImage = image; 191 192 return skylist; 193 } 194 195 off_t dvoGetDetections(SkyList *skylist, int imageID, dvoDetection **results, int *pMaxDetID) 196 { 138 if (!dvoLoadImages(dvoConfig)) return NULL; 139 140 for (i = 0; i < dvoConfig->nImages; i++) { 141 Image *image = dvoConfig->images + i; 142 if ((image->externID == externID) && (image->sourceID == sourceID)) { 143 BuildChipMatch(dvoConfig->images, dvoConfig->nImages); 144 return image; 145 } 146 } 147 fprintf(stderr, "can't find image for %d %d\n", sourceID, externID); 148 return NULL; 149 } 150 151 SkyTable *dvoLoadSkyTable(dvoConfig *dvoConfig) { 152 if (!dvoConfig->skyTable) { 153 char *skyfile = ""; 154 dvoConfig->skyTable = SkyTableLoadOptimal(dvoConfig->catdir, skyfile, dvoConfig->gscfile, 155 FALSE, dvoConfig->skyDepth, 0); 156 } 157 158 if (dvoConfig->skyTable == NULL) { 159 fprintf(stderr, "failed to load SkyTable\n"); 160 return NULL; 161 } 162 163 SkyTableSetFilenames(dvoConfig->skyTable, dvoConfig->catdir, "cpt"); 164 165 return dvoConfig->skyTable; 166 } 167 168 SkyList *dvoSkyListByExternID(dvoConfig *dvoConfig, int sourceID, int externID, Image **ppImage) { 169 Image *image = dvoImageByExternID(dvoConfig, sourceID, externID); 170 if (image == NULL) { 171 // fprintf(stderr, "can't find image for %d %d\n", sourceID, externID); 172 return NULL; 173 } 174 175 if (dvoLoadSkyTable(dvoConfig) == NULL) { 176 fprintf(stderr, "failed to load Sky table\n"); 177 return NULL; 178 } 179 SkyList *skylist = SkyListByImage(dvoConfig->skyTable, -1, image); 180 if (!skylist->Nregions) { 181 fprintf(stderr, "failed to find SkyList for image %d %d\n", sourceID, externID); 182 return NULL; 183 } 184 185 *ppImage = image; 186 187 return skylist; 188 } 189 190 off_t dvoGetDetections(SkyList *skylist, unsigned int imageID, dvoDetection **results, unsigned int *pMaxDetID) { 197 191 int GetMeasures = 1; 198 192 int reg; … … 204 198 *pMaxDetID = -1; 205 199 for (reg=0; reg< skylist->Nregions; reg++) { 206 /* lock, load, unlock catalog */ 207 Catalog catalog; 208 209 dvo_catalog_init (&catalog, TRUE); 210 catalog.filename = skylist->filename[reg]; 211 catalog.catflags = GetMeasures ? DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT : DVO_LOAD_AVERAGE | DVO_LOAD_SECFILT; 212 catalog.Nsecfilt = 0; 213 214 // an error exit status here is a significant error 215 if (!dvo_catalog_open (&catalog, NULL, FALSE, "r")) { 216 fprintf (stderr, "ERROR: failure to open catalog file %s\n", catalog.filename); 217 exit (2); 200 /* lock, load, unlock catalog */ 201 Catalog catalog; 202 203 dvo_catalog_init (&catalog, TRUE); 204 catalog.filename = skylist->filename[reg]; 205 catalog.catflags = GetMeasures ? DVO_LOAD_AVERAGE | DVO_LOAD_MEASURE | DVO_LOAD_SECFILT : DVO_LOAD_AVERAGE | DVO_LOAD_SECFILT; 206 catalog.Nsecfilt = 0; 207 208 // an error exit status here is a significant error 209 if (!dvo_catalog_open (&catalog, NULL, FALSE, "r")) { 210 fprintf (stderr, "ERROR: failure to open catalog file %s\n", catalog.filename); 211 exit (2); 212 } 213 dvo_catalog_unlock (&catalog); 214 215 off_t Nmeasure = catalog.Nmeasure; 216 217 off_t i; 218 for (i=0; i< Nmeasure; i++) { 219 Measure *m = catalog.measure + i; 220 if (m->imageID != imageID) { 221 continue; 218 222 } 219 dvo_catalog_unlock (&catalog); 220 221 off_t Nmeasure = catalog.Nmeasure; 222 223 off_t i; 224 for (i=0; i< Nmeasure; i++) { 225 Measure *m = catalog.measure + i; 226 if (m->imageID != imageID) { 227 continue; 228 } 229 Average *a = catalog.average + m->averef; 223 Average *a = catalog.average + m->averef; 230 224 231 dvoDetection *det = detections + Ndetect;232 233 det->valid = 1;234 det->ave = *a;235 det->meas = *m;225 dvoDetection *det = detections + Ndetect; 226 227 det->valid = 1; 228 det->ave = *a; 229 det->meas = *m; 236 230 #ifdef notdfe 237 det->objID = a->objID;238 det->catID = m->catID;239 det->detID = m->detID;240 det->pspsObjID = a->extID;241 det->pspsDetID = m->extID;231 det->objID = a->objID; 232 det->catID = m->catID; 233 det->detID = m->detID; 234 det->pspsObjID = a->extID; 235 det->pspsDetID = m->extID; 242 236 #endif 243 237 244 if ((int) det->meas.detID > *pMaxDetID) { 245 *pMaxDetID = det->meas.detID; 246 } 247 248 Ndetect++; 249 CHECK_REALLOCATE(detections, dvoDetection, detectionsArrayLength, Ndetect, 1000); 238 if (det->meas.detID > *pMaxDetID) { 239 *pMaxDetID = det->meas.detID; 250 240 } 251 241 252 dvo_catalog_free (&catalog); 242 Ndetect++; 243 CHECK_REALLOCATE(detections, dvoDetection, detectionsArrayLength, Ndetect, 1000); 244 } 245 246 dvo_catalog_free (&catalog); 253 247 } 254 248 size_t NInvalidDetID = 0; 255 249 if (Ndetect) { 256 dvoDetection *sorted; 257 ALLOCATE(sorted, dvoDetection, *pMaxDetID + 1); 258 259 memset(sorted, 0, sizeof(dvoDetection) * *pMaxDetID); 260 off_t i; 261 for (i = 0; i < Ndetect; i++) { 262 263 if (detections[i].meas.detID < 0 || detections[i].meas.detID > (*pMaxDetID + 1)) 264 NInvalidDetID++; 265 else 266 sorted[detections[i].meas.detID] = detections[i]; 267 } 268 *results = sorted; 250 dvoDetection *sorted; 251 ALLOCATE(sorted, dvoDetection, *pMaxDetID + 1); 252 253 memset(sorted, 0, sizeof(dvoDetection) * *pMaxDetID); 254 off_t i; 255 for (i = 0; i < Ndetect; i++) { 256 257 // if (detections[i].meas.detID < 0 || detections[i].meas.detID > (*pMaxDetID + 1)) 258 259 if (detections[i].meas.detID > (*pMaxDetID + 1)) 260 NInvalidDetID++; 261 else 262 sorted[detections[i].meas.detID] = detections[i]; 263 } 264 *results = sorted; 269 265 } else { 270 *results = NULL;266 *results = NULL; 271 267 } 272 268 -
trunk/Ohana/src/libdvo/src/dvosorts.c
r36084 r39457 76 76 /* sort a coordinate pair (X,Y) and the associated index (S) */ 77 77 void sort_coords_indexonly (double *X, double *Y, off_t *S, off_t N) { 78 OHANA_UNUSED_PARAM(Y); 78 79 79 80 # define SWAPFUNC(A,B){ off_t itmp; \ -
trunk/Ohana/src/libdvo/src/match_image.c
r31635 r39457 1 1 # include "dvo.h" 2 2 3 off_t match_image (Image *image, off_t Nimage, unsigned intT, short int S) {3 off_t match_image (Image *image, off_t Nimage, e_time T, short int S) { 4 4 5 5 off_t N, Nlo, Nhi, N1, N2; … … 37 37 } 38 38 39 off_t match_image_subset (Image *image, off_t *subset, off_t Nsubset, unsigned intT, short int S) {39 off_t match_image_subset (Image *image, off_t *subset, off_t Nsubset, e_time T, short int S) { 40 40 41 41 off_t N, Nlo, Nhi, N1, N2; -
trunk/Ohana/src/libdvo/src/mosaic_astrom.c
r39325 r39457 64 64 images[i].coords.mosaic = &images[j].coords; 65 65 } 66 67 free (DISentry); 68 free (DIStzero); 69 66 70 return (TRUE); 67 71 } -
trunk/Ohana/src/libfits/extern/gzip.c
r38986 r39457 122 122 123 123 z_stream stream; 124 int i,err;124 int err; 125 125 126 126 stream.next_in = (Bytef*)source; … … 140 140 if (EXTRA_VERBOSE) { 141 141 fprintf (stderr, "inp cmp: "); 142 unsigned long int i; 142 143 for (i = 0; i < sourceLen; i++) { 143 144 fprintf (stderr, "0x%02hhx ", source[i]); … … 165 166 if (EXTRA_VERBOSE) { 166 167 fprintf (stderr, "out cmp: "); 168 unsigned long int i; 167 169 for (i = 0; i < stream.total_out; i++) { 168 170 fprintf (stderr, "0x%02hhx ", dest[i]); … … 182 184 183 185 z_stream stream; 184 int i,err;186 int err; 185 187 186 188 stream.next_in = (Bytef*)source; … … 200 202 if (EXTRA_VERBOSE) { 201 203 fprintf (stderr, "inp unc: "); 204 unsigned long int i; 202 205 for (i = 0; i < sourceLen; i++) { 203 206 fprintf (stderr, "0x%02hhx ", source[i]); … … 226 229 if (EXTRA_VERBOSE) { 227 230 fprintf (stderr, "out unc: "); 231 unsigned long int i; 228 232 for (i = 0; i < stream.total_out; i++) { 229 233 fprintf (stderr, "0x%02hhx ", dest[i]); -
trunk/Ohana/src/libfits/header/F_write_H.c
r38553 r39457 25 25 myAssert (myBlock->startblock == OHANA_MEMMAGIC, "bad memory"); 26 26 myAssert (myBlock->endblock == OHANA_MEMMAGIC, "bad memory"); 27 myAssert (myBlock->size >= header[0].datasize, "overflow");27 myAssert (myBlock->size >= (size_t) header[0].datasize, "overflow"); 28 28 } 29 29 # endif -
trunk/Ohana/src/libfits/include/gfitsio.h
r39394 r39457 193 193 194 194 int gfits_uncompress_image PROTO((Header *header, Matrix *matrix, FTable *ftable)); 195 int gfits_uncompress_data PROTO((char *zdata, int Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *outdata, int *Nout,int Nout_alloc, int out_pixsize));196 int gfits_distribute_data PROTO((Matrix *matrix, char *data, int Ndata, int bitpix, int *otile, int oblank,int *ztile, int zblank, float zscale, float zzero));197 198 int gfits_compress_data PROTO((char *zdata, int *Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *rawdata,int Nraw, int raw_pixsize, int Nx, int Ny));199 int gfits_compress_image PROTO((Header *header, Matrix *matrix, FTable *ftable, int *Ztile, char *zcmptype));200 int gfits_collect_data PROTO((Matrix *matrix, char *raw, int Nraw, int raw_pixsize, int *otile, int oblank,int *ztile, int zblank, float zscale, float zzero));195 int gfits_uncompress_data PROTO((char *zdata, unsigned long int Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *outdata, unsigned long int *Nout, unsigned long int Nout_alloc, int out_pixsize)); 196 int gfits_distribute_data PROTO((Matrix *matrix, char *data, unsigned long int Ndata, int bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero)); 197 198 int gfits_compress_data PROTO((char *zdata, unsigned long int *Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *rawdata, unsigned long int Nraw, int raw_pixsize, int Nx, int Ny)); 199 int gfits_compress_image PROTO((Header *header, Matrix *matrix, FTable *ftable, unsigned long int *Ztile, char *zcmptype)); 200 int gfits_collect_data PROTO((Matrix *matrix, char *raw, unsigned long int Nraw, int raw_pixsize, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero)); 201 201 202 202 int gfits_copy_keywords_compress PROTO((Header *srchead, Header *tgthead)); 203 203 int gfits_swap_raw PROTO((Matrix *matrix)); 204 204 205 off_t gfits_tile_size PROTO((Matrix *matrix, int *otile, int *ztile));206 int gfits_imtile_maxsize PROTO((Matrix *matrix, int *ztile));207 int gfits_imtile_count PROTO((Matrix *matrix, int *ztile, int *ntile));205 off_t gfits_tile_size PROTO((Matrix *matrix, int *otile, unsigned long int *ztile)); 206 int gfits_imtile_maxsize PROTO((Matrix *matrix, unsigned long int *ztile)); 207 int gfits_imtile_count PROTO((Matrix *matrix, unsigned long int *ztile, int *ntile)); 208 208 int gfits_imtile_start PROTO((Matrix *matrix, int *otile)); 209 int gfits_imtile_next PROTO((Matrix *matrix, int *ztile, int *ntile, int *otile));209 int gfits_imtile_next PROTO((Matrix *matrix, unsigned long int *ztile, int *ntile, int *otile)); 210 210 211 211 int gfits_extension_is_compressed_image PROTO((Header *header)); 212 212 int gfits_extension_is_compressed_table PROTO((Header *header)); 213 int gfits_byteswap_zdata PROTO((char *zdata, int Nzdata, int pixsize));213 int gfits_byteswap_zdata PROTO((char *zdata, off_t Nzdata, int pixsize)); 214 214 int gfits_compressed_data_pixsize PROTO((char *cmptype, int out_bitpix, char **optname, char **optvalue, int Noptions)); 215 215 int gfits_uncompressed_data_pixsize PROTO((char *cmptype, int out_bitpix, char **optname, char **optvalue, int Noptions)); … … 279 279 int gfits_write_Theader PROTO((char *filename, Header *header)); 280 280 281 int gfits_compress_table PROTO((FTable *srctable, FTable *tgttable, int ztilelen, char *zcmptype));281 int gfits_compress_table PROTO((FTable *srctable, FTable *tgttable, unsigned long int ztilelen, char *zcmptype)); 282 282 int gfits_uncompress_table PROTO((FTable *srctable, FTable *tgttable)); 283 283 -
trunk/Ohana/src/libfits/matrix/F_compress_M.c
r38441 r39457 4 4 # define VERBOSE_DUMP 0 5 5 6 int gfits_collect_gzp2 (Matrix *matrix, char *raw, int Nraw, int raw_bitpix, int *otile, int oblank,int *ztile, int zblank, float zscale, float zzero);6 int gfits_collect_gzp2 (Matrix *matrix, char *raw, unsigned long int Nraw, int raw_bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero); 7 7 8 8 // the user needs to specify the various compression options: … … 23 23 # define ESCAPE { fprintf (stderr, "error in %s @ line %d\n", __func__, __LINE__); goto escape; } 24 24 25 int gfits_compress_image (Header *header, Matrix *matrix, FTable *ftable, int *Ztile, char *zcmptype) {25 int gfits_compress_image (Header *header, Matrix *matrix, FTable *ftable, unsigned long int *Ztile, char *zcmptype) { 26 26 27 27 int i; … … 33 33 char *zdata = NULL; 34 34 35 int *ztile = Ztile;35 unsigned long int *ztile = Ztile; 36 36 37 37 Header *theader = ftable->header; … … 41 41 // determine the number of tiles (from ztile[] and image size) 42 42 if (!ztile) { 43 ALLOCATE (ztile, int, matrix->Naxes);43 ALLOCATE (ztile, unsigned long int, matrix->Naxes); 44 44 ztile[0] = matrix->Naxis[0]; 45 45 for (i = 1; i < matrix->Naxes; i++) ztile[i] = 1; … … 99 99 for (i = 0; i < header->Naxes; i++) { 100 100 snprintf (keyword, 10, "ZTILE%d", i + 1); 101 if (!gfits_modify (theader, keyword, "% d", 1, ztile[i])) ESCAPE;101 if (!gfits_modify (theader, keyword, "%lu", 1, ztile[i])) ESCAPE; 102 102 } 103 103 … … 157 157 158 158 // size (in pixels) of the largest tile 159 int max_tile_size = gfits_imtile_maxsize (matrix, ztile);159 unsigned long int max_tile_size = gfits_imtile_maxsize (matrix, ztile); 160 160 161 161 // size of a pixel in the raw pixel buffer (before compression) … … 179 179 180 180 // allocate the buffer for compression work 181 int Nzdata_alloc = raw_pixsize*max_tile_size + 100;181 unsigned long int Nzdata_alloc = raw_pixsize*max_tile_size + 100; 182 182 ALLOCATE (raw, char, raw_pixsize*max_tile_size); 183 183 ALLOCATE (zdata, char, Nzdata_alloc); … … 191 191 192 192 // size of the current tile in pixels 193 int Nraw = gfits_tile_size (matrix, otile, ztile);193 unsigned long int Nraw = gfits_tile_size (matrix, otile, ztile); 194 194 195 195 // copy the raw pixels from their native matrix locations to the temporary output buffer … … 216 216 if (!gfits_byteswap_zdata (raw, Nraw * raw_pixsize, raw_pixsize)) ESCAPE; 217 217 } 218 int Nzdata = Nzdata_alloc; // available space, replaced with actual output size on compression218 unsigned long int Nzdata = Nzdata_alloc; // available space, replaced with actual output size on compression 219 219 220 220 if (VERBOSE_DUMP && (i == 0)) { … … 223 223 for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", raw[k]); if (k % 4 == 3) fprintf (stderr, " "); } 224 224 fprintf (stderr, "\n"); 225 fprintf (stderr, "Nzdata: % d-> ", Nzdata);225 fprintf (stderr, "Nzdata: %lu -> ", Nzdata); 226 226 } 227 227 … … 231 231 if (VERBOSE_DUMP && (i == 0)) { 232 232 int k; 233 fprintf (stderr, "% d\n", Nzdata);233 fprintf (stderr, "%lu\n", Nzdata); 234 234 fprintf (stderr, "cmp SWP: "); 235 235 for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", zdata[k]); if (k % 4 == 3) fprintf (stderr, " "); } … … 290 290 291 291 int gfits_copy_keywords_compress (Header *srchead, Header *tgthead) { 292 292 OHANA_UNUSED_PARAM(tgthead); 293 OHANA_UNUSED_PARAM(srchead); 294 295 # if (0) 293 296 int i; 294 297 295 298 for (i = 0; i < srchead->datasize; i += FT_LINE_LENGTH) { 296 299 } 300 # endif 301 297 302 return TRUE; 298 303 } … … 303 308 // * ztile gives the size of the i-th dimension of the current tile 304 309 // * raw_bitpix defines the size and type of the raw buffer 305 int gfits_collect_data (Matrix *matrix, char *raw, int Nraw, int raw_bitpix, int *otile, int oblank,int *ztile, int zblank, float zscale, float zzero) {306 307 int i, j, start, offset, coord, Nline;308 int *counter = NULL;309 int *Ztile = NULL;310 311 ALLOCATE (counter, int, matrix->Naxes); // counter for current row in tile to copy312 ALLOCATE (Ztile, int, matrix->Naxes); // true sizes of this tile (in pixels)310 int gfits_collect_data (Matrix *matrix, char *raw, unsigned long int Nraw, int raw_bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero) { 311 312 int i, k, start, offset, coord, Nline; 313 unsigned int *counter = NULL; 314 unsigned long int *Ztile = NULL; 315 316 ALLOCATE (counter, unsigned int, matrix->Naxes); // counter for current row in tile to copy 317 ALLOCATE (Ztile, unsigned long int, matrix->Naxes); // true sizes of this tile (in pixels) 313 318 314 319 for (i = 0; i < matrix->Naxes; i++) { … … 343 348 // this macro is used at the inner switch to run the actual loop 344 349 # define SCALE_AND_DIST_INT_PRINT(TYPE, SIZE, INTYPE) { \ 350 unsigned long int j; \ 345 351 TYPE *TILEptr = (TYPE *) &matrix->buffer[SIZE*(offset + start)]; \ 346 352 for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) { \ … … 356 362 // this macro is used at the inner switch to run the actual loop 357 363 # define SCALE_AND_DIST_INT(OTYPE, OSIZE) { \ 364 unsigned long int j; \ 358 365 OTYPE *TILEptr = (OTYPE *) &matrix->buffer[OSIZE*(offset + start)]; \ 359 366 for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) { \ … … 370 377 // this macro is used at the inner switch to run the actual loop 371 378 # define SCALE_AND_DIST_FLOAT(OTYPE, OSIZE) { \ 379 unsigned long int j; \ 372 380 OTYPE *TILEptr = (OTYPE *) &matrix->buffer[OSIZE*(offset + start)]; \ 373 381 for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) { \ … … 419 427 420 428 // update the counters, carrying to the next dimension if needed 421 for ( j = 1; j < matrix->Naxes; j++) {422 counter[ j] ++;423 if (counter[ j] == Ztile[j]) {424 counter[ j] = 0;429 for (k = 1; k < matrix->Naxes; k++) { 430 counter[k] ++; 431 if (counter[k] == Ztile[k]) { 432 counter[k] = 0; 425 433 } else { 426 434 break; 427 435 } 428 436 } 429 if ( j== matrix->Naxes) assert (i == Nline - 1); // we should be done here...437 if (k == matrix->Naxes) assert (i == Nline - 1); // we should be done here... 430 438 431 439 // Naxes = 3 … … 435 443 // determine the offset of the next line relative to the start position 436 444 offset = counter[matrix->Naxes - 1]; 437 for ( j = matrix->Naxes - 2; j >= 0; j--) {438 offset = offset*matrix->Naxis[ j] + counter[j];445 for (k = matrix->Naxes - 2; k >= 0; k--) { 446 offset = offset*matrix->Naxis[k] + counter[k]; 439 447 } 440 448 } … … 453 461 // * ztile gives the size of the i-th dimension of the current tile 454 462 // * raw_bitpix defines the size and type of the raw buffer 455 int gfits_collect_gzp2 (Matrix *matrix, char *raw, int Nraw, int raw_bitpix, int *otile, int oblank, int *ztile, int zblank, float zscale, float zzero) { 456 457 int i, j, k; 458 int *counter = NULL; 459 int *Ztile = NULL; 460 461 ALLOCATE (counter, int, matrix->Naxes); // counter for current row in tile to copy 462 ALLOCATE (Ztile, int, matrix->Naxes); // true sizes of this tile (in pixels) 463 int gfits_collect_gzp2 (Matrix *matrix, char *raw, unsigned long int Nraw, int raw_bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero) { 464 OHANA_UNUSED_PARAM(oblank); 465 OHANA_UNUSED_PARAM(zblank); 466 OHANA_UNUSED_PARAM(zzero); 467 OHANA_UNUSED_PARAM(zscale); 468 469 unsigned long int i, j; 470 unsigned int *counter = NULL; 471 unsigned long int *Ztile = NULL; 472 473 ALLOCATE (counter, unsigned int, matrix->Naxes); // counter for current row in tile to copy 474 ALLOCATE (Ztile, unsigned long int, matrix->Naxes); // true sizes of this tile (in pixels) 463 475 464 for (i = 0; i < matrix->Naxes; i++) { 465 counter[i] = 0; 466 Ztile[i] = MIN ((matrix->Naxis[i] - otile[i]*ztile[i]), ztile[i]); 476 int k; 477 for (k = 0; k < matrix->Naxes; k++) { 478 counter[k] = 0; 479 Ztile[k] = MIN ((matrix->Naxis[k] - otile[k]*ztile[k]), ztile[k]); 467 480 } 468 481 469 482 // number of lines in the tile (in pixels) 470 int Nline = 1;471 int Npix = matrix->Naxis[0];472 for ( i = 1; i < matrix->Naxes; i++) {473 Nline *= Ztile[ i];474 Npix *= matrix->Naxis[ i];483 unsigned long int Nline = 1; 484 unsigned long int Npix = matrix->Naxis[0]; 485 for (k = 1; k < matrix->Naxes; k++) { 486 Nline *= Ztile[k]; 487 Npix *= matrix->Naxis[k]; 475 488 } 476 489 … … 482 495 // start = otile[0]*ztile[0] + Naxis[0]*(otile[1]*ztile[1] + Naxis[1]*(otile[2]*ztile[2] + ...)); 483 496 int start = otile[matrix->Naxes-1]*ztile[matrix->Naxes-1]; 484 for ( i = matrix->Naxes - 2; i >= 0; i--) {485 int coord = otile[i]*ztile[i];486 start = start*matrix->Naxis[ i] + coord;497 for (k = matrix->Naxes - 2; k >= 0; k--) { 498 unsigned long int coord = otile[k]*ztile[k]; 499 start = start*matrix->Naxis[k] + coord; 487 500 } 488 501 … … 519 532 520 533 // update the counters, carrying to the next dimension if needed 521 for (j = 1; j < matrix->Naxes; j++) { 522 counter[j] ++; 523 if (counter[j] == Ztile[j]) { 524 counter[j] = 0; 534 int axis; 535 for (axis = 1; axis < matrix->Naxes; axis++) { 536 counter[axis] ++; 537 if (counter[axis] == Ztile[axis]) { 538 counter[axis] = 0; 525 539 } else { 526 540 break; 527 541 } 528 542 } 529 if ( j== matrix->Naxes) assert (i == Nline - 1); // we should be done here...543 if (axis == matrix->Naxes) assert (i == Nline - 1); // we should be done here... 530 544 531 545 // Naxes = 3 … … 535 549 // determine the offset of the next line relative to the start position 536 550 offset = counter[matrix->Naxes - 1]; 537 for ( j = matrix->Naxes - 2; j >= 0; j--) {538 offset = offset*matrix->Naxis[ j] + counter[j];551 for (axis = matrix->Naxes - 2; axis >= 0; axis--) { 552 offset = offset*matrix->Naxis[axis] + counter[axis]; 539 553 } 540 554 } -
trunk/Ohana/src/libfits/matrix/F_compress_data.c
r38986 r39457 2 2 # include <gfitsio.h> 3 3 # include <zlib.h> 4 5 /* functions defined in ricecomp.c */ 6 int fits_rcomp(int a[], int nx, unsigned char *c, int clen, int nblock); 7 int fits_rcomp_short(short a[], int nx, unsigned char *c, int clen, int nblock); 8 int fits_rcomp_byte(char a[], int nx, unsigned char *c, int clen, int nblock); 9 int fits_rdecomp (unsigned char *c, int clen, unsigned int array[], int nx, int nblock); 10 int fits_rdecomp_short (unsigned char *c, int clen, unsigned short array[], int nx, int nblock); 11 int fits_rdecomp_byte (unsigned char *c, int clen, unsigned char array[], int nx, int nblock); 12 13 /* functions defined in fits_hcompress.c */ 14 # define LONGLONG long long 15 int fits_hcompress(int *a, int ny, int nx, int scale, char *output, long *nbytes, int *status); 16 int fits_hcompress64(LONGLONG *a, int ny, int nx, int scale, char *output, long *nbytes, int *status); 17 18 /* functions defined in fits_hdeccompress.c */ 19 int fits_hdecompress(unsigned char *input, int smooth, int *a, int *ny, int *nx, int *scale, int *status); 20 int fits_hdecompress64(unsigned char *input, int smooth, LONGLONG *a, int *ny, int *nx, int *scale, int *status); 21 22 /* functions defined in pliocomp.c */ 23 int pl_p2li (int *pxsrc, int xs, short *lldst, int npix); 24 int pl_l2pi (short *ll_src, int xs, int *px_dst, int npix); 25 26 /* functions defined in gzip.c */ 27 int gfits_gz_stripheader (unsigned char *data, int *ndata); 28 int gfits_uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen); 29 int gfits_compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen); 4 # include <gfits_compress.h> 30 5 31 6 # define ESCAPE(RET) { fprintf (stderr, "gzip error in %s @ %s:%d\n", __func__, __FILE__, __LINE__); return (RET); } … … 33 8 // XXX I'm putting Nx and Ny on the argument list -- only used by hcompress 34 9 // with a little work, these could go on the option list 35 int gfits_compress_data (char *zdata, int *Nzdata, char *cmptype, 36 char **optname, char **optvalue, int Nopt, 37 char *rawdata, int Nrawpix, int rawpix_size, 38 int Nx, int Ny) { 10 int gfits_compress_data (char *zdata, unsigned long int *Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *rawdata, unsigned long int Nrawpix, int rawpix_size, int Nx, int Ny) { 39 11 40 int Nout;41 12 int status; 42 13 … … 68 39 69 40 if (!strcasecmp(cmptype, "RICE_1") || !strcasecmp(cmptype, "RICE_ONE")) { 41 long int Nout; 70 42 int i, blocksize; 71 43 // look for the BLOCKSIZE … … 85 57 // fprintf (stderr, "%d comp bytes; %d uncomp 'pixels', totals: %d %d\n", Nzdata, Npix, Ninsum, Noutsum); 86 58 87 int k;88 89 59 switch (rawpix_size) { 90 60 case 4: … … 98 68 99 69 if (0) { 100 fprintf (stderr, "Nout: %d, Nrawpix: %d\n", Nout, Nrawpix); 70 long int k; 71 fprintf (stderr, "Nout: %lu, Nrawpix: %lu\n", Nout, Nrawpix); 101 72 fprintf (stderr, "cmp inp: "); 102 73 for (k = 0; k < Nout; k++) { fprintf (stderr, "%02hhx", zdata[k]); if (k % 2) fprintf (stderr, " "); } … … 119 90 return (FALSE); 120 91 } 121 if (Nout > *Nzdata) {122 fprintf (stderr, "buffer overrun! % d out, %davailable\n", Nout, *Nzdata);92 if (Nout > (long int) *Nzdata) { 93 fprintf (stderr, "buffer overrun! %ld out, %lu available\n", Nout, *Nzdata); 123 94 return FALSE; 124 95 } 125 *Nzdata = Nout;96 *Nzdata = (unsigned long int) Nout; 126 97 return TRUE; 127 98 } … … 129 100 if (!strcasecmp(cmptype, "PLIO_1")) { 130 101 // note the fortan starting point: zdata is decremented at start 131 Nout = pl_p2li ((int *) rawdata, 1, (short *) zdata, Nrawpix);102 int Nout = pl_p2li ((int *) rawdata, 1, (short *) zdata, Nrawpix); 132 103 *Nzdata = Nout; 133 104 if (!Nout) return (FALSE); -
trunk/Ohana/src/libfits/matrix/F_compress_utils.c
r38441 r39457 17 17 18 18 typedef struct { 19 int *ztile; // max size of a tile (edge tiles may be smaller)19 unsigned long int *ztile; // max size of a tile (edge tiles may be smaller) 20 20 int *otile; // counter for current tile (eg, for (2,3,0) otile[0] = 2, otile[1] = 3, otile[2] = 0) 21 21 int *ntile; // number of tiles in dimension [i] … … 23 23 24 24 // advance the otile counter. 25 int gfits_imtile_next (Matrix *matrix, int *ztile, int *ntile, int *otile) { 25 int gfits_imtile_next (Matrix *matrix, unsigned long int *ztile, int *ntile, int *otile) { 26 OHANA_UNUSED_PARAM(ztile); 26 27 27 28 int i; … … 53 54 54 55 // how many tiles needed for this image (given ztile[]) 55 int gfits_imtile_count (Matrix *matrix, int *ztile, int *ntile) {56 int gfits_imtile_count (Matrix *matrix, unsigned long int *ztile, int *ntile) { 56 57 57 58 int i; … … 67 68 68 69 // how many tiles needed for this image (given ztile[]) 69 int gfits_imtile_maxsize (Matrix *matrix, int *ztile) {70 int gfits_imtile_maxsize (Matrix *matrix, unsigned long int *ztile) { 70 71 71 72 int i; 72 73 73 int max_tile_size = 1;74 unsigned long int max_tile_size = 1; 74 75 for (i = 0; i < matrix->Naxes; i++) { 75 76 max_tile_size *= ztile[i]; … … 80 81 81 82 // true sizes of this tile (in pixels) 82 off_t gfits_tile_size (Matrix *matrix, int *otile, int *ztile) {83 off_t gfits_tile_size (Matrix *matrix, int *otile, unsigned long int *ztile) { 83 84 84 85 off_t i, Npixels, Ndimen; … … 93 94 } 94 95 95 int gfits_byteswap_zdata (char *zdata, int Nzdata, int pixsize) {96 int gfits_byteswap_zdata (char *zdata, off_t Nzdata, int pixsize) { 96 97 97 98 # define DOSWAP(A,B) { char tmp = A; A = B; B = tmp; } … … 99 100 # ifdef BYTE_SWAP 100 101 101 int i;102 off_t i; 102 103 103 104 // fprintf (stderr, "swapping %d bytes in pix of size %d bytes...\n", Nzdata, pixsize); -
trunk/Ohana/src/libfits/matrix/F_convert_format.c
r38062 r39457 19 19 in = (inMode *) matrix[0].buffer; \ 20 20 for (i = 0; i < Npixels; i++, out++, in++) \ 21 if (*in == inBlank) {\21 if (*in == (inMode) inBlank) { \ 22 22 *out = (MY_NAN); \ 23 23 } else { \ … … 32 32 in = (inMode *) matrix[0].buffer; \ 33 33 for (i = 0; i < Npixels; i++, out++, in++) \ 34 if (*in == inBlank) { \34 if (*in == (inMode) inBlank) { \ 35 35 *out = (MY_NAN); \ 36 36 } else { \ … … 45 45 in = (inMode *)matrix[0].buffer + Npixels - 1; \ 46 46 for (i = 0; i < Npixels; i++, out--, in--) \ 47 if (*in == inBlank) { \47 if (*in == (inMode) inBlank) { \ 48 48 *out = (MY_NAN); \ 49 49 } else { \ -
trunk/Ohana/src/libfits/matrix/F_uncompress_M.c
r38989 r39457 4 4 # define VERBOSE_DUMP 0 5 5 6 int gfits_distribute_gzp2 (Matrix *matrix, char *raw, int Nraw, int raw_bitpix, int *otile, int oblank, int *ztile, int zblank, float zscale, float zzero); 7 8 # define ESCAPE { \ 9 fprintf (stderr, "error in %s @ line %d\n", __func__, __LINE__); \ 10 if (ztile != NULL) free (ztile); \ 11 if (optname != NULL) { \ 12 for (j = 0; j < Noptions; j++) { \ 13 free (optname[j]); \ 14 free (optvalue[j]); \ 15 } \ 16 free (optname); \ 17 free (optvalue); \ 18 } \ 19 if (out != NULL) free (out); \ 20 if (otile != NULL) free (otile); \ 21 if (ntile != NULL) free (ntile); \ 22 return (FALSE); } 23 24 # define MOD_KEYWORD(ZNAME,NAME,TYPE,IN,OUT) { \ 6 int gfits_distribute_gzp2 (Matrix *matrix, char *raw, unsigned long int Nraw, int raw_bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero); 7 8 # define ESCAPE { \ 9 fprintf (stderr, "error in %s @ line %d\n", __func__, __LINE__); \ 10 if (ztile != NULL) free (ztile); \ 11 if (optname != NULL) { \ 12 int opt; \ 13 for (opt = 0; opt < Noptions; opt++) { \ 14 free (optname[opt]); \ 15 free (optvalue[opt]); \ 16 } \ 17 free (optname); \ 18 free (optvalue); \ 19 } \ 20 if (out != NULL) free (out); \ 21 if (otile != NULL) free (otile); \ 22 if (ntile != NULL) free (ntile); \ 23 return (FALSE); } 24 25 # define MOD_KEYWORD(ZNAME,NAME,TYPE,IN,OUT) { \ 25 26 if (gfits_scan (header, ZNAME, TYPE, 1, IN)) { \ 26 gfits_modify (header, NAME, TYPE, 1, OUT); \27 } \27 gfits_modify (header, NAME, TYPE, 1, OUT); \ 28 } \ 28 29 gfits_delete (header, ZNAME, 1); } 29 30 30 # define MOD_KEYWORD_ALT(ZNAME,NAME,TYPE,IN,OUT) { \31 # define MOD_KEYWORD_ALT(ZNAME,NAME,TYPE,IN,OUT) { \ 31 32 if (gfits_scan_alt (header, ZNAME, TYPE, 1, IN)) { \ 32 gfits_modify_alt (header, NAME, TYPE, 1, OUT); \33 } \33 gfits_modify_alt (header, NAME, TYPE, 1, OUT); \ 34 } \ 34 35 gfits_delete (header, ZNAME, 1); } 35 36 36 # define MOD_KEYWORD_REQUIRED(ZNAME,NAME,TYPE,IN,OUT) { \37 if (!gfits_scan (header, ZNAME, TYPE, 1, IN)) ESCAPE;\38 gfits_delete (header, ZNAME, 1);\39 gfits_modify (header, NAME, TYPE, 1, OUT); }37 # define MOD_KEYWORD_REQUIRED(ZNAME,NAME,TYPE,IN,OUT) { \ 38 if (!gfits_scan (header, ZNAME, TYPE, 1, IN)) ESCAPE; \ 39 gfits_delete (header, ZNAME, 1); \ 40 gfits_modify (header, NAME, TYPE, 1, OUT); } 40 41 41 42 int gfits_uncompress_image (Header *header, Matrix *matrix, FTable *ftable) { 42 43 44 int status, zimage; 43 45 off_t Nzdata, Nzrows, zcol; 44 int i, j, status, zimage, Nout,max_tile_size;46 unsigned long int max_tile_size; 45 47 char cmptype[80]; 46 48 char zaxis[10], naxis[10], key[10], word[81], exttype[81], checksum[81], datasum[81]; … … 49 51 float zscale, zzero; 50 52 51 int *ztile = NULL;53 unsigned long int *ztile = NULL; 52 54 int *otile = NULL; 53 55 int *ntile = NULL; … … 77 79 MOD_KEYWORD_REQUIRED ("ZNAXIS", "NAXIS", "%d", &header->Naxes, header->Naxes); 78 80 79 for (i = 0; i < header->Naxes; i++) { 80 snprintf (zaxis, 10, "ZNAXIS%d", i + 1); 81 snprintf (naxis, 10, "NAXIS%d", i + 1); 82 MOD_KEYWORD_REQUIRED (zaxis, naxis, OFF_T_FMT, &header->Naxis[i], header->Naxis[i]); 81 int axis; 82 for (axis = 0; axis < header->Naxes; axis++) { 83 snprintf (zaxis, 10, "ZNAXIS%d", axis + 1); 84 snprintf (naxis, 10, "NAXIS%d", axis + 1); 85 MOD_KEYWORD_REQUIRED (zaxis, naxis, OFF_T_FMT, &header->Naxis[axis], header->Naxis[axis]); 83 86 } 84 87 … … 86 89 // the actual tile size may be smaller at the edge of a dimension. if the ZTILEn 87 90 // entries are not found, default to [Nx,1,1,...] 88 ALLOCATE (ztile, int, header->Naxes);89 if (!gfits_scan (header, "ZTILE1", "% d", 1, &ztile[0])) {91 ALLOCATE (ztile, unsigned long int, header->Naxes); 92 if (!gfits_scan (header, "ZTILE1", "%lu", 1, &ztile[0])) { 90 93 ztile[0] = header->Naxis[0]; 91 for ( i = 1; i < header->Naxes; i++) {92 ztile[ i] = 1;94 for (axis = 1; axis < header->Naxes; axis++) { 95 ztile[axis] = 1; 93 96 } 94 97 } else { 95 98 gfits_delete (header, "ZTILE1", 1); 96 for ( i = 1; i < header->Naxes; i++) {97 snprintf (key, 10, "ZTILE%d", i+ 1);98 if (!gfits_scan (header, key, "% d", 1, &ztile[i])) ESCAPE;99 for (axis = 1; axis < header->Naxes; axis++) { 100 snprintf (key, 10, "ZTILE%d", axis + 1); 101 if (!gfits_scan (header, key, "%lu", 1, &ztile[axis])) ESCAPE; 99 102 gfits_delete (header, key, 1); 100 103 } … … 199 202 // find the COMPRESSED_DATA column (format should be 1PB, 1PI, 1PJ) 200 203 // is it required that this be the only column? 201 for (i = 1; TRUE; i++) { 202 snprintf (key, 10, "TTYPE%d", i); 204 int colnum; 205 for (colnum = 1; TRUE; colnum++) { 206 snprintf (key, 10, "TTYPE%d", colnum); 203 207 if (!gfits_scan (ftable->header, key, "%s", 1, word)) ESCAPE; 204 208 if (!strcmp (word, "COMPRESSED_DATA")) break; 205 209 } 206 zcol = i;210 zcol = colnum; 207 211 208 212 if (!gfits_varlength_column_define (ftable, &zdef, zcol)) ESCAPE; … … 220 224 ALLOCATE (ntile, int, matrix->Naxes); 221 225 max_tile_size = 1; 222 for ( i = 0; i < matrix->Naxes; i++) {223 otile[ i] = 0;224 ntile[ i] = (matrix->Naxis[i] % ztile[i]) ? (matrix->Naxis[i] / ztile[i] + 1) : (matrix->Naxis[i] / ztile[i]);225 max_tile_size *= ztile[ i];226 227 // ztile[ i] is the default (or max) tile size in the i-th dimension228 // ntile[ i] is the number of tiles in the i-th dimension229 // otile[ i] is the current output tile counter in the i-th dimension226 for (axis = 0; axis < matrix->Naxes; axis++) { 227 otile[axis] = 0; 228 ntile[axis] = (matrix->Naxis[axis] % ztile[axis]) ? (matrix->Naxis[axis] / ztile[axis] + 1) : (matrix->Naxis[axis] / ztile[axis]); 229 max_tile_size *= ztile[axis]; 230 231 // ztile[axis] is the default (or max) tile size in the i-th dimension 232 // ntile[axis] is the number of tiles in the i-th dimension 233 // otile[axis] is the current output tile counter in the i-th dimension 230 234 } 231 235 … … 254 258 // fprintf (stderr, "raw_pixsize: %d, cmp_pixsize: %d, tile_pixsize: %d, raw_bitpix: %d\n", raw_pixsize, cmp_pixsize, tile_pixsize, raw_bitpix); 255 259 256 int Nout_alloc = raw_pixsize*max_tile_size;260 unsigned long int Nout_alloc = raw_pixsize*max_tile_size; 257 261 ALLOCATE (out, char, Nout_alloc); 258 262 … … 271 275 272 276 // expected output size for this tile 273 Nout = raw_pixsize*gfits_tile_size (matrix, otile, ztile);277 unsigned long Nout = raw_pixsize*gfits_tile_size (matrix, otile, ztile); 274 278 275 279 zdata = gfits_varlength_column_pointer (ftable, &zdef, row, &Nzdata); … … 297 301 for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", zdata[k]); if (k % 4 == 3) fprintf (stderr, " "); } 298 302 fprintf (stderr, "\n"); 299 fprintf (stderr, "Nout : % d-> ", Nout);303 fprintf (stderr, "Nout : %lu -> ", Nout); 300 304 } 301 305 … … 307 311 if (VERBOSE_DUMP && (row == 0)) { 308 312 int k; 309 fprintf (stderr, "% d\n", Nout);313 fprintf (stderr, "%lu\n", Nout); 310 314 fprintf (stderr, "unc swp: "); 311 315 for (k = 0; k < 64; k++) { fprintf (stderr, "%02hhx", out[k]); if (k % 4 == 3) fprintf (stderr, " "); } … … 315 319 if (!strcasecmp(cmptype, "GZIP_1")) { 316 320 // Nout is number of pixels 317 if (!gfits_byteswap_zdata (out, Nout * raw_pixsize, raw_pixsize)) ESCAPE;321 if (!gfits_byteswap_zdata (out, (off_t) (Nout * raw_pixsize), raw_pixsize)) ESCAPE; 318 322 } 319 323 … … 340 344 341 345 // update the tile counters, carrying to the next dimension if needed 342 for ( j = 0; j < matrix->Naxes; j++) {343 otile[ j] ++;344 if (otile[ j] == ntile[j]) {345 otile[ j] = 0;346 for (axis = 0; axis < matrix->Naxes; axis++) { 347 otile[axis] ++; 348 if (otile[axis] == ntile[axis]) { 349 otile[axis] = 0; 346 350 } else { 347 351 break; … … 352 356 FREE (ztile); 353 357 if (optname != NULL) { 354 for (j = 0; j < Noptions; j++) { 355 FREE (optname[j]); 356 FREE (optvalue[j]); 358 int opt; 359 for (opt = 0; opt < Noptions; opt++) { 360 FREE (optname[opt]); 361 FREE (optvalue[opt]); 357 362 } 358 363 FREE (optname); … … 366 371 367 372 // bitpix is the input data size/type 368 int gfits_distribute_data (Matrix *matrix, char *raw, int Nraw, int raw_bitpix, int *otile, int oblank,int *ztile, int zblank, float zscale, float zzero) {369 370 int i, j;371 int *counter = NULL;372 int *Ztile = NULL;373 374 ALLOCATE (counter, int, matrix->Naxes);375 ALLOCATE (Ztile, int, matrix->Naxes);373 int gfits_distribute_data (Matrix *matrix, char *raw, unsigned long int Nraw, int raw_bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero) { 374 375 int axis; 376 unsigned int *counter = NULL; 377 unsigned long int *Ztile = NULL; 378 379 ALLOCATE (counter, unsigned int, matrix->Naxes); 380 ALLOCATE (Ztile, unsigned long int, matrix->Naxes); 376 381 377 382 // counter for current row in tile to copy 378 383 // true sizes of this tile (in pixels) 379 for ( i = 0; i < matrix->Naxes; i++) {380 counter[ i] = 0;381 Ztile[ i] = MIN ((matrix->Naxis[i] - otile[i]*ztile[i]), ztile[i]);384 for (axis = 0; axis < matrix->Naxes; axis++) { 385 counter[axis] = 0; 386 Ztile[axis] = MIN ((matrix->Naxis[axis] - otile[axis]*ztile[axis]), ztile[axis]); 382 387 } 383 388 384 389 // number of lines in the tile (in pixels) 385 int Nline = 1;386 for ( i = 1; i < matrix->Naxes; i++) {387 Nline *= Ztile[ i];390 unsigned long int Nline = 1; 391 for (axis = 1; axis < matrix->Naxes; axis++) { 392 Nline *= Ztile[axis]; 388 393 } 389 394 … … 394 399 // start = otile[0]*ztile[0] + otile[1]*ztile[1]*Naxis[0] + otile[2]*ztile[2]*Naxis[0]*Naxis[1] + ...; 395 400 // start = otile[0]*ztile[0] + Naxis[0]*(otile[1]*ztile[1] + Naxis[1]*(otile[2]*ztile[2] + ...)); 396 int start = otile[matrix->Naxes-1]*ztile[matrix->Naxes-1];397 for ( i = matrix->Naxes - 2; i >= 0; i--) {398 int coord = otile[i]*ztile[i];399 start = start*matrix->Naxis[ i] + coord;401 unsigned long int start = otile[matrix->Naxes-1]*ztile[matrix->Naxes-1]; 402 for (axis = matrix->Naxes - 2; axis >= 0; axis--) { 403 unsigned long int coord = otile[axis]*ztile[axis]; 404 start = start*matrix->Naxis[axis] + coord; 400 405 } 401 406 402 407 // pixel offset in output array relative to tile start 403 int offset = 0;408 unsigned long int offset = 0; 404 409 405 410 int directCopy = (zzero == 0.0) && (zscale == 1.0); 406 411 407 412 # define SCALE_AND_DIST_INT_PRINT(TYPE, SIZE) { \ 413 unsigned long j; \ 408 414 TYPE *TILEptr = (TYPE *) &matrix->buffer[SIZE*(offset + start)]; \ 409 415 for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) { \ … … 418 424 // this macro is used at the inner switch to run the actual loop 419 425 # define SCALE_AND_DIST_INT(OTYPE, OSIZE) { \ 426 unsigned long j; \ 420 427 OTYPE *TILEptr = (OTYPE *) &matrix->buffer[OSIZE*(offset + start)]; \ 421 428 for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) { \ … … 432 439 // this macro is used at the inner switch to run the actual loop 433 440 # define SCALE_AND_DIST_FLOAT(OTYPE, OSIZE) { \ 441 unsigned long j; \ 434 442 OTYPE *TILEptr = (OTYPE *) &matrix->buffer[OSIZE*(offset + start)]; \ 435 443 for (j = 0; j < Ztile[0]; j++, TILEptr++, RAWptr++) { \ … … 461 469 case 8: SCALE_AND_DIST_INT (char, 1); break; \ 462 470 case 16: SCALE_AND_DIST_INT (short, 2); break; \ 463 case 32: SCALE_AND_DIST_INT (int, 4); break; \471 case 32: SCALE_AND_DIST_INT (int, 4); break; \ 464 472 case -32: SCALE_AND_DIST_FLOAT (float, 4); break; \ 465 473 case -64: SCALE_AND_DIST_FLOAT (double, 8); break; \ … … 468 476 469 477 // loop over lines in the tile 478 unsigned long int i; 470 479 for (i = 0; i < Nline; i++) { 471 480 switch (raw_bitpix) { … … 479 488 480 489 // update the counters, carrying to the next dimension if needed 481 for ( j = 1; j < matrix->Naxes; j++) {482 counter[ j] ++;483 if (counter[ j] == Ztile[j]) {484 counter[ j] = 0;490 for (axis = 1; axis < matrix->Naxes; axis++) { 491 counter[axis] ++; 492 if (counter[axis] == Ztile[axis]) { 493 counter[axis] = 0; 485 494 } else { 486 495 break; 487 496 } 488 497 } 489 if ( j== matrix->Naxes) assert (i == Nline - 1); // we should be done here...498 if (axis == matrix->Naxes) assert (i == Nline - 1); // we should be done here... 490 499 491 500 // Naxes = 3 … … 495 504 // determine the offset of the next line relative to the start position 496 505 offset = counter[matrix->Naxes - 1]; 497 for ( j = matrix->Naxes - 2; j >= 0; j--) {498 offset = offset*matrix->Naxis[ j] + counter[j];506 for (axis = matrix->Naxes - 2; axis >= 0; axis--) { 507 offset = offset*matrix->Naxis[axis] + counter[axis]; 499 508 } 500 509 } … … 506 515 507 516 // bitpix is the input data size/type 508 int gfits_distribute_gzp2 (Matrix *matrix, char *raw, int Nraw, int raw_bitpix, int *otile, int oblank, int *ztile, int zblank, float zscale, float zzero) { 509 510 int i, j, k; 511 int *counter = NULL; 512 int *Ztile = NULL; 513 514 ALLOCATE (counter, int, matrix->Naxes); 515 ALLOCATE (Ztile, int, matrix->Naxes); 517 int gfits_distribute_gzp2 (Matrix *matrix, char *raw, unsigned long int Nraw, int raw_bitpix, int *otile, int oblank, unsigned long int *ztile, int zblank, float zscale, float zzero) { 518 OHANA_UNUSED_PARAM(oblank); 519 OHANA_UNUSED_PARAM(zblank); 520 OHANA_UNUSED_PARAM(zzero); 521 OHANA_UNUSED_PARAM(zscale); 522 523 int axis; 524 unsigned int *counter = NULL; 525 unsigned long int *Ztile = NULL; 526 527 ALLOCATE (counter, unsigned int, matrix->Naxes); 528 ALLOCATE (Ztile, unsigned long int, matrix->Naxes); 516 529 517 530 // counter for current row in tile to copy 518 531 // true sizes of this tile (in pixels) 519 for ( i = 0; i < matrix->Naxes; i++) {520 counter[ i] = 0;521 Ztile[ i] = MIN ((matrix->Naxis[i] - otile[i]*ztile[i]), ztile[i]);532 for (axis = 0; axis < matrix->Naxes; axis++) { 533 counter[axis] = 0; 534 Ztile[axis] = MIN ((matrix->Naxis[axis] - otile[axis]*ztile[axis]), ztile[axis]); 522 535 } 523 536 524 537 // number of lines in the tile (in pixels) 525 int Nline = 1;526 int Npix = matrix->Naxis[0];527 for ( i = 1; i < matrix->Naxes; i++) {528 Nline *= Ztile[ i];529 Npix *= matrix->Naxis[ i];538 unsigned long int Nline = 1; 539 unsigned long int Npix = matrix->Naxis[0]; 540 for (axis = 1; axis < matrix->Naxes; axis++) { 541 Nline *= Ztile[axis]; 542 Npix *= matrix->Naxis[axis]; 530 543 } 531 544 … … 536 549 // start = otile[0]*ztile[0] + otile[1]*ztile[1]*Naxis[0] + otile[2]*ztile[2]*Naxis[0]*Naxis[1] + ...; 537 550 // start = otile[0]*ztile[0] + Naxis[0]*(otile[1]*ztile[1] + Naxis[1]*(otile[2]*ztile[2] + ...)); 538 int start = otile[matrix->Naxes-1]*ztile[matrix->Naxes-1];539 for ( i = matrix->Naxes - 2; i >= 0; i--) {540 int coord = otile[i]*ztile[i];541 start = start*matrix->Naxis[ i] + coord;551 unsigned long int start = otile[matrix->Naxes-1]*ztile[matrix->Naxes-1]; 552 for (axis = matrix->Naxes - 2; axis >= 0; axis--) { 553 unsigned long int coord = otile[axis]*ztile[axis]; 554 start = start*matrix->Naxis[axis] + coord; 542 555 } 543 556 … … 553 566 554 567 // pixel offset in output array relative to tile start 555 int offset = 0;568 unsigned long int offset = 0; 556 569 557 570 static int pass = 0; 571 int k; 558 572 for (k = 0; k < size; k++) { 573 unsigned long int i; 559 574 for (i = 0; i < Nline; i++) { 560 575 # ifdef BYTE_SWAP … … 564 579 # endif 565 580 char *rawptr = &raw[i*Ztile[0] + k*Nraw]; 581 unsigned long j; 566 582 for (j = 0; j < Ztile[0]; j++, srcptr += size, rawptr ++) { 567 583 if (FALSE && (i == 0) && (j < 4) && (pass == 0)) { … … 574 590 575 591 // update the counters, carrying to the next dimension if needed 576 for ( j = 1; j < matrix->Naxes; j++) {577 counter[ j] ++;578 if (counter[ j] == Ztile[j]) {579 counter[ j] = 0;592 for (axis = 1; axis < matrix->Naxes; axis++) { 593 counter[axis] ++; 594 if (counter[axis] == Ztile[axis]) { 595 counter[axis] = 0; 580 596 } else { 581 597 break; 582 598 } 583 599 } 584 if ( j== matrix->Naxes) assert (i == Nline - 1); // we should be done here...600 if (axis == matrix->Naxes) assert (i == Nline - 1); // we should be done here... 585 601 586 602 // Naxes = 3 … … 590 606 // determine the offset of the next line relative to the start position 591 607 offset = counter[matrix->Naxes - 1]; 592 for ( j = matrix->Naxes - 2; j >= 0; j--) {593 offset = offset*matrix->Naxis[ j] + counter[j];608 for (axis = matrix->Naxes - 2; axis >= 0; axis--) { 609 offset = offset*matrix->Naxis[axis] + counter[axis]; 594 610 } 595 611 } -
trunk/Ohana/src/libfits/matrix/F_uncompress_data.c
r38441 r39457 2 2 # include <gfitsio.h> 3 3 # include <zlib.h> 4 5 /* functions defined in ricecomp.c */ 6 int fits_rcomp(int a[], int nx, unsigned char *c, int clen, int nblock); 7 int fits_rdecomp (unsigned char *c, int clen, unsigned int array[], int nx, int nblock); 8 int fits_rdecomp_short (unsigned char *c, int clen, unsigned short array[], int nx, int nblock); 9 int fits_rdecomp_byte (unsigned char *c, int clen, unsigned char array[], int nx, int nblock); 10 11 /* functions defined in fits_hcompress.c */ 12 # define LONGLONG long long 13 int fits_hcompress(int *a, int ny, int nx, int scale, char *output, long *nbytes, int *status); 14 int fits_hcompress64(LONGLONG *a, int ny, int nx, int scale, char *output, long *nbytes, int *status); 15 16 /* functions defined in fits_hdeccompress.c */ 17 int fits_hdecompress(unsigned char *input, int smooth, int *a, int *ny, int *nx, int *scale, int *status); 18 int fits_hdecompress64(unsigned char *input, int smooth, LONGLONG *a, int *ny, int *nx, int *scale, int *status); 19 20 /* functions defined in pliocomp.c */ 21 int pl_p2li (int *pxsrc, int xs, short *lldst, int npix); 22 int pl_l2pi (short *ll_src, int xs, int *px_dst, int npix); 23 24 /* functions defined in gzip.c */ 25 int gfits_gz_stripheader (unsigned char *data, int *ndata); 26 int gfits_uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen); 4 # include <gfits_compress.h> 27 5 28 6 # define ESCAPE(RET) { fprintf (stderr, "gzip error in %s @ %s:%d\n", __func__, __FILE__, __LINE__); return (RET); } 29 7 30 int gfits_uncompress_data (char *zdata, int Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *outdata, int *Nout,int Nout_alloc, int out_pixsize) {8 int gfits_uncompress_data (char *zdata, unsigned long Nzdata, char *cmptype, char **optname, char **optvalue, int Nopt, char *outdata, unsigned long int *Nout, unsigned long int Nout_alloc, int out_pixsize) { 31 9 32 10 int status; … … 78 56 79 57 int status = FALSE; 80 int Npix = *Nout / out_pixsize; 81 int k; 58 unsigned long int Npix = *Nout / out_pixsize; 82 59 83 60 switch (out_pixsize) { … … 88 65 case 2: 89 66 if (0) { 90 fprintf (stderr, "Nout: %d, Nrawpix: %d\n", Nzdata, Npix); 67 unsigned long int k; 68 fprintf (stderr, "Nout: %lu, Nrawpix: %lu\n", Nzdata, Npix); 91 69 fprintf (stderr, "cmp out: "); 92 70 for (k = 0; k < Nzdata; k++) { fprintf (stderr, "0x%02hhx ", zdata[k]); } … … 112 90 113 91 if (!strcasecmp(cmptype, "PLIO_1")) { 92 int Ntru = *Nout; 114 93 int Npix; 115 Npix = pl_l2pi ((short *) zdata, 1, (int *) outdata, *Nout);116 if (Npix != *Nout) {94 Npix = pl_l2pi ((short *) zdata, 1, (int *) outdata, Ntru); 95 if (Npix != Ntru) { 117 96 fprintf (stderr, "error in plio decompression\n"); 118 97 return (FALSE); … … 122 101 123 102 if (!strcasecmp(cmptype, "HCOMPRESS_1")) { 103 unsigned long int Ntru = *Nout; 124 104 int Nx, Ny, scale; 125 105 status = 0; … … 132 112 // fprintf (stderr, "decompression yields image %d x %d (scale: %d)\n", Nx, Ny, scale); 133 113 134 if (Nx * Ny != *Nout) { 114 unsigned long Npix = Nx * Ny; 115 if (Npix != Ntru) { 135 116 fprintf (stderr, "error in hdecompress: mismatched output size\n"); 136 117 return (FALSE); -
trunk/Ohana/src/libfits/table/F_compress_T.c
r39358 r39457 23 23 # define ESCAPE { fprintf (stderr, "error in %s @ line %d\n", __func__, __LINE__); goto escape; } 24 24 25 int gfits_collect_table_data (FTable *table, TableField *field, char *raw, int row_start,int Nrows);26 int gfits_collect_table_gzp2 (FTable *table, TableField *field, char *raw, int row_start,int Nrows);25 int gfits_collect_table_data (FTable *table, TableField *field, char *raw, unsigned long int row_start, unsigned long int Nrows); 26 int gfits_collect_table_gzp2 (FTable *table, TableField *field, char *raw, unsigned long int row_start, unsigned long int Nrows); 27 27 28 28 static float timeSum1 = 0.0; … … 51 51 } 52 52 53 int gfits_compress_table (FTable *srctable, FTable *tgttable, int ztilelen, char *zcmptype) { 54 55 int i, j; 53 int gfits_compress_table (FTable *srctable, FTable *tgttable, unsigned long int ztilelen, char *zcmptype) { 56 54 57 55 char keyword[81]; … … 69 67 gettimeofday (&startTimer, (void *) NULL); 70 68 71 int Ntile, ztilelast;69 unsigned long int Ntile, ztilelast; 72 70 if (!ztilelen) ztilelen = srcheader->Naxis[1]; 73 71 … … 104 102 105 103 ALLOCATE_ZERO (fields, TableField, Nfields); 106 for (i = 0; i < Nfields; i++) { 107 snprintf (keyword, 80, "TTYPE%d", i+1); 108 if (!gfits_scan (srcheader, keyword, "%s", 1, fields[i].ttype)) ESCAPE; 109 if (!gfits_scan_alt (srcheader, keyword, "%C", 1, fields[i].ttype_cmt)) ESCAPE; 104 105 for (int field = 0; field < Nfields; field++) { 106 snprintf (keyword, 80, "TTYPE%d", field+1); 107 if (!gfits_scan (srcheader, keyword, "%s", 1, fields[field].ttype)) ESCAPE; 108 if (!gfits_scan_alt (srcheader, keyword, "%C", 1, fields[field].ttype_cmt)) ESCAPE; 110 109 111 110 // TUNIT is not mandatory 112 snprintf (keyword, 80, "TUNIT%d", i+1);113 if (!gfits_scan (srcheader, keyword, "%s", 1, fields[ i].tunit)) {114 fields[ i].tunit[0] = 0;111 snprintf (keyword, 80, "TUNIT%d", field+1); 112 if (!gfits_scan (srcheader, keyword, "%s", 1, fields[field].tunit)) { 113 fields[field].tunit[0] = 0; 115 114 } else { 116 if (!gfits_scan_alt (srcheader, keyword, "%C", 1, fields[ i].tunit_cmt)) ESCAPE;115 if (!gfits_scan_alt (srcheader, keyword, "%C", 1, fields[field].tunit_cmt)) ESCAPE; 117 116 } 118 117 119 snprintf (keyword, 80, "TFORM%d", i+1);120 if (!gfits_scan (srcheader, keyword, "%s", 1, fields[ i].tformat)) ESCAPE;121 if (!gfits_scan_alt (srcheader, keyword, "%C", 1, fields[ i].tformat_cmt)) ESCAPE;118 snprintf (keyword, 80, "TFORM%d", field+1); 119 if (!gfits_scan (srcheader, keyword, "%s", 1, fields[field].tformat)) ESCAPE; 120 if (!gfits_scan_alt (srcheader, keyword, "%C", 1, fields[field].tformat_cmt)) ESCAPE; 122 121 123 122 // for now we set all fields to the requested type. since I do not yet know the column data types I cannot yet assign automatic cmptypes 124 strcpy (fields[ i].zctype, zcmptype);123 strcpy (fields[field].zctype, zcmptype); 125 124 126 125 // by using "P" format, we are limited to 32bit pointers (2GB heap) 127 if (!gfits_define_bintable_column (tgtheader, "1QB(0)", fields[ i].ttype, fields[i].ttype_cmt, fields[i].tunit, 1.0, 0.0)) ESCAPE;126 if (!gfits_define_bintable_column (tgtheader, "1QB(0)", fields[field].ttype, fields[field].ttype_cmt, fields[field].tunit, 1.0, 0.0)) ESCAPE; 128 127 } 129 128 … … 137 136 char *tmpbuffer = NULL; 138 137 ALLOCATE_ZERO (tmpbuffer, char, 16*Ntile); // need space for Ntile entries, each of width 16 bytes (2 long) 139 for (i = 0; i < Nfields; i++) {140 if (!gfits_set_bintable_column (tgtheader, tgttable, fields[ i].ttype, tmpbuffer, Ntile)) ESCAPE;138 for (int field = 0; field < Nfields; field++) { 139 if (!gfits_set_bintable_column (tgtheader, tgttable, fields[field].ttype, tmpbuffer, Ntile)) ESCAPE; 141 140 } 142 141 free (tmpbuffer); … … 146 145 147 146 // define compression-specific keywords, update header as needed. 148 if (!gfits_modify (tgtheader, "ZTILELEN", "% d", 1, ztilelen)) ESCAPE;147 if (!gfits_modify (tgtheader, "ZTILELEN", "%lu", 1, ztilelen)) ESCAPE; 149 148 150 149 if (!gfits_modify (tgtheader, "ZNAXIS1", OFF_T_FMT, 1, srcheader->Naxis[0])) ESCAPE; … … 163 162 int offset = 0; // bytes from first column of first field to the current field (accumulate to set) 164 163 165 for (i = 0; i < Nfields; i++) {166 snprintf (keyword, 81, "ZFORM%d", i+1);167 if (!gfits_modify (tgtheader, keyword, "%s", 1, fields[ i].tformat)) ESCAPE;168 if (!gfits_varlength_column_define (tgttable, &fields[ i].zdef, i+1)) ESCAPE;169 if (!gfits_bintable_format (fields[ i].tformat, fields[i].datatype, &fields[i].Nvalues, &fields[i].pixsize)) ESCAPE; //170 fields[ i].rowsize = fields[i].Nvalues*fields[i].pixsize;171 max_width = MAX(max_width, fields[ i].rowsize);172 173 if (!strcasecmp (fields[ i].zctype, "AUTO")) {174 if (!strcmp (fields[ i].datatype, "short") ||175 !strcmp (fields[ i].datatype, "float") ||176 !strcmp (fields[ i].datatype, "double")||177 !strcmp (fields[ i].datatype, "int64_t")) {178 strcpy (fields[ i].zctype, "GZIP_2");164 for (int field = 0; field < Nfields; field++) { 165 snprintf (keyword, 81, "ZFORM%d", field+1); 166 if (!gfits_modify (tgtheader, keyword, "%s", 1, fields[field].tformat)) ESCAPE; 167 if (!gfits_varlength_column_define (tgttable, &fields[field].zdef, field+1)) ESCAPE; 168 if (!gfits_bintable_format (fields[field].tformat, fields[field].datatype, &fields[field].Nvalues, &fields[field].pixsize)) ESCAPE; // 169 fields[field].rowsize = fields[field].Nvalues*fields[field].pixsize; 170 max_width = MAX(max_width, fields[field].rowsize); 171 172 if (!strcasecmp (fields[field].zctype, "AUTO")) { 173 if (!strcmp (fields[field].datatype, "short") || 174 !strcmp (fields[field].datatype, "float") || 175 !strcmp (fields[field].datatype, "double")|| 176 !strcmp (fields[field].datatype, "int64_t")) { 177 strcpy (fields[field].zctype, "GZIP_2"); 179 178 goto got_cmptype; 180 179 } 181 if (!strcmp (fields[ i].datatype, "int")) {182 strcpy (fields[ i].zctype, "RICE_1");180 if (!strcmp (fields[field].datatype, "int")) { 181 strcpy (fields[field].zctype, "RICE_1"); 183 182 goto got_cmptype; 184 183 } 185 if (!strcmp (fields[ i].datatype, "byte") ||186 !strcmp (fields[ i].datatype, "char")) {187 strcpy (fields[ i].zctype, "GZIP_1");184 if (!strcmp (fields[field].datatype, "byte") || 185 !strcmp (fields[field].datatype, "char")) { 186 strcpy (fields[field].zctype, "GZIP_1"); 188 187 goto got_cmptype; 189 188 } … … 193 192 194 193 // OVERRIDE: RICE can only be used on integer fields 195 if (!strcasecmp (fields[ i].zctype, "RICE_1") || !strcasecmp (fields[i].zctype, "RICE_ONE")) {196 if (!strcmp (fields[ i].datatype, "float") || !strcmp (fields[i].datatype, "double") || !strcmp (fields[i].datatype, "int64_t")) {197 strcpy (fields[ i].zctype, "GZIP_2");194 if (!strcasecmp (fields[field].zctype, "RICE_1") || !strcasecmp (fields[field].zctype, "RICE_ONE")) { 195 if (!strcmp (fields[field].datatype, "float") || !strcmp (fields[field].datatype, "double") || !strcmp (fields[field].datatype, "int64_t")) { 196 strcpy (fields[field].zctype, "GZIP_2"); 198 197 } 199 198 } 200 199 201 200 // OVERRIDE: GZIP_2 invalid for B (use GZIP_1) 202 if (!strcasecmp (fields[ i].zctype, "GZIP_2") && !strcmp (fields[i].datatype, "byte")) {203 strcpy (fields[ i].zctype, "GZIP_1");201 if (!strcasecmp (fields[field].zctype, "GZIP_2") && !strcmp (fields[field].datatype, "byte")) { 202 strcpy (fields[field].zctype, "GZIP_1"); 204 203 } 205 204 206 205 // compression type per column (XXX for now we are just using zcmptype, as set above) 207 snprintf (keyword, 81, "ZCTYP%d", i+1);208 if (!gfits_modify (tgtheader, keyword, "%s", 1, fields[ i].zctype)) ESCAPE;209 210 fields[ i].offset = offset;211 offset += fields[ i].rowsize;206 snprintf (keyword, 81, "ZCTYP%d", field+1); 207 if (!gfits_modify (tgtheader, keyword, "%s", 1, fields[field].zctype)) ESCAPE; 208 209 fields[field].offset = offset; 210 offset += fields[field].rowsize; 212 211 } 213 212 214 213 // allocate the intermediate storage buffers 215 int Nzdata_alloc = 2*max_width*ztilelen + 100;214 unsigned long int Nzdata_alloc = 2*max_width*ztilelen + 100; 216 215 ALLOCATE (raw, char, max_width*ztilelen); 217 216 ALLOCATE (zdata, char, Nzdata_alloc); … … 229 228 // compress the data : copy into a tile, compress the tile, then add to the output table 230 229 // each tile -> 1 row of the output table 231 for ( i = 0; i < Ntile; i++) {232 233 for ( j = 0; j < Nfields; j++) {234 235 gettimeofday (&startTimer, (void *) NULL); 236 237 int Nrows = (i== Ntile - 1) ? ztilelast : ztilelen;238 int row_start = i*ztilelen;230 for (unsigned long int tile = 0; tile < Ntile; tile++) { 231 232 for (int field = 0; field < Nfields; field++) { 233 234 gettimeofday (&startTimer, (void *) NULL); 235 236 unsigned long int Nrows = (tile == Ntile - 1) ? ztilelast : ztilelen; 237 unsigned long int row_start = tile*ztilelen; 239 238 // ^- first row for this tile & field 240 239 // NOTE: assumes each tile has the same length, ex the last (true for now) 241 240 242 241 // copy the raw pixels from their native matrix locations to the temporary output buffer 243 if (!strcasecmp(fields[ j].zctype, "GZIP_2") || !strcasecmp(fields[j].zctype, "NONE_2")) {244 if (!gfits_collect_table_gzp2 (srctable, &fields[ j], raw, row_start, Nrows)) ESCAPE;242 if (!strcasecmp(fields[field].zctype, "GZIP_2") || !strcasecmp(fields[field].zctype, "NONE_2")) { 243 if (!gfits_collect_table_gzp2 (srctable, &fields[field], raw, row_start, Nrows)) ESCAPE; 245 244 } else { 246 if (!gfits_collect_table_data (srctable, &fields[ j], raw, row_start, Nrows)) ESCAPE;245 if (!gfits_collect_table_data (srctable, &fields[field], raw, row_start, Nrows)) ESCAPE; 247 246 } 248 247 … … 256 255 257 256 if (VERBOSE_DUMP) { 258 int k;259 257 fprintf (stderr, "c1: "); 260 for ( k = 0; k < Nrows*fields[j].Nvalues*fields[j].pixsize; k++) {258 for (unsigned long int k = 0; k < Nrows*fields[field].Nvalues*fields[field].pixsize; k++) { 261 259 fprintf (stderr, "%02hhx", raw[k]); 262 260 if (k % 2) fprintf (stderr, " "); … … 269 267 // optname, optvalue = NULL, Noptions = 0 270 268 271 int Nraw = Nrows*fields[j].Nvalues; // number of pixels272 if (!strcasecmp(fields[ j].zctype, "GZIP_1")) {273 if (!gfits_byteswap_zdata (raw, Nraw * fields[ j].pixsize, fields[j].pixsize)) ESCAPE;269 unsigned long int Nraw = Nrows*fields[field].Nvalues; // number of pixels 270 if (!strcasecmp(fields[field].zctype, "GZIP_1")) { 271 if (!gfits_byteswap_zdata (raw, Nraw * fields[field].pixsize, fields[field].pixsize)) ESCAPE; 274 272 } 275 273 … … 281 279 282 280 if (VERBOSE_DUMP) { 283 int k;284 281 fprintf (stderr, "c2: "); 285 for ( k = 0; k < Nrows*fields[j].Nvalues*fields[j].pixsize; k++) {282 for (unsigned long int k = 0; k < Nrows*fields[field].Nvalues*fields[field].pixsize; k++) { 286 283 fprintf (stderr, "%02hhx", raw[k]); 287 284 if (k % 2) fprintf (stderr, " "); … … 291 288 } 292 289 293 int Nzdata = Nzdata_alloc; // available space, replaced with actual output size on compression294 if (!gfits_compress_data (zdata, &Nzdata, fields[ j].zctype, NULL, NULL, 0, raw, Nraw, fields[j].pixsize, 0, 0)) ESCAPE;290 unsigned long int Nzdata = Nzdata_alloc; // available space, replaced with actual output size on compression 291 if (!gfits_compress_data (zdata, &Nzdata, fields[field].zctype, NULL, NULL, 0, raw, Nraw, fields[field].pixsize, 0, 0)) ESCAPE; 295 292 296 293 // XXX TIMER 2c … … 301 298 302 299 if (VERBOSE_DUMP) { 303 int k;304 300 fprintf (stderr, "c3: "); 305 for ( k = 0; k < Nzdata; k++) {301 for (unsigned long int k = 0; k < Nzdata; k++) { 306 302 fprintf (stderr, "%02hhx", zdata[k]); 307 303 if (k % 2) fprintf (stderr, " "); … … 311 307 } 312 308 313 if (strcasecmp(fields[ j].zctype, "NONE_2") && // NONE and NONE_1 not swapped?314 strcasecmp(fields[ j].zctype, "GZIP_1") &&315 strcasecmp(fields[ j].zctype, "GZIP_2") &&316 strcasecmp(fields[ j].zctype, "RICE_1") &&317 strcasecmp(fields[ j].zctype, "RICE_ONE")) {318 if (!gfits_byteswap_zdata (zdata, Nzdata, fields[ j].pixsize)) ESCAPE;309 if (strcasecmp(fields[field].zctype, "NONE_2") && // NONE and NONE_1 not swapped? 310 strcasecmp(fields[field].zctype, "GZIP_1") && 311 strcasecmp(fields[field].zctype, "GZIP_2") && 312 strcasecmp(fields[field].zctype, "RICE_1") && 313 strcasecmp(fields[field].zctype, "RICE_ONE")) { 314 if (!gfits_byteswap_zdata (zdata, Nzdata, fields[field].pixsize)) ESCAPE; 319 315 } 320 316 … … 326 322 327 323 if (VERBOSE_DUMP) { 328 int k;329 324 fprintf (stderr, "c4: "); 330 for ( k = 0; k < Nzdata; k++) {325 for (unsigned long int k = 0; k < Nzdata; k++) { 331 326 fprintf (stderr, "%02hhx", zdata[k]); 332 327 if (k % 2) fprintf (stderr, " "); … … 336 331 } 337 332 338 if (!gfits_varlength_column_add_data (tgttable, zdata, Nzdata, i, &fields[j].zdef)) ESCAPE;333 if (!gfits_varlength_column_add_data (tgttable, zdata, Nzdata, tile, &fields[field].zdef)) ESCAPE; 339 334 // XXX TIMER 2e 340 335 gettimeofday (&stopTimer, (void *) NULL); … … 347 342 if (OHANA_MEMCHECK) ohana_memcheck (TRUE); 348 343 349 for (i = 0; i < Nfields; i++) {350 if (!gfits_varlength_column_finish (tgttable, &fields[ i].zdef)) ESCAPE;344 for (int field = 0; field < Nfields; field++) { 345 if (!gfits_varlength_column_finish (tgttable, &fields[field].zdef)) ESCAPE; 351 346 } 352 347 … … 375 370 // raw_pixsize is the bytes / pixel for the input matrix 376 371 // place the raw image bytes for the current tile into the tile buffer 377 int gfits_collect_table_data (FTable *table, TableField *field, char *raw, int row_start, int Nrows) { 378 379 off_t i; 372 int gfits_collect_table_data (FTable *table, TableField *field, char *raw, unsigned long int row_start, unsigned long int Nrows) { 380 373 381 374 // we are copying NN rows into the column which starts at XX and has MM bytes per row … … 388 381 389 382 if (VERBOSE) fprintf (stderr, "distribute: "); 390 for ( i = 0; i < Nrows; i++, tblbuffer += Nx) {383 for (unsigned long i = 0; i < Nrows; i++, tblbuffer += Nx) { 391 384 memcpy (&raw[i*rowsize], tblbuffer, rowsize); 392 385 # if (VERBOSE) 393 int j; for (j = 0; j < field->rowsize; j++) fprintf (stderr, "0x%02hhx ", table->buffer[Nx*row + field->offset + j]);386 for (int j = 0; j < field->rowsize; j++) fprintf (stderr, "0x%02hhx ", table->buffer[Nx*row + field->offset + j]); 394 387 # endif 395 388 } … … 399 392 } 400 393 401 int gfits_collect_table_data_alt (FTable *table, TableField *field, char *raw, int row_start, int Nrows) { 402 403 off_t i; 394 int gfits_collect_table_data_alt (FTable *table, TableField *field, char *raw, unsigned long int row_start, unsigned long int Nrows) { 404 395 405 396 // we are copying NN rows of the column which starts at XX and has MM bytes per row … … 408 399 409 400 if (VERBOSE) fprintf (stderr, "collect: "); 410 for ( i = 0; i < Nrows; i++) {401 for (unsigned long i = 0; i < Nrows; i++) { 411 402 int row = row_start + i; 412 403 memcpy (&raw[i*field->rowsize], &table->buffer[Nx*row + field->offset], field->rowsize); … … 420 411 } 421 412 422 int gfits_collect_table_gzp2 (FTable *table, TableField *field, char *raw, int row_start, int Nrows) { 423 424 off_t i, j, k; 413 int gfits_collect_table_gzp2 (FTable *table, TableField *field, char *raw, unsigned long int row_start, unsigned long int Nrows) { 425 414 426 415 // we are copying NN rows into the column which starts at XX and has MM bytes per row … … 433 422 char *rawptr = raw; 434 423 435 for ( k = 0; k < field->pixsize; k++) {424 for (off_t k = 0; k < field->pixsize; k++) { 436 425 # ifdef BYTE_SWAP 437 426 char *tblptr_start = &table->buffer[Nx*row_start + offset + (pixsize - k - 1)]; … … 439 428 char *tblptr_start = &table->buffer[Nx*row_start + offset + k]; 440 429 # endif 441 for ( i = 0; i < Nrows; i++, tblptr_start += Nx) {430 for (unsigned long int i = 0; i < Nrows; i++, tblptr_start += Nx) { 442 431 char *tblptr = tblptr_start; 443 for ( j = 0; j < Nvalues; j++, tblptr += pixsize, rawptr++) {432 for (off_t j = 0; j < Nvalues; j++, tblptr += pixsize, rawptr++) { 444 433 *rawptr = *tblptr; 445 434 } … … 449 438 } 450 439 451 int gfits_collect_table_gzp2_alt (FTable *table, TableField *field, char *raw, int row_start, int Nrows) { 452 453 off_t i, j, k; 440 int gfits_collect_table_gzp2_alt (FTable *table, TableField *field, char *raw, unsigned long int row_start, unsigned long int Nrows) { 454 441 455 442 // we are copying NN rows into the column which starts at XX and has MM bytes per row … … 457 444 off_t Nx = table->header->Naxis[0]; 458 445 459 for ( k = 0; k < field->pixsize; k++) {460 for ( i = 0; i < Nrows; i++) {461 int row = row_start + i;446 for (off_t k = 0; k < field->pixsize; k++) { 447 for (unsigned long int i = 0; i < Nrows; i++) { 448 unsigned long int row = row_start + i; 462 449 char *rawptr = &raw[i*field->Nvalues + k*Nrows*field->Nvalues]; 463 450 # ifdef BYTE_SWAP … … 466 453 char *tblptr = &table->buffer[Nx*row + field->offset + k]; 467 454 # endif 468 for ( j = 0; j < field->Nvalues; j++, tblptr += field->pixsize, rawptr++) {455 for (off_t j = 0; j < field->Nvalues; j++, tblptr += field->pixsize, rawptr++) { 469 456 *rawptr = *tblptr; 470 myAssert (rawptr - raw < Nrows*field->Nvalues*field->pixsize, "oops"); 457 myAssert (rawptr >= raw, "oops"); 458 myAssert ((unsigned long int)(rawptr - raw) < Nrows*field->Nvalues*field->pixsize, "oops"); 471 459 myAssert (tblptr - table->buffer < table->header->Naxis[0]*table->header->Naxis[1], "oops"); 472 460 } -
trunk/Ohana/src/libfits/table/F_set_column.c
r39394 r39457 109 109 if (CHECK_MEMBLOCKS) { 110 110 OhanaMemblock *ref = (OhanaMemblock *) array - 1; 111 fprintf (stderr, "ref: "OFF_T_FMT", array: "OFF_T_FMT"\n", (off_t) ref, (off_t) array);111 fprintf (stderr, "ref: 0x%08lx, array: 0x%08lx, size: %ld, (%s@%d : %s), freed: %1d, Nalloc: %d\n", (long int) ref, (long int) array, ref->size, ref->file, ref->line, ref->func, ref->freed, ref->Nalloc); 112 112 if (!ref->nextBlock && !ref->prevBlock) abort(); 113 113 } … … 120 120 if (CHECK_MEMBLOCKS) { 121 121 OhanaMemblock *ref = (OhanaMemblock *) array - 1; 122 fprintf (stderr, "ref: "OFF_T_FMT", array: "OFF_T_FMT"\n", (off_t) ref, (off_t) array);122 fprintf (stderr, "ref: 0x%08lx, array: 0x%08lx, size: %ld, (%s@%d : %s), freed: %1d, Nalloc: %d\n", (long int) ref, (long int) array, ref->size, ref->file, ref->line, ref->func, ref->freed, ref->Nalloc); 123 123 if (!ref->nextBlock && !ref->prevBlock) abort(); 124 124 } … … 212 212 if (CHECK_MEMBLOCKS) { 213 213 OhanaMemblock *ref = (OhanaMemblock *) array - 1; 214 fprintf (stderr, "ref: "OFF_T_FMT", array: "OFF_T_FMT"\n", (off_t) ref, (off_t) array);214 fprintf (stderr, "ref: 0x%08lx, array: 0x%08lx, size: %ld, (%s@%d : %s), freed: %1d, Nalloc: %d\n", (long int) ref, (long int) array, ref->size, ref->file, ref->line, ref->func, ref->freed, ref->Nalloc); 215 215 if (!ref->nextBlock && !ref->prevBlock) abort(); 216 216 } … … 241 241 if (CHECK_MEMBLOCKS) { 242 242 OhanaMemblock *ref = (OhanaMemblock *) array - 1; 243 fprintf (stderr, "ref: "OFF_T_FMT", array: "OFF_T_FMT"\n", (off_t) ref, (off_t) array);243 fprintf (stderr, "ref: 0x%08lx, array: 0x%08lx, size: %ld, (%s@%d : %s), freed: %1d, Nalloc: %d\n", (long int) ref, (long int) array, ref->size, ref->file, ref->line, ref->func, ref->freed, ref->Nalloc); 244 244 if (!ref->nextBlock && !ref->prevBlock) abort(); 245 245 } -
trunk/Ohana/src/libfits/table/F_table_varlength.c
r39340 r39457 187 187 ptr[0] = Ndata; 188 188 ptr[1] = heap_offset - table->heap_start; 189 // fprintf (stderr, "row: %d, Ndata: %d, maxlen: %d, Ndata: %d, ptr1: %d\n", (int) row, (int) Ndata, (int) column->maxlen, (int) Ndata, (int) (heap_offset - table->heap_start)); 189 190 } 190 191 -
trunk/Ohana/src/libfits/table/F_uncompress_T.c
r39358 r39457 13 13 int gfits_dump_raw_table (FTable *table, char *message) { 14 14 # if (VERBOSE_DUMP) 15 int i;16 15 fprintf (stderr, "%s data:\n", message); 17 for (i = 0; i < table->header->Naxis[0]*table->header->Naxis[1]; i++) {16 for (int i = 0; i < table->header->Naxis[0]*table->header->Naxis[1]; i++) { 18 17 // for (i = 0; i < 16; i++) { 19 18 fprintf (stderr, "%02hhx", table->buffer[i]); … … 22 21 } 23 22 fprintf (stderr, "\n"); 23 # else 24 OHANA_UNUSED_PARAM(table); 25 OHANA_UNUSED_PARAM(message); 24 26 # endif 25 27 return TRUE; … … 28 30 int gfits_dump_cmp_table (FTable *table, char *message) { 29 31 # if (VERBOSE_DUMP) 30 int i;31 32 fprintf (stderr, "%s pntr:\n", message); 32 for (i = 0; i < table->header->Naxis[0]*table->header->Naxis[1]; i++) {33 for (int i = 0; i < table->header->Naxis[0]*table->header->Naxis[1]; i++) { 33 34 fprintf (stderr, "%02hhx", table->buffer[i]); 34 35 if (i % 2) fprintf (stderr, " "); … … 38 39 39 40 fprintf (stderr, "%s data:\n", message); 40 for (i = 0; i < table->header->pcount; i++) {41 for (int i = 0; i < table->header->pcount; i++) { 41 42 fprintf (stderr, "%02hhx", table->buffer[table->heap_start + i]); 42 43 if (i % 2) fprintf (stderr, " "); … … 44 45 } 45 46 fprintf (stderr, "\n"); 47 # else 48 OHANA_UNUSED_PARAM(table); 49 OHANA_UNUSED_PARAM(message); 46 50 # endif 47 51 return TRUE; … … 77 81 int gfits_uncompress_table (FTable *srctable, FTable *tgttable) { 78 82 79 int i;80 81 83 char keyword[256]; 82 84 … … 114 116 115 117 ALLOCATE (fields, TableField, Nfields); 116 for (i = 0; i < Nfields; i++) {118 for (int i = 0; i < Nfields; i++) { 117 119 snprintf (keyword, 80, "TTYPE%d", i+1); 118 120 if (!gfits_scan (srcheader, keyword, "%s", 1, fields[i].ttype)) ESCAPE; … … 170 172 // calling with an empty data array, data values are not actually copied (this is done 171 173 // below after decompression) 172 for (i = 0; i < Nfields; i++) {174 for (int i = 0; i < Nfields; i++) { 173 175 if (!gfits_set_bintable_column (tgtheader, tgttable, fields[i].ttype, NULL, Ny)) ESCAPE; 174 176 } … … 200 202 gettimeofday (&startTimer, (void *) NULL); 201 203 202 off_t row; 203 for (row = 0; row < srcheader->Naxis[1]; row++) { 204 205 for (i = 0; i < Nfields; i++) { 204 for (off_t row = 0; row < srcheader->Naxis[1]; row++) { 205 206 for (int i = 0; i < Nfields; i++) { 206 207 207 208 // gfits_uncompress_data can take values specific to the compression mode … … 218 219 219 220 if (VERBOSE_DUMP) { 220 int k;221 221 fprintf (stderr, "u4: "); 222 for ( k = 0; k < Nzdata; k++) {222 for (int k = 0; k < Nzdata; k++) { 223 223 fprintf (stderr, "%02hhx", zdata[k]); 224 224 if (k % 2) fprintf (stderr, " "); … … 250 250 251 251 if (VERBOSE_DUMP) { 252 int k;253 252 fprintf (stderr, "u3: "); 254 for ( k = 0; k < Nzdata; k++) {253 for (int k = 0; k < Nzdata; k++) { 255 254 fprintf (stderr, "%02hhx", zdata[k]); 256 255 if (k % 2) fprintf (stderr, " "); … … 266 265 gettimeofday (&startTimer, (void *) NULL); 267 266 268 int Nrows = (row == Ntile - 1) ? ztilelast : ztilelen;269 int Nraw = Nrows*fields[i].Nvalues*fields[i].pixsize; // expected number of bytes267 unsigned long int Nrows = (row == Ntile - 1) ? ztilelast : ztilelen; 268 unsigned long int Nraw = Nrows*fields[i].Nvalues*fields[i].pixsize; // expected number of bytes 270 269 if (!gfits_uncompress_data (zdata, Nzdata, fields[i].zctype, NULL, NULL, 0, raw, &Nraw, Nraw_alloc, fields[i].pixsize)) ESCAPE; 271 270 272 271 if (VERBOSE_DUMP) { 273 int k;274 272 fprintf (stderr, "u2: "); 275 for ( k = 0; k < Nraw*fields[i].pixsize; k++) {273 for (unsigned long int k = 0; k < Nraw*fields[i].pixsize; k++) { 276 274 fprintf (stderr, "%02hhx", raw[k]); 277 275 if (k % 2) fprintf (stderr, " "); … … 299 297 300 298 if (VERBOSE_DUMP) { 301 int k;302 299 fprintf (stderr, "u1: "); 303 for ( k = 0; k < Nraw*fields[i].pixsize; k++) {300 for (unsigned long int k = 0; k < Nraw*fields[i].pixsize; k++) { 304 301 fprintf (stderr, "%02hhx", raw[k]); 305 302 if (k % 2) fprintf (stderr, " "); … … 356 353 int gfits_distribute_table_data (FTable *table, TableField *field, char *raw, int row_start, int Nrows) { 357 354 358 off_t i;359 360 355 // we are copying NN rows into the column which starts at XX and has MM bytes per row 361 356 … … 367 362 368 363 if (VERBOSE) fprintf (stderr, "distribute: "); 369 for ( i = 0; i < Nrows; i++, tblbuffer += Nx) {364 for (off_t i = 0; i < Nrows; i++, tblbuffer += Nx) { 370 365 memcpy (tblbuffer, &raw[i*rowsize], rowsize); 371 366 # if (VERBOSE) 372 int j; for (j = 0; j < field->rowsize; j++) fprintf (stderr, "0x%02hhx ", table->buffer[Nx*row + field->offset + j]);367 for (int j = 0; j < field->rowsize; j++) fprintf (stderr, "0x%02hhx ", table->buffer[Nx*row + field->offset + j]); 373 368 # endif 374 369 } … … 379 374 380 375 int gfits_distribute_table_gzp2 (FTable *table, TableField *field, char *raw, int row_start, int Nrows) { 381 382 off_t i, j, k;383 376 384 377 // we are copying NN rows into the column which starts at XX and has MM bytes per row … … 391 384 char *rawptr = raw; 392 385 393 for ( k = 0; k < field->pixsize; k++) {386 for (off_t k = 0; k < field->pixsize; k++) { 394 387 # ifdef BYTE_SWAP 395 388 char *tblptr_start = &table->buffer[Nx*row_start + offset + (pixsize - k - 1)]; … … 397 390 char *tblptr_start = &table->buffer[Nx*row_start + offset + k]; 398 391 # endif 399 for ( i = 0; i < Nrows; i++, tblptr_start += Nx) {392 for (off_t i = 0; i < Nrows; i++, tblptr_start += Nx) { 400 393 char *tblptr = tblptr_start; 401 for ( j = 0; j < Nvalues; j++, tblptr += pixsize, rawptr++) {394 for (off_t j = 0; j < Nvalues; j++, tblptr += pixsize, rawptr++) { 402 395 *tblptr = *rawptr; 403 396 } … … 409 402 int gfits_distribute_table_gzp2_alt (FTable *table, TableField *field, char *raw, int row_start, int Nrows) { 410 403 411 off_t i, j, k;412 413 404 // we are copying NN rows into the column which starts at XX and has MM bytes per row 414 405 415 406 off_t Nx = table->header->Naxis[0]; 416 407 417 for ( k = 0; k < field->pixsize; k++) {418 for ( i = 0; i < Nrows; i++) {408 for (off_t k = 0; k < field->pixsize; k++) { 409 for (off_t i = 0; i < Nrows; i++) { 419 410 int row = row_start + i; 420 411 char *rawptr = &raw[i*field->Nvalues + k*Nrows*field->Nvalues]; … … 424 415 char *tblptr = &table->buffer[Nx*row + field->offset + k]; 425 416 # endif 426 for ( j = 0; j < field->Nvalues; j++, tblptr += field->pixsize, rawptr++) {417 for (off_t j = 0; j < field->Nvalues; j++, tblptr += field->pixsize, rawptr++) { 427 418 *tblptr = *rawptr; 428 419 } -
trunk/Ohana/src/libfits/table/F_write_T.c
r38553 r39457 27 27 myAssert (myBlock->startblock == OHANA_MEMMAGIC, "bad memory"); 28 28 myAssert (myBlock->endblock == OHANA_MEMMAGIC, "bad memory"); 29 myAssert (myBlock->size >= table[0].datasize, "overflow");29 myAssert (myBlock->size >= (size_t) table[0].datasize, "overflow"); 30 30 } 31 31 # endif -
trunk/Ohana/src/libfits/table/F_write_TH.c
r38553 r39457 27 27 myAssert (myBlock->startblock == OHANA_MEMMAGIC, "bad memory"); 28 28 myAssert (myBlock->endblock == OHANA_MEMMAGIC, "bad memory"); 29 myAssert (myBlock->size >= header[0].datasize, "overflow");29 myAssert (myBlock->size >= (size_t) header[0].datasize, "overflow"); 30 30 } 31 31 # endif -
trunk/Ohana/src/libfits/test/imagecomp.c
r38553 r39457 17 17 static int NY = 10; 18 18 19 int main ( int argc, char **argv) {19 int main (void) { 20 20 21 21 plan_tests (3*3*234); … … 196 196 } 197 197 198 int Ztile[2] = {NX, NY};199 ok (gfits_compress_image (&rawheader, &rawmatrix, &ftable, ( int *) &Ztile, zcmptype), "compressed image");198 unsigned long int Ztile[2] = {NX, NY}; 199 ok (gfits_compress_image (&rawheader, &rawmatrix, &ftable, (unsigned long int *) &Ztile, zcmptype), "compressed image"); 200 200 // ok (gfits_compress_image (&rawheader, &rawmatrix, &ftable, NULL, zcmptype), "compressed image"); 201 201 ok (gfits_uncompress_image (&outheader, &outmatrix, &ftable), "uncompressed image"); -
trunk/Ohana/src/libfits/test/keywords.c
r39321 r39457 15 15 tmp = Pout[3]; Pout[3] = Pout[4]; Pout[4] = tmp; } 16 16 17 int main ( int argc, char **argv) {17 int main (void) { 18 18 19 19 plan_tests (14); … … 21 21 diag ("libfits keyword tests"); 22 22 23 int i, err;24 double srcbuf[NSRC], tgtbuf[NTGT], outbuf[NOUT];25 26 23 { 27 24 … … 96 93 ptr = gfits_header_field (&header, "END", 1); ok (ptr, "END still good"); 97 94 98 ok (gfits_modify (&header, "D_LONG3", "%Ld", 1, (long long) 0x100), "wrote a keyword"); 99 ptr = gfits_header_field (&header, "END", 1); ok (ptr, "END still good"); 95 // this is not ISO C99: 96 // ok (gfits_modify (&header, "D_LONG3", "%Ld", 1, (long long) 0x100), "wrote a keyword"); 97 // ptr = gfits_header_field (&header, "END", 1); ok (ptr, "END still good"); 100 98 101 99 // set one of each of the few numerical types (unsigned ints) … … 109 107 ptr = gfits_header_field (&header, "END", 1); ok (ptr, "END still good"); 110 108 111 ok (gfits_modify (&header, "DU_LONG3", "%Lu", 1, (long long) 0x100), "wrote a keyword");112 ptr = gfits_header_field (&header, "END", 1); ok (ptr, "END still good");109 // ok (gfits_modify (&header, "DU_LONG3", "%Lu", 1, (long long) 0x100), "wrote a keyword"); 110 // ptr = gfits_header_field (&header, "END", 1); ok (ptr, "END still good"); 113 111 114 112 ok (gfits_modify (&header, "D_SHORT", "%hd", 1, 0x20), "wrote a keyword"); … … 229 227 ptr = gfits_header_field (&header, "END", 1); ok (ptr, "END still good"); 230 228 231 ok (gfits_scan (&header, "D_LONG3", "%Ld", 1, &Kvalue), "read a keyword");232 ok (Kvalue == 0x100, "got the right value");233 ptr = gfits_header_field (&header, "END", 1); ok (ptr, "END still good");229 // ok (gfits_scan (&header, "D_LONG3", "%Ld", 1, &Kvalue), "read a keyword"); 230 // ok (Kvalue == 0x100, "got the right value"); 231 // ptr = gfits_header_field (&header, "END", 1); ok (ptr, "END still good"); 234 232 235 233 // set one of each of the few numerical types (unsigned ints) … … 246 244 ptr = gfits_header_field (&header, "END", 1); ok (ptr, "END still good"); 247 245 248 ok (gfits_scan (&header, "DU_LONG3", "%Lu", 1, &Ulonglong), "read a keyword");249 ok (Ulonglong == 0x100, "got the right value");250 ptr = gfits_header_field (&header, "END", 1); ok (ptr, "END still good");246 // ok (gfits_scan (&header, "DU_LONG3", "%Lu", 1, &Ulonglong), "read a keyword"); 247 // ok (Ulonglong == 0x100, "got the right value"); 248 // ptr = gfits_header_field (&header, "END", 1); ok (ptr, "END still good"); 251 249 252 250 ok (gfits_scan (&header, "D_SHORT", "%hd", 1, &Ishort), "read a keyword"); -
trunk/Ohana/src/libfits/test/ricetest.c
r38404 r39457 1 1 # include <ohana.h> 2 2 # include <gfitsio.h> 3 # include <gfits_compress.h> 3 4 # include "tap_ohana.h" 4 5 … … 6 7 # define NBYTE 4*NPIX 7 8 8 int main ( int argc, char **argv) {9 int main (void) { 9 10 10 11 plan_tests (45); … … 12 13 diag ("libfits ricetest.c tests"); 13 14 14 // buffers to store max array15 char rawdata[NBYTE];16 char cmpdata[NBYTE];17 char outdata[NBYTE];18 19 15 // ok (1, "failure"); 20 16 21 17 if (1) { 18 // buffers to store max array 19 char rawdata[NBYTE]; 20 unsigned char outdata[NBYTE]; 21 unsigned char cmpdata[NBYTE]; 22 22 char *rawvalue = (char *) rawdata; 23 23 char *outvalue = (char *) outdata; … … 46 46 47 47 if (1) { 48 // buffers to store max array 49 char rawdata[NBYTE]; 50 unsigned short outdata[NBYTE]; 51 unsigned char cmpdata[NBYTE]; 52 48 53 short *rawvalue = (short *) rawdata; 49 54 short *outvalue = (short *) outdata; … … 72 77 73 78 if (1) { 79 // buffers to store max array 80 char rawdata[NBYTE]; 81 unsigned int outdata[NBYTE]; 82 unsigned char cmpdata[NBYTE]; 83 74 84 int *rawvalue = (int *) rawdata; 75 85 int *outvalue = (int *) outdata; -
trunk/Ohana/src/libfits/test/tablecomp.c
r38553 r39457 10 10 char *cmptype[] = {"NONE", "NONE_1", "NONE_2", "GZIP_1", "GZIP_2", "RICE_1", "RICE_ONE", "AUTO", NULL}; 11 11 12 int main ( int argc, char **argv) {13 14 plan_tests (668 );12 int main (void) { 13 14 plan_tests (668+428); 15 15 16 16 diag ("libfits tablecomp.c tests"); … … 28 28 test_compress_empty (cmptype[i]); 29 29 ok (ohana_memcheck (TRUE), "no memory corruption"); 30 ohana_memdump (TRUE); 30 31 } 31 32 … … 89 90 ok (gfits_compress_table (&ftable, &cmptable, 10, zcmptype), "compressed table"); 90 91 92 if (0) { int ix, iy; 93 for (ix = 0; ix < 12; ix++) { 94 for (iy = 0; iy < 16; iy++) { 95 fprintf (stderr, "%x ", (int) cmptable.buffer[ix*16 + iy]); 96 } 97 } 98 } 99 100 Header rawheader; 101 FTable rawtable; 102 rawtable.header = &rawheader; 103 ok (gfits_uncompress_table (&cmptable, &rawtable), "uncompressed table"); 104 105 gfits_free_header (&cmpheader); 106 gfits_free_table (&cmptable); 107 108 outheader = &rawheader; 109 outtable = &rawtable; 110 } 111 112 char type[16]; 113 int Ncol; 114 off_t Nrow; 115 116 char *VAL_B_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_B", type, &Nrow, &Ncol); ok (!strcmp (type, "byte"), "read byte table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols"); 117 short *VAL_I_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_I", type, &Nrow, &Ncol); ok (!strcmp (type, "short"), "read short table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols"); 118 int *VAL_J_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_J", type, &Nrow, &Ncol); ok (!strcmp (type, "int"), "read int table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols"); 119 int64_t *VAL_K_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_K", type, &Nrow, &Ncol); ok (!strcmp (type, "int64_t"), "read int64_t table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols"); 120 float *VAL_E_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_E", type, &Nrow, &Ncol); ok (!strcmp (type, "float"), "read float table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols"); 121 double *VAL_D_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_D", type, &Nrow, &Ncol); ok (!strcmp (type, "double"), "read double table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols"); 122 123 // count mismatched values 124 int NVAL_B_bad = 0; 125 int NVAL_I_bad = 0; 126 int NVAL_J_bad = 0; 127 int NVAL_K_bad = 0; 128 int NVAL_E_bad = 0; 129 int NVAL_D_bad = 0; 130 131 // for (i = 0; i < Nval; i++) { 132 // fprintf (stderr, "%0llx : %0llx\n", (long long) VAL_K[i], (long long) VAL_K_t[i]); 133 // } 134 135 for (i = 0; i < Nval; i++) { 136 if (VAL_B[i] != VAL_B_t[i]) NVAL_B_bad++; 137 if (VAL_I[i] != VAL_I_t[i]) NVAL_I_bad++; 138 if (VAL_J[i] != VAL_J_t[i]) NVAL_J_bad++; 139 if (VAL_K[i] != VAL_K_t[i]) NVAL_K_bad++; 140 if (VAL_E[i] != VAL_E_t[i]) NVAL_E_bad++; 141 if (VAL_D[i] != VAL_D_t[i]) NVAL_D_bad++; 142 } 143 144 ok (!NVAL_B_bad, "byte values match (input vs output)"); 145 ok (!NVAL_I_bad, "short values match (input vs output)"); 146 ok (!NVAL_J_bad, "int values match (input vs output)"); 147 ok (!NVAL_K_bad, "int64_t values match (input vs output)"); 148 ok (!NVAL_E_bad, "float values match (input vs output)"); 149 ok (!NVAL_D_bad, "double values match (input vs output)"); 150 151 free (VAL_B); 152 free (VAL_I); 153 free (VAL_J); 154 free (VAL_K); 155 free (VAL_E); 156 free (VAL_D); 157 158 free (VAL_B_t); 159 free (VAL_I_t); 160 free (VAL_J_t); 161 free (VAL_K_t); 162 free (VAL_E_t); 163 free (VAL_D_t); 164 165 gfits_free_header (&header); 166 gfits_free_table (&ftable); 167 if (zcmptype) { 168 gfits_free_header (outheader); 169 gfits_free_table (outtable); 170 } 171 return TRUE; 172 } 173 174 int test_compress_fullrange (char *zcmptype) { // test 2: make a table, compress, uncompress, compare : use compression "NONE" 175 176 Header header; 177 FTable ftable; 178 179 diag ("--- starting test_compress with zcmptype %s ---", zcmptype); 180 ok (gfits_init_header (&header), "inited the header"); 181 ok (gfits_init_table (&ftable), "inited the table"); 182 183 ok (gfits_create_table_header (&header, "BINTABLE", "TESTDATA"), "created the table header"); 184 185 ok (gfits_define_bintable_column (&header, "B", "VAL_B", "byte", "none", 1.0, 0.0), "defined byte column"); 186 ok (gfits_define_bintable_column (&header, "I", "VAL_I", "short", "none", 1.0, 0.0), "defined short column"); 187 ok (gfits_define_bintable_column (&header, "J", "VAL_J", "int", "none", 1.0, 0.0), "defined int column"); 188 ok (gfits_define_bintable_column (&header, "K", "VAL_K", "long", "none", 1.0, 0.0), "defined long column"); 189 ok (gfits_define_bintable_column (&header, "E", "VAL_E", "float", "degree", 1.0, 0.0), "defined float column"); 190 ok (gfits_define_bintable_column (&header, "D", "VAL_D", "double", "degree", 1.0, 0.0), "defined double column"); 191 192 // generate the output array that carries the data 193 ok (gfits_create_table (&header, &ftable), "created the basic table"); 194 195 int Nval = 1000; 196 char *VAL_B; ALLOCATE (VAL_B, char, Nval); 197 short *VAL_I; ALLOCATE (VAL_I, short, Nval); 198 int *VAL_J; ALLOCATE (VAL_J, int, Nval); 199 int64_t *VAL_K; ALLOCATE (VAL_K, int64_t, Nval); 200 float *VAL_E; ALLOCATE (VAL_E, float, Nval); 201 double *VAL_D; ALLOCATE (VAL_D, double, Nval); 202 203 long A = time(NULL); 204 srand48(A); 205 206 int i; 207 for (i = 0; i < Nval; i++) { 208 VAL_B[i] = 0xff & lrand48(); 209 VAL_I[i] = 0xffff & lrand48(); 210 VAL_J[i] = 0xffffffff & lrand48(); 211 VAL_K[i] = (((int64_t)lrand48()) << 32) + (int64_t)lrand48(); 212 VAL_E[i] = FLT_MAX * (2.0*drand48() - 1.0); 213 VAL_D[i] = DBL_MAX * (2.0*drand48() - 1.0); 214 } 215 216 // add the columns to the output array 217 ok (gfits_set_bintable_column (&header, &ftable, "VAL_B", VAL_B, Nval), "set byte table column"); 218 ok (gfits_set_bintable_column (&header, &ftable, "VAL_I", VAL_I, Nval), "set short table column"); 219 ok (gfits_set_bintable_column (&header, &ftable, "VAL_J", VAL_J, Nval), "set int table column"); 220 ok (gfits_set_bintable_column (&header, &ftable, "VAL_K", VAL_K, Nval), "set long table column"); 221 ok (gfits_set_bintable_column (&header, &ftable, "VAL_E", VAL_E, Nval), "set float table column"); 222 ok (gfits_set_bintable_column (&header, &ftable, "VAL_D", VAL_D, Nval), "set double table column"); 223 224 Header *outheader = &header; 225 FTable *outtable = &ftable; 226 227 if (zcmptype) { 228 Header cmpheader; 229 FTable cmptable; 230 cmptable.header = &cmpheader; 231 ok (gfits_compress_table (&ftable, &cmptable, 10, zcmptype), "compressed table"); 232 91 233 Header rawheader; 92 234 FTable rawtable; … … 120 262 int NVAL_D_bad = 0; 121 263 122 // for (i = 0; i < Nval; i++) {123 // fprintf (stderr, "%0llx : %0llx\n", (long long) VAL_K[i], (long long) VAL_K_t[i]);124 // }125 126 264 for (i = 0; i < Nval; i++) { 127 265 if (VAL_B[i] != VAL_B_t[i]) NVAL_B_bad++; … … 140 278 ok (!NVAL_D_bad, "double values match (input vs output)"); 141 279 280 free (VAL_B); 281 free (VAL_I); 282 free (VAL_J); 283 free (VAL_K); 284 free (VAL_E); 285 free (VAL_D); 286 287 free (VAL_B_t); 288 free (VAL_I_t); 289 free (VAL_J_t); 290 free (VAL_K_t); 291 free (VAL_E_t); 292 free (VAL_D_t); 293 142 294 gfits_free_header (&header); 143 295 gfits_free_table (&ftable); … … 149 301 } 150 302 151 int test_compress_fullrange (char *zcmptype) { // test 2: make a table, compress, uncompress, compare : use compression "NONE" 303 int test_compress_single_full (char *zcmptype) { // test 2: make a table, compress, uncompress, compare : use compression "NONE" 304 305 Header header; 306 FTable ftable; 307 308 diag ("--- starting test_compress with zcmptype %s ---", zcmptype); 309 ok (gfits_init_header (&header), "inited the header"); 310 ok (gfits_init_table (&ftable), "inited the table"); 311 312 ok (gfits_create_table_header (&header, "BINTABLE", "TESTDATA"), "created the table header"); 313 314 ok (gfits_define_bintable_column (&header, "I", "SEQ", "seq", "none", 1.0, 0.0), "defined short column"); 315 316 // generate the output array that carries the data 317 ok (gfits_create_table (&header, &ftable), "created the basic table"); 318 319 int Nval = 1000; 320 short *SEQ; ALLOCATE (SEQ, short, Nval); 321 322 int i; 323 for (i = 0; i < Nval; i++) { 324 SEQ[i] = i; 325 } 326 327 // add the columns to the output array 328 ok (gfits_set_bintable_column (&header, &ftable, "SEQ", SEQ, Nval), "set short table column"); 329 330 Header *outheader = &header; 331 FTable *outtable = &ftable; 332 333 if (zcmptype) { 334 Header cmpheader; 335 FTable cmptable; 336 cmptable.header = &cmpheader; 337 ok (gfits_compress_table (&ftable, &cmptable, 0, zcmptype), "compressed table"); 338 339 Header rawheader; 340 FTable rawtable; 341 rawtable.header = &rawheader; 342 ok (gfits_uncompress_table (&cmptable, &rawtable), "uncompressed table"); 343 344 gfits_free_header (&cmpheader); 345 gfits_free_table (&cmptable); 346 347 outheader = &rawheader; 348 outtable = &rawtable; 349 } 350 351 char type[16]; 352 int Ncol; 353 off_t Nrow; 354 355 short *SEQ_t = gfits_get_bintable_column_data (outheader, outtable, "SEQ", type, &Nrow, &Ncol); ok (!strcmp (type, "short"), "read short table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols"); 356 357 // count mismatched values 358 int Nseq = 0; 359 for (i = 0; i < Nval; i++) { 360 if (SEQ[i] != SEQ_t[i]) Nseq++; 361 } 362 363 ok (!Nseq, "short values match (input vs output)"); 364 365 gfits_free_header (&header); 366 gfits_free_table (&ftable); 367 if (zcmptype) { 368 gfits_free_header (outheader); 369 gfits_free_table (outtable); 370 } 371 return TRUE; 372 } 373 374 int test_compress_empty (char *zcmptype) { // test 2: make a table, compress, uncompress, compare : use compression "NONE" 152 375 153 376 Header header; … … 170 393 ok (gfits_create_table (&header, &ftable), "created the basic table"); 171 394 172 int Nval = 1000;395 int Nval = 0; 173 396 char *VAL_B; ALLOCATE (VAL_B, char, Nval); 174 397 short *VAL_I; ALLOCATE (VAL_I, short, Nval); … … 178 401 double *VAL_D; ALLOCATE (VAL_D, double, Nval); 179 402 180 long A = time(NULL);181 srand48(A);182 183 403 int i; 184 404 for (i = 0; i < Nval; i++) { 185 VAL_B[i] = 0xff & lrand48();186 VAL_I[i] = 0xffff & lrand48();187 VAL_J[i] = 0xffffffff & lrand48();188 VAL_K[i] = (((int64_t)lrand48()) << 32) + (int64_t)lrand48();189 VAL_E[i] = FLT_MAX * (2.0*drand48() - 1.0);190 VAL_D[i] = DBL_MAX * (2.0*drand48() - 1.0);405 VAL_B[i] = (i % 255) - 128; 406 VAL_I[i] = i; 407 VAL_J[i] = 10000*i + 100*i; 408 VAL_K[i] = 10000*i + 330*i; 409 VAL_E[i] = 0.1*i; 410 VAL_D[i] = 1.001*i; 191 411 } 192 412 … … 206 426 FTable cmptable; 207 427 cmptable.header = &cmpheader; 208 ok (gfits_compress_table (&ftable, &cmptable, 10, zcmptype), "compressed table");428 ok (gfits_compress_table (&ftable, &cmptable, 0, zcmptype), "compressed table"); 209 429 210 430 Header rawheader; … … 239 459 int NVAL_D_bad = 0; 240 460 461 // for (i = 0; i < Nval; i++) { 462 // fprintf (stderr, "%0llx : %0llx\n", (long long) VAL_K[i], (long long) VAL_K_t[i]); 463 // } 464 241 465 for (i = 0; i < Nval; i++) { 242 466 if (VAL_B[i] != VAL_B_t[i]) NVAL_B_bad++; … … 255 479 ok (!NVAL_D_bad, "double values match (input vs output)"); 256 480 481 free (VAL_B); 482 free (VAL_I); 483 free (VAL_J); 484 free (VAL_K); 485 free (VAL_E); 486 free (VAL_D); 487 488 free (VAL_B_t); 489 free (VAL_I_t); 490 free (VAL_J_t); 491 free (VAL_K_t); 492 free (VAL_E_t); 493 free (VAL_D_t); 494 257 495 gfits_free_header (&header); 258 496 gfits_free_table (&ftable); … … 264 502 } 265 503 266 int test_compress_single_full (char *zcmptype) { // test 2: make a table, compress, uncompress, compare : use compression "NONE" 267 268 Header header; 269 FTable ftable; 270 271 diag ("--- starting test_compress with zcmptype %s ---", zcmptype); 272 ok (gfits_init_header (&header), "inited the header"); 273 ok (gfits_init_table (&ftable), "inited the table"); 274 275 ok (gfits_create_table_header (&header, "BINTABLE", "TESTDATA"), "created the table header"); 276 277 ok (gfits_define_bintable_column (&header, "I", "SEQ", "seq", "none", 1.0, 0.0), "defined short column"); 278 279 // generate the output array that carries the data 280 ok (gfits_create_table (&header, &ftable), "created the basic table"); 281 282 int Nval = 1000; 283 short *SEQ; ALLOCATE (SEQ, short, Nval); 284 285 int i; 286 for (i = 0; i < Nval; i++) { 287 SEQ[i] = i; 288 } 289 290 // add the columns to the output array 291 ok (gfits_set_bintable_column (&header, &ftable, "SEQ", SEQ, Nval), "set short table column"); 292 293 Header *outheader = &header; 294 FTable *outtable = &ftable; 295 296 if (zcmptype) { 297 Header cmpheader; 298 FTable cmptable; 299 cmptable.header = &cmpheader; 300 ok (gfits_compress_table (&ftable, &cmptable, 0, zcmptype), "compressed table"); 301 302 Header rawheader; 303 FTable rawtable; 304 rawtable.header = &rawheader; 305 ok (gfits_uncompress_table (&cmptable, &rawtable), "uncompressed table"); 306 307 gfits_free_header (&cmpheader); 308 gfits_free_table (&cmptable); 309 310 outheader = &rawheader; 311 outtable = &rawtable; 312 } 313 314 char type[16]; 315 int Ncol; 316 off_t Nrow; 317 318 short *SEQ_t = gfits_get_bintable_column_data (outheader, outtable, "SEQ", type, &Nrow, &Ncol); ok (!strcmp (type, "short"), "read short table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols"); 319 320 // count mismatched values 321 int Nseq = 0; 322 for (i = 0; i < Nval; i++) { 323 if (SEQ[i] != SEQ_t[i]) Nseq++; 324 } 325 326 ok (!Nseq, "short values match (input vs output)"); 327 328 gfits_free_header (&header); 329 gfits_free_table (&ftable); 330 if (zcmptype) { 331 gfits_free_header (outheader); 332 gfits_free_table (outtable); 333 } 334 return TRUE; 335 } 336 337 int test_compress_empty (char *zcmptype) { // test 2: make a table, compress, uncompress, compare : use compression "NONE" 338 339 Header header; 340 FTable ftable; 341 342 diag ("--- starting test_compress with zcmptype %s ---", zcmptype); 343 ok (gfits_init_header (&header), "inited the header"); 344 ok (gfits_init_table (&ftable), "inited the table"); 345 346 ok (gfits_create_table_header (&header, "BINTABLE", "TESTDATA"), "created the table header"); 347 348 ok (gfits_define_bintable_column (&header, "B", "VAL_B", "byte", "none", 1.0, 0.0), "defined byte column"); 349 ok (gfits_define_bintable_column (&header, "I", "VAL_I", "short", "none", 1.0, 0.0), "defined short column"); 350 ok (gfits_define_bintable_column (&header, "J", "VAL_J", "int", "none", 1.0, 0.0), "defined int column"); 351 ok (gfits_define_bintable_column (&header, "K", "VAL_K", "long", "none", 1.0, 0.0), "defined long column"); 352 ok (gfits_define_bintable_column (&header, "E", "VAL_E", "float", "degree", 1.0, 0.0), "defined float column"); 353 ok (gfits_define_bintable_column (&header, "D", "VAL_D", "double", "degree", 1.0, 0.0), "defined double column"); 354 355 // generate the output array that carries the data 356 ok (gfits_create_table (&header, &ftable), "created the basic table"); 357 358 int Nval = 0; 359 char *VAL_B; ALLOCATE (VAL_B, char, Nval); 360 short *VAL_I; ALLOCATE (VAL_I, short, Nval); 361 int *VAL_J; ALLOCATE (VAL_J, int, Nval); 362 int64_t *VAL_K; ALLOCATE (VAL_K, int64_t, Nval); 363 float *VAL_E; ALLOCATE (VAL_E, float, Nval); 364 double *VAL_D; ALLOCATE (VAL_D, double, Nval); 365 366 int i; 367 for (i = 0; i < Nval; i++) { 368 VAL_B[i] = (i % 255) - 128; 369 VAL_I[i] = i; 370 VAL_J[i] = 10000*i + 100*i; 371 VAL_K[i] = 10000*i + 330*i; 372 VAL_E[i] = 0.1*i; 373 VAL_D[i] = 1.001*i; 374 } 375 376 // add the columns to the output array 377 ok (gfits_set_bintable_column (&header, &ftable, "VAL_B", VAL_B, Nval), "set byte table column"); 378 ok (gfits_set_bintable_column (&header, &ftable, "VAL_I", VAL_I, Nval), "set short table column"); 379 ok (gfits_set_bintable_column (&header, &ftable, "VAL_J", VAL_J, Nval), "set int table column"); 380 ok (gfits_set_bintable_column (&header, &ftable, "VAL_K", VAL_K, Nval), "set long table column"); 381 ok (gfits_set_bintable_column (&header, &ftable, "VAL_E", VAL_E, Nval), "set float table column"); 382 ok (gfits_set_bintable_column (&header, &ftable, "VAL_D", VAL_D, Nval), "set double table column"); 383 384 Header *outheader = &header; 385 FTable *outtable = &ftable; 386 387 if (zcmptype) { 388 Header cmpheader; 389 FTable cmptable; 390 cmptable.header = &cmpheader; 391 ok (gfits_compress_table (&ftable, &cmptable, 0, zcmptype), "compressed table"); 392 393 Header rawheader; 394 FTable rawtable; 395 rawtable.header = &rawheader; 396 ok (gfits_uncompress_table (&cmptable, &rawtable), "uncompressed table"); 397 398 gfits_free_header (&cmpheader); 399 gfits_free_table (&cmptable); 400 401 outheader = &rawheader; 402 outtable = &rawtable; 403 } 404 405 char type[16]; 406 int Ncol; 407 off_t Nrow; 408 409 char *VAL_B_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_B", type, &Nrow, &Ncol); ok (!strcmp (type, "byte"), "read byte table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols"); 410 short *VAL_I_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_I", type, &Nrow, &Ncol); ok (!strcmp (type, "short"), "read short table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols"); 411 int *VAL_J_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_J", type, &Nrow, &Ncol); ok (!strcmp (type, "int"), "read int table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols"); 412 int64_t *VAL_K_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_K", type, &Nrow, &Ncol); ok (!strcmp (type, "int64_t"), "read int64_t table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols"); 413 float *VAL_E_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_E", type, &Nrow, &Ncol); ok (!strcmp (type, "float"), "read float table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols"); 414 double *VAL_D_t = gfits_get_bintable_column_data (outheader, outtable, "VAL_D", type, &Nrow, &Ncol); ok (!strcmp (type, "double"), "read double table column"); ok (Nrow == Nval, "right number of rows"); ok (Ncol == 1, "right number of cols"); 415 416 // count mismatched values 417 int NVAL_B_bad = 0; 418 int NVAL_I_bad = 0; 419 int NVAL_J_bad = 0; 420 int NVAL_K_bad = 0; 421 int NVAL_E_bad = 0; 422 int NVAL_D_bad = 0; 423 424 // for (i = 0; i < Nval; i++) { 425 // fprintf (stderr, "%0llx : %0llx\n", (long long) VAL_K[i], (long long) VAL_K_t[i]); 426 // } 427 428 for (i = 0; i < Nval; i++) { 429 if (VAL_B[i] != VAL_B_t[i]) NVAL_B_bad++; 430 if (VAL_I[i] != VAL_I_t[i]) NVAL_I_bad++; 431 if (VAL_J[i] != VAL_J_t[i]) NVAL_J_bad++; 432 if (VAL_K[i] != VAL_K_t[i]) NVAL_K_bad++; 433 if (VAL_E[i] != VAL_E_t[i]) NVAL_E_bad++; 434 if (VAL_D[i] != VAL_D_t[i]) NVAL_D_bad++; 435 } 436 437 ok (!NVAL_B_bad, "byte values match (input vs output)"); 438 ok (!NVAL_I_bad, "short values match (input vs output)"); 439 ok (!NVAL_J_bad, "int values match (input vs output)"); 440 ok (!NVAL_K_bad, "int64_t values match (input vs output)"); 441 ok (!NVAL_E_bad, "float values match (input vs output)"); 442 ok (!NVAL_D_bad, "double values match (input vs output)"); 443 444 gfits_free_header (&header); 445 gfits_free_table (&ftable); 446 if (zcmptype) { 447 gfits_free_header (outheader); 448 gfits_free_table (outtable); 449 } 450 return TRUE; 451 } 452 453 504 -
trunk/Ohana/src/libfits/test/zlib.c
r38442 r39457 16 16 tmp = Pout[3]; Pout[3] = Pout[4]; Pout[4] = tmp; } 17 17 18 int main ( int argc, char **argv) {18 int main (void) { 19 19 20 20 plan_tests (14); … … 30 30 { 31 31 z_stream zdn; 32 zdn.next_in = ( char *) srcbuf;32 zdn.next_in = (unsigned char *) srcbuf; 33 33 zdn.avail_in = NSRC * sizeof(double); 34 zdn.next_out = ( char *) tgtbuf;34 zdn.next_out = (unsigned char *) tgtbuf; 35 35 zdn.avail_out = NTGT * sizeof(double); 36 36 … … 83 83 { 84 84 z_stream zup; 85 zup.next_in = ( char *) tgtbuf;85 zup.next_in = (unsigned char *) tgtbuf; 86 86 zup.avail_in = NTGT * sizeof(double); 87 zup.next_out = ( char *) outbuf;87 zup.next_out = (unsigned char *) outbuf; 88 88 zup.avail_out = NOUT * sizeof(double); 89 89 … … 120 120 { 121 121 z_stream zdn; 122 zdn.next_in = ( char *) srcbuf;122 zdn.next_in = (unsigned char *) srcbuf; 123 123 zdn.avail_in = NSRC * sizeof(double); 124 zdn.next_out = ( char *) tgtbuf;124 zdn.next_out = (unsigned char *) tgtbuf; 125 125 zdn.avail_out = NTGT * sizeof(double); 126 126 … … 174 174 { 175 175 z_stream zup; 176 zup.next_in = ( char *) tgtbuf;176 zup.next_in = (unsigned char *) tgtbuf; 177 177 zup.avail_in = NTGT * sizeof(double); 178 zup.next_out = ( char *) outbuf;178 zup.next_out = (unsigned char *) outbuf; 179 179 zup.avail_out = NOUT * sizeof(double); 180 180 -
trunk/Ohana/src/libkapa/rotfont/courier12.h
r38991 r39457 63 63 static unsigned char courier12_31_bits[] = { 64 64 0x00}; 65 static unsigned char courier12_32_bits[] = {}; 65 static unsigned char courier12_32_bits[] = { 66 0x00}; 66 67 static unsigned char courier12_33_bits[] = { 67 68 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x02}; -
trunk/Ohana/src/libkapa/rotfont/courier24.h
r38991 r39457 63 63 static unsigned char courier24_31_bits[] = { 64 64 0x00}; 65 static unsigned char courier24_32_bits[] = {}; 65 static unsigned char courier24_32_bits[] = { 66 0x00}; 66 67 static unsigned char courier24_33_bits[] = { 67 68 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00, 0x07, -
trunk/Ohana/src/libkapa/rotfont/courier8.h
r38991 r39457 63 63 static unsigned char courier8_31_bits[] = { 64 64 0x00}; 65 static unsigned char courier8_32_bits[] = {}; 65 static unsigned char courier8_32_bits[] = { 66 0x00}; 66 67 static unsigned char courier8_33_bits[] = { 67 68 0x01, 0x01, 0x01, 0x01}; -
trunk/Ohana/src/libkapa/rotfont/fixed.h
r5854 r39457 62 62 static unsigned char fixed_31_bits[] = { 63 63 0x01}; 64 static unsigned char fixed_32_bits[] = {}; 64 static unsigned char fixed_32_bits[] = { 65 0x00}; 65 66 static unsigned char fixed_33_bits[] = { 66 67 0x1, 0x1, 0x1, 0x1, 0x1, 0x0, 0x01}; -
trunk/Ohana/src/libkapa/src/DrawRotString.c
r38986 r39457 36 36 unsigned char *bitmap; 37 37 char *currentname, basename[64]; 38 int i,dy, dx, N, X, Y, code, protect;38 int dy, dx, N, X, Y, code, protect; 39 39 int dX, Xoff, dY, Yoff, YoffBase; 40 40 int currentsize, basesize; … … 76 76 YoffBase = Yoff; 77 77 /* draw characters one-by-one */ 78 unsigned int i; 78 79 for (i = 0; i < strlen(string); i++) { 79 80 N = (int)(string[i]); … … 150 151 int ii, jj, byte_line, byte, bit, flag; 151 152 unsigned long int fore; 152 double i , j, cs, sn, rscale, tmp;153 double ix, iy, cs, sn, rscale, tmp; 153 154 int X, Y, X0, X1, X2, Y0, Y1, Y2, x0, y0; 154 155 … … 212 213 XSetForeground (RotDisplay, RotGC, fore); 213 214 if (scale > 1) { 214 for (i = X1; i <= X2; i+=1) {215 for ( j = Y1; j <= Y2; j+=1) {216 tmp = rscale*(cs*(i - X0) + sn*(j- Y0)) + x0; ii = NEARINT (tmp);217 tmp = rscale*(cs*( j - Y0) - sn*(i- X0)) + y0; jj = NEARINT (tmp);215 for (ix = X1; ix <= X2; ix += 1) { 216 for (iy = Y1; iy <= Y2; iy += 1) { 217 tmp = rscale*(cs*(ix - X0) + sn*(iy - Y0)) + x0; ii = NEARINT (tmp); 218 tmp = rscale*(cs*(iy - Y0) - sn*(ix - X0)) + y0; jj = NEARINT (tmp); 218 219 /* fprintf (stderr, "%d %d %d %d\n", i, j, ii, jj); */ 219 220 if ((ii < 0) || (ii >= dx) || (jj < 0) || (jj >= dy)) continue; … … 221 222 bit = ii % 8; 222 223 flag = 0x01 & (bitmap[byte] >> bit); 223 if (flag) XDrawPoint (RotDisplay, RotWindow, RotGC, x + i , y + j);224 if (flag) XDrawPoint (RotDisplay, RotWindow, RotGC, x + ix, y + iy); 224 225 } 225 226 } 226 227 } else { 227 for (i = X1; i <= X2; i+=scale) {228 for ( j = Y1; j <= Y2; j+=scale) {229 tmp = rscale*(cs*(i - X0) + sn*(j- Y0)) + x0; ii = NEARINT (tmp);230 tmp = rscale*(cs*( j - Y0) - sn*(i- X0)) + y0; jj = NEARINT (tmp);228 for (ix = X1; ix <= X2; ix+=scale) { 229 for (iy = Y1; iy <= Y2; iy+=scale) { 230 tmp = rscale*(cs*(ix - X0) + sn*(iy - Y0)) + x0; ii = NEARINT (tmp); 231 tmp = rscale*(cs*(iy - Y0) - sn*(ix - X0)) + y0; jj = NEARINT (tmp); 231 232 /* fprintf (stderr, "%d %d %d %d\n", i, j, ii, jj); */ 232 233 if ((ii < 0) || (ii >= dx) || (jj < 0) || (jj >= dy)) continue; … … 236 237 /* fprintf (stderr, "%2d %2d %3d %3d %1d %f %f\n", i, j, ii, jj, flag, 237 238 rscale*(cs*(i - X0) + sn*(j - Y0)) + x0, rscale*(cs*(j - Y0) - sn*(i - X0)) + y0); */ 238 if (flag) XDrawPoint (RotDisplay, RotWindow, RotGC, x + i , y + j);239 if (flag) XDrawPoint (RotDisplay, RotWindow, RotGC, x + ix, y + iy); 239 240 } 240 241 } 241 242 # if (0) 242 for (i = 0; i < dx; i++) {243 for ( j = 0; j < dy; j++) {244 tmp = scale*(cs*(i - x0) - sn*(j- y0)) + X0; ii = NEARINT (tmp);245 tmp = scale*(cs*( j - y0) + sn*(i- x0)) + Y0; jj = NEARINT (tmp);243 for (ix = 0; ix < dx; ix++) { 244 for (iy = 0; iy < dy; iy++) { 245 tmp = scale*(cs*(ix - x0) - sn*(iy - y0)) + X0; ii = NEARINT (tmp); 246 tmp = scale*(cs*(iy - y0) + sn*(ix - x0)) + Y0; jj = NEARINT (tmp); 246 247 /* if ((ii < 0) || (ii >= dx) || (jj < 0) || (jj >= dy)) continue; */ 247 byte = byte_line * j + (i/ 8);248 bit = i % 8;248 byte = byte_line * iy + (ix / 8); 249 bit = ix % 8; 249 250 flag = 0x01 & (bitmap[byte] >> bit); 250 fprintf (stderr, "%2d %2d %3d %3d %1d %f %f\n", i , j, ii, jj, flag,251 scale*(cs*(i - x0) - sn*(j - y0)) + X0, scale*(cs*(j - y0) + sn*(i- x0)) + Y0);251 fprintf (stderr, "%2d %2d %3d %3d %1d %f %f\n", ix, iy, ii, jj, flag, 252 scale*(cs*(ix - x0) - sn*(iy - y0)) + X0, scale*(cs*(iy - y0) + sn*(ix - x0)) + Y0); 252 253 if (flag) XDrawPoint (RotDisplay, RotWindow, RotGC, x + ii, y + jj); 253 254 } -
trunk/Ohana/src/libkapa/src/KapaOpen.c
r39225 r39457 10 10 11 11 static int Nvalid = 0; 12 static int *VALID = NULL;12 static u_int32_t *VALID = NULL; 13 13 14 14 int KapaLaunchCommand (char *line); … … 146 146 if (Nvalid == 0) { 147 147 Nvalid = 1; 148 ALLOCATE (VALID, int, Nvalid);148 ALLOCATE (VALID, u_int32_t, Nvalid); 149 149 } else { 150 150 Nvalid ++; 151 REALLOCATE (VALID, int, Nvalid);151 REALLOCATE (VALID, u_int32_t, Nvalid); 152 152 } 153 153 -
trunk/Ohana/src/libkapa/src/PSRotFont.c
r38986 r39457 7 7 8 8 char *segment, basename[64], *currentname; 9 int i,N, code, protect;9 int N, code, protect; 10 10 int dX, dY, Xoff, Yoff, X, Y, Nseg, NSEG, YoffBase; 11 11 double cs, sn, currentscale; … … 78 78 YoffBase = 0; 79 79 /* accumulate string segments with common state */ 80 81 unsigned int i; 80 82 for (i = 0; i < strlen (string); i++) { 81 83 N = (int)(string[i]); … … 198 200 int PSRotStrlen (char *c) { 199 201 200 int i,N, dX, code;202 int N, dX, code; 201 203 double currentscale, scale; 202 204 … … 208 210 209 211 code = FALSE; 212 213 unsigned int i; 210 214 for (i = 0; i < strlen (c); i++) { 211 215 N = (int)(c[i]); -
trunk/Ohana/src/libkapa/src/RotFont.c
r39339 r39457 95 95 int RotStrlen (char *c) { 96 96 97 int i,N, dX, code;97 int N, dX, code; 98 98 double scale; 99 99 … … 106 106 107 107 code = FALSE; 108 109 unsigned int i; 108 110 for (i = 0; i < strlen (c); i++) { 109 111 N = (int)(c[i]); -
trunk/Ohana/src/libkapa/src/bDrawRotFont.c
r30603 r39457 14 14 unsigned char *bitmap; 15 15 char *currentname, basename[64]; 16 int i,dy, dx, N, X, Y, code, protect;16 int dy, dx, N, X, Y, code, protect; 17 17 int dX, Xoff, dY, Yoff, YoffBase; 18 18 int currentsize, basesize; … … 57 57 YoffBase = Yoff; 58 58 /* draw characters one-by-one */ 59 60 unsigned int i; 59 61 for (i = 0; i < strlen(string); i++) { 60 62 N = (int)(string[i]); … … 125 127 126 128 int bDrawRotBitmap (bDrawBuffer *buffer, int x, int y, int dx, int dy, unsigned char *bitmap, int mode, double angle, double scale) { 129 OHANA_UNUSED_PARAM(mode); 127 130 128 131 int ii, jj, byte_line, byte, bit, flag; -
trunk/Ohana/src/libohana/include/ohana.h
r39407 r39457 400 400 int write_fmt PROTO((int fd, char *format, ...)) OHANA_FORMAT(printf, 2, 3); 401 401 402 char **isolate_elements PROTO(( int argc, char **argv,int *nstack));402 char **isolate_elements PROTO((unsigned int argc, char **argv, unsigned int *nstack)); 403 403 404 404 // functions used to manage "last error message" … … 486 486 int ohana_bisection_double (double *values, int Nvalues, double threshold); 487 487 488 int sprintf_float (char *output, float value);489 int sprintf_double (char *output, double value);488 unsigned int sprintf_float (char *output, float value); 489 unsigned int sprintf_double (char *output, double value); 490 490 491 491 /* in gaussdev.c */ -
trunk/Ohana/src/libohana/include/ohana_allocate.h
r39324 r39457 13 13 int line; // line (re)allocated 14 14 int freed; // memory has been freed 15 int dummy; // need to put endblock on the endpost15 int Nalloc; // need to put endblock on the endpost 16 16 uint32_t endblock; // endpost marker 17 17 } OhanaMemblock; -
trunk/Ohana/src/libohana/src/Fread.c
r29537 r39457 44 44 45 45 static int ByteSwap (char *ptr, off_t size, off_t nitems, char *type) { 46 OHANA_UNUSED_PARAM(size); 46 47 47 # ifdef BYTE_SWAP 48 # ifndef BYTE_SWAP 49 OHANA_UNUSED_PARAM(ptr); 50 OHANA_UNUSED_PARAM(nitems); 51 OHANA_UNUSED_PARAM(type); 52 return (TRUE); 53 54 # else 48 55 49 56 off_t i; … … 108 115 return (FALSE); 109 116 110 # else111 112 return (TRUE);113 114 117 # endif 115 118 -
trunk/Ohana/src/libohana/src/config.c
r39393 r39457 43 43 uid_t uid; 44 44 gid_t gid; 45 int i, N, NDEF, status;45 int unsigned i, N, NDEF, status; 46 46 47 47 /* first look for -C CONFIG variable */ -
trunk/Ohana/src/libohana/src/findexec.c
r39393 r39457 315 315 /* force addition of user exec/read/write */ 316 316 mode |= S_IRWXU; 317 errno = 0; // If mkdirhier succeeds, errno must be 0 317 318 if (mkdir (path, mode)) { 318 319 if (errno == ENOENT) { -
trunk/Ohana/src/libohana/src/gaussj.c
r39369 r39457 20 20 // numerical precision, I am raising an error if |growth| > 1e8 21 21 int dgaussjordan_pivot (double **A, double **B, int N, int M, double MIN_PIVOT) { 22 OHANA_UNUSED_PARAM(MIN_PIVOT); 22 23 23 24 int *colIndex; -
trunk/Ohana/src/libohana/src/isolate_elements.c
r31635 r39457 1 // # include "opihi.h" 2 // 3 #include "ohana.h" 1 # include "ohana.h" 4 2 5 3 /* local private functions */ 6 char **InsertValue (char **myOutput, int *Nout, int *Nchar,int *NCHAR, char c);7 char **EndOfString (char **myOutput, int *Nout, int *Nchar, int *NOUT,int *NCHAR);4 char **InsertValue (char **myOutput, unsigned int *Nout, unsigned int *Nchar, unsigned int *NCHAR, char c); 5 char **EndOfString (char **myOutput, unsigned int *Nout, unsigned int *Nchar, unsigned int *NOUT, unsigned int *NCHAR); 8 6 int IsAnOp (char *c); 9 7 int IsTwoOp (char *c); 10 8 11 char **isolate_elements ( int Nin, char **in,int *nout) {9 char **isolate_elements (unsigned int Nin, char **in, unsigned int *nout) { 12 10 13 11 /* local private static variables */ 14 int NCHAR, Nchar, Nout, NOUT;12 unsigned int NCHAR, Nchar, Nout, NOUT; 15 13 char **myOutput; 16 14 17 int i, j, minus, negate, plus, posate, OpStat, SciNotation;15 unsigned int i, j, minus, negate, plus, posate, OpStat, SciNotation; 18 16 19 17 NOUT = Nin; … … 142 140 } 143 141 144 char **InsertValue (char **myOutput, int *Nout, int *Nchar,int *NCHAR, char c) {142 char **InsertValue (char **myOutput, unsigned int *Nout, unsigned int *Nchar, unsigned int *NCHAR, char c) { 145 143 myOutput[*Nout][*Nchar] = c; 146 144 (*Nchar) ++; … … 153 151 } 154 152 155 char **EndOfString (char **myOutput, int *Nout, int *Nchar, int *NOUT,int *NCHAR) {153 char **EndOfString (char **myOutput, unsigned int *Nout, unsigned int *Nchar, unsigned int *NOUT, unsigned int *NCHAR) { 156 154 if ((*Nchar) > 0) { 157 155 myOutput[*Nout][*Nchar] = 0; -
trunk/Ohana/src/libohana/src/ohana_allocate.c
r39407 r39457 18 18 # define MAX(X,Y) ((X) > (Y) ? (X) : (Y)) 19 19 20 // a no-op to mark unused parameters in a function 21 # define OHANA_UNUSED_PARAM(x)(void)(x) 22 20 23 static OhanaMemblock *lastBlock = NULL; 21 24 static int Nblock = 0; … … 52 55 Nelem = MAX (1, Nelem); 53 56 size = Nelem * esize; 57 // if (size % 8) size += (8 - size % 8); // do NOT round to 8-byte boundary (did not fix corruption) 54 58 55 59 // total size is : memblock + data + endpost 56 60 new = (OhanaMemblock *) malloc (sizeof(OhanaMemblock) + size + 2*sizeof(void *)); 57 61 if (new == NULL) ohana_memabort ("failed to allocate memory (%s, %d, %s)\n", file, line, func); 58 if (errno == ENOMEM) abort();62 // if (errno == ENOMEM) abort(); I should not check the value of errno if new is not NULL 59 63 60 64 // pointer to the start of the user memory … … 72 76 new->func = func; 73 77 new->freed = FALSE; 78 new->Nalloc = 1; 74 79 75 80 // poison the whole memory: we should not rely of 0'ed memory … … 126 131 Nelem = MAX (1, Nelem); 127 132 size = Nelem * esize; 133 // if (size % 8) size += (8 - size % 8); // do NOT round to 8-byte boundary (did not fix corruption) 128 134 129 135 // requested same size as current allocation … … 131 137 return in; 132 138 } 139 size_t oldsize = old->size; 133 140 134 141 pthread_mutex_lock(&memBlockListMutex); … … 153 160 new->nextBlock = old->nextBlock; 154 161 new->prevBlock = old->prevBlock; 162 new->startblock = OHANA_MEMMAGIC; 163 new->endblock = OHANA_MEMMAGIC; 164 new->freed = FALSE; 155 165 # else 156 166 // ask for new memory … … 161 171 # endif 162 172 163 // set the end-post values 164 new->startblock = OHANA_MEMMAGIC; 165 new->endblock = OHANA_MEMMAGIC; 166 *(uint32_t *)(ptr_new + size) = OHANA_MEMMAGIC; 173 if (new->startblock != OHANA_MEMMAGIC) ohana_memabort ("corrupt memory (%s, %d, %s)\n", file, line, func); 174 if (new->endblock != OHANA_MEMMAGIC) ohana_memabort ("corrupt memory (%s, %d, %s)\n", file, line, func); 167 175 168 176 // set the memory metadata … … 171 179 new->line = line; 172 180 new->func = func; 173 new-> freed = FALSE;174 175 // update the endpost (the others were set originally 181 new->Nalloc++; 182 183 // update the endpost (the others were set originally and maintained through the realloc) 176 184 *(uint32_t *)(ptr_new + size) = OHANA_MEMMAGIC; 185 186 // poison the new memory: we should not rely of 0'ed memory 187 if (new->size > oldsize) { 188 memset (&ptr_new[oldsize], 0x7f, new->size - oldsize); 189 } 177 190 178 191 // need to reset lastBlock in case we moved -
trunk/Ohana/src/libohana/src/sprintf_floats.c
r39058 r39457 8 8 9 9 // returns the number of bytes written EXCLUDING the ending NULL char 10 int sprintf_float (char *output, float value) {10 unsigned int sprintf_float (char *output, float value) { 11 11 12 12 // I want a fast way to print a float in %e format. Simplifying assumptions: print a … … 117 117 118 118 // returns the number of bytes written EXCLUDING the ending NULL char 119 int sprintf_double (char *output, double value) {119 unsigned int sprintf_double (char *output, double value) { 120 120 121 121 // I want a fast way to print a float in %e format. Simplifying assumptions: print a -
trunk/Ohana/src/libohana/test/sprintf_floats.c
r39058 r39457 7 7 8 8 void test_float (float value) { 9 char output[128], string[128] ;9 char output[128], string[128], altout[128]; 10 10 11 int Noutput = sprintf_float(output, value);11 unsigned int Noutput = sprintf_float(output, value); 12 12 ok (Noutput == strlen(output), "right length"); 13 13 sprintf (string, "%+14.7e", value); 14 ok (!strcmp (output, string), "right format");15 14 16 if (strcmp (output, string)) { 17 fprintf (stderr, "output: %s, string: %s\n", output, string); 15 // due to rounding error (where?), the last digit may differ between sprintf and sprintf_float 16 if (!strcmp (output, string)) { 17 pass ("right format: %s, string: %s", output, string); 18 return; 18 19 } 20 21 strcpy (altout, output); 22 int Co = output[9] - '0'; 23 int Ci = string[9] - '0'; 24 int valid = (Co - 1 == Ci); // e.g., Co = 8, Ci = 9 25 valid = valid || (Co + 1 == Ci); // e.g., Co = 8, Ci = 7 26 valid = valid || ((Co == 0) && Ci == 9); // e.g., Co = 0, Ci = 9 27 valid = valid || ((Ci == 0) && Co == 9); // e.g., Co = 9, Ci = 0 28 if (!valid) { 29 fail ("wrong format: %s, string: %s", output, string); 30 return; 31 } 32 altout[9] = string[9]; 33 if ((Co == 0) && (Ci == 9)) { 34 altout[8] = string[8]; 35 } 36 if ((Co == 9) && (Ci == 0)) { 37 altout[8] = string[8]; 38 } 39 if (!strcmp (altout, string)) { 40 pass ("fixed format: %s, string: %s", output, string); 41 } else { 42 fail ("wrong format: %s, string: %s", output, string); 43 } 44 19 45 return; 20 46 } 21 47 22 48 void test_double (double value) { 23 char output[128], string[128] ;49 char output[128], string[128], altout[128]; 24 50 25 int Noutput = sprintf_double(output, value);51 unsigned int Noutput = sprintf_double(output, value); 26 52 ok (Noutput == strlen(output), "right length"); 27 53 sprintf (string, "%+21.14e", value); 28 ok (!strcmp (output, string), "right format");29 54 30 if (strcmp (output, string)) { 31 fprintf (stderr, "output: %s, string: %s\n", output, string); 55 // due to rounding error (where?), the last digit may differ between sprintf and sprintf_float 56 if (!strcmp (output, string)) { 57 pass ("right format: %s, string: %s", output, string); 58 return; 32 59 } 60 61 strcpy (altout, output); 62 int Co = output[16] - '0'; 63 int Ci = string[16] - '0'; 64 int valid = (Co - 1 == Ci); // e.g., Co = 8, Ci = 9 65 valid = valid || (Co + 1 == Ci); // e.g., Co = 8, Ci = 7 66 valid = valid || ((Co == 0) && Ci == 9); // e.g., Co = 0, Ci = 9 67 valid = valid || ((Ci == 0) && Co == 9); // e.g., Co = 9, Ci = 0 68 if (!valid) { 69 fail ("wrong format: %s, string: %s", output, string); 70 return; 71 } 72 altout[16] = string[16]; 73 if ((Co == 0) && (Ci == 9)) { 74 altout[15] = string[15]; 75 fprintf (stderr, "last two digits .. "); 76 } 77 if ((Co == 9) && (Ci == 0)) { 78 altout[15] = string[15]; 79 fprintf (stderr, "last two digits .. "); 80 } 81 if (!strcmp (altout, string)) { 82 pass ("fixed format: %s, string: %s", output, string); 83 } else { 84 fail ("wrong format: %s, string: %s", output, string); 85 } 86 33 87 return; 34 88 } … … 43 97 /*** sprint_float ***/ 44 98 if (DO_FLOATS) { 45 int Noutput;99 unsigned int Noutput; 46 100 char output[128]; 47 101 … … 85 139 /*** sprint_double ***/ 86 140 if (DO_DOUBLES) { 87 int Noutput;141 unsigned int Noutput; 88 142 char output[128]; 89 143 -
trunk/Ohana/src/libtap/include/tap_ohana.h
r10312 r39457 28 28 and requires the caller to add the final comma if they've ommitted 29 29 the optional arguments */ 30 #ifdef __GNUC__ 30 #if __STDC_VERSION__ >= 199901L /* we are C99 */ 31 # define ok(e, ...) ((e) ? \ 32 _gen_result(1, __func__, __FILE__, __LINE__, \ 33 __VA_ARGS__) : \ 34 _gen_result(0, __func__, __FILE__, __LINE__, \ 35 __VA_ARGS__)) 36 37 # define ok1(e) ((e) ? \ 38 _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \ 39 _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e)) 40 41 # define pass(...) ok(1, __VA_ARGS__); 42 # define fail(...) ok(0, __VA_ARGS__); 43 44 # define skip_start(test, n, ...) \ 45 do { \ 46 if((test)) { \ 47 skip(n, __VA_ARGS__); \ 48 continue; \ 49 } 50 #elif __GNUC__ /* we are at least gcc */ 31 51 # define ok(e, test, ...) ((e) ? \ 32 52 _gen_result(1, __func__, __FILE__, __LINE__, \ … … 48 68 continue; \ 49 69 } 50 #elif __STDC_VERSION__ >= 199901L /* __GNUC__ */ 51 # define ok(e, ...) ((e) ? \ 52 _gen_result(1, __func__, __FILE__, __LINE__, \ 53 __VA_ARGS__) : \ 54 _gen_result(0, __func__, __FILE__, __LINE__, \ 55 __VA_ARGS__)) 56 57 # define ok1(e) ((e) ? \ 58 _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \ 59 _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e)) 60 61 # define pass(...) ok(1, __VA_ARGS__); 62 # define fail(...) ok(0, __VA_ARGS__); 63 64 # define skip_start(test, n, ...) \ 65 do { \ 66 if((test)) { \ 67 skip(n, __VA_ARGS__); \ 68 continue; \ 69 } 70 #else /* __STDC_VERSION__ */ 70 #else /* neither __STDC_VERSION__ nor gcc: */ 71 71 # error "Needs gcc or C99 compiler for variadic macros." 72 72 #endif /* __STDC_VERSION__ */ -
trunk/Ohana/src/opihi/cmd.astro/flux.c
r27611 r39457 1 1 # include "astro.h" 2 # include <signal.h> 2 3 3 4 int flux (int argc, char **argv) { 4 5 5 6 int i, j, k, xmin, ymin, xmax, ymax; 6 void *oldsignal;7 7 double ax, ay, s, S, flux; 8 8 double bx[5], by[5], x[5], y[5], bb[5]; … … 55 55 we have to add up the angles for concave contours */ 56 56 flux = 0; 57 oldsignal = signal (SIGINT, handle_interrupt); 58 interrupt = FALSE;57 58 struct sigaction *old_sigaction = SetInterrupt(); 59 59 for (j = ymin; (j < ymax) && !interrupt; j++) { 60 60 V = (float *)(buf[0].matrix.buffer) + j*buf[0].matrix.Naxis[0] + xmin; … … 72 72 } 73 73 } 74 signal (SIGINT, oldsignal);74 ClearInterrupt (old_sigaction); 75 75 76 76 gprint (GP_LOG, "flux: %f\n", flux); -
trunk/Ohana/src/opihi/cmd.astro/imfit-fgauss.c
r20936 r39457 41 41 /* real 2D gaussian -- x, y, sx, sy, sxy, I, sky */ 42 42 opihi_flt fgaussTD (opihi_flt x, opihi_flt y, opihi_flt *par, int Npar, opihi_flt *dpar) { 43 OHANA_UNUSED_PARAM(Npar); 43 44 44 45 opihi_flt X, Y, px, py; -
trunk/Ohana/src/opihi/cmd.astro/imfit-pgauss-psf.c
r20936 r39457 39 39 /* pseudo 2D gaussian -- x, y, (sx), (sy), (sxy), I, sky */ 40 40 opihi_flt pgauss_psfTD (opihi_flt x, opihi_flt y, opihi_flt *par, int Npar, opihi_flt *dpar) { 41 OHANA_UNUSED_PARAM(Npar); 41 42 42 43 opihi_flt X, Y, px, py; -
trunk/Ohana/src/opihi/cmd.astro/imfit-pgauss.c
r20936 r39457 41 41 /* pseudo 2D gaussian -- x, y, sx, sy, sxy, I, sky */ 42 42 opihi_flt pgaussTD (opihi_flt x, opihi_flt y, opihi_flt *par, int Npar, opihi_flt *dpar) { 43 OHANA_UNUSED_PARAM(Npar); 43 44 44 45 opihi_flt X, Y, px, py; -
trunk/Ohana/src/opihi/cmd.astro/imfit-qfgauss.c
r20936 r39457 45 45 /* one component, two slopes: (1 + z^M + z^N)^(-1) -- x, y, sx, sy, sxy, I, sky */ 46 46 opihi_flt qfgaussTD (opihi_flt x, opihi_flt y, opihi_flt *par, int Npar, opihi_flt *dpar) { 47 OHANA_UNUSED_PARAM(Npar); 47 48 48 49 opihi_flt X, Y, px, py; -
trunk/Ohana/src/opihi/cmd.astro/imfit-qgauss-psf.c
r20936 r39457 42 42 /* one component, two slopes: (1 + z^M + z^N)^(-1) -- x, y, sx, sy, sxy, I, sky, sr */ 43 43 opihi_flt qgauss_psfTD (opihi_flt x, opihi_flt y, opihi_flt *par, int Npar, opihi_flt *dpar) { 44 OHANA_UNUSED_PARAM(Npar); 44 45 45 46 opihi_flt X, Y, px, py; -
trunk/Ohana/src/opihi/cmd.astro/imfit-qgauss.c
r20936 r39457 45 45 /* one component, two slopes: (1 + z^M + z^N)^(-1) -- x, y, sx, sy, sxy, I, sky, sr */ 46 46 opihi_flt qgaussTD (opihi_flt x, opihi_flt y, opihi_flt *par, int Npar, opihi_flt *dpar) { 47 OHANA_UNUSED_PARAM(Npar); 47 48 48 49 opihi_flt X, Y, px, py; -
trunk/Ohana/src/opihi/cmd.astro/imfit-qrgauss.c
r20936 r39457 45 45 46 46 opihi_flt qrgaussTD (opihi_flt x, opihi_flt y, opihi_flt *par, int Npar, opihi_flt *dpar) { 47 OHANA_UNUSED_PARAM(Npar); 47 48 48 49 opihi_flt X, Y, px, py; -
trunk/Ohana/src/opihi/cmd.astro/imfit-rgauss.c
r20936 r39457 37 37 /* two components: (1 + z_1 + 0.5*z_1^2 + z_2^N)^(-1) -- x, y, sx1, sy1, sxy1, I, sky, sx2, sy2, sxy2 */ 38 38 opihi_flt rgaussTD (opihi_flt x, opihi_flt y, opihi_flt *par, int Npar, opihi_flt *dpar) { 39 OHANA_UNUSED_PARAM(Npar); 39 40 40 41 opihi_flt X, Y, px1, py1, px2, py2; -
trunk/Ohana/src/opihi/cmd.astro/imfit-serbulge.c
r20936 r39457 42 42 /* exp (-b (r/r_e)^(1/n)) + pgauss (r) */ 43 43 opihi_flt serbulgeTD (opihi_flt x, opihi_flt y, opihi_flt *par, int Npar, opihi_flt *dpar) { 44 OHANA_UNUSED_PARAM(Npar); 44 45 45 46 opihi_flt X, Y, px1, px2, py1, py2; -
trunk/Ohana/src/opihi/cmd.astro/imfit-sersic.c
r20936 r39457 34 34 /* exp (-b (r/r_e)^(1/n)) */ 35 35 opihi_flt sersicTD (opihi_flt x, opihi_flt y, opihi_flt *par, int Npar, opihi_flt *dpar) { 36 OHANA_UNUSED_PARAM(Npar); 36 37 37 38 opihi_flt X, Y, px, py; -
trunk/Ohana/src/opihi/cmd.astro/imfit-sgauss-psf.c
r20936 r39457 44 44 /* two components: (1 + z_1 + z_2^N)^(-1) -- x, y, sx1, sy1, sxy1, I, sky, sx2, sy2, sxy2 */ 45 45 opihi_flt sgauss_psfTD (opihi_flt x, opihi_flt y, opihi_flt *par, int Npar, opihi_flt *dpar) { 46 OHANA_UNUSED_PARAM(Npar); 46 47 47 48 opihi_flt X, Y, px1, py1, px2, py2; -
trunk/Ohana/src/opihi/cmd.astro/imfit-sgauss.c
r20936 r39457 53 53 /* two components: (1 + z_1 + z_2^N)^(-1) -- x, y, sx1, sy1, sxy1, I, sky, sx2, sy2, sxy2 */ 54 54 opihi_flt sgaussTD (opihi_flt x, opihi_flt y, opihi_flt *par, int Npar, opihi_flt *dpar) { 55 OHANA_UNUSED_PARAM(Npar); 55 56 56 57 opihi_flt X, Y, px1, py1, px2, py2; -
trunk/Ohana/src/opihi/cmd.astro/imfit-tgauss.c
r20936 r39457 32 32 /* two components: (1 + z_1^M + z_2^N)^(-1) -- x, y, sx1, sy1, sxy1, I, sky, sx2, sy2, sxy2 */ 33 33 opihi_flt tgaussTD (opihi_flt x, opihi_flt y, opihi_flt *par, int Npar, opihi_flt *dpar) { 34 OHANA_UNUSED_PARAM(Npar); 34 35 35 36 opihi_flt X, Y, px1, py1, px2, py2; -
trunk/Ohana/src/opihi/cmd.astro/imfit-vgauss.c
r20936 r39457 27 27 /* pseudo 2D gaussian with opihi_flting 2nd and 3rd order terms -- x, y, sx, sy, sxy, I, sky, f1, f2 */ 28 28 opihi_flt vgaussTD (opihi_flt x, opihi_flt y, opihi_flt *par, int Npar, opihi_flt *dpar) { 29 OHANA_UNUSED_PARAM(Npar); 29 30 30 31 opihi_flt X, Y, px, py; -
trunk/Ohana/src/opihi/cmd.astro/spexseq.c
r33662 r39457 43 43 44 44 void get_sequence (Object *object, int Nobject, int idx1, float Dmax, float f1, float f2, int pin1, int pin2) { 45 OHANA_UNUSED_PARAM(pin1); 46 OHANA_UNUSED_PARAM(pin2); 45 47 46 48 int i, j, N; -
trunk/Ohana/src/opihi/cmd.basic/continue.c
r10846 r39457 2 2 3 3 int exec_next (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argc); 5 OHANA_UNUSED_PARAM(argv); 6 4 7 loop_next = TRUE; 5 8 return (TRUE); … … 7 10 8 11 int exec_last (int argc, char **argv) { 12 OHANA_UNUSED_PARAM(argc); 13 OHANA_UNUSED_PARAM(argv); 14 9 15 loop_last = TRUE; 10 16 return (TRUE); -
trunk/Ohana/src/opihi/cmd.basic/list_help.c
r27611 r39457 2 2 3 3 int list_help (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argc); 5 OHANA_UNUSED_PARAM(argv); 4 6 5 7 FILE *f; -
trunk/Ohana/src/opihi/cmd.basic/list_vars.c
r2598 r39457 2 2 3 3 int list_vars (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argc); 5 OHANA_UNUSED_PARAM(argv); 4 6 5 7 ListVariables (); -
trunk/Ohana/src/opihi/cmd.basic/nop.c
r26891 r39457 2 2 3 3 int nop (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argc); 5 OHANA_UNUSED_PARAM(argv); 6 4 7 return (TRUE); 5 8 } -
trunk/Ohana/src/opihi/cmd.basic/run_for.c
r33963 r39457 104 104 105 105 status = TRUE; 106 interrupt = FALSE;107 106 for (value = start; (sign*value < sign*end) && !interrupt; value += delta) { 108 107 if ((int)value == value) -
trunk/Ohana/src/opihi/cmd.basic/run_foreach.c
r33963 r39457 72 72 73 73 status = TRUE; 74 interrupt = FALSE;75 74 for (i = 2; (i < argc) && !interrupt; i++) { 76 75 set_str_variable (argv[1], argv[i]); -
trunk/Ohana/src/opihi/cmd.basic/shell.c
r33662 r39457 51 51 // wait for process to finish or timeout 52 52 // loop forever if desired, but catch C-C and stop the process on interrupt 53 interrupt = FALSE;53 struct sigaction *old_sigaction = SetInterrupt(); 54 54 while (!interrupt) { 55 55 result = waitpid (pid, &wait_status, WNOHANG); … … 59 59 case ECHILD: 60 60 gprint (GP_ERR, "unknown PID, not a child process: %d\n", pid); 61 ClearInterrupt (old_sigaction); 61 62 return (FALSE); 62 63 default: … … 72 73 if (DTIME(now, start) > timeout) { 73 74 gprint (GP_ERR, "timeout on %s (pid %d)\n", argv[1], pid); 75 ClearInterrupt (old_sigaction); 74 76 return (FALSE); 75 77 } … … 83 85 } 84 86 if (WIFEXITED(wait_status)) { 87 ClearInterrupt (old_sigaction); 85 88 exit_status = WEXITSTATUS(wait_status); 86 89 if (exit_status) { … … 91 94 } 92 95 if (WIFSIGNALED(wait_status)) { 96 ClearInterrupt (old_sigaction); 93 97 gprint (GP_ERR, "job %d exited on signal %d\n", pid, WTERMSIG(wait_status)); 94 98 return (FALSE); … … 100 104 } 101 105 } 106 ClearInterrupt (old_sigaction); 102 107 gprint (GP_ERR, "caught interrupt, killing %s (%d)\n", argv[1], pid); 103 108 -
trunk/Ohana/src/opihi/cmd.data/book_commands.c
r17419 r39457 2 2 3 3 int book_list (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argv); 4 5 if (argc != 1) { 5 6 gprint (GP_ERR, "USAGE: book list\n"); -
trunk/Ohana/src/opihi/cmd.data/cursor.c
r33662 r39457 6 6 int i, N, kapa, VERBOSE; 7 7 double X, Y, R, D, Z; 8 void *oldsignal;9 8 10 9 // XXX need to be able to specify graph vs image coords … … 38 37 KiiCursorOn (kapa); 39 38 40 oldsignal = signal (SIGINT, handle_interrupt); 41 interrupt = FALSE; 42 39 struct sigaction *old_sigaction = SetInterrupt(); 43 40 for (i = 0; ((i < N) || (N == 0)) && !interrupt; i++) { 44 41 … … 62 59 if (!strcasecmp (key, "Q")) break; 63 60 } 61 ClearInterrupt (old_sigaction); 64 62 65 signal (SIGINT, oldsignal);66 63 KiiCursorOff (kapa); 67 64 return (TRUE); -
trunk/Ohana/src/opihi/cmd.data/gaussdeviate.c
r39248 r39457 30 30 31 31 int gaussintegral (int argc, char **argv) { 32 OHANA_UNUSED_PARAM(argc); 33 OHANA_UNUSED_PARAM(argv); 32 34 33 35 gprint (GP_ERR, "fix gaussintegral\n"); -
trunk/Ohana/src/opihi/cmd.data/list_buffers.c
r33662 r39457 2 2 3 3 int list_buffers (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argv); 4 5 5 6 if (argc == 3) PrintBuffers (TRUE); -
trunk/Ohana/src/opihi/cmd.data/list_vectors.c
r33662 r39457 2 2 3 3 int list_vectors (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argc); 5 OHANA_UNUSED_PARAM(argv); 4 6 5 7 ListVectors (); -
trunk/Ohana/src/opihi/cmd.data/medimage.c
r36679 r39457 18 18 19 19 int medimage_help (int argc, char **argv) { 20 OHANA_UNUSED_PARAM(argc); 21 OHANA_UNUSED_PARAM(argv); 20 22 21 23 gprint (GP_ERR, "USAGE: medimage (command)\n"); -
trunk/Ohana/src/opihi/cmd.data/medimage_commands.c
r39233 r39457 2 2 3 3 int medimage_list (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argv); 5 4 6 if (argc != 1) { 5 7 gprint (GP_ERR, "USAGE: medimage list\n"); -
trunk/Ohana/src/opihi/cmd.data/queuelist.c
r7917 r39457 2 2 3 3 int queuelist (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argv); 4 5 5 6 if (argc != 1) { -
trunk/Ohana/src/opihi/cmd.data/spline.c
r35109 r39457 23 23 24 24 int spline_help (int argc, char **argv) { 25 OHANA_UNUSED_PARAM(argc); 26 OHANA_UNUSED_PARAM(argv); 25 27 26 28 gprint (GP_ERR, "USAGE: spline (command)\n"); -
trunk/Ohana/src/opihi/cmd.data/spline_commands.c
r35109 r39457 2 2 3 3 int spline_list (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argv); 5 4 6 if (argc != 1) { 5 7 gprint (GP_ERR, "USAGE: spline list\n"); -
trunk/Ohana/src/opihi/cmd.data/uniq.c
r39297 r39457 56 56 int onePercent = ivec->Nelements / 100; 57 57 58 void *Signal = signal (SIGINT, handle_interrupt); 59 interrupt = FALSE; 58 struct sigaction *old_sigaction = SetInterrupt(); 60 59 for (i = 0; (i < ivec->Nelements) && !interrupt; Nnew++) { 61 60 vtgt[Nnew] = *vsrc; … … 72 71 } 73 72 } 74 signal (SIGINT, Signal);73 ClearInterrupt (old_sigaction); 75 74 if (VERBOSE) gprint (GP_ERR, "\n"); 76 75 free (indata); … … 90 89 int onePercent = ivec->Nelements / 100; 91 90 92 void *Signal = signal (SIGINT, handle_interrupt); 93 interrupt = FALSE; 91 struct sigaction *old_sigaction = SetInterrupt(); 94 92 for (i = 0; (i < ivec->Nelements) && !interrupt; Nnew++) { 95 93 vtgt[Nnew] = *vsrc; … … 106 104 } 107 105 } 108 signal (SIGINT, Signal);106 ClearInterrupt (old_sigaction); 109 107 if (VERBOSE) gprint (GP_ERR, "\n"); 110 108 free (indata); -
trunk/Ohana/src/opihi/cmd.data/vellipse.c
r36679 r39457 230 230 // XXX NOTE that PHI is defined with the wrong sign, should fix this... 231 231 opihi_flt fellipseOD (opihi_flt alpha, opihi_flt *par, int Npar, opihi_flt *dpar) { 232 OHANA_UNUSED_PARAM(Npar); 232 233 233 234 static int pass = 0; -
trunk/Ohana/src/opihi/cmd.data/vgauss.c
r36489 r39457 127 127 /* pars: x_o, sigma, I, back */ 128 128 opihi_flt fgaussOD (opihi_flt x, opihi_flt *par, int Npar, opihi_flt *dpar) { 129 OHANA_UNUSED_PARAM(Npar); 129 130 130 131 opihi_flt z, r, f; -
trunk/Ohana/src/opihi/cmd.data/vmaxwell.c
r20936 r39457 96 96 // f = C3 + C2*(x - C4)^2 * exp(-0.5*(x - C0)^2 / C1^2) 97 97 opihi_flt fmaxwellOD (opihi_flt x, opihi_flt *par, int Npar, opihi_flt *dpar) { 98 OHANA_UNUSED_PARAM(Npar); 98 99 99 100 opihi_flt z, r, f; -
trunk/Ohana/src/opihi/dvo/avextract.c
r39360 r39457 4 4 5 5 off_t i, j, n, m; 6 int N, Npts, NPTS, last, next, state, Nfields, Nreturn, N cstack, Nstack;6 int N, Npts, NPTS, last, next, state, Nfields, Nreturn, Nstack; 7 7 int Nsecfilt, VERBOSE; 8 8 char **cstack, name[1024]; 9 unsigned int Ncstack; 9 10 10 11 Catalog catalog; … … 169 170 170 171 // grab data from all selected sky regions 171 void *Signal = signal (SIGINT, handle_interrupt); 172 interrupt = FALSE; 172 struct sigaction *old_sigaction = SetInterrupt(); 173 173 for (i = 0; (i < skylist[0].Nregions) && !interrupt; i++) { 174 174 … … 254 254 dvo_catalog_free (&catalog); 255 255 } 256 signal (SIGINT, Signal);257 interrupt = FALSE; 256 ClearInterrupt (old_sigaction); 257 258 258 for (n = 0; n < Nreturn; n++) { 259 259 ResetVector (vec[n], fields[n].type, Npts); -
trunk/Ohana/src/opihi/dvo/avmatch.c
r39360 r39457 17 17 int VERBOSE; 18 18 char name[1024], *found; 19 void *Signal;20 19 float RADIUS; 21 20 … … 179 178 180 179 // grab data from all selected sky regions 181 Signal = signal (SIGINT, handle_interrupt); 182 interrupt = FALSE; 180 struct sigaction *old_sigaction = SetInterrupt(); 183 181 for (i = 0; (i < skylist[0].Nregions) && !interrupt; i++) { 184 182 … … 253 251 dvo_catalog_free (&catalog); 254 252 } 255 signal (SIGINT, Signal); 256 interrupt = FALSE; 253 ClearInterrupt (old_sigaction); 257 254 258 255 // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere) -
trunk/Ohana/src/opihi/dvo/catname.c
r37807 r39457 55 55 56 56 // prepare to handle interrupt signals 57 signal (SIGINT, handle_interrupt); 58 interrupt = FALSE; 57 struct sigaction *old_sigaction = SetInterrupt(); 59 58 60 59 for (i = 0; (i < skylist[0].Nregions) && !interrupt; i++) { … … 99 98 set_str_variable ("CATNAME", filename); 100 99 } 100 ClearInterrupt (old_sigaction); 101 101 102 102 return (TRUE); -
trunk/Ohana/src/opihi/dvo/ccd.c
r38471 r39457 62 62 63 63 // grab data from all selected sky regions 64 signal (SIGINT, handle_interrupt);65 interrupt = FALSE;66 64 67 65 /* loop over regions, extract data for each region */ 66 struct sigaction *old_sigaction = SetInterrupt(); 68 67 for (k = 0; (k < skylist[0].Nregions) && !interrupt; k++) { 69 68 /* lock, load, unlock catalog */ … … 119 118 dvo_catalog_free (&catalog); 120 119 } 120 ClearInterrupt (old_sigaction); 121 121 122 122 xvec[0].Nelements = yvec[0].Nelements = Npts; -
trunk/Ohana/src/opihi/dvo/cmd.c
r38471 r39457 21 21 skylist = NULL; 22 22 selection = NULL; 23 struct sigaction *old_sigaction = NULL: 23 24 24 25 /* load photcode information */ … … 60 61 61 62 // grab data from all selected sky regions 62 // void *Signal = signal (SIGINT, handle_interrupt); 63 signal (SIGINT, handle_interrupt); 64 interrupt = FALSE; 63 old_sigaction = SetInterrupt(); 65 64 66 65 /* loop over regions, extract data for each region */ … … 118 117 dvo_catalog_free (&catalog); 119 118 } 119 ClearInterrupt (old_sigaction); 120 120 121 121 xvec[0].Nelements = yvec[0].Nelements = Npts; … … 129 129 130 130 escape: 131 ClearInterrupt (old_sigaction); 131 132 dvo_catalog_free (&catalog); 132 133 SkyListFree (skylist); -
trunk/Ohana/src/opihi/dvo/dmt.c
r38471 r39457 3 3 /* extract vectors giving delta mags for multiple measurements */ 4 4 int dmt (int argc, char **argv) { 5 OHANA_UNUSED_PARAM(argc); 6 OHANA_UNUSED_PARAM(argv); 5 7 6 8 // XXX this needs to be fixed: how to access different graphs at once? -
trunk/Ohana/src/opihi/dvo/dvo.c.in
r33662 r39457 9 9 /* program-dependent initialization */ 10 10 void program_init (int *argc, char **argv) { 11 OHANA_UNUSED_PARAM(argc); 12 OHANA_UNUSED_PARAM(argv); 11 13 12 14 auto_break = TRUE; -
trunk/Ohana/src/opihi/dvo/dvo_host_utils.c
r39360 r39457 249 249 // and has since been re-run 250 250 int HostTableReloadResults (char *uniquer, int VERBOSE) { 251 OHANA_UNUSED_PARAM(VERBOSE); 251 252 252 253 int i; … … 317 318 // and has since been re-run 318 319 int HostTableGetResults (char *uniquer, int VERBOSE) { 320 OHANA_UNUSED_PARAM(VERBOSE); 319 321 320 322 int i; -
trunk/Ohana/src/opihi/dvo/fitcolors.c
r39233 r39457 14 14 int mode[4]; 15 15 int Nsecfilt, status; 16 void *oldsignal;17 16 char *cmd, *outcmd, *camera; 18 17 char name[64], filename[64], plotname[64], label[64]; … … 40 39 colorFit = NULL; 41 40 deltaFit = NULL; 42 43 oldsignal = signal (SIGINT, handle_interrupt);44 interrupt = FALSE;45 41 46 42 /* load photcode information */ … … 199 195 graphdata.ptype = 2; 200 196 } 197 198 struct sigaction *old_sigaction = SetInterrupt(); 201 199 202 200 /*** generate the color-color vectors for the pairs ***/ … … 357 355 if (colorFit != NULL) free (colorFit); 358 356 if (deltaFit != NULL) free (deltaFit); 359 signal (SIGINT, oldsignal);357 ClearInterrupt (old_sigaction); 360 358 return (TRUE); 361 359 … … 381 379 DeleteVector (xvec); 382 380 DeleteVector (yvec); 383 signal (SIGINT, oldsignal); 381 ClearInterrupt (old_sigaction); 382 384 383 return (FALSE); 385 384 } -
trunk/Ohana/src/opihi/dvo/fitsed.c
r38471 r39457 27 27 int N, done, Nfit; 28 28 int status; 29 void *oldsignal;30 29 char name[64], line[1024], key[20]; 31 30 float *fitmags, *fiterrs, *wavecode, *vegaToAB; … … 48 47 SEDtableRow sourceValue, sourceError; 49 48 SEDfit minFit, testFit; 49 struct sigaction *old_sigaction = NULL; 50 50 51 51 /* defaults */ … … 74 74 fiterrs = NULL; 75 75 fitmags = NULL; 76 77 oldsignal = signal (SIGINT, handle_interrupt);78 interrupt = FALSE;79 76 80 77 /* load photcode information */ … … 184 181 /* loop over regions, extract data for each region */ 185 182 // XXX add interrupt checks 183 old_sigaction = SetInterrupt(); 186 184 gprint (GP_ERR, "using "OFF_T_FMT" possible regions\n", skylist[0].Nregions); 187 for (k = 0; k < skylist[0].Nregions; k++) {185 for (k = 0; (k < skylist[0].Nregions) && !interrupt; k++) { 188 186 /* lock, load, unlock catalog */ 189 187 dvo_catalog_init (&catalog, TRUE); … … 377 375 if (sourceError.mags != NULL) free (sourceError.mags); 378 376 379 signal (SIGINT, oldsignal);377 ClearInterrupt (old_sigaction); 380 378 return (status); 381 379 } -
trunk/Ohana/src/opihi/dvo/gcat.c
r39294 r39457 57 57 58 58 // prepare to handle interrupt signals 59 signal (SIGINT, handle_interrupt); 60 interrupt = FALSE; 59 struct sigaction *old_sigaction = SetInterrupt(); 61 60 62 61 for (i = 0; (i < skylist[0].Nregions) && !interrupt; i++) { … … 101 100 set_str_variable ("CATNAME", hostfile); 102 101 } 102 ClearInterrupt (old_sigaction); 103 103 104 104 return (TRUE); -
trunk/Ohana/src/opihi/dvo/gstar.c
r39298 r39457 876 876 877 877 void printPhotcodeSequence (Average *average, SecFilt *secfilt, int entry, int type) { 878 OHANA_UNUSED_PARAM(average); 878 879 879 880 int seq; -
trunk/Ohana/src/opihi/dvo/imdata.c
r38471 r39457 128 128 129 129 // prepare to handle interrupt signals 130 signal (SIGINT, handle_interrupt); 131 interrupt = FALSE; 130 struct sigaction *old_sigaction = SetInterrupt(); 132 131 133 132 /* for each region file, extract the data of interest in the right time range */ … … 216 215 dvo_catalog_free (&catalog); 217 216 } 217 ClearInterrupt (old_sigaction); 218 218 219 219 vec[0].Nelements = N; -
trunk/Ohana/src/opihi/dvo/imextract.c
r37807 r39457 4 4 5 5 off_t i, j, Nimage; 6 int n, N, Npts, NPTS, last, next, state, Nfields, Nreturn, N cstack, Nstack;6 int n, N, Npts, NPTS, last, next, state, Nfields, Nreturn, Nstack; 7 7 char **cstack, name[1024]; 8 void *Signal;9 8 10 9 Vector **vec; … … 57 56 58 57 // parse the remainder of the line as a boolean math expression 58 unsigned int Ncstack; 59 59 cstack = isolate_elements (argc-next, &argv[next], &Ncstack); 60 60 … … 97 97 98 98 // grab data from all selected sky regions 99 Signal = signal (SIGINT, handle_interrupt); 100 interrupt = FALSE; 99 struct sigaction *old_sigaction = SetInterrupt(); 101 100 for (j = 0; (j < Nimage) && !interrupt; j++) { 102 101 … … 128 127 } 129 128 } 130 signal (SIGINT, Signal);131 interrupt = FALSE; 129 ClearInterrupt (old_sigaction); 130 132 131 for (n = 0; n < Nreturn; n++) { 133 132 vec[n][0].Nelements = Npts; -
trunk/Ohana/src/opihi/dvo/mextract.c
r39360 r39457 25 25 26 26 off_t i, j, k, m; // used for counter averages and measures 27 int n, N, Npts, NPTS, last, next, state, Nfields, Nreturn, N cstack, Nstack;27 int n, N, Npts, NPTS, last, next, state, Nfields, Nreturn, Nstack; 28 28 int Nsecfilt, VERBOSE, loadImages; 29 29 char **cstack, name[1024]; 30 30 dbValue *values; 31 void *Signal;32 31 33 32 Catalog catalog; … … 115 114 116 115 // parse the remainder of the line as a boolean math expression 116 unsigned int Ncstack; 117 117 cstack = isolate_elements (argc-next, &argv[next], &Ncstack); 118 118 … … 217 217 218 218 // grab data from all selected sky regions 219 Signal = signal (SIGINT, handle_interrupt); 220 interrupt = FALSE; 221 222 // fprintf (stderr, "done setup..."); 219 struct sigaction *old_sigaction = SetInterrupt(); 223 220 224 221 for (i = 0; (i < skylist[0].Nregions) && !interrupt; i++) { … … 310 307 // dbStackFreeReset (); 311 308 } 312 signal (SIGINT, Signal);309 ClearInterrupt (old_sigaction); 313 310 interrupt = FALSE; 314 311 -
trunk/Ohana/src/opihi/dvo/mmatch.c
r39360 r39457 14 14 int VERBOSE; 15 15 char name[1024]; 16 void *Signal;17 16 float RADIUS; 18 17 … … 237 236 238 237 // grab data from all selected sky regions 239 Signal = signal (SIGINT, handle_interrupt); 240 interrupt = FALSE; 238 struct sigaction *old_sigaction = SetInterrupt(); 241 239 for (i = 0; (i < skylist[0].Nregions) && !interrupt; i++) { 242 240 … … 331 329 dvo_catalog_free (&catalog); 332 330 } 333 signal (SIGINT, Signal); 334 interrupt = FALSE; 331 ClearInterrupt (old_sigaction); 335 332 336 333 for (n = 0; n < Nfields; n++) { -
trunk/Ohana/src/opihi/dvo/mmextract.c
r38471 r39457 6 6 off_t i, j, k, m; 7 7 int n, N, Npts, NPTS, last, next, state; 8 int Nfields, Nreturn, Nreturn_base, N cstack1, Ncstack2, Nstack1, Nstack2;8 int Nfields, Nreturn, Nreturn_base, Nstack1, Nstack2; 9 9 int Nwhere, Iwhere, Nmatch, Imatch, NTABLE, Nt1, Nt2, n1, n2; 10 10 int Nsecfilt, VERBOSE, loadImages; 11 11 char **cstack1, **cstack2, name1[1024], name2[1024]; 12 12 dbValue *values, **table1, **table2; 13 void *Signal;14 13 15 14 Catalog catalog; … … 102 101 103 102 // parse the 'where' and 'matched to' segments of the line as boolean math expressions 103 unsigned int Ncstack1, Ncstack2; 104 104 cstack1 = isolate_elements (Nwhere, &argv[Iwhere], &Ncstack1); 105 105 cstack2 = isolate_elements (Nmatch, &argv[Imatch], &Ncstack2); … … 178 178 179 179 // grab data from all selected sky regions 180 Signal = signal (SIGINT, handle_interrupt);181 interrupt = FALSE; 180 struct sigaction *old_sigaction = SetInterrupt(); 181 182 182 for (i = 0; (i < skylist[0].Nregions) && !interrupt; i++) { 183 183 /* lock, load, unlock catalog */ … … 286 286 // dbStackFreeReset (); 287 287 } 288 signal (SIGINT, Signal); 289 interrupt = FALSE; 288 ClearInterrupt (old_sigaction); 290 289 291 290 // free excess memory -
trunk/Ohana/src/opihi/dvo/objectcoverage.c
r39233 r39457 174 174 Nsecfilt = GetPhotcodeNsecfilt(); 175 175 // grab data from all selected sky regions 176 signal (SIGINT, handle_interrupt);177 interrupt = FALSE;178 176 179 177 /* load region corresponding to selection above */ 180 178 if ((skylist = SelectRegions (selection)) == NULL) goto escape; 179 180 struct sigaction *old_sigaction = SetInterrupt(); 181 181 182 182 /* loop over regions, extract data for each region */ … … 224 224 } 225 225 } 226 ClearInterrupt (old_sigaction); 226 227 return (TRUE); 227 228 -
trunk/Ohana/src/opihi/dvo/paverage.c
r38471 r39457 99 99 100 100 // prepare to handle interrupt signals 101 signal (SIGINT, handle_interrupt); 102 interrupt = FALSE; 101 struct sigaction *old_sigaction = SetInterrupt(); 103 102 104 103 Nloaded = 0; … … 154 153 dvo_catalog_free (&catalog); 155 154 } 155 ClearInterrupt (old_sigaction); 156 156 if (Npts > 0) { 157 157 KapaPrepPlot (kapa, Npts, &graphmode); -
trunk/Ohana/src/opihi/dvo/pmeasure.c
r38471 r39457 172 172 173 173 // prepare to handle interrupt signals 174 signal (SIGINT, handle_interrupt); 175 interrupt = FALSE; 174 struct sigaction *old_sigaction = SetInterrupt(); 176 175 177 176 Nloaded = 0; … … 240 239 dvo_catalog_free (&catalog); 241 240 } 241 ClearInterrupt (old_sigaction); 242 242 243 if (Npts > 0) { 243 244 KapaPrepPlot (kapa, Npts, &graphmode); -
trunk/Ohana/src/opihi/dvo/procks.c
r34584 r39457 74 74 NROCKS = 100; 75 75 ALLOCATE (rocks, Rocks, NROCKS); 76 for (i = 0; fscanf (f, "%lf %lf % d%lf%lf%lf %d%lf%lf%lf %d%lf%lf%lf",76 for (i = 0; fscanf (f, "%lf %lf %u%lf%lf%lf %u%lf%lf%lf %u%lf%lf%lf", 77 77 &rocks[i].X[0], &rocks[i].Y[0], 78 78 &rocks[i].t[0], &rocks[i].ra[0], &rocks[i].dec[0], &rocks[i].mag[0], -
trunk/Ohana/src/opihi/dvo/showtile.c
r37807 r39457 4 4 5 5 int showtile (int argc, char **argv) { 6 OHANA_UNUSED_PARAM(argv); 6 7 7 8 int kapa, Nd, N, NPTS, status, i, InPic; -
trunk/Ohana/src/opihi/dvo/skycat.c
r39354 r39457 71 71 72 72 // prepare to handle interrupt signals 73 signal (SIGINT, handle_interrupt); 74 interrupt = FALSE; 73 struct sigaction *old_sigaction = SetInterrupt(); 75 74 76 75 for (i = 0; (i < Nregions) && !interrupt; i++) { … … 113 112 } 114 113 } 114 ClearInterrupt (old_sigaction); 115 115 116 116 gprint (GP_ERR, "plotting %d catalogs\n", Npts/8); -
trunk/Ohana/src/opihi/dvo/version.c
r8653 r39457 3 3 4 4 int version (int argc, char **argv) { 5 OHANA_UNUSED_PARAM(argc); 6 OHANA_UNUSED_PARAM(argv); 5 7 6 8 char *tmp; -
trunk/Ohana/src/opihi/include/dvoshell.h
r37049 r39457 81 81 void compare PROTO((Catalog *catlog1, Catalog *catlog2, Vector *rvec, Vector *dvec, Vector *mvec, Vector *drvec, Vector *ddvec, Vector *dmvec, double radius)); 82 82 void cprecess PROTO((Average *average, off_t Naverage, double in_epoch, double out_epoch)); 83 void image_subset PROTO((Image *image, off_t Nimage, off_t **Subset, off_t *Nsubset, SkyRegionSelection *selection, unsigned long int tzero, double trange, int TimeSelect));84 83 off_t match_image PROTO((Image *image, off_t Nimage, unsigned int T, short int S)); 85 off_t match_image_subset PROTO((Image *image, off_t *subset, off_t Nsubset, unsigned int T, short int S));86 84 void print_value PROTO((double value, short int ival)); 87 85 CMPstars *cmpReadFits PROTO((FILE *f, off_t *nstars)); -
trunk/Ohana/src/opihi/include/shell.h
r39227 r39457 132 132 #endif 133 133 134 struct sigaction *SetInterrupt PROTO((void)); 135 int ClearInterrupt PROTO((struct sigaction *old_sigaction)); 134 136 void handle_interrupt PROTO((int)); 135 137 char **command_completer PROTO((const char *, int, int)); -
trunk/Ohana/src/opihi/lib.data/hermitian.c
r26891 r39457 3 3 double hermitian_polynomial (double x, int order) { 4 4 double value; 5 switch (order) {6 case 0:7 value = hermitian_00(x);8 break;9 case 1:10 value = hermitian_01(x);11 break;12 case 2:13 value = hermitian_02(x);14 break;15 case 3:16 value = hermitian_03(x);17 break;18 case 4:19 value = hermitian_04(x);20 break;21 case 5:22 value = hermitian_05(x);23 break;24 case 6:25 value = hermitian_06(x);26 break;27 case 7:28 value = hermitian_07(x);29 break;30 case 8:31 value = hermitian_08(x);32 break;33 case 9:34 value = hermitian_09(x);35 break;36 case 10:37 value = hermitian_10(x);38 break;39 default:40 value = NAN;41 break;42 }43 return value;5 switch (order) { 6 case 0: 7 value = hermitian_00(x); 8 break; 9 case 1: 10 value = hermitian_01(x); 11 break; 12 case 2: 13 value = hermitian_02(x); 14 break; 15 case 3: 16 value = hermitian_03(x); 17 break; 18 case 4: 19 value = hermitian_04(x); 20 break; 21 case 5: 22 value = hermitian_05(x); 23 break; 24 case 6: 25 value = hermitian_06(x); 26 break; 27 case 7: 28 value = hermitian_07(x); 29 break; 30 case 8: 31 value = hermitian_08(x); 32 break; 33 case 9: 34 value = hermitian_09(x); 35 break; 36 case 10: 37 value = hermitian_10(x); 38 break; 39 default: 40 value = NAN; 41 break; 42 } 43 return value; 44 44 } 45 45 46 46 double hermitian_00(double x) { 47 double value; 48 // H_0(x) = 1 49 value = 1; 50 return value; 47 OHANA_UNUSED_PARAM(x); 48 49 double value; 50 // H_0(x) = 1 51 value = 1; 52 return value; 51 53 } 52 54 double hermitian_01(double x) { 53 double value;54 // H_1(x) = x55 value = x;56 return value;55 double value; 56 // H_1(x) = x 57 value = x; 58 return value; 57 59 } 58 60 double hermitian_02(double x) { 59 double value, x2;60 // H_2(x) = x^2-161 x2 = x*x;62 value = x2 - 1.0;63 return value;61 double value, x2; 62 // H_2(x) = x^2-1 63 x2 = x*x; 64 value = x2 - 1.0; 65 return value; 64 66 } 65 67 double hermitian_03(double x) { 66 double value, x2;67 // H_3(x) = x^3-3x68 x2 = x*x;69 value = x*(x2 - 3.0);70 return value;68 double value, x2; 69 // H_3(x) = x^3-3x 70 x2 = x*x; 71 value = x*(x2 - 3.0); 72 return value; 71 73 } 72 74 double hermitian_04(double x) { 73 double value, x2;74 // H_4(x) = x^4-6x^2+375 x2 = x*x;76 value = (x2 - 6.0)*x2 + 3.0;77 return value;75 double value, x2; 76 // H_4(x) = x^4-6x^2+3 77 x2 = x*x; 78 value = (x2 - 6.0)*x2 + 3.0; 79 return value; 78 80 } 79 81 double hermitian_05(double x) { 80 double value, x2;81 // H_5(x) = x^5-10x^3+15x82 x2 = x*x;83 value = ((x2 - 10.0)*x2 + 15.0)*x;84 return value;82 double value, x2; 83 // H_5(x) = x^5-10x^3+15x 84 x2 = x*x; 85 value = ((x2 - 10.0)*x2 + 15.0)*x; 86 return value; 85 87 } 86 88 double hermitian_06(double x) { 87 double value, x2;88 // H_6(x) = x^6-15x^4+45x^2-1589 x2 = x*x;90 value = (((x2 - 15.0)*x2 + 45.0)*x2) - 15.0;91 return value;89 double value, x2; 90 // H_6(x) = x^6-15x^4+45x^2-15 91 x2 = x*x; 92 value = (((x2 - 15.0)*x2 + 45.0)*x2) - 15.0; 93 return value; 92 94 } 93 95 double hermitian_07(double x) { 94 double value, x2;95 // H_7(x) = x^7-21x^5+105x^3-105x96 x2 = x*x;97 value = (((x2 - 21.0)*x2+105.0)*x2 - 105.0)*x;98 return value;96 double value, x2; 97 // H_7(x) = x^7-21x^5+105x^3-105x 98 x2 = x*x; 99 value = (((x2 - 21.0)*x2+105.0)*x2 - 105.0)*x; 100 return value; 99 101 } 100 102 double hermitian_08(double x) { 101 double value, x2;102 // H_8(x) = x^8-28x^6+210x^4-420x^2+105103 x2 = x*x;104 value = ((((x2 - 28.0)*x2 + 210.0)*x2 - 420.0)*x2 + 105.0);105 return value;103 double value, x2; 104 // H_8(x) = x^8-28x^6+210x^4-420x^2+105 105 x2 = x*x; 106 value = ((((x2 - 28.0)*x2 + 210.0)*x2 - 420.0)*x2 + 105.0); 107 return value; 106 108 } 107 109 double hermitian_09(double x) { 108 double value, x2;109 // H_9(x) = x^9-36x^7+378x^5-1260x^3+945x110 x2 = x*x;111 value = ((((x2 - 36.0)*x2 + 378.0)*x2 - 1260.0)*x2 + 945.0)*x;112 return value;110 double value, x2; 111 // H_9(x) = x^9-36x^7+378x^5-1260x^3+945x 112 x2 = x*x; 113 value = ((((x2 - 36.0)*x2 + 378.0)*x2 - 1260.0)*x2 + 945.0)*x; 114 return value; 113 115 } 114 116 double hermitian_10(double x) { 115 double value, x2;116 // H_{10}(x) = x^{10}-45x^8+630x^6-3150x^4+4725x^2-945117 x2 = x*x;118 value = (((((x2 - 45.0)*x2 + 630.0)*x2 - 3150.0)*x2 + 4725.0)*x2 - 945.0);119 return value;117 double value, x2; 118 // H_{10}(x) = x^{10}-45x^8+630x^6-3150x^4+4725x^2-945 119 x2 = x*x; 120 value = (((((x2 - 45.0)*x2 + 630.0)*x2 - 3150.0)*x2 + 4725.0)*x2 - 945.0); 121 return value; 120 122 } -
trunk/Ohana/src/opihi/lib.shell/CommandOps.c
r31667 r39457 151 151 /* tell readline to use out command_generator rather than basic completion */ 152 152 char **command_completer (const char *text, int start, int end) { 153 OHANA_UNUSED_PARAM(end); 153 154 154 155 char **matches; -
trunk/Ohana/src/opihi/lib.shell/VectorIO.c
r39360 r39457 81 81 } 82 82 fprintf (stderr, "\n"); 83 # else 84 OHANA_UNUSED_PARAM(table); 85 OHANA_UNUSED_PARAM(message); 83 86 # endif 84 87 return TRUE; … … 99 102 } 100 103 fprintf (stderr, "\n"); 104 # else 105 OHANA_UNUSED_PARAM(table); 106 OHANA_UNUSED_PARAM(message); 101 107 # endif 102 108 return TRUE; -
trunk/Ohana/src/opihi/lib.shell/dvomath.c
r36375 r39457 16 16 char *dvomath (int argc, char **argv, int *size, int validsize) { 17 17 18 int i, Nstack , Ncstack;18 int i, Nstack; 19 19 char **cstack, *outname; 20 20 StackVar *stack; … … 27 27 28 28 /* take char array with expression, convert to important elements */ 29 unsigned int Ncstack; 29 30 cstack = isolate_elements (argc, argv, &Ncstack); 30 31 -
trunk/Ohana/src/opihi/lib.shell/exec_loop.c
r12332 r39457 3 3 int exec_loop (Macro *loop) { 4 4 5 void *Signal;6 5 int j, status, ThisList; 7 6 char *line; … … 17 16 18 17 /* set up interrupts */ 19 Signal = signal (SIGINT, handle_interrupt); 20 interrupt = FALSE; 18 struct sigaction *old_sigaction = SetInterrupt(); 21 19 22 20 /* process the list */ … … 32 30 if (loop_break || loop_last || loop_next) break; 33 31 } 34 signal (SIGINT, Signal);32 ClearInterrupt (old_sigaction); 35 33 36 34 /* free remaining lines on the list, free the list, decrement the shell level */ -
trunk/Ohana/src/opihi/lib.shell/interrupt.c
r27611 r39457 7 7 8 8 void handle_interrupt (int input) { 9 OHANA_UNUSED_PARAM(input); 9 10 10 11 char string[64]; 11 12 int Nask; 12 13 13 signal (SIGINT, SIG_IGN);14 // signal (SIGINT, SIG_IGN); 14 15 15 16 Nask = 0; … … 31 32 if ((string[0] == 'y') || (string[0] == 'Y')) { 32 33 interrupt = FALSE; 33 signal (SIGINT, handle_interrupt);34 // signal (SIGINT, handle_interrupt); 34 35 Nint = 0; 35 36 return; … … 38 39 if ((string[0] == 'n') || (string[0] == 'N')) { 39 40 interrupt = TRUE; 40 signal (SIGINT, handle_interrupt);41 // signal (SIGINT, handle_interrupt); 41 42 Nint = 0; 42 43 return; … … 45 46 if (Nask > 3) { 46 47 interrupt = TRUE; 47 signal (SIGINT, handle_interrupt);48 // signal (SIGINT, handle_interrupt); 48 49 Nint = 0; 49 50 return; … … 52 53 53 54 } 55 56 struct sigaction *SetInterrupt () { 57 58 struct sigaction new_sigaction; 59 struct sigaction *old_sigaction; 60 61 ALLOCATE (old_sigaction, struct sigaction, 1); 62 63 new_sigaction.sa_handler = handle_interrupt; 64 new_sigaction.sa_flags = 0; 65 66 int sigstat = sigaction (SIGINT, &new_sigaction, old_sigaction); 67 if (sigstat) { 68 perror ("failed to set signal handler: "); 69 free (old_sigaction); 70 return NULL; 71 } 72 73 interrupt = FALSE; 74 return old_sigaction; 75 } 76 77 int ClearInterrupt (struct sigaction *old_sigaction) { 78 79 // interrupt = FALSE; 80 81 if (!old_sigaction) return TRUE; 82 83 struct sigaction new_sigaction; 84 85 if (sigaction (SIGINT, old_sigaction, &new_sigaction)) { 86 perror ("failed to reset signal handler: "); 87 FREE (old_sigaction); 88 return FALSE; 89 } 90 FREE (old_sigaction); 91 92 return TRUE; 93 } -
trunk/Ohana/src/opihi/lib.shell/macro_edit.c
r7917 r39457 2 2 3 3 int macro_edit (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argc); 5 OHANA_UNUSED_PARAM(argv); 4 6 5 7 gprint (GP_ERR, "this function is not implemented yet\n"); -
trunk/Ohana/src/opihi/lib.shell/macro_read.c
r7917 r39457 2 2 3 3 int macro_read (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argc); 5 OHANA_UNUSED_PARAM(argv); 4 6 5 7 gprint (GP_ERR, "this function is not implemented yet\n"); -
trunk/Ohana/src/opihi/lib.shell/macro_write.c
r7917 r39457 2 2 3 3 int macro_write (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argc); 5 OHANA_UNUSED_PARAM(argv); 4 6 5 7 gprint (GP_ERR, "this function is not implemented yet\n"); -
trunk/Ohana/src/opihi/lib.shell/multicommand.c
r32632 r39457 65 65 done = FALSE; 66 66 status = TRUE; 67 interrupt = FALSE; 67 68 while (!done) { 68 69 q = strchr (p, ';'); -
trunk/Ohana/src/opihi/mana/mana.c.in
r16448 r39457 9 9 /* program-dependent initialization */ 10 10 void program_init (int *argc, char **argv) { 11 OHANA_UNUSED_PARAM(argc); 12 OHANA_UNUSED_PARAM(argv); 11 13 12 14 auto_break = TRUE; -
trunk/Ohana/src/opihi/mana/version.c
r8653 r39457 3 3 4 4 int version (int argc, char **argv) { 5 OHANA_UNUSED_PARAM(argc); 6 OHANA_UNUSED_PARAM(argv); 5 7 6 8 char *tmp; -
trunk/Ohana/src/opihi/pantasks/ListenClients.c
r27435 r39457 68 68 /* select for messages from the current clients; wait for 0.5s before updating client list */ 69 69 void *ListenClients (void *data) { 70 OHANA_UNUSED_PARAM(data); 70 71 71 72 int i, Ncurrent, Nmax, status, Nread; -
trunk/Ohana/src/opihi/pantasks/controller_machines.c
r26411 r39457 2 2 3 3 int controller_machines (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argv); 4 5 5 6 int status; -
trunk/Ohana/src/opihi/pantasks/controller_threads.c
r23530 r39457 13 13 14 14 void *CheckControllerThread (void *data) { 15 OHANA_UNUSED_PARAM(data); 15 16 16 17 char log_stdout[128], log_stderr[128]; -
trunk/Ohana/src/opihi/pantasks/controller_version.c
r26411 r39457 2 2 3 3 int controller_version (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argv); 4 5 5 6 int status; -
trunk/Ohana/src/opihi/pantasks/invalid.c
r7917 r39457 2 2 3 3 int invalid (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argc); 4 5 5 6 gprint (GP_ERR, "%s is not valid for the pantasks client\n", argv[0]); -
trunk/Ohana/src/opihi/pantasks/jobs_and_tasks_thread.c
r23530 r39457 24 24 25 25 void *CheckJobsAndTasksThread (void *data) { 26 OHANA_UNUSED_PARAM(data); 26 27 27 28 char log_stdout[128], log_stderr[128]; -
trunk/Ohana/src/opihi/pantasks/pantasks.c.in
r27996 r39457 9 9 /* program-dependent initialization */ 10 10 void program_init (int *argc, char **argv) { 11 OHANA_UNUSED_PARAM(argc); 12 OHANA_UNUSED_PARAM(argv); 11 13 12 14 pthread_t JobsAndTasksThread; -
trunk/Ohana/src/opihi/pantasks/pantasks_client.c.in
r16453 r39457 9 9 /* program-dependent initialization */ 10 10 void program_init (int *argc, char **argv) { 11 OHANA_UNUSED_PARAM(argc); 12 OHANA_UNUSED_PARAM(argv); 11 13 12 14 auto_break = TRUE; -
trunk/Ohana/src/opihi/pantasks/pantasks_server.c.in
r38986 r39457 149 149 /* these are needed to resolve symbols expected by libshell.so */ 150 150 void welcome () { } 151 void program_init (int *argc, char **argv) {} 151 void program_init (int *argc, char **argv) { 152 OHANA_UNUSED_PARAM(argc); 153 OHANA_UNUSED_PARAM(argv); 154 } 152 155 153 156 // I need to do things in a different order here to have config / freopen / gprint sequenced correctly -
trunk/Ohana/src/opihi/pantasks/run.c
r11084 r39457 9 9 10 10 int run (int argc, char **argv) { 11 OHANA_UNUSED_PARAM(argv); 11 12 12 13 if (argc != 1) { -
trunk/Ohana/src/opihi/pantasks/server_connect.c
r16903 r39457 2 2 3 3 int server_connect (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argv); 4 5 5 6 int server; -
trunk/Ohana/src/opihi/pantasks/server_disconnect.c
r16903 r39457 2 2 3 3 int server_disconnect (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argv); 4 5 5 6 int server; -
trunk/Ohana/src/opihi/pantasks/server_run.c
r23530 r39457 2 2 3 3 int server_run (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argv); 4 5 5 6 if (argc != 1) { … … 15 16 16 17 int server_stop (int argc, char **argv) { 18 OHANA_UNUSED_PARAM(argv); 17 19 18 20 if (argc != 1) { … … 26 28 27 29 int server_halt (int argc, char **argv) { 30 OHANA_UNUSED_PARAM(argv); 28 31 29 32 if (argc != 1) { -
trunk/Ohana/src/opihi/pantasks/stop.c
r11084 r39457 2 2 3 3 int stop (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argv); 4 5 5 6 if (argc != 1) { … … 16 17 17 18 int halt (int argc, char **argv) { 19 OHANA_UNUSED_PARAM(argv); 18 20 19 21 if (argc != 1) { -
trunk/Ohana/src/opihi/pantasks/thread_locks.c
r27435 r39457 29 29 30 30 void ControlLock (const char *func) { 31 OHANA_UNUSED_PARAM(func); 31 32 // fprintf (stderr, "control lock %s\n", func); 32 33 pthread_mutex_lock (&ControlMutex); … … 34 35 35 36 void ControlUnlock (const char *func) { 37 OHANA_UNUSED_PARAM(func); 36 38 // fprintf (stderr, "control unlock %s\n", func); 37 39 pthread_mutex_unlock (&ControlMutex); -
trunk/Ohana/src/opihi/pantasks/version.c
r8176 r39457 3 3 4 4 int version (int argc, char **argv) { 5 OHANA_UNUSED_PARAM(argc); 6 OHANA_UNUSED_PARAM(argv); 5 7 6 8 char *tmp; -
trunk/Ohana/src/opihi/pclient/check.c
r3187 r39457 2 2 3 3 int check (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argc); 5 OHANA_UNUSED_PARAM(argv); 4 6 5 7 /* force a check */ -
trunk/Ohana/src/opihi/pclient/pclient.c.in
r26891 r39457 8 8 9 9 void dummy_prep_term (int flag) { 10 OHANA_UNUSED_PARAM(flag); 10 11 } 11 12 12 13 /* program-dependent initialization */ 13 14 void program_init (int *argc, char **argv) { 15 OHANA_UNUSED_PARAM(argc); 16 OHANA_UNUSED_PARAM(argv); 14 17 15 18 auto_break = TRUE; … … 80 83 81 84 void pipe_signal (int signum) { 85 OHANA_UNUSED_PARAM(signum); 86 82 87 Npipe ++; 83 88 if (Npipe > 100) { -
trunk/Ohana/src/opihi/pclient/reset.c
r20047 r39457 2 2 3 3 int reset (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argv); 4 5 5 6 int i, result, waitstatus; -
trunk/Ohana/src/opihi/pclient/status.c
r7917 r39457 2 2 3 3 int status (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argv); 4 5 5 6 char status_string[64]; -
trunk/Ohana/src/opihi/pclient/stdout.c
r7917 r39457 2 2 3 3 int stdout_pclient (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argv); 4 5 5 6 if (argc != 1) { … … 16 17 17 18 int stderr_pclient (int argc, char **argv) { 19 OHANA_UNUSED_PARAM(argv); 18 20 19 21 if (argc != 1) { -
trunk/Ohana/src/opihi/pclient/version.c
r8176 r39457 3 3 4 4 int version (int argc, char **argv) { 5 OHANA_UNUSED_PARAM(argc); 6 OHANA_UNUSED_PARAM(argv); 5 7 6 8 char *tmp; -
trunk/Ohana/src/opihi/pcontrol/CheckSystem.c
r34088 r39457 61 61 62 62 void *CheckSystem_Threaded (void *data) { 63 OHANA_UNUSED_PARAM(data); 63 64 64 65 int Njobchecks, Nhostchecks, Ndonejobs; -
trunk/Ohana/src/opihi/pcontrol/JobOps.c
r36623 r39457 208 208 209 209 IDtype AddJob (char *hostname, JobMode mode, int timeout, int nicelevel, int argc, char **argv, int Nxhosts, char **xhosts) { 210 OHANA_UNUSED_PARAM(timeout); 210 211 211 212 int JobID; … … 215 216 216 217 job[0].JobID = NextJobID(); 217 if (job[0].JobID < 0) { 218 free (job); 219 return -1; 220 } 218 // XXX this test does not make sense 219 // if (job[0].JobID < 0) { 220 // free (job); 221 // return -1; 222 // } 221 223 222 224 job[0].argc = argc; -
trunk/Ohana/src/opihi/pcontrol/MachineOps.c
r29540 r39457 74 74 // delete a new machine (if not new, return TRUE) 75 75 int DelMachine (char *name) { 76 OHANA_UNUSED_PARAM(name); 76 77 77 78 return TRUE; -
trunk/Ohana/src/opihi/pcontrol/StackOps.c
r16458 r39457 16 16 17 17 if (!DEBUG) return; 18 fprintf (stderr, "%s: %p ", func, stack);19 fprintf (stderr, "objects: %p ", stack[0].object);18 fprintf (stderr, "%s: %p ", func, (void *) stack); 19 fprintf (stderr, "objects: %p ", (void *) stack[0].object); 20 20 fprintf (stderr, "Nobjects: %d, NOBJECTS: %d\n", stack[0].Nobject, stack[0].NOBJECT); 21 21 } -
trunk/Ohana/src/opihi/pcontrol/machines.c
r26411 r39457 2 2 3 3 int machines (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argc); 5 OHANA_UNUSED_PARAM(argv); 4 6 5 7 PrintMachines (); -
trunk/Ohana/src/opihi/pcontrol/pcontrol.c.in
r28158 r39457 11 11 /* program-dependent initialization */ 12 12 void program_init (int *argc, char **argv) { 13 OHANA_UNUSED_PARAM(argc); 14 OHANA_UNUSED_PARAM(argv); 13 15 14 16 # ifdef THREADED -
trunk/Ohana/src/opihi/pcontrol/version.c
r8176 r39457 3 3 4 4 int version (int argc, char **argv) { 5 OHANA_UNUSED_PARAM(argc); 6 OHANA_UNUSED_PARAM(argv); 5 7 6 8 char *tmp; -
trunk/Ohana/src/photdbc/include/photdbc.h
r38441 r39457 48 48 double JOIN_RADIUS; 49 49 double UNIQ_RADIUS; 50 double DMCAL_MIN; ;50 double DMCAL_MIN; 51 51 char ImageCat[DVO_MAX_PATH]; 52 52 char GSCFILE[DVO_MAX_PATH]; -
trunk/Ohana/src/photdbc/src/UseBackupForHost.c
r33655 r39457 7 7 // set DATA_USE_BCK for all tables with DATA_ON_BCK and host matches srcHost 8 8 int UseBackupForHost (char *catdir, SkyList *skylist, HostTable *table) { 9 OHANA_UNUSED_PARAM(catdir); 9 10 10 11 int i; -
trunk/Ohana/src/relastro/Makefile
r39375 r39457 41 41 $(SRC)/Shutdown.$(ARCH).o \ 42 42 $(SRC)/UpdateChips.$(ARCH).o \ 43 $(SRC)/UpdateStacks.$(ARCH).o \ 43 44 $(SRC)/UpdateMosaic.$(ARCH).o \ 44 45 $(SRC)/UpdateObjects.$(ARCH).o \ … … 47 48 $(SRC)/UpdateMeasures.$(ARCH).o \ 48 49 $(SRC)/GetAstromError.$(ARCH).o \ 50 $(SRC)/MeasFilterTest.$(ARCH).o \ 49 51 $(SRC)/args.$(ARCH).o \ 50 52 $(SRC)/bcatalog.$(ARCH).o \ … … 120 122 $(SRC)/UpdateMeasures.$(ARCH).o \ 121 123 $(SRC)/GetAstromError.$(ARCH).o \ 124 $(SRC)/MeasFilterTest.$(ARCH).o \ 122 125 $(SRC)/args.$(ARCH).o \ 123 126 $(SRC)/bcatalog.$(ARCH).o \ … … 195 198 $(SRC)/mkpolyterm.$(ARCH).o \ 196 199 $(SRC)/GetAstromError.$(ARCH).o \ 197 $(SRC)/ImageOps.$(ARCH).o \ 198 $(SRC)/MosaicOps.$(ARCH).o \ 200 $(SRC)/MeasFilterTest.$(ARCH).o \ 199 201 $(SRC)/extra.$(ARCH).o \ 200 202 $(SRC)/plotstuff.$(ARCH).o \ … … 218 220 $(SRC)/mkpolyterm.$(ARCH).o \ 219 221 $(SRC)/GetAstromError.$(ARCH).o \ 220 $(SRC)/ImageOps.$(ARCH).o \ 221 $(SRC)/MosaicOps.$(ARCH).o \ 222 $(SRC)/MeasFilterTest.$(ARCH).o \ 222 223 $(SRC)/extra.$(ARCH).o \ 223 224 $(SRC)/plotstuff.$(ARCH).o \ … … 241 242 $(SRC)/mkpolyterm.$(ARCH).o \ 242 243 $(SRC)/GetAstromError.$(ARCH).o \ 243 $(SRC)/ImageOps.$(ARCH).o \ 244 $(SRC)/MosaicOps.$(ARCH).o \ 244 $(SRC)/MeasFilterTest.$(ARCH).o \ 245 245 $(SRC)/extra.$(ARCH).o \ 246 246 $(SRC)/plotstuff.$(ARCH).o \ 247 247 $(SRC)/fitpoly.$(ARCH).o 248 249 # stupid dependencies: 250 # UpdateObjects.c:UpdateObjects_Chips needs 251 # ImageOps.c:MeasFilterTiny forces 252 # load_images.c:free_astrom_table needs 253 # select_images.c 254 # MosaicOps.c 248 255 249 256 $(FITSTK): $(INC)/relastro.h -
trunk/Ohana/src/relastro/include/relastro.h
r39396 r39457 88 88 off_t *NMEASURE; // allocated Measures per catalog 89 89 int *index; // lookup table catID -> catalog[i] 90 int*catIDs; // lookup table catID <- catalog[i]91 int maxID;// max catID value to date90 unsigned int *catIDs; // lookup table catID <- catalog[i] 91 unsigned int maxID; // max catID value to date 92 92 } CatalogSplitter; 93 93 … … 259 259 int REGION_HOST_ID; 260 260 int PARALLEL_REGIONS_MANUAL; 261 char *MANUAL_UNIQUER; 261 262 262 263 int HOST_ID; … … 416 417 int SetSignals (void); 417 418 418 void relastro_client_free (); 419 void relastro_free (SkyTable *sky, SkyList *skylist); 420 void relastro_client_free (SkyTable *sky, SkyList *skylist); 419 421 420 422 GSCRegion *find_regions PROTO((Image *image, off_t Nimage, int *Nregions, GSCRegion *fullregion)); … … 438 440 void initImageBins PROTO((Catalog *catalog, int Ncatalog, int FULLINIT)); 439 441 void initImages PROTO((Image *input, off_t *line_number, off_t N)); 442 void freeImages PROTO(()); 440 443 void initMosaicBins PROTO((Catalog *catalog, int Ncatalog)); 441 444 void initMosaicGrid PROTO((Image *image, off_t Nimage)); … … 528 531 int UpdateSimple (Catalog *catalog, int Ncatalog); 529 532 int UpdateChips (Catalog *catalog, int Ncatalog, int Nloop); 533 int UpdateStacks (Catalog *catalog, int Ncatalog); 530 534 int UpdateMosaic (Catalog *catalog, int Ncatalog); 531 535 int UpdateMeasures (Catalog *catalog, int Ncatalog); … … 552 556 Mosaic *getmosaics (off_t *N); 553 557 void initMosaics (Image *image, off_t Nimage); 558 void freeMosaics (); 554 559 StarData *getMosaicRaw (Catalog *catalog, int Ncatalog, off_t mos, off_t *Nstars); 555 560 StarData *getMosaicRef (Catalog *catalog, int Ncatalog, off_t mos, off_t *Nstars); … … 588 593 589 594 int initStarMaps (); 595 void freeStarMaps (); 590 596 int updateStarMaps(Catalog *catalog); 591 597 int createStarMapPoints(); … … 653 659 654 660 int indexCatalogs (Catalog *catalog, int Ncatalog); 655 int catID_and_objID_to_seq (int catID, int objID, int *catSeq, off_t *objSeq); 661 int catID_and_objID_to_seq (unsigned int catID, unsigned int objID, int *catSeq, off_t *objSeq); 662 void freeCatalogIndexes (int Ncatalog); 656 663 657 664 int markObjects (Catalog *catalog, int Ncatalog); … … 682 689 AstromOffsetTable *get_astrom_table (); 683 690 void put_astrom_table (AstromOffsetTable *myTable); 691 void free_astrom_table (); 684 692 685 693 int fit_map (AstromOffsetMap *map, StarData *raw, StarData *ref, int Npts); -
trunk/Ohana/src/relastro/src
- Property svn:mergeinfo set to
-
trunk/Ohana/src/relastro/src/BootstrapOps.c
r39364 r39457 98 98 myAbort ("invalid option"); 99 99 } 100 free (values); 100 101 101 102 return TRUE; -
trunk/Ohana/src/relastro/src/BrightCatalog.c
r39396 r39457 358 358 ohana_memcheck (1); 359 359 360 my_memdump("start of define_bintable");361 360 gfits_define_bintable_column (&theader, "D", "RA", "ra", "degrees", 1.0, 0.0); 362 my_memdump("after define_bintable RA");363 364 361 gfits_define_bintable_column (&theader, "D", "DEC", "dec", "degrees", 1.0, 0.0); 365 my_memdump("after define_bintable DEC");366 367 362 gfits_define_bintable_column (&theader, "E", "MAG_SYS", "magnitude (sys)", NULL, 1.0, 0.0); 368 363 gfits_define_bintable_column (&theader, "E", "MAG_CAL", "magnitude (cal)", NULL, 1.0, 0.0); … … 433 428 // add the columns to the output array 434 429 gfits_set_bintable_column (&theader, &ftable, "RA", R, catalog->Nmeasure); 430 431 fprintf (stderr, "--------------- after set_bintable RA --------------"); 432 ohana_memdump_file (stderr, TRUE); 433 435 434 gfits_set_bintable_column (&theader, &ftable, "DEC", D, catalog->Nmeasure); 436 435 gfits_set_bintable_column (&theader, &ftable, "MAG_SYS", M, catalog->Nmeasure); … … 798 797 catalogs->maxID = 0; 799 798 ALLOCATE (catalogs->index, int, catalogs->maxID + 1); 800 for (i = 0; i <= catalogs->maxID; i++) catalogs->index[i] = -1; 799 800 unsigned int ID; 801 for (ID = 0; ID <= catalogs->maxID; ID++) catalogs->index[ID] = -1; 801 802 802 803 catalogs->Nsecfilt = Nsecfilt; … … 807 808 ALLOCATE (catalogs->catalog, Catalog, catalogs->NCATALOG); 808 809 809 ALLOCATE (catalogs->catIDs, int,catalogs->NCATALOG);810 ALLOCATE (catalogs->NAVERAGE, off_t, catalogs->NCATALOG);811 ALLOCATE (catalogs->NMEASURE, off_t, catalogs->NCATALOG);810 ALLOCATE (catalogs->catIDs, unsigned int, catalogs->NCATALOG); 811 ALLOCATE (catalogs->NAVERAGE, off_t, catalogs->NCATALOG); 812 ALLOCATE (catalogs->NMEASURE, off_t, catalogs->NCATALOG); 812 813 813 814 for (i = 0; i < catalogs->NCATALOG; i++) { … … 828 829 int BrightCatalogSplitFree (CatalogSplitter *catalogs) { 829 830 830 free (catalogs->catIDs); 831 free (catalogs->NAVERAGE); 832 free (catalogs->NMEASURE); 833 free (catalogs->index); 834 free (catalogs); 831 # if (0) 832 int i; 833 834 for (i = 0; i < catalogs->NCATALOG; i++) { 835 FREE (catalogs->catalog[i].average); 836 FREE (catalogs->catalog[i].secfilt); 837 FREE (catalogs->catalog[i].measureT); 838 } 839 FREE (catalogs->catalog); 840 # endif 841 842 FREE (catalogs->catIDs); 843 FREE (catalogs->NAVERAGE); 844 FREE (catalogs->NMEASURE); 845 FREE (catalogs->index); 846 FREE (catalogs); 835 847 return TRUE; 836 848 } … … 844 856 845 857 // find the max value of catID in this BrightCatalog 846 int catIDmax = 0;858 unsigned int catIDmax = 0; 847 859 for (i = 0; i < bcatalog->Naverage; i++) { 848 860 catIDmax = MAX(catIDmax, bcatalog->average[i].catID); … … 850 862 // XXX validate the measure ID range here 851 863 852 int maxIDold = catalogs->maxID;864 unsigned int maxIDold = catalogs->maxID; 853 865 catalogs->maxID = MAX (maxIDold, catIDmax); 854 866 855 867 // extend the index array and init 856 868 REALLOCATE (catalogs->index, int, catalogs->maxID + 1); 857 for (i = maxIDold + 1; i <= catalogs->maxID; i++) catalogs->index[i] = -1; 869 870 unsigned int id; 871 for (id = maxIDold + 1; id <= catalogs->maxID; id++) catalogs->index[id] = -1; 858 872 859 873 // identify the new catID values 860 874 for (i = 0; i < bcatalog->Naverage; i++) { 861 int catID = bcatalog->average[i].catID;875 unsigned int catID = bcatalog->average[i].catID; 862 876 assert (catID > 0); 863 877 assert (catID < catalogs->maxID + 1); … … 881 895 882 896 if (catalogs->Ncatalog >= catalogs->NCATALOG) { 897 int oldNCATALOG = catalogs->NCATALOG; 883 898 catalogs->NCATALOG += 16; 884 899 // fprintf (stderr, "realloc catalogs->catalog: old: %llx ", (long long) catalogs->catalog); … … 894 909 // fprintf (stderr, "new: %llx - %llx\n", (long long) catalogs->NMEASURE, (long long) (catalogs->NMEASURE + sizeof(off_t)*catalogs->NCATALOG)); 895 910 896 REALLOCATE (catalogs->catIDs, int,catalogs->NCATALOG);911 REALLOCATE (catalogs->catIDs, unsigned int, catalogs->NCATALOG); 897 912 898 913 int j; 899 for (j = catalogs->NCATALOG - 16; j < catalogs->NCATALOG; j++) {914 for (j = oldNCATALOG; j < catalogs->NCATALOG; j++) { 900 915 dvo_catalog_init (&catalogs->catalog[j], TRUE); 901 916 catalogs->catIDs[j] = 0; … … 917 932 // assign the averages to the corresponding catalog 918 933 for (i = 0; i < bcatalog->Naverage; i++) { 919 int ID = bcatalog->average[i].catID;934 unsigned int ID = bcatalog->average[i].catID; 920 935 int Nc = catalogs->index[ID]; 921 936 assert (Nc > -1); … … 942 957 // XXX what about averef and related links? Do I need them? 943 958 for (i = 0; i < bcatalog->Nmeasure; i++) { 944 int ID = bcatalog->measure[i].catID;959 unsigned int ID = bcatalog->measure[i].catID; 945 960 int Nc = catalogs->index[ID]; 946 961 assert (Nc > -1); -
trunk/Ohana/src/relastro/src/FitAstromOps.c
r39375 r39457 297 297 median = x[(int)(0.5*Npoints)]; 298 298 } 299 free (x); 299 300 300 301 return median; -
trunk/Ohana/src/relastro/src/FitChip.c
r38986 r39457 221 221 222 222 int i, Ns; 223 float dL, dM, dLsum, dLsum2, dMsum, dMsum2, *dR; 224 225 ALLOCATE (dR, float, Nstars); 223 float dL, dM; 224 225 ALLOCATE_PTR (dRvec, double, Nstars); 226 ALLOCATE_PTR (dLvec, double, Nstars); 227 ALLOCATE_PTR (dMvec, double, Nstars); 226 228 227 229 Ns = 0; 228 dLsum = dLsum2 = dMsum = dMsum2 = 0.0;229 230 for (i = 0; i < Nstars; i++) { 230 231 if (raw[i].mask) continue; … … 235 236 dM = raw[i].M - ref[i].M; 236 237 237 dLsum += dL; 238 dLsum2 += dL*dL; 239 dMsum += dM; 240 dMsum2 += dM*dM; 241 242 dR[Ns] = hypot (dL, dM); 238 dLvec[Ns] = dL; 239 dMvec[Ns] = dM; 240 dRvec[Ns] = hypot (dL, dM); 243 241 Ns++; 244 242 } 245 243 246 *dLsig = sqrt((dLsum2 / Ns) - SQ(dLsum/Ns)); 247 *dMsig = sqrt((dMsum2 / Ns) - SQ(dMsum/Ns)); 244 dsort (dLvec, Ns); 245 dsort (dMvec, Ns); 246 247 double Slo, Shi; 248 Slo = VectorFractionInterpolate (dLvec, 0.158655, Ns); 249 Shi = VectorFractionInterpolate (dLvec, 0.841345, Ns); 250 *dLsig = (Shi - Slo) / 2.0; 251 free (dLvec); 252 253 Slo = VectorFractionInterpolate (dMvec, 0.158655, Ns); 254 Shi = VectorFractionInterpolate (dMvec, 0.841345, Ns); 255 *dMsig = (Shi - Slo) / 2.0; 256 free (dMvec); 257 248 258 *nKeep = Ns; 249 259 250 260 if (Ns < 5) { 251 261 *dRsig = NAN; 252 free (dR );262 free (dRvec); 253 263 return (FALSE); 254 264 } 255 265 256 266 // for a 2D Gaussian, 40% of the points are within R = 1 sigma 257 fsort (dR, Ns);258 *dRsig = dR [(int)(0.40*Ns)];267 dsort (dRvec, Ns); 268 *dRsig = dRvec[(int)(0.40*Ns)]; 259 269 260 free (dR );270 free (dRvec); 261 271 return (TRUE); 262 272 } -
trunk/Ohana/src/relastro/src/GetAstromError.c
r39225 r39457 76 76 // weight to ensure the image is tied down to the 2mass frame 77 77 78 if (has2MASS && LoopWeight2MASS ) {78 if (has2MASS && LoopWeight2MASS && (Nloop >= 0)) { 79 79 dPtotal = dPtotal / LoopWeight2MASS[Nloop]; 80 80 } 81 if (is2MASS && LoopWeight2MASS ) {81 if (is2MASS && LoopWeight2MASS && (Nloop >= 0)) { 82 82 dPtotal = dPtotal / LoopWeight2MASS[Nloop]; 83 83 } 84 if (isTycho && LoopWeightTycho ) {84 if (isTycho && LoopWeightTycho && (Nloop >= 0)) { 85 85 dPtotal = dPtotal / LoopWeightTycho[Nloop]; 86 86 } -
trunk/Ohana/src/relastro/src/ImageOps.c
r39381 r39457 1 1 # include "relastro.h" 2 int isGPC1chip (int photcode);3 2 4 3 # define USE_IMAGE_ID 1 … … 10 9 // if we read only a subset of the rows from the Image FITS, LineNumber tells us to which row 11 10 // each image belongs 12 static off_t *LineNumber ; // match of subset to full image table13 14 static off_t *N_onImage ; // number of measurements on image15 static off_t *N_ONIMAGE ; // allocated number of measurements on image16 17 static int *Ncatlist ; // catalogs associated with each image18 static int *NCATLIST ; // catalogs associated with each image19 static int **catlist ; // catalogs associated with each image20 21 static IDX_T **MeasureToImage ; // link from catalog,measure to image22 static IDX_T **ImageToCatalog ; // catalog which supplied measurement on image23 static IDX_T **ImageToMeasure ; // measure reference for measurement on image11 static off_t *LineNumber = NULL; // match of subset to full image table 12 13 static off_t *N_onImage = NULL; // number of measurements on image 14 static off_t *N_ONIMAGE = NULL; // allocated number of measurements on image 15 16 static int *Ncatlist = NULL; // catalogs associated with each image 17 static int *NCATLIST = NULL; // catalogs associated with each image 18 static int **catlist = NULL; // catalogs associated with each image 19 20 static IDX_T **MeasureToImage = NULL; // link from catalog,measure to image 21 static IDX_T **ImageToCatalog = NULL; // catalog which supplied measurement on image 22 static IDX_T **ImageToMeasure = NULL; // measure reference for measurement on image 24 23 25 24 // if we search by image ID, we sort (imageIDs, imageIdx) by imageIDs to get a sorted … … 27 26 28 27 # if USE_IMAGE_ID 29 static off_t *imageIDs ; // list of all image IDs30 static off_t *imageIdx ; // list of index for image IDs28 static off_t *imageIDs = NULL; // list of all image IDs 29 static off_t *imageIdx = NULL; // list of index for image IDs 31 30 32 31 // as an alternative, we generate imageSeq, which directly maps imageID -> seq 33 static off_t *imageSeq ; // list of index for image IDs32 static off_t *imageSeq = NULL; // list of index for image IDs 34 33 35 34 // MAX_ID requires 512M to store the image index … … 120 119 } 121 120 # endif 121 } 122 123 void freeImages () { 124 125 FREE (LineNumber); 126 127 # if USE_IMAGE_ID 128 FREE (imageIDs); 129 FREE (imageIdx); 130 FREE (imageSeq); 131 # else 132 FREE (start); 133 FREE (stop); 134 # endif 135 136 free_astrom_table(); 122 137 } 123 138 … … 197 212 198 213 for (i = 0; i < Ncatalog; i++) { 199 free(MeasureToImage[i]);200 } 201 free(MeasureToImage);214 FREE (MeasureToImage[i]); 215 } 216 FREE (MeasureToImage); 202 217 for (i = 0; i < Nimage; i++) { 203 if (ImageToCatalog[i]) { free (ImageToCatalog[i]); } 204 if (ImageToMeasure[i]) { free (ImageToMeasure[i]); } 205 } 206 free (ImageToCatalog); 207 free (ImageToMeasure); 208 free (N_onImage); 209 free (N_ONIMAGE); 218 FREE (ImageToCatalog[i]); 219 FREE (ImageToMeasure[i]); 220 if (catlist) { FREE (catlist[i]); } 221 } 222 FREE (Ncatlist); 223 FREE (NCATLIST); 224 FREE (catlist); 225 Ncatlist = NULL; 226 NCATLIST = NULL; 227 catlist = NULL; 228 229 FREE (ImageToCatalog); 230 FREE (ImageToMeasure); 231 FREE (N_onImage); 232 FREE (N_ONIMAGE); 210 233 } 211 234 … … 240 263 name = GetPhotcodeNamebyCode (image[i].photcode); 241 264 int showExample = (Nfew < 30); 242 if (showExample) fprintf (stderr, "image "OFF_T_FMT" (%d, %s) has "OFF_T_FMT" of %d measures (%s, %s) ", i, image[i].imageID, image[i].name, N_onImage[i], image[i].nstar, 243 ohana_sec_to_date(image[i].tzero), name); 265 if (showExample) { 266 char *myDate = ohana_sec_to_date(image[i].tzero); 267 fprintf (stderr, "image "OFF_T_FMT" (%d, %s) has "OFF_T_FMT" of %d measures (%s, %s) ", i, image[i].imageID, image[i].name, N_onImage[i], image[i].nstar, myDate, name); 268 free (myDate); 269 } 244 270 if (N_onImage[i] < 20) { 245 271 if (showExample) fprintf (stderr, "*"); … … 508 534 m = ImageToMeasure[im][i]; 509 535 c = ImageToCatalog[im][i]; 536 myAssert (c < Ncatalog, "oops"); 510 537 511 538 Measure *measure = &catalog[c].measure[m]; … … 653 680 m = ImageToMeasure[im][i]; 654 681 c = ImageToCatalog[im][i]; 682 myAssert (c < Ncatalog, "oops"); 655 683 656 684 MeasureTiny *measure = &catalog[c].measureT[m]; … … 753 781 m = ImageToMeasure[im][i]; 754 782 c = ImageToCatalog[im][i]; 783 myAssert (c < Ncatalog, "oops"); 755 784 756 785 MeasureTiny *measure = &catalog[c].measureT[m]; … … 829 858 m = ImageToMeasure[im][i]; 830 859 c = ImageToCatalog[im][i]; 860 myAssert (c < Ncatalog, "oops"); 831 861 832 862 // XXX should I use the raw coords or just measure.X,Y -> R,D? … … 871 901 m = ImageToMeasure[im][i]; 872 902 c = ImageToCatalog[im][i]; 903 myAssert (c < Ncatalog, "oops"); 873 904 874 905 MeasureTiny *measure = &catalog[c].measureT[m]; … … 900 931 } 901 932 933 # if (0) 902 934 /** lifted from relphot/StarOps.clean_measures */ 903 935 void FlagOutliers2D(Catalog *catalog); … … 1267 1299 return TRUE; 1268 1300 } 1301 # endif -
trunk/Ohana/src/relastro/src/ImageTable.c
r38441 r39457 33 33 } 34 34 35 // gfits_db_free (&db); 36 gfits_free_header (&db.header); 37 gfits_free_matrix (&db.matrix); 38 gfits_free_header (&db.theader); 39 free (db.filename); 40 35 41 *nimage = Nimage; 36 42 return image; … … 61 67 dvo_image_unlock (&db); 62 68 69 gfits_db_free (&db); 70 63 71 return TRUE; 64 72 } -
trunk/Ohana/src/relastro/src/MosaicOps.c
r37038 r39457 3 3 // array of mosaic definition structures 4 4 static off_t Nmosaic; 5 static Mosaic *mosaic ;5 static Mosaic *mosaic = NULL; 6 6 7 7 // list of all images associated with a mosaic … … 185 185 } 186 186 187 void freeMosaics () { 188 189 off_t i; 190 191 if (!mosaic) return; 192 193 for (i = 0; i < Nmosaic; i++) { 194 FREE (mosaic_own_images[i]); 195 } 196 197 FREE (mosaic); 198 FREE (Nmosaic_own_images); 199 FREE (Amosaic_own_images); 200 FREE (mosaic_own_images); 201 FREE (mosaic_for_images); 202 } 203 187 204 // return StarData values for detections in the specified image, converting coordinates from the 188 205 // chip positions: X,Y -> L,M -> P,Q -> R,D … … 274 291 // extend each host image table to include the mosaic 'images' needed by the host 275 292 int select_mosaics_hostregion (RegionHostTable *regionHosts, Image *image, off_t Nimage) { 293 OHANA_UNUSED_PARAM(Nimage); 276 294 277 295 int i; … … 324 342 } 325 343 344 free (addMosaic); 345 326 346 host->Nimage += Nadd; 327 347 } 348 free (mosaicUsed); 349 328 350 return TRUE; 329 351 } -
trunk/Ohana/src/relastro/src/SetSignals.c
r39402 r39457 54 54 55 55 void my_memdump (char *message) { 56 57 return; 56 58 57 59 fprintf (stderr, "%s\n", message); -
trunk/Ohana/src/relastro/src/StarMaps.c
r38986 r39457 25 25 } StarMap; 26 26 27 static StarMap *starmap;27 static StarMap *starmap = NULL; 28 28 // static int Nstarmap; -- is it always == Nimages? 29 29 … … 55 55 } 56 56 57 void freeStarMaps () { 58 59 off_t i, Nimages; 60 61 getimages(&Nimages, NULL); 62 63 for (i = 0; i < Nimages; i++) { 64 FREE (starmap[i].points); 65 FREE (starmap[i].stars); 66 } 67 68 FREE (starmap); 69 return; 70 } 71 57 72 int updateStarMaps(Catalog *catalog) { 58 73 -
trunk/Ohana/src/relastro/src/UpdateChips.c
r38986 r39457 152 152 } 153 153 } 154 155 AstromOffsetMapFree (oldCoords.offsetMap); 154 156 155 157 // Apply the modified coords back to the measure.R,D. Note that raw.R,D, ref.L,M, etc … … 356 358 } 357 359 360 AstromOffsetMapFree (oldCoords.offsetMap); 361 358 362 // apply the modified R,D back to the measures 359 363 setImageRaw (threadinfo->catalog, threadinfo->Ncatalog, i, raw, Nraw, MODE_MOSAIC); … … 569 573 AstromOffsetMapSetOrder (truMap, tmpMap->Nx, tmpMap->Ny, image); 570 574 AstromOffsetMapCopyData (truMap, tmpMap); 575 AstromOffsetMapFree (tmpMap); 571 576 return; 572 577 } … … 579 584 unlockUpdateChips (); 580 585 AstromOffsetMapCopyData (image->coords.offsetMap, tmpMap); 586 AstromOffsetMapFree (tmpMap); 581 587 return; 582 588 } -
trunk/Ohana/src/relastro/src/UpdateMeasures.c
r39385 r39457 71 71 72 72 double dR = 3600.0*fabs(csdec*(oldR - R)); 73 double dD = 3600.0*fabs(oldD - R);73 double dD = 3600.0*fabs(oldD - D); 74 74 75 75 // complain if the new location is far from the old location -
trunk/Ohana/src/relastro/src/UpdateObjectOffsets.c
r39171 r39457 62 62 // uses MeasureTiny values, but will also update Measure values when populated 63 63 // if Galaxy Motion Model correction is active, do not apply at this last stage 64 UpdateObjects (&catalog, 1, FALSE);64 UpdateObjects (&catalog, 1, -1); 65 65 66 66 free_tiny_values(&catalog); … … 218 218 fprintf (stderr, "command: %s\n", command); 219 219 220 if (PARALLEL_MANUAL) continue; 220 if (PARALLEL_MANUAL) { 221 free (command); 222 continue; 223 } 221 224 222 225 if (PARALLEL_SERIAL) { … … 236 239 group->hosts[i][0].pid = pid; // save for future reference 237 240 } 241 free (command); 238 242 } 239 243 … … 338 342 fprintf (stderr, "command: %s\n", command); 339 343 340 if (PARALLEL_MANUAL) continue; 344 if (PARALLEL_MANUAL) { 345 free (command); 346 continue; 347 } 341 348 342 349 if (PARALLEL_SERIAL) { … … 356 363 table->hosts[i].pid = pid; // save for future reference 357 364 } 365 free (command); 358 366 } 359 367 … … 366 374 } 367 375 376 FreeHostTable (table); 377 368 378 return TRUE; 369 379 } -
trunk/Ohana/src/relastro/src/UpdateObjects.c
r39390 r39457 121 121 // be called with just MeasureTiny set and Measure == NULL 122 122 int UpdateObjects_Chips (Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int Nsecfilt, FitStats *fitStats, int cat, off_t measOff) { 123 OHANA_UNUSED_PARAM(Nsecfilt); 123 124 124 125 int k; … … 257 258 } 258 259 260 // if we have fitted (and accepted) a parallax model, get the best pm fit and chisq 261 // given the set of points (mask is respected) 259 262 if (average[0].flags & ID_OBJ_USE_PAR) { 260 // get the best pm fit and chisq given the set of points (mask is respected)261 263 if (!FitPM_Basic (&fitPM, fitStats->fitdataPM, fitStats->points, fitStats->Npoints)) { 262 264 average[0].flags |= ID_OBJ_BAD_PM; … … 551 553 // be called with just MeasureTiny set and Measure == NULL 552 554 int UpdateObjects_Stack (Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int Nsecfilt, FitStats *fitStats) { 555 OHANA_UNUSED_PARAM(Nsecfilt); 553 556 554 557 int status; … … 650 653 651 654 int UpdateObjects_SelectMeasures (FitStats *fit, Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int isStack, int *stackEntry) { 655 OHANA_UNUSED_PARAM(secfilt); 652 656 653 657 // I've already allocated fit->points (and fit->sample) with space for fit->NpointsAlloc entries -
trunk/Ohana/src/relastro/src/args.c
r39396 r39457 51 51 remove_argument (N, &argc, argv); 52 52 RELASTRO_OP = OP_UPDATE_OFFSETS; 53 } 54 55 // elements needed for parallel regions / parallel images 56 MANUAL_UNIQUER = NULL; 57 if ((N = get_argument (argc, argv, "-manual-uniquer"))) { 58 remove_argument (N, &argc, argv); 59 MANUAL_UNIQUER = strcreate (argv[N]); 60 remove_argument (N, &argc, argv); 53 61 } 54 62 … … 372 380 snprintf (PHOTCODE_SKIP_LIST, Ntotal, "%s,%s", SuperCOSMOS_SKIP, RawSkip); 373 381 free (RawSkip); 374 free (SuperCOSMOS_SKIP);375 382 } else { 376 383 PHOTCODE_SKIP_LIST = RawSkip; … … 378 385 remove_argument (N, &argc, argv); 379 386 } 387 free (SuperCOSMOS_SKIP); 380 388 381 389 VERBOSE = VERBOSE2 = FALSE; … … 562 570 if (argc != 1) usage (); 563 571 return TRUE; 572 } 573 574 void relastro_free (SkyTable *sky, SkyList *skylist) { 575 FREE (REGION_FILE); 576 FREE (IMAGE_TABLE); 577 FREE (LoopWeight2MASSstr); 578 FREE (LoopWeightTychostr); 579 580 FREE (PHOTCODE_SKIP_LIST); 581 FREE (PHOTCODE_KEEP_LIST); 582 FREE (PHOTCODE_RESET_LIST); 583 FREE (DCR_RED_COLOR_POS); 584 FREE (DCR_RED_COLOR_NEG); 585 FREE (DCR_BLUE_COLOR_POS); 586 FREE (DCR_BLUE_COLOR_NEG); 587 588 FREE (PHOTCODE_A_LIST); 589 FREE (PHOTCODE_B_LIST); 590 FREE (HIGH_SPEED_DIR); 591 FREE (BCATALOG); 592 FREE (HOSTDIR); 593 594 // these are set in initialize 595 FREE(photcodesKeep); 596 FREE(photcodesSkip); 597 FREE(photcodesReset); 598 FREE(photcodesGroupA); 599 FREE(photcodesGroupB); 600 601 SkyTableFree (sky); 602 SkyListFree(skylist); 603 FreePhotcodeTable(); 604 605 ohana_memcheck (VERBOSE); 606 ohana_memdump (VERBOSE); 564 607 } 565 608 … … 922 965 } 923 966 924 void relastro_client_free ( ) {967 void relastro_client_free (SkyTable *sky, SkyList *skylist) { 925 968 FREE (PHOTCODE_SKIP_LIST); 926 969 FREE (PHOTCODE_KEEP_LIST); … … 936 979 FREE(BCATALOG); 937 980 FREE (HOSTDIR); 981 982 // these are set in initialize 983 FREE(photcodesKeep); 984 FREE(photcodesSkip); 985 FREE(photcodesReset); 986 FREE(photcodesGroupA); 987 FREE(photcodesGroupB); 988 989 SkyTableFree (sky); 990 SkyListFree(skylist); 991 FreePhotcodeTable(); 992 993 ohana_memcheck (VERBOSE); 994 ohana_memdump (VERBOSE); 938 995 } 939 996 -
trunk/Ohana/src/relastro/src/assign_images.c
r38986 r39457 156 156 157 157 // this is a bit memory expensive : I am making a complete copy of the image table here 158 // XXX is adding an image, can we just add a pointer? 158 159 off_t Nsubset = host->Nimage; 159 160 host->image[Nsubset] = image[j]; … … 168 169 169 170 // save the astrometry maps, where they exist 171 // here we are adding an AstromOffsetTable, but the data are only pointers 172 // we should NOT free this table with AstromOffsetTableFree() 170 173 if (image[j].coords.offsetMap) { 171 174 if (!host->astromTable) { -
trunk/Ohana/src/relastro/src/bcatalog.c
r39375 r39457 184 184 offset = catalog[0].average[i].measureOffset + j; 185 185 186 // we do not measure astrometry for the warps, so skip: 187 if (isGPC1warp(catalog[0].measure[offset].photcode)) continue; 188 186 189 // filter objects based on user supplied criteria, including SIGMA_LIM 187 190 if (!MeasFilterTest(&catalog[0].measure[offset], TRUE)) { -
trunk/Ohana/src/relastro/src/dvo_astrom_ops.c
r37038 r39457 2 2 /* the Measure carries the instantaneous mean position at the epoch t */ 3 3 4 // average & secfilt no longer used since R and D are now in measure 5 4 6 double getMeanR (MeasureTiny *measure, Average *average, SecFilt *secfilt) { 7 OHANA_UNUSED_PARAM(average); 8 OHANA_UNUSED_PARAM(secfilt); 5 9 6 10 double ra; … … 14 18 15 19 double getMeanD (MeasureTiny *measure, Average *average, SecFilt *secfilt) { 20 OHANA_UNUSED_PARAM(average); 21 OHANA_UNUSED_PARAM(secfilt); 16 22 17 23 double dec; … … 25 31 26 32 int setMeanR (double ra_fit, MeasureTiny *measure, Average *average, SecFilt *secfilt) { 33 OHANA_UNUSED_PARAM(average); 34 OHANA_UNUSED_PARAM(secfilt); 27 35 28 36 // old: measure[0].dR += (ra_fit - average[0].R) * 3600.0; … … 34 42 35 43 int setMeanD (double dec_fit, MeasureTiny *measure, Average *average, SecFilt *secfilt) { 44 OHANA_UNUSED_PARAM(average); 45 OHANA_UNUSED_PARAM(secfilt); 36 46 37 47 // old: measure[0].dD += (dec_fit - average[0].D) * 3600.0; … … 43 53 44 54 double getMeanR_Big (Measure *measure, Average *average, SecFilt *secfilt) { 55 OHANA_UNUSED_PARAM(average); 56 OHANA_UNUSED_PARAM(secfilt); 45 57 46 58 double ra; … … 54 66 55 67 double getMeanD_Big (Measure *measure, Average *average, SecFilt *secfilt) { 68 OHANA_UNUSED_PARAM(average); 69 OHANA_UNUSED_PARAM(secfilt); 56 70 57 71 double dec; … … 65 79 66 80 int setMeanR_Big (double ra_fit, Measure *measure, Average *average, SecFilt *secfilt) { 81 OHANA_UNUSED_PARAM(average); 82 OHANA_UNUSED_PARAM(secfilt); 67 83 68 84 // old: measure[0].dR += (ra_fit - average[0].R) * 3600.0; … … 74 90 75 91 int setMeanD_Big (double dec_fit, Measure *measure, Average *average, SecFilt *secfilt) { 92 OHANA_UNUSED_PARAM(average); 93 OHANA_UNUSED_PARAM(secfilt); 76 94 77 95 // measure[0].dD += (dec_fit - average[0].D) * 3600.0; -
trunk/Ohana/src/relastro/src/fitobj.c
r39370 r39457 156 156 157 157 Catalog *mkstar (FitStats *fitStats, double Ro, double Do, double uR, double uD, double plx, int Npoints, int Nbad) { 158 OHANA_UNUSED_PARAM(fitStats); 158 159 159 160 int i; … … 239 240 return catalog; 240 241 } 242 243 // these dummy functions are used to avoid including ImageOps, etc 244 int areImagesMatched () { 245 return FALSE; 246 } 247 float getColorBlue (off_t meas, int cat) { 248 OHANA_UNUSED_PARAM(meas); 249 OHANA_UNUSED_PARAM(cat); 250 return (NAN); 251 } 252 float getColorRed (off_t meas, int cat) { 253 OHANA_UNUSED_PARAM(meas); 254 OHANA_UNUSED_PARAM(cat); 255 return (NAN); 256 } -
trunk/Ohana/src/relastro/src/fitobj2.c
r39375 r39457 173 173 174 174 Catalog *mkstar (FitStats *fitStats, double Ro, double Do, double uR, double uD, double plx, int Npoints, int Nbad) { 175 OHANA_UNUSED_PARAM(fitStats); 175 176 176 177 int i; … … 264 265 return catalog; 265 266 } 267 268 // these dummy functions are used to avoid including ImageOps, etc 269 int areImagesMatched () { 270 return FALSE; 271 } 272 float getColorBlue (off_t meas, int cat) { 273 OHANA_UNUSED_PARAM(meas); 274 OHANA_UNUSED_PARAM(cat); 275 return (NAN); 276 } 277 float getColorRed (off_t meas, int cat) { 278 OHANA_UNUSED_PARAM(meas); 279 OHANA_UNUSED_PARAM(cat); 280 return (NAN); 281 } -
trunk/Ohana/src/relastro/src/fitstk.c
r39387 r39457 279 279 return catalog; 280 280 } 281 282 // these dummy functions are used to avoid including ImageOps, etc 283 int areImagesMatched () { 284 return FALSE; 285 } 286 float getColorBlue (off_t meas, int cat) { 287 OHANA_UNUSED_PARAM(meas); 288 OHANA_UNUSED_PARAM(cat); 289 return (NAN); 290 } 291 float getColorRed (off_t meas, int cat) { 292 OHANA_UNUSED_PARAM(meas); 293 OHANA_UNUSED_PARAM(cat); 294 return (NAN); 295 } -
trunk/Ohana/src/relastro/src/high_speed_utils.c
r38601 r39457 8 8 #define DEFAULT_WHERE_B "((flags & 0x01000000) == 0) && ((flags & 0x04000000) && ((y:nphot > 1) || (z:nphot > 1)) &&((y:err < 0.2) || (z:err < 0.2)))" 9 9 10 11 extern char **isolate_elements(int, char **, int *);12 10 13 11 int print_error(); … … 76 74 // parse it into elements of the where condition 77 75 char **cstack = NULL; 78 int Ncstack;76 unsigned int Ncstack; 79 77 cstack = isolate_elements(nWords, words, &Ncstack); 80 78 free(words); -
trunk/Ohana/src/relastro/src/indexCatalogs.c
r36630 r39457 1 1 # include "relastro.h" 2 2 3 static int catIDmax = 0;4 static int *catIDseq = NULL;5 static int *objIDmax = NULL;6 static int **objIDseq = NULL;3 static unsigned int catIDmax = 0; 4 static int *catIDseq = NULL; 5 static unsigned int *objIDmax = NULL; 6 static int **objIDseq = NULL; 7 7 8 8 int indexCatalogs (Catalog *catalog, int Ncatalog) { … … 19 19 20 20 ALLOCATE (catIDseq, int, catIDmax + 1); 21 for (i = 0; i < catIDmax + 1; i++) { 22 catIDseq[i] = -1; 21 22 unsigned int ID; 23 for (ID = 0; ID < catIDmax + 1; ID++) { 24 catIDseq[ID] = -1; 23 25 } 24 26 25 27 for (i = 0; i < Ncatalog; i++) { 26 int catID = catalog[i].catID;28 unsigned int catID = catalog[i].catID; 27 29 catIDseq[catID] = i; 28 30 } 29 31 30 ALLOCATE (objIDmax, int, Ncatalog);31 ALLOCATE (objIDseq, int *, Ncatalog);32 ALLOCATE (objIDmax, unsigned int, Ncatalog); 33 ALLOCATE (objIDseq, int *, Ncatalog); 32 34 for (i = 0; i < Ncatalog; i++) { 33 35 objIDmax[i] = 0; … … 37 39 38 40 ALLOCATE (objIDseq[i], int, objIDmax[i] + 1); 39 for ( j = 0; j < objIDmax[i] + 1; j++) {40 objIDseq[i][ j] = -1;41 for (ID = 0; ID < objIDmax[i] + 1; ID++) { 42 objIDseq[i][ID] = -1; 41 43 } 42 44 43 45 for (j = 0; j < catalog[i].Naverage; j++) { 44 int objID = catalog[i].average[j].objID;46 unsigned int objID = catalog[i].average[j].objID; 45 47 objIDseq[i][objID] = j; 46 48 } … … 49 51 } 50 52 51 int catID_and_objID_to_seq (int catID, int objID, int *catSeq, off_t *objSeq) { 53 void freeCatalogIndexes (int Ncatalog) { 54 int i; 55 56 for (i = 0; i < Ncatalog; i++) { 57 free (objIDseq[i]); 58 } 59 free (objIDmax); 60 free (objIDseq); 61 free (catIDseq); 62 } 63 64 int catID_and_objID_to_seq (unsigned int catID, unsigned int objID, int *catSeq, off_t *objSeq) { 52 65 53 66 if (catID > catIDmax) return FALSE; -
trunk/Ohana/src/relastro/src/initialize.c
r37807 r39457 2 2 3 3 void initialize (int argc, char **argv) { 4 5 photcodesKeep = NULL; 6 photcodesSkip = NULL; 7 photcodesReset = NULL; 8 photcodesGroupA = NULL; 9 photcodesGroupB = NULL; 4 10 5 11 ConfigInit (&argc, argv); -
trunk/Ohana/src/relastro/src/launch_region_hosts.c
r39389 r39457 161 161 fprintf (stderr, "command: %s\n", command); 162 162 163 if (PARALLEL_REGIONS_MANUAL) continue; 163 if (PARALLEL_REGIONS_MANUAL) { 164 free (command); 165 continue; 166 } 164 167 165 168 // launch the job, then wait for it to be done loading catalogs. force the remote … … 180 183 check_sync_file (syncfile, 1); 181 184 free (syncfile); 185 186 free (command); 182 187 } 183 188 -
trunk/Ohana/src/relastro/src/load_catalogs.c
r39396 r39457 142 142 int TIME = time(NULL); 143 143 int PID = getpid(); 144 snprintf (uniquer, 12, "%05d.%05d", PID, TIME % 100000); 144 145 if (PARALLEL_MANUAL && MANUAL_UNIQUER) { 146 snprintf (uniquer, 12, "%11s", MANUAL_UNIQUER); 147 } else { 148 snprintf (uniquer, 12, "%05d.%05d", PID, TIME % 100000); 149 } 145 150 146 151 // load the list of hosts … … 224 229 fprintf (stderr, "command: %s\n", command); 225 230 226 if (PARALLEL_MANUAL) continue; 231 if (PARALLEL_MANUAL) { 232 free (command); 233 continue; 234 } 227 235 228 236 if (PARALLEL_SERIAL) { … … 242 250 table->hosts[i].pid = pid; // save for future reference 243 251 } 252 free (command); 244 253 } 245 254 … … 289 298 } 290 299 300 FreeHostTable (table); 301 291 302 Catalog *catalog = catalogs->catalog; 292 303 *Ncatalog = catalogs->Ncatalog; 304 305 // need to free the place-holder catalogs: 306 for (i = catalogs->Ncatalog; i < catalogs->NCATALOG; i++) { 307 free (catalogs->catalog[i].average); 308 free (catalogs->catalog[i].measureT); 309 free (catalogs->catalog[i].secfilt); 310 } 293 311 294 312 int Nmeasure = 0; -
trunk/Ohana/src/relastro/src/load_images.c
r38986 r39457 27 27 MARKTIME("build chip match: %f sec\n", dtime); 28 28 29 char mapfile[DVO_MAX_PATH];30 snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR);31 table = AstromOffsetMapLoad (mapfile, 100000, VERBOSE);32 33 // assign images.coords.offsetMap -> table->map[i]34 if (table) {35 AstromOffsetTableMatchChips (image, Nimage, table);36 } else {37 table = AstromOffsetTableInit ();38 }39 40 29 // select the images which overlap the selected sky regions 41 30 if (UseAllImages) { … … 54 43 } 55 44 45 /* unlock, if we can (else, unlocked below) and free, if we can */ 46 int unlockImages = !UPDATE || (RELASTRO_OP == OP_UPDATE_OFFSETS); 47 if (unlockImages) { 48 if (subset != image) { 49 // if we have generated an image subset and we are running UPDATE_OFFSETS, the we can free images here 50 free (image); 51 db[0].ftable.buffer = NULL; 52 BuildChipMatch (subset, Nsubset); 53 } 54 dvo_image_unlock (db); 55 } 56 57 char mapfile[DVO_MAX_PATH]; 58 snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.fits", CATDIR); 59 table = AstromOffsetMapLoad (mapfile, 100000, VERBOSE); 60 61 // assign images.coords.offsetMap -> table->map[i] 62 if (table) { 63 AstromOffsetTableMatchChips (subset, Nsubset, table); 64 } else { 65 table = AstromOffsetTableInit (); 66 } 67 56 68 initImages (subset, LineNumber, Nsubset); 57 69 MARKTIME(" init images: %f sec\n", dtime); … … 60 72 MARKTIME(" init mosaics: %f sec\n", dtime); 61 73 62 /* unlock, if we can (else, unlocked below) */63 int unlockImages = !UPDATE || (RELASTRO_OP == OP_UPDATE_OFFSETS);64 if (unlockImages) dvo_image_unlock (db);65 66 74 return TRUE; 67 75 } … … 102 110 } 103 111 112 void free_astrom_table () { 113 if (!table) return; 114 AstromOffsetTableFree (table); 115 free (table); 116 } -
trunk/Ohana/src/relastro/src/plot_scatter.c
r17203 r39457 2 2 3 3 void plot_scatter (Catalog *catalog, int Ncatalog) { 4 OHANA_UNUSED_PARAM(catalog); 5 OHANA_UNUSED_PARAM(Ncatalog); 4 6 5 7 # if (0) -
trunk/Ohana/src/relastro/src/plotstuff.c
r39396 r39457 44 44 45 45 void JpegPlot (Graphdata *graphmode, int N, char *filename) { 46 OHANA_UNUSED_PARAM(graphmode); 46 47 47 48 if (Xgraph[N] == 0) return; … … 52 53 53 54 void PSPlot (Graphdata *graphmode, int N, char *filename) { 55 OHANA_UNUSED_PARAM(graphmode); 54 56 55 57 if (Xgraph[N] == 0) return; … … 79 81 80 82 void PlotVector (int Npts, double *vect, int mode, int N, char *type) { 83 OHANA_UNUSED_PARAM(mode); 81 84 82 85 float *values; -
trunk/Ohana/src/relastro/src/relastro.c
r39382 r39457 7 7 initialize (argc, argv); 8 8 9 SkyTable *sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 10 SkyTableSetFilenames (sky, CATDIR, "cpt"); 11 SkyList *skylist = SkyListByPatch (sky, -1, &UserPatch); 9 SkyTable *sky = NULL; 10 SkyList *skylist = NULL; 11 12 if ((RELASTRO_OP != OP_PARALLEL_IMAGES) && (RELASTRO_OP != OP_PARALLEL_REGIONS)) { 13 sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE); 14 SkyTableSetFilenames (sky, CATDIR, "cpt"); 15 skylist = SkyListByPatch (sky, -1, &UserPatch); 16 } 12 17 13 18 switch (RELASTRO_OP) { … … 15 20 /* the object analysis is a separate process iterating over catalogs */ 16 21 relastro_objects (skylist, 0, NULL); 17 exit (0); 18 19 case OP_HIGH_SPEED: 20 /* high-speed is a 2pt cross-correlation process for linking moving objects (high PM) */ 21 high_speed_catalogs (sky, skylist, 0, NULL); 22 exit (0); 23 24 case OP_HPM: 25 hpm_catalogs (sky, skylist, 0, NULL); 26 exit (0); 27 28 case OP_MERGE_SOURCE: 29 /* a special method to manually merge unlinked detections of sources togther (not parallel) */ 30 relastro_merge_source (sky); 22 relastro_free (sky, skylist); 31 23 exit (0); 32 24 33 25 case OP_IMAGES: 34 26 relastro_images (skylist); 27 relastro_free (sky, skylist); 35 28 exit (0); 36 29 37 case OP_UPDATE_OFFSETS: 30 case OP_UPDATE_OFFSETS: { 31 FITS_DB db; 38 32 if (!PARALLEL) { 39 FITS_DB db;40 33 41 34 set_db (&db); … … 55 48 // iterate over catalogs to make detection coordinates consistant 56 49 UpdateObjectOffsets (skylist, 0, NULL); 50 51 if (!PARALLEL) { 52 gfits_db_free (&db); 53 freeImages(); 54 freeMosaics (); 55 } 56 57 relastro_free (sky, skylist); 57 58 exit (0); 59 } 58 60 59 61 case OP_PARALLEL_REGIONS: … … 67 69 exit (0); 68 70 71 case OP_HIGH_SPEED: 72 /* high-speed is a 2pt cross-correlation process for linking moving objects (high PM) */ 73 high_speed_catalogs (sky, skylist, 0, NULL); 74 exit (0); 75 76 case OP_HPM: 77 hpm_catalogs (sky, skylist, 0, NULL); 78 exit (0); 79 80 case OP_MERGE_SOURCE: 81 /* a special method to manually merge unlinked detections of sources togther (not parallel) */ 82 relastro_merge_source (sky); 83 exit (0); 84 69 85 default: 70 86 fprintf (stderr, "impossible!\n"); -
trunk/Ohana/src/relastro/src/relastro_client.c
r39396 r39457 55 55 } 56 56 57 SkyTableFree (sky);58 SkyListFree(skylist);59 FreePhotcodeTable();60 61 57 int i; 62 58 for (i = 0; i < Ncatalog; i++) { … … 66 62 BrightCatalogFree(bcatalog); 67 63 68 relastro_client_free (); 69 FREE(photcodesKeep); 70 FREE(photcodesSkip); 71 FREE(photcodesReset); 72 FREE(photcodesGroupA); 73 FREE(photcodesGroupB); 74 75 ohana_memcheck (TRUE); 76 ohana_memdump (TRUE); 64 relastro_client_free (sky, skylist); 77 65 break; 78 66 } … … 81 69 // USAGE: relastro_client -update-objects 82 70 relastro_objects (skylist, HOST_ID, HOSTDIR); 83 break; 84 } 85 86 case OP_HIGH_SPEED: { 87 // USAGE: relastro_client -high-speed 88 high_speed_catalogs (sky, skylist, HOST_ID, HOSTDIR); 89 break; 90 } 91 92 case OP_HPM: { 93 // USAGE: relastro_client -high-speed 94 hpm_catalogs (sky, skylist, HOST_ID, HOSTDIR); 71 relastro_client_free (sky, skylist); 95 72 break; 96 73 } … … 112 89 /* load regions and images based on specified sky patch (default depth) */ 113 90 load_images (&db, skylist, FALSE, USE_ALL_IMAGES); 114 115 // I can free the database after I have loaded the images...116 117 // // load the image subset table from the specified location118 // off_t Nimage;119 // ImageSubset *image = ImageSubsetLoad (IMAGES, &Nimage);120 // if (!image) {121 // fprintf (stderr, "ERROR loading image subset %s\n", CATDIR);122 // exit (2);123 // }124 //125 // // save the available image information in the static array in ImageOps.c126 // initImagesSubset (image, NULL, Nimage);127 //128 // // load the flat-field correction table from CATDIR129 // char flatcorrFile[1024];130 // snprintf (flatcorrFile, 1024, "%s/flatcorr.fits", CATDIR);131 // FlatCorrectionTable *flatcorr = FlatCorrectionLoad (flatcorrFile, VERBOSE);132 91 133 92 UpdateObjectOffsets (skylist, HOST_ID, HOSTDIR); 134 93 94 gfits_db_free (&db); 95 freeImages(); 96 freeMosaics (); 97 98 relastro_client_free (sky, skylist); 99 break; 100 } 101 102 case OP_HIGH_SPEED: { 103 // USAGE: relastro_client -high-speed 104 high_speed_catalogs (sky, skylist, HOST_ID, HOSTDIR); 105 break; 106 } 107 108 case OP_HPM: { 109 // USAGE: relastro_client -high-speed 110 hpm_catalogs (sky, skylist, HOST_ID, HOSTDIR); 135 111 break; 136 112 } -
trunk/Ohana/src/relastro/src/relastro_images.c
r38986 r39457 12 12 set_db (&db); 13 13 gfits_db_init (&db); 14 15 // final pass fit mode (use FIT_AVERAGE only for the image loop) 16 int finalPassMode = FIT_MODE; // start with the globally-defined fit mode 17 FIT_MODE = FIT_AVERAGE; 14 18 15 19 /* lock and load the image db table */ … … 77 81 MARKTIME("update chips: %f sec\n", dtime); 78 82 } 83 84 // measure scatter for stacks 85 UpdateStacks (catalog, Ncatalog); 86 MARKTIME("UpdateStacks: %f sec\n", dtime); 87 79 88 // create summary plots of the process 80 89 // relastroVisualSummaryChips(); … … 93 102 } 94 103 95 if (!UPDATE) exit (0); 104 if (!UPDATE) { 105 freeStarMaps(); 106 gfits_db_free (&db); 107 ohana_memcheck (VERBOSE); 108 ohana_memdump (VERBOSE); 109 exit (0); 110 } 96 111 97 112 // free the image / measurement pointers 98 freeImageBins (1); 113 freeImageBins (Ncatalog); 114 for (i = 0; i < Ncatalog; i++) { 115 dvo_catalog_free (&catalog[i]); 116 } 117 free (catalog); 118 freeMosaics (); 99 119 100 120 // If we did NOT use all images, then we applied the measured corrections to a subset of … … 105 125 reload_images (&db); 106 126 } 127 freeStarMaps(); 107 128 108 129 if (PARALLEL) { … … 116 137 } 117 138 dvo_image_unlock (&db); 139 gfits_db_free (&db); 140 freeImages(); 118 141 } 119 142 … … 123 146 124 147 // if we do NOT have parallel partitions, we must NOT write them out yet: the act of 125 // writing out the files byte-swaps the data and makes the values invalid efor the148 // writing out the files byte-swaps the data and makes the values invalid for the 126 149 // following calls to UpdateObjectOffsets (which attempt to apply the image values from 127 150 // the structure in memory) 151 152 FIT_MODE = finalPassMode; // use the user-selected mode for the final pass 128 153 129 154 // iterate over catalogs to make detection coordinates consistant … … 141 166 } 142 167 dvo_image_unlock (&db); 168 gfits_db_free (&db); 169 freeImages(); 143 170 } 144 171 145 exit (0);172 return TRUE; 146 173 } -
trunk/Ohana/src/relastro/src/relastro_merge_source.c
r38986 r39457 22 22 // load data from each region file, only use bright stars 23 23 for (i = 0; i < sky[0].Nregions; i++) { 24 if (sky[0].regions[i].index == CAT_ID_SRC) { 24 myAssert (sky[0].regions[i].index >= 0, "oops"); 25 if ((unsigned int) sky[0].regions[i].index == CAT_ID_SRC) { 25 26 catalog_src.filename = sky[0].filename[i]; 26 27 region_src = &sky[0].regions[i]; 27 28 } 28 29 // currently, we only accept dst == src... 29 if ( sky[0].regions[i].index == CAT_ID_DST) {30 if ((unsigned int) sky[0].regions[i].index == CAT_ID_DST) { 30 31 catalog_dst.filename = sky[0].filename[i]; 31 32 // region_dst = &sky[0].regions[i]; -
trunk/Ohana/src/relastro/src/relastro_objects.c
r39375 r39457 84 84 populate_tiny_values(&catalog, DVO_TV_MEASURE); 85 85 86 UpdateObjects (&catalog, 1, 0); 86 // the 3rd argument (-1) is the loop number for re-weighting 2MASS and Tycho. -1 is a special value meaning "ignore" 87 // we do NOT want to apply special weights to 2MASS and/or Tycho when calculating object final motions. 88 UpdateObjects (&catalog, 1, -1); 87 89 88 90 free_tiny_values(&catalog); … … 215 217 table->hosts[i].pid = pid; // save for future reference 216 218 } 219 free (command); 217 220 } 218 221 … … 224 227 HostTableWaitJobsGetIO (table, __FILE__, __LINE__, VERBOSE); 225 228 } 229 FreeHostTable (table); 226 230 227 231 return TRUE; -
trunk/Ohana/src/relastro/src/relastro_parallel_images.c
r38986 r39457 16 16 17 17 INITTIME; 18 19 // over-ride user selection here: this program does not set the final object 20 // astrometry. since it only sets the image parameters it should not use pm or par 21 FIT_MODE = FIT_AVERAGE; 18 22 19 23 client_logger_init (CATDIR); … … 141 145 LOGRTIME("slurp_meas_pos loop %d on %s, host %d: %f sec\n", i, myHostName, REGION_HOST_ID, dtime); 142 146 } 147 148 // measure scatter for stacks 149 UpdateStacks (catalog, Ncatalog); 150 LOGRTIME("UpdateStacks on %s, host %d: %f sec\n", myHostName, REGION_HOST_ID, dtime); 151 143 152 // create summary plots of the process 144 153 // relastroVisualSummaryChips(); … … 176 185 LOGRTIME("share image pos loop %d on %s, host %d: %f sec\n", -1, myHostName, REGION_HOST_ID, dtime); 177 186 187 // free the image / measurement pointers 188 freeImageBins (Ncatalog); 189 for (i = 0; i < Ncatalog; i++) { 190 dvo_catalog_free (&catalog[i]); 191 } 192 free (catalog); 193 freeCatalogIndexes(Ncatalog); 194 195 freeMosaics (); 196 197 freeStarMaps(); 198 199 freeImages(); 200 free (image); 201 202 FreeRegionHostTable (regionHosts); 203 relastro_free (sky, skylist); 204 178 205 exit (0); 179 206 } -
trunk/Ohana/src/relastro/src/relastro_parallel_regions.c
r38441 r39457 83 83 } 84 84 85 // testjump: 86 85 87 MARKTIME ("finished relastro -parallel-regions: %f sec total\n", dtime); 88 89 gfits_db_free (&db); 90 freeImages(); 91 freeMosaics (); 92 93 FreeRegionHostTable (regionHosts); 94 relastro_free (sky, skylist); 86 95 87 96 exit (0); -
trunk/Ohana/src/relastro/src/share_icrf_obj.c
r37807 r39457 99 99 int cat, ave, meas; 100 100 ICRFdata (i, &cat, &ave, &meas); 101 myAssert (cat < Ncatalog, "oops"); 101 102 102 103 Average *average = &catalog[cat].average[ave]; -
trunk/Ohana/src/relastro/src/share_images_pos.c
r38986 r39457 141 141 142 142 AstromOffsetTableFree(table); 143 free (table); 143 144 LOGRTIME("image_maps_free host %d loop %d on %s, host %d: %f sec\n", i, nloop, myHostName, REGION_HOST_ID, dtime); 144 145 } 145 146 146 147 // apply the modified image parameters to my detections 148 // This loop is skipped because the updated image parameters are applied to 149 // all measurements in UpdateChips (and those modified measurements are saved 150 // at the same time) 147 151 for (i = 0; FALSE && (Ncatalog > 0) && (i < Nimage_pos); i++) { 148 152 off_t seq = getImageByID (image_pos[i].imageID); -
trunk/Ohana/src/relastro/src/share_mean_pos.c
r38062 r39457 107 107 continue; 108 108 } 109 109 myAssert (catSeq < Ncatalog, "oops"); 110 110 111 catalog[catSeq].average[objSeq].R = meanpos[i].R; 111 112 catalog[catSeq].average[objSeq].D = meanpos[i].D; -
trunk/Ohana/src/relastro/src/share_meas_pos.c
r38062 r39457 58 58 off_t i, k; 59 59 60 int Nmeaspos = 0;61 MeasPos *measpos = NULL;62 ALLOCATE (measpos, MeasPos, 1);63 64 60 fprintf (stderr, "grabbing meas object pos from other hosts...\n"); 65 61 … … 78 74 LOGRTIME("meas_load_sync host %d loop %d on %s, host %d: %f sec\n", i, nloop, myHostName, REGION_HOST_ID, dtime); 79 75 80 off_t N subset= 0;76 off_t Nmeaspos = 0; 81 77 char *posfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "measpos.fits"); 82 MeasPos *measpos Subset = MeasPosLoad (posfile, &Nsubset);78 MeasPos *measpos = MeasPosLoad (posfile, &Nmeaspos); 83 79 free (posfile); 84 80 LOGRTIME("MeasPosLoad host %d loop %d on %s, host %d: %f sec\n", i, nloop, myHostName, REGION_HOST_ID, dtime); 85 81 86 // merge_meas_pos reallocs measpos and frees the input measposSubset 87 measpos = merge_meas_pos (measpos, &Nmeaspos, measposSubset, Nsubset); 88 LOGRTIME("merge_meas_pos host %d loop %d on %s, host %d: %f sec\n", i, nloop, myHostName, REGION_HOST_ID, dtime); 82 // apply the loaded measurement positions: 83 for (off_t j = 0; j < Nmeaspos; j++) { 84 int objID = measpos[j].objID; 85 int catID = measpos[j].catID; 86 87 // set the meas mag 88 int catSeq; 89 off_t objSeq; 90 if (!catID_and_objID_to_seq (catID, objID, &catSeq, &objSeq)) { 91 // XXX what should I do if this does not match? 92 continue; 93 } 94 myAssert (catSeq < Ncatalog, "oops"); 95 96 off_t m = catalog[catSeq].average[objSeq].measureOffset; 97 for (k = 0; k < catalog[catSeq].average[objSeq].Nmeasure; k++, m++) { 98 if (catalog[catSeq].measureT[m].imageID != measpos[j].imageID) continue; 99 catalog[catSeq].measureT[m].R = measpos[j].R; 100 catalog[catSeq].measureT[m].D = measpos[j].D; 101 if (catalog[catSeq].measure) { 102 catalog[catSeq].measure[m].R = measpos[j].R; 103 catalog[catSeq].measure[m].D = measpos[j].D; 104 } 105 } 106 } 107 free (measpos); 108 LOGRTIME("match_catID_and_objID/meas loop %d on %s, host %d: %f sec\n", nloop, myHostName, REGION_HOST_ID, dtime); 89 109 } 90 110 LOGRTIME("meas_load_done loop %d on %s, host %d: %f sec\n", nloop, myHostName, REGION_HOST_ID, dtime); 91 92 for (i = 0; i < Nmeaspos; i++) {93 int objID = measpos[i].objID;94 int catID = measpos[i].catID;95 96 // set the meas mag97 int catSeq;98 off_t objSeq;99 if (!catID_and_objID_to_seq (catID, objID, &catSeq, &objSeq)) {100 // XXX what should I do if this does not match?101 continue;102 }103 off_t m = catalog[catSeq].average[objSeq].measureOffset;104 for (k = 0; k < catalog[catSeq].average[objSeq].Nmeasure; k++, m++) {105 if (catalog[catSeq].measureT[m].imageID != measpos[i].imageID) continue;106 catalog[catSeq].measureT[m].R = measpos[i].R;107 catalog[catSeq].measureT[m].D = measpos[i].D;108 if (catalog[catSeq].measure) {109 catalog[catSeq].measure[m].R = measpos[i].R;110 catalog[catSeq].measure[m].D = measpos[i].D;111 }112 }113 }114 free (measpos);115 LOGRTIME("match_catID_and_objID/meas loop %d on %s, host %d: %f sec\n", nloop, myHostName, REGION_HOST_ID, dtime);116 111 117 112 fprintf (stderr, "DONE grabbing meas object pos from other hosts...\n"); -
trunk/Ohana/src/relphot/src/GridOps.c
r37037 r39457 38 38 39 39 void initGrid (int dX, int dY) { 40 OHANA_UNUSED_PARAM(dX); 41 OHANA_UNUSED_PARAM(dY); 40 42 41 43 int i, N, ccdnum_max, refX, refY, refBin; -
trunk/Ohana/src/relphot/src/ImageOps.c
r39377 r39457 413 413 // NOTE: static flat-field component is included in measure.Mflat 414 414 float getMcal (off_t meas, int cat, FlatCorrectionTable *flatcorr, Catalog *catalog) { 415 OHANA_UNUSED_PARAM(flatcorr); 416 OHANA_UNUSED_PARAM(catalog); 415 417 416 418 off_t i; … … 437 439 // NOTE: static flat-field component is included in measure.Mflat 438 440 float getMcal_alt (off_t meas, int cat, FlatCorrectionTable *flatcorr, float Xccd, float Yccd) { 441 OHANA_UNUSED_PARAM(flatcorr); 442 OHANA_UNUSED_PARAM(Xccd); 443 OHANA_UNUSED_PARAM(Yccd); 439 444 440 445 off_t i; … … 562 567 563 568 float getMflat (off_t meas, int cat, FlatCorrectionTable *flatcorr, Catalog *catalog) { 569 OHANA_UNUSED_PARAM(flatcorr); 564 570 565 571 off_t i = MeasureToImage[cat][meas]; … … 842 848 static int setMcal_init_done = FALSE; 843 849 void plot_setMcal (double *list, int Npts, StatType *stats, float clouds) { 850 OHANA_UNUSED_PARAM(stats); 851 OHANA_UNUSED_PARAM(clouds); 844 852 845 853 off_t i; … … 1023 1031 1024 1032 StatType statsImageX (Catalog *catalog) { 1033 OHANA_UNUSED_PARAM(catalog); 1025 1034 1026 1035 off_t i, n; … … 1055 1064 1056 1065 StatType statsImageM (Catalog *catalog) { 1066 OHANA_UNUSED_PARAM(catalog); 1057 1067 1058 1068 off_t i, n; … … 1087 1097 1088 1098 StatType statsImagedM (Catalog *catalog) { 1099 OHANA_UNUSED_PARAM(catalog); 1089 1100 1090 1101 off_t i, n; -
trunk/Ohana/src/relphot/src/MosaicOps.c
r39377 r39457 501 501 502 502 void setMosaicCenters (Image *image, off_t Nimage) { 503 OHANA_UNUSED_PARAM(Nimage); 503 504 504 505 /* find max dR, dD range for all mosaics */ … … 596 597 597 598 void initMosaicGrid (Image *image, off_t Nimage) { 599 OHANA_UNUSED_PARAM(Nimage); 598 600 599 601 /* find max dR, dD range for all mosaics */ … … 1580 1582 1581 1583 StatType statsMosaicM (Catalog *catalog) { 1584 OHANA_UNUSED_PARAM(catalog); 1582 1585 1583 1586 off_t i; … … 1612 1615 1613 1616 StatType statsMosaicdM (Catalog *catalog) { 1617 OHANA_UNUSED_PARAM(catalog); 1614 1618 1615 1619 off_t i, n; … … 1692 1696 1693 1697 StatType statsMosaicX (Catalog *catalog) { 1698 OHANA_UNUSED_PARAM(catalog); 1694 1699 1695 1700 off_t i, n; -
trunk/Ohana/src/relphot/src/StarOps.c
r39377 r39457 443 443 // NOTE: here 'catalog' is a pointer to a specific catalog, not the root of the array 444 444 int setMrel_catalog (Catalog *catalog, int Nc, int pass, FlatCorrectionTable *flatcorr, SetMrelInfo *results, int Nsecfilt) { 445 OHANA_UNUSED_PARAM(catalog); 446 OHANA_UNUSED_PARAM(Nc); 447 OHANA_UNUSED_PARAM(pass); 448 OHANA_UNUSED_PARAM(flatcorr); 449 OHANA_UNUSED_PARAM(results); 450 OHANA_UNUSED_PARAM(Nsecfilt); 445 451 446 452 fprintf (stderr, "??? should you still be using the old version of setMrel_catalog??\n"); -
trunk/Ohana/src/relphot/src/plotstuff.c
r38466 r39457 52 52 53 53 void JpegPlot (Graphdata *graphmode, int N, char *filename) { 54 OHANA_UNUSED_PARAM(graphmode); 54 55 55 56 if (Xgraph[N] == 0) return; … … 60 61 61 62 void PSPlot (Graphdata *graphmode, int N, char *filename) { 63 OHANA_UNUSED_PARAM(graphmode); 62 64 63 65 if (Xgraph[N] == 0) return; … … 93 95 94 96 void PlotVector (int Npts, double *vect, int mode, int N, char *type) { 97 OHANA_UNUSED_PARAM(mode); 95 98 96 99 float *values; -
trunk/Ohana/src/relphot/src/setMrelCatalog.c
r39377 r39457 719 719 // analysis is done on flux, not mags (as the faintest objects will be nearly insignificant) 720 720 int setMrelAverageForcedWarp (Catalog *catalog, int cat, off_t ave, int Nsecfilt, FlatCorrectionTable *flatcorr, SetMrelInfo *results) { 721 OHANA_UNUSED_PARAM(flatcorr); 721 722 722 723 // we are guaranteed to have average, measure, secfilt -
trunk/Ohana/src/relphot/src/share_mean_mags.c
r37037 r39457 64 64 65 65 int slurp_mean_mags (Catalog *catalog, int Ncatalog, RegionHostTable *regionHosts, int nloop) { 66 OHANA_UNUSED_PARAM(Ncatalog); 66 67 67 68 off_t i; -
trunk/Ohana/src/relphot/src/synthetic_mags.c
r35416 r39457 18 18 19 19 int add_synthetic_mags (AverageTiny *average, SecFilt *secfilt, MeasureTiny *measure, off_t *Nmeasure, off_t *Nm) { 20 OHANA_UNUSED_PARAM(average); 20 21 21 22 if (!SyntheticPhotometry) return TRUE; -
trunk/Ohana/src/skycalc/src/astro.c
r27491 r39457 1 1 # include <skycalc_internal.h> 2 # define UNUSED_PARAM(x)(void)(x) 2 3 3 4 /* Takes a coordinate pair and precesses it using matrix procedures … … 104 105 equatorial (all assumed of date.) */ 105 106 void SC_eclrot(double jd, double *x, double *y, double *z) { 107 UNUSED_PARAM(x); 106 108 107 109 double incl; … … 112 114 113 115 incl = (23.439291 + T * (-0.0130042 - 0.00000016 * T))/DEG_IN_RADIAN; 114 /* 1992 Astron Almanac, p. B18, dropping the115 cubic term, which is 2 milli-arcsec! */116 /* 1992 Astron Almanac, p. B18, dropping the 117 cubic term, which is 2 milli-arcsec! */ 116 118 ypr = cos(incl) * *y - sin(incl) * *z; 117 119 zpr = sin(incl) * *y + cos(incl) * *z; 118 120 *y = ypr; 119 121 *z = zpr; 120 /* x remains the same. */122 /* x remains the same. */ 121 123 } 122 124 123 125 /* Given a julian date in 1900-2100, returns the correction 124 delta t which is:125 TDT - UT (after 1983 and before 1993)126 ET - UT (before 1983)127 an extrapolated guess (after 1993).126 delta t which is: 127 TDT - UT (after 1983 and before 1993) 128 ET - UT (before 1983) 129 an extrapolated guess (after 1993). 128 130 129 For dates in the past (<= 1993) the value is linearly130 interpolated on 5-year intervals; for dates after the present,131 an extrapolation is used, because the true value of delta t132 cannot be predicted precisely. Note that TDT is essentially the133 modern version of ephemeris time with a slightly cleaner134 definition.131 For dates in the past (<= 1993) the value is linearly 132 interpolated on 5-year intervals; for dates after the present, 133 an extrapolation is used, because the true value of delta t 134 cannot be predicted precisely. Note that TDT is essentially the 135 modern version of ephemeris time with a slightly cleaner 136 definition. 135 137 136 Where the algorithm shifts there is an approximately 0.1 second137 discontinuity. Also, the 5-year linear interpolation scheme can138 lead to errors as large as 0.5 seconds in some cases, though139 usually rather smaller. */138 Where the algorithm shifts there is an approximately 0.1 second 139 discontinuity. Also, the 5-year linear interpolation scheme can 140 lead to errors as large as 0.5 seconds in some cases, though 141 usually rather smaller. */ 140 142 141 143 double SC_etcorr (double jd) { -
trunk/Ohana/src/tools/src/list_astro.c
r12333 r39457 2 2 3 3 int main (int argc, char **argv) { 4 OHANA_UNUSED_PARAM(argv); 4 5 5 6 float *ra1, *ra2, *dec1, *dec2; -
trunk/Ohana/src/uniphot/src/update_catalog_setphot.c
r39288 r39457 2 2 3 3 void update_catalog_setphot (Catalog *catalog, Image *image, off_t *index, off_t Nimage, CamPhotomCorrection *camcorr) { 4 OHANA_UNUSED_PARAM(Nimage); 4 5 5 6 off_t i, found; -
trunk/Ohana/src/uniphot/src/update_catalog_setposangle.c
r34844 r39457 2 2 3 3 void update_catalog_setposangle (Catalog *catalog, ImageSubset *image, off_t *index, off_t Nimage) { 4 OHANA_UNUSED_PARAM(Nimage); 4 5 5 6 float posAngle, pltScale;
Note:
See TracChangeset
for help on using the changeset viewer.
